工厂大屏数据接口
This commit is contained in:
parent
9476a9c243
commit
fc40bb61fa
@ -0,0 +1,110 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.screendata.ScreenDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "工厂大屏数据")
|
||||
@RestController
|
||||
@RequestMapping("/smartfactory/factory-screen-data")
|
||||
@Validated
|
||||
public class FactoryScreenDataController {
|
||||
|
||||
@Resource
|
||||
private ScreenDataService screenDataService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type 1: 省,2 市,3区
|
||||
* @param adcode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getProvincesData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏全局省份/省/市工厂数据(包函工厂基本信息)")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<List<ProvincesDataRespVO>> getProvincesData(Integer type, String adcode) {
|
||||
List<ProvincesDataRespVO> provincesDatas = screenDataService.getProvincesData(type,adcode) ;
|
||||
return success(provincesDatas);
|
||||
}
|
||||
|
||||
@GetMapping("/getStaffData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏员工信息数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<StaffDataRespVO> getStaffData(Long factoryId) {
|
||||
StaffDataRespVO staffDataRespVO = screenDataService.getStaffData(factoryId) ;
|
||||
return success(staffDataRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getPropertyData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏资产数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<PropertyDataRespVO> getPropertyData(Long factoryId) {
|
||||
PropertyDataRespVO propertyDataRespVO = screenDataService.getPropertyData(factoryId) ;
|
||||
return success(propertyDataRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryOperateData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂运营数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<OperateDataRespVO> getFactoryOperateData(Long factoryId) {
|
||||
OperateDataRespVO factoryOperateDataRespVO = screenDataService.getFactoryOperateData(factoryId) ;
|
||||
return success(factoryOperateDataRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryRollData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂滚动数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<FactoryRollDataRespVO> getFactoryRollData() {
|
||||
FactoryRollDataRespVO factoryRollDataRespVO = screenDataService.getFactoryRollData() ;
|
||||
return success(factoryRollDataRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryCamerasData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂监控视频数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<List<FactoryCameraDataRespVO>> getFactoryCamerasData(Long factoryId) {
|
||||
List<FactoryCameraDataRespVO> factoryCameraDatas = screenDataService.getFactoryCamerasData(factoryId) ;
|
||||
return success(factoryCameraDatas);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryWeatherInfo")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂天气数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<FactoryWeatherDataRespVO> getFactoryWeatherInfo(Long factoryId) {
|
||||
return success(screenDataService.getFactoryWeatherInfo(factoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 大屏工厂打包线数据
|
||||
* @param type
|
||||
* @param factoryId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getFactoryPackLineInfo")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂打包线数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<List<FactoryPackLineDataRespVO>> getFactoryPackLineInfo(Integer type,Long factoryId ) {
|
||||
return success(screenDataService.getFactoryPackLineInfo(type,factoryId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 工厂摄像头数据 Response VO")
|
||||
@Data
|
||||
public class FactoryCameraDataRespVO {
|
||||
|
||||
@Schema(description = "设备id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "设备id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "南昌市")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "设别编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "afcbdc00465348918d67518e2294792b")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "设备图片", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://xx.com/ss.jpg")
|
||||
private String imgUrl ;
|
||||
|
||||
@Schema(description = "推流地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "ws://hik.znkj.ispt.com.cn:559/openUrl/Koe0Kg8")
|
||||
private String streamUrl ;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 工厂打包线数据 Response VO")
|
||||
@Data
|
||||
public class FactoryPackLineDataRespVO {
|
||||
|
||||
@Schema(description = "打包线id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long packLineId;
|
||||
|
||||
@Schema(description = "规格id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private String standardsId;
|
||||
|
||||
@Schema(description = "规格标准", requiredMode = Schema.RequiredMode.REQUIRED, example = "800 * 400")
|
||||
private String standards;
|
||||
|
||||
@Schema(description = "打包数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer total;
|
||||
|
||||
@Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-03-04")
|
||||
private String date ;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 工厂基础滚动数据 Response VO")
|
||||
@Data
|
||||
public class FactoryRollDataRespVO {
|
||||
|
||||
@Schema(description = "工厂名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "江西省南昌市第一工厂")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "工厂简称", requiredMode = Schema.RequiredMode.REQUIRED, example = "第一工厂")
|
||||
private String shortName;
|
||||
|
||||
@Schema(description = "城市名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "南昌市")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "员工数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer total;
|
||||
|
||||
@Schema(description = "窑炉数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer kilnTotal;
|
||||
|
||||
@Schema(description = "打包线数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer packLineTotal ;
|
||||
|
||||
@Schema(description = "托盘数", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer trayTotal ;
|
||||
|
||||
@Schema(description = "绑带", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer tieTotal ;
|
||||
|
||||
@Schema(description = "叉车数", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer forkliftTotal ;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 工厂天气数据 Response VO")
|
||||
@Data
|
||||
public class FactoryWeatherDataRespVO {
|
||||
|
||||
@Schema(description = "工厂ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "城市编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private String areaCode ;
|
||||
|
||||
@Schema(description = "温度", requiredMode = Schema.RequiredMode.REQUIRED, example = "12.3")
|
||||
private String temperature ;
|
||||
|
||||
@Schema(description = "湿度", requiredMode = Schema.RequiredMode.REQUIRED, example = "68%")
|
||||
private String humidity ;
|
||||
|
||||
@Schema(description = "天气", requiredMode = Schema.RequiredMode.REQUIRED, example = "晴")
|
||||
private String weather ;
|
||||
|
||||
@Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "晴")
|
||||
private String date ;
|
||||
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 工厂运营数据 Response VO")
|
||||
@Data
|
||||
public class OperateDataRespVO {
|
||||
|
||||
/**今日 **/
|
||||
@Schema(description = "今日出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer outboundTotal;
|
||||
|
||||
@Schema(description = "今日入库(打包数-破损)", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer warehouseTotal ;
|
||||
|
||||
@Schema(description = "今日破损", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer wornTotal ;
|
||||
|
||||
@Schema(description = "优等品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100 (优等品,即使打包线打包数量)")
|
||||
private Integer ydpTotal ;
|
||||
|
||||
@Schema(description = "一级品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer yjpTotal ;
|
||||
|
||||
@Schema(description = "合格品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer hgpTotal ;
|
||||
|
||||
/**昨日 **/
|
||||
@Schema(description = "昨日出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer outboundTotalYesterday;
|
||||
|
||||
@Schema(description = "昨日入库", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer warehouseTotalYesterday ;
|
||||
|
||||
@Schema(description = "昨日破损", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer wornTotalYesterday ;
|
||||
|
||||
@Schema(description = "优等品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer ydpTotalYesterday ;
|
||||
|
||||
@Schema(description = "一级品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer yjpTotalYesterday ;
|
||||
|
||||
@Schema(description = "合格品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer hgpTotalYesterday ;
|
||||
|
||||
/**本周 **/
|
||||
@Schema(description = "本周出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer outboundTotalWeek;
|
||||
|
||||
@Schema(description = "本周入库", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer warehouseTotalWeek ;
|
||||
|
||||
@Schema(description = "本周分检数", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer sortingTotalWeek ;
|
||||
|
||||
@Schema(description = "本周破损", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer wornTotalWeek ;
|
||||
|
||||
@Schema(description = "优等品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer ydpTotalWeek ;
|
||||
|
||||
@Schema(description = "一级品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer yjpTotalWeek ;
|
||||
|
||||
@Schema(description = "合格品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer hgpTotalWeek ;
|
||||
|
||||
/**本月 **/
|
||||
@Schema(description = "本月出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer outboundTotalMonth;
|
||||
|
||||
@Schema(description = "本月入库", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer warehouseTotalMonth ;
|
||||
|
||||
@Schema(description = "本月分检数", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer sortingTotalMonth ;
|
||||
|
||||
@Schema(description = "本月破损", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer wornTotalMonth ;
|
||||
|
||||
@Schema(description = "优等品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer ydpTotalMonth ;
|
||||
|
||||
@Schema(description = "一级品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer yjpTotalMonth ;
|
||||
|
||||
@Schema(description = "合格品", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer hgpTotalMonth ;
|
||||
|
||||
/**
|
||||
* 公式:(今日破损 - 昨日破损) / 昨日破损 * 100% = 环比%
|
||||
*/
|
||||
@Schema(description = "破损环比增长/下降", requiredMode = Schema.RequiredMode.REQUIRED, example = "-12.22%")
|
||||
private String wornQOQ;
|
||||
|
||||
|
||||
DecimalFormat df = new DecimalFormat("#0.00");
|
||||
|
||||
public String setWornQOQ() {
|
||||
double a = getWornTotal() ;
|
||||
double b = getWornTotalYesterday() ;
|
||||
double i = ((a - b) / b ) * 100;
|
||||
this.wornQOQ = df.format(i) ;
|
||||
return wornQOQ;
|
||||
}
|
||||
|
||||
@Schema(description = "优等率", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private String ydl;
|
||||
@Schema(description = "昨日优等率", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private String ydlYesterday;
|
||||
@Schema(description = "本周优等率", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private String ydlWeek;
|
||||
@Schema(description = "本月优等率", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private String ydlMonth;
|
||||
|
||||
|
||||
/**
|
||||
* 根据type类型, 计划今日,昨日,本周,本月
|
||||
* @param type 1= 今日 2= 昨日 3= 本周 4本月
|
||||
* @param ydpTotal 合格品
|
||||
* @param yjpTotal 一级品
|
||||
* @param hgpTotal 合格品
|
||||
*/
|
||||
public void setYdl(Integer type, Integer ydpTotal, Integer yjpTotal, Integer hgpTotal) {
|
||||
double a = ydpTotal ;
|
||||
double b = ydpTotal + yjpTotal + hgpTotal ;
|
||||
double i = (a / b ) * 100 ;
|
||||
String c = df.format(i) ;
|
||||
switch ( type ) {
|
||||
case 1:
|
||||
this.ydl = c ;
|
||||
break ;
|
||||
case 2:
|
||||
this.ydlYesterday = c ;
|
||||
break ;
|
||||
case 3:
|
||||
this.ydlWeek = c ;
|
||||
break ;
|
||||
case 4:
|
||||
this.ydlMonth = c ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// OperateDataRespVO a = new OperateDataRespVO() ;
|
||||
//
|
||||
// a.setYdl(4, 100, 20,30);
|
||||
//
|
||||
// System.out.println(a.getYdl());
|
||||
// System.out.println(a.getYdlYesterday());
|
||||
// System.out.println(a.getYdlWeek());
|
||||
// System.out.println(a.getYdlMonth());
|
||||
// }
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 资产数据 Response VO")
|
||||
@Data
|
||||
public class PropertyDataRespVO {
|
||||
|
||||
@Schema(description = "窑炉数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer kilnTotal;
|
||||
|
||||
@Schema(description = "打包线数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer packLineTotal ;
|
||||
|
||||
@Schema(description = "托盘数", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer trayTotal ;
|
||||
|
||||
@Schema(description = "绑带", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer tieTotal ;
|
||||
|
||||
@Schema(description = "叉车数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private ForkliftInfo forkliftInfo ;
|
||||
|
||||
class ForkliftInfo {
|
||||
@Schema(description = "叉车数", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer forkliftTotal ;
|
||||
|
||||
@Schema(description = "运行中", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer onlineTotal ;
|
||||
|
||||
@Schema(description = "离线", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
|
||||
private Integer outLineTotal ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 省份工厂数据 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ProvincesDataRespVO {
|
||||
|
||||
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "江西省 or 高安市")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "区域标记点", requiredMode = Schema.RequiredMode.REQUIRED, example = "[114.173355, 22.320048]")
|
||||
private List<Double> center ;
|
||||
|
||||
@Schema(description = "区域标记点oid", requiredMode = Schema.RequiredMode.REQUIRED, example = "[114.134357, 22.377366]")
|
||||
private List<Double> centroid ;
|
||||
|
||||
@Schema(description = "区域代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "810000")
|
||||
private Integer adcode ;
|
||||
|
||||
@Schema(description = "英文名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "jiangxi")
|
||||
private String enName ;
|
||||
|
||||
@Schema(description = "工厂数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
private Integer value;
|
||||
|
||||
/**
|
||||
* 只有到第三层 district_id 区县的时候,需要输出工厂ID
|
||||
*/
|
||||
@Schema(description = "工厂Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
private Long factoryId;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 工厂员工数据 Response VO")
|
||||
@Data
|
||||
public class StaffDataRespVO {
|
||||
|
||||
@Schema(description = "员工数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer total;
|
||||
|
||||
@Schema(description = "男员工", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
|
||||
private Integer maleTotal ;
|
||||
|
||||
@Schema(description = "女员工", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||
private Integer femaleTotal ;
|
||||
|
||||
@Schema(description = "员工信息", requiredMode = Schema.RequiredMode.REQUIRED, example = "阿依塔洪·阿依提巴依 搬运工")
|
||||
private List<StaffInfo> staffInfos ;
|
||||
|
||||
class StaffInfo {
|
||||
@Schema(description = "员工名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "马龙")
|
||||
private String name ;
|
||||
@Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "叉车司机")
|
||||
private String postName ;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.framework.util;
|
||||
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.*;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author qun.xu
|
||||
* @version 1.0.0
|
||||
* @date 2019.03.28
|
||||
*/
|
||||
|
||||
public class HttpUtil {
|
||||
/**
|
||||
* GET请求 带头部信息
|
||||
*
|
||||
* @param url
|
||||
* @param headers
|
||||
* @return
|
||||
*/
|
||||
public static String doGetSetHeader(String url, Map<String, String> headers) {
|
||||
try {
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpGet request = new HttpGet(url);
|
||||
headers.forEach((k, v) -> request.setHeader(k, v));
|
||||
HttpResponse response = httpClient.execute(request);
|
||||
return EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.screendata;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 大屏数据 Service 接口
|
||||
*
|
||||
* @author 姚君
|
||||
*/
|
||||
public interface ScreenDataService {
|
||||
|
||||
/**
|
||||
* 大屏全局省份/省/市工厂数据
|
||||
* adcode是null,就查询全部省份数据
|
||||
* @param adcode 省/市/区编码
|
||||
* @return 显示数据
|
||||
*/
|
||||
List<ProvincesDataRespVO> getProvincesData(Integer type, String adcode) ;
|
||||
|
||||
|
||||
/**
|
||||
* 查询员工数据
|
||||
* factoryId是null,查询所有工厂员工数据
|
||||
* @param factoryId 工厂ID ,
|
||||
* @return
|
||||
*/
|
||||
StaffDataRespVO getStaffData(Long factoryId) ;
|
||||
|
||||
/**
|
||||
* 查询资产数据
|
||||
* @param factoryId
|
||||
* factoryId是null,查询所有工厂资产数据
|
||||
* @return
|
||||
*/
|
||||
PropertyDataRespVO getPropertyData(Long factoryId) ;
|
||||
|
||||
|
||||
/**
|
||||
* 查询工厂运营数据
|
||||
* @param factoryId
|
||||
* factoryId是null,查询所有工厂运营数据
|
||||
* @return
|
||||
*/
|
||||
OperateDataRespVO getFactoryOperateData(Long factoryId) ;
|
||||
|
||||
/**
|
||||
* 大屏工厂滚屏数据查询
|
||||
* @return
|
||||
*/
|
||||
FactoryRollDataRespVO getFactoryRollData() ;
|
||||
|
||||
/**
|
||||
* 获取工厂监控设备集合
|
||||
* @param factoryId
|
||||
* @return
|
||||
*/
|
||||
List<FactoryCameraDataRespVO> getFactoryCamerasData(Long factoryId) ;
|
||||
|
||||
/**
|
||||
* 获取工厂对应城市的天气数据
|
||||
* @param factoryId
|
||||
* @return
|
||||
*/
|
||||
FactoryWeatherDataRespVO getFactoryWeatherInfo(Long factoryId) ;
|
||||
|
||||
/**
|
||||
* 根据类型获取工厂打包线数据
|
||||
* @param type 1= 今日 2= 本周
|
||||
* @param factoryId
|
||||
* @return
|
||||
*/
|
||||
List<FactoryPackLineDataRespVO> getFactoryPackLineInfo(Integer type,Long factoryId) ;
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.screendata;
|
||||
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.screendata.factory.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.framework.util.HttpUtil;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月06日 11:54
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ScreenDataServiceImpl implements ScreenDataService{
|
||||
@Override
|
||||
public List<ProvincesDataRespVO> getProvincesData(Integer type,String adcode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaffDataRespVO getStaffData(Long factoryId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDataRespVO getPropertyData(Long factoryId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperateDataRespVO getFactoryOperateData(Long factoryId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FactoryRollDataRespVO getFactoryRollData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryCameraDataRespVO> getFactoryCamerasData(Long factoryId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static final String WEATHER_URL = "https://d1.weather.com.cn/sk_2d/";
|
||||
private static final String REFERER = "referer";
|
||||
private static final String REFERER_URL = "http://www.weather.com.cn/";
|
||||
private static final String WEATHER_SPLIT = "dataSK=";
|
||||
|
||||
public FactoryWeatherDataRespVO getFactoryWeatherInfo(Long factoryId) {
|
||||
//根据factoryId 查询areaCode;
|
||||
String areaCode = "101190101" ;
|
||||
String url = WEATHER_URL + areaCode + ".html";
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put(REFERER, REFERER_URL);
|
||||
String result = HttpUtil.doGetSetHeader(url, headers);
|
||||
String[] str = result.split(WEATHER_SPLIT);
|
||||
if(str.length > 1) {
|
||||
FactoryWeatherDataRespVO vo = new FactoryWeatherDataRespVO();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(str[1]) ;
|
||||
vo.setFactoryId(factoryId);
|
||||
vo.setAreaCode(areaCode) ;
|
||||
vo.setTemperature(jsonObject.getStr("temp")) ; //温度
|
||||
vo.setHumidity(jsonObject.getStr("sd")); //湿度
|
||||
vo.setWeather(jsonObject.getStr("weather")) ; //天气
|
||||
vo.setDate(jsonObject.getStr("date")); //日期
|
||||
return vo ;
|
||||
}else {
|
||||
return null ;
|
||||
}
|
||||
}
|
||||
|
||||
public List<FactoryPackLineDataRespVO> getFactoryPackLineInfo(Integer type, Long factoryId) {
|
||||
return null ;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user