数据大屏
This commit is contained in:
parent
8584168ebd
commit
4cf44f0480
@ -30,6 +30,8 @@ public class DateUtils {
|
||||
|
||||
public static final String FORMAT_HOUR_MINUTE_SECOND = "HH:mm:ss";
|
||||
|
||||
public static final String IS0_8601 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
||||
|
||||
/**
|
||||
* 根据传入的时间格式,将Date对象,转换成对应的时间格式
|
||||
* @param date
|
||||
|
@ -157,5 +157,6 @@ yudao:
|
||||
- infra_job_log
|
||||
- infra_job_log
|
||||
- infra_data_source_config
|
||||
- sys_region
|
||||
|
||||
debug: false
|
||||
|
@ -103,5 +103,6 @@ yudao:
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
- sys_region
|
||||
|
||||
debug: false
|
||||
|
@ -103,5 +103,6 @@ yudao:
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
- sys_region
|
||||
|
||||
debug: false
|
||||
|
@ -103,5 +103,6 @@ yudao:
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
- sys_region
|
||||
|
||||
debug: false
|
||||
|
@ -103,6 +103,8 @@ yudao:
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
- sys_region
|
||||
|
||||
trade:
|
||||
order:
|
||||
app-id: 1 # 商户编号
|
||||
|
@ -103,5 +103,6 @@ yudao:
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
- sys_region
|
||||
|
||||
debug: false
|
||||
|
@ -175,6 +175,7 @@ yudao:
|
||||
- system_mail_template
|
||||
- system_mail_log
|
||||
- system_notify_template
|
||||
- sys_region
|
||||
sms-code: # 短信验证码相关的配置项
|
||||
expire-times: 10m
|
||||
send-frequency: 1m
|
||||
|
@ -144,6 +144,11 @@
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hikvision.ga</groupId>
|
||||
<artifactId>artemis-http-client</artifactId>
|
||||
<version>1.1.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.constant;
|
||||
|
||||
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class ArtemisApiConstant implements CommandLineRunner {
|
||||
|
||||
public static String camerasApi;
|
||||
public static String previewUrlsApi;
|
||||
public static String replayUrlApi;
|
||||
|
||||
public static String operateUrlApi = "/artemis/api/video/v1/ptzs/controlling";
|
||||
|
||||
@Value("${resource.cameras}")
|
||||
public void setCamerasApi(String a) {
|
||||
camerasApi = a;
|
||||
}
|
||||
|
||||
@Value("${video.previewUrls}")
|
||||
public void setPreviewUrls(String a) {
|
||||
previewUrlsApi = a;
|
||||
}
|
||||
|
||||
@Value("${video.replayUrlApi}")
|
||||
public void setReplayUrlApi(String a) {
|
||||
replayUrlApi = a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
log.info("# 【ArtemisApiConstant】 camerasApi:{} #", camerasApi);
|
||||
log.info("# 【ArtemisApiConstant】 previewUrlsApi:{} #", previewUrlsApi);
|
||||
log.info("# 【ArtemisApiConstant】 replayUrlApi:{} #", replayUrlApi);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.constant;
|
||||
|
||||
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class ArtemisConfigConstant implements CommandLineRunner {
|
||||
|
||||
|
||||
public static String host;
|
||||
public static String appKey;
|
||||
public static String appSecret;
|
||||
|
||||
@Value("${isc.host}")
|
||||
public void setHost(String a) {
|
||||
host = a;
|
||||
ArtemisConfig.host = a;
|
||||
}
|
||||
|
||||
@Value("${isc.appKey}")
|
||||
public void setAppKey(String a) {
|
||||
appKey = a;
|
||||
ArtemisConfig.appKey = a;
|
||||
}
|
||||
|
||||
@Value("${isc.appSecret}")
|
||||
public void setAppSecret(String a) {
|
||||
appSecret = a;
|
||||
ArtemisConfig.appSecret = a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
log.info("# 【ArtemisConfigConstant】 host:{} #", ArtemisConfigConstant.host);
|
||||
log.info("# 【ArtemisConfigConstant】 appKey:{} #", ArtemisConfigConstant.appKey);
|
||||
log.info("# 【ArtemisConfigConstant】 appSecret:{} #", ArtemisConfigConstant.appSecret);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydata.FactoryDataDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factorydata.FactoryDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 工厂出库入库数据")
|
||||
@RestController
|
||||
@RequestMapping("/factory/data")
|
||||
@Validated
|
||||
public class FactoryDataController {
|
||||
|
||||
@Resource
|
||||
private FactoryDataService dataService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工厂出库入库数据")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data:create')")
|
||||
public CommonResult<Long> createData(@Valid @RequestBody FactoryDataSaveReqVO createReqVO) {
|
||||
return success(dataService.createData(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新工厂出库入库数据")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data:update')")
|
||||
public CommonResult<Boolean> updateData(@Valid @RequestBody FactoryDataSaveReqVO updateReqVO) {
|
||||
dataService.updateData(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除工厂出库入库数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('factory:data:delete')")
|
||||
public CommonResult<Boolean> deleteData(@RequestParam("id") Long id) {
|
||||
dataService.deleteData(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得工厂出库入库数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data:query')")
|
||||
public CommonResult<FactoryDataRespVO> getData(@RequestParam("id") Long id) {
|
||||
FactoryDataDO data = dataService.getData(id);
|
||||
return success(BeanUtils.toBean(data, FactoryDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得工厂出库入库数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data:query')")
|
||||
public CommonResult<PageResult<FactoryDataRespVO>> getDataPage(@Valid FactoryDataPageReqVO pageReqVO) {
|
||||
PageResult<FactoryDataDO> pageResult = dataService.getDataPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, FactoryDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出工厂出库入库数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDataExcel(@Valid FactoryDataPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<FactoryDataDO> list = dataService.getDataPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "工厂出库入库数据.xls", "数据", FactoryDataRespVO.class,
|
||||
BeanUtils.toBean(list, FactoryDataRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂出库入库数据分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FactoryDataPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "工厂id", example = "7606")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "进出库类型 1出库 2进库", example = "1")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDate[] date;
|
||||
|
||||
@Schema(description = "搬运工姓名", example = "张三")
|
||||
private String porterName;
|
||||
|
||||
@Schema(description = "叉车司机姓名", example = "芋艿")
|
||||
private String dirverName;
|
||||
|
||||
@Schema(description = "仓库看管员姓名", example = "李四")
|
||||
private String keeperName;
|
||||
|
||||
@Schema(description = "总数量")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "总金额")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@Schema(description = "总车数")
|
||||
private Integer totalTruck;
|
||||
|
||||
@Schema(description = "搬运总数")
|
||||
private Integer moveNum;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂出库入库数据 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class FactoryDataRespVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17120")
|
||||
@ExcelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7606")
|
||||
@ExcelProperty("工厂id")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "进出库类型 1出库 2进库", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("进出库类型 1出库 2进库")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("日期")
|
||||
private LocalDate date;
|
||||
|
||||
@Schema(description = "搬运工姓名", example = "张三")
|
||||
@ExcelProperty("搬运工姓名")
|
||||
private String porterName;
|
||||
|
||||
@Schema(description = "叉车司机姓名", example = "芋艿")
|
||||
@ExcelProperty("叉车司机姓名")
|
||||
private String dirverName;
|
||||
|
||||
@Schema(description = "仓库看管员姓名", example = "李四")
|
||||
@ExcelProperty("仓库看管员姓名")
|
||||
private String keeperName;
|
||||
|
||||
@Schema(description = "总数量")
|
||||
@ExcelProperty("总数量")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "总金额")
|
||||
@ExcelProperty("总金额")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@Schema(description = "总车数")
|
||||
@ExcelProperty("总车数")
|
||||
private Integer totalTruck;
|
||||
|
||||
@Schema(description = "搬运总数")
|
||||
@ExcelProperty("搬运总数")
|
||||
private Integer moveNum;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂出库入库数据新增/修改 Request VO")
|
||||
@Data
|
||||
public class FactoryDataSaveReqVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17120")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7606")
|
||||
@NotNull(message = "工厂id不能为空")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "进出库类型 1出库 2进库", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "进出库类型 1出库 2进库不能为空")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "日期不能为空")
|
||||
private LocalDate date;
|
||||
|
||||
@Schema(description = "搬运工姓名", example = "张三")
|
||||
private String porterName;
|
||||
|
||||
@Schema(description = "叉车司机姓名", example = "芋艿")
|
||||
private String dirverName;
|
||||
|
||||
@Schema(description = "仓库看管员姓名", example = "李四")
|
||||
private String keeperName;
|
||||
|
||||
@Schema(description = "总数量")
|
||||
private Integer totalNum;
|
||||
|
||||
@Schema(description = "总金额")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@Schema(description = "总车数")
|
||||
private Integer totalTruck;
|
||||
|
||||
@Schema(description = "搬运总数")
|
||||
private Integer moveNum;
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview.FactoryDataOverviewDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factorydataoverview.FactoryDataOverviewService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 工厂数据总览")
|
||||
@RestController
|
||||
@RequestMapping("/factory/data-overview")
|
||||
@Validated
|
||||
public class FactoryDataOverviewController {
|
||||
|
||||
@Resource
|
||||
private FactoryDataOverviewService dataOverviewService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工厂数据总览")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data-overview:create')")
|
||||
public CommonResult<Long> createDataOverview(@Valid @RequestBody FactoryDataOverviewSaveReqVO createReqVO) {
|
||||
return success(dataOverviewService.createDataOverview(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新工厂数据总览")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data-overview:update')")
|
||||
public CommonResult<Boolean> updateDataOverview(@Valid @RequestBody FactoryDataOverviewSaveReqVO updateReqVO) {
|
||||
dataOverviewService.updateDataOverview(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除工厂数据总览")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('factory:data-overview:delete')")
|
||||
public CommonResult<Boolean> deleteDataOverview(@RequestParam("id") Long id) {
|
||||
dataOverviewService.deleteDataOverview(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得工厂数据总览")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data-overview:query')")
|
||||
public CommonResult<FactoryDataOverviewRespVO> getDataOverview(@RequestParam("id") Long id) {
|
||||
FactoryDataOverviewDO dataOverview = dataOverviewService.getDataOverview(id);
|
||||
return success(BeanUtils.toBean(dataOverview, FactoryDataOverviewRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得工厂数据总览分页")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data-overview:query')")
|
||||
public CommonResult<PageResult<FactoryDataOverviewRespVO>> getDataOverviewPage(@Valid FactoryDataOverviewPageReqVO pageReqVO) {
|
||||
PageResult<FactoryDataOverviewDO> pageResult = dataOverviewService.getDataOverviewPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, FactoryDataOverviewRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出工厂数据总览 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('factory:data-overview:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDataOverviewExcel(@Valid FactoryDataOverviewPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<FactoryDataOverviewDO> list = dataOverviewService.getDataOverviewPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "工厂数据总览.xls", "数据", FactoryDataOverviewRespVO.class,
|
||||
BeanUtils.toBean(list, FactoryDataOverviewRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂数据总览分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FactoryDataOverviewPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "工厂id", example = "2906")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂全称", example = "芋艿")
|
||||
private String fullName;
|
||||
|
||||
@Schema(description = "员工简称", example = "李四")
|
||||
private String shortName;
|
||||
|
||||
@Schema(description = "城市名称", example = "张三")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "工人数量")
|
||||
private Integer workerNum;
|
||||
|
||||
@Schema(description = "叉车总数")
|
||||
private Integer truckTotalNum;
|
||||
|
||||
@Schema(description = "打包线数量")
|
||||
private Integer dbxNum;
|
||||
|
||||
@Schema(description = "托盘数量")
|
||||
private Integer tpNum;
|
||||
|
||||
@Schema(description = "绑带数量")
|
||||
private Integer bdNum;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂数据总览 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class FactoryDataOverviewRespVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12045")
|
||||
@ExcelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2906")
|
||||
@ExcelProperty("工厂id")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂全称", example = "芋艿")
|
||||
@ExcelProperty("工厂全称")
|
||||
private String fullName;
|
||||
|
||||
@Schema(description = "员工简称", example = "李四")
|
||||
@ExcelProperty("员工简称")
|
||||
private String shortName;
|
||||
|
||||
@Schema(description = "城市名称", example = "张三")
|
||||
@ExcelProperty("城市名称")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "工人数量")
|
||||
@ExcelProperty("工人数量")
|
||||
private Integer workerNum;
|
||||
|
||||
@Schema(description = "叉车总数")
|
||||
@ExcelProperty("叉车总数")
|
||||
private Integer truckTotalNum;
|
||||
|
||||
@Schema(description = "打包线数量")
|
||||
@ExcelProperty("打包线数量")
|
||||
private Integer dbxNum;
|
||||
|
||||
@Schema(description = "托盘数量")
|
||||
@ExcelProperty("托盘数量")
|
||||
private Integer tpNum;
|
||||
|
||||
@Schema(description = "绑带数量")
|
||||
@ExcelProperty("绑带数量")
|
||||
private Integer bdNum;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂数据总览新增/修改 Request VO")
|
||||
@Data
|
||||
public class FactoryDataOverviewSaveReqVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12045")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工厂id", requiredMode = Schema.RequiredMode.REQUIRED, example = "2906")
|
||||
@NotNull(message = "工厂id不能为空")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "工厂全称", example = "芋艿")
|
||||
private String fullName;
|
||||
|
||||
@Schema(description = "员工简称", example = "李四")
|
||||
private String shortName;
|
||||
|
||||
@Schema(description = "城市名称", example = "张三")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "工人数量")
|
||||
private Integer workerNum;
|
||||
|
||||
@Schema(description = "叉车总数")
|
||||
private Integer truckTotalNum;
|
||||
|
||||
@Schema(description = "打包线数量")
|
||||
private Integer dbxNum;
|
||||
|
||||
@Schema(description = "托盘数量")
|
||||
private Integer tpNum;
|
||||
|
||||
@Schema(description = "绑带数量")
|
||||
private Integer bdNum;
|
||||
|
||||
}
|
@ -1,37 +1,31 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo;
|
||||
|
||||
import cn.iocoder.yudao.framework.ip.core.Area;
|
||||
import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 工厂信息")
|
||||
@RestController
|
||||
|
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.hik;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.hik.vo.CameraReplayDTO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.hik.HikService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 工厂管理-工厂列表
|
||||
*
|
||||
* @author qun.xu
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/smartfactory/hik")
|
||||
@Tag(name = "海康接口")
|
||||
public class HikController {
|
||||
|
||||
@Resource
|
||||
private HikService hikService;
|
||||
|
||||
@GetMapping("/getCameraUrl")
|
||||
@Operation(summary = "视频播放->查询播放地址")
|
||||
public CommonResult<String> getCameraUrl(String cameraCode) {
|
||||
String url = hikService.getPreviewUrlsApi(cameraCode, 0);
|
||||
return CommonResult.success(url);
|
||||
}
|
||||
|
||||
@GetMapping("/replayUrl")
|
||||
@Operation(summary = "视频播放->回放流")
|
||||
public CommonResult<JSONObject> getReplayUrl(CameraReplayDTO cameraReplayDTO) {
|
||||
JSONObject replayUrl = hikService.getReplayUrl(cameraReplayDTO);
|
||||
return CommonResult.success(replayUrl);
|
||||
}
|
||||
|
||||
// @GetMapping("/operate")
|
||||
// @Operation(summary = "视频->云台操作")
|
||||
// public CommonResult<String> operate(CameraOperateDTO dto) {
|
||||
// //判断操作权限
|
||||
// Long cameraFactoryId = dto.getFactoryId();
|
||||
// Long userFactoryId = SecurityUtils.getFactoryId();
|
||||
// if (cameraFactoryId == null || userFactoryId == null) {
|
||||
// throw new ServiceException("没有权限操控该摄像头,请联系管理员");
|
||||
// }
|
||||
// if (SystemConfig.getFactoryCenterId() != userFactoryId && userFactoryId.longValue() != cameraFactoryId) {
|
||||
// throw new ServiceException("没有权限操控该摄像头,请联系管理员");
|
||||
// }
|
||||
// String msg = hikService.operateCamera(dto);
|
||||
// return CommonResult.success(msg);
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.hik.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @date 2023-06-13
|
||||
*/
|
||||
@Data
|
||||
public class CameraOperateDTO {
|
||||
|
||||
@Schema(description = "摄像头工厂id")
|
||||
private Long factoryId;
|
||||
|
||||
@Schema(description = "摄像头编号")
|
||||
private String cameraIndexCode;
|
||||
|
||||
@Schema(description = "存储位置")
|
||||
private Integer action;
|
||||
|
||||
@Schema(description = "操作类型")
|
||||
private String command;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.hik.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @date 2023-06-13
|
||||
*/
|
||||
@Data
|
||||
public class CameraReplayDTO {
|
||||
@Schema(description = "摄像头编号")
|
||||
private String cameraIndexCode;
|
||||
@Schema(description = "存储位置")
|
||||
private Integer recordLocation;
|
||||
@Schema(description = "开始时间")
|
||||
private String beginTime;
|
||||
@Schema(description = "结束时间")
|
||||
private String endTime;
|
||||
}
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.smartfactory.controller.admin.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.admin.screendata.factory.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.packagedata.PackageDataDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.screendata.ScreenDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -15,6 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@ -29,66 +31,66 @@ public class FactoryScreenDataController {
|
||||
private ScreenDataService screenDataService;
|
||||
|
||||
/**
|
||||
* @param type 1: 省,2 市,3区
|
||||
* @param adcode
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getProvincesData")
|
||||
@Operation(summary = "大屏全局省份/省/市工厂数据(包函工厂基本信息)")
|
||||
public CommonResult<List<ProvincesDataRespVO>> getProvincesData(@RequestParam Integer type, @RequestParam String code) {
|
||||
List<ProvincesDataRespVO> provincesDataList = screenDataService.getProvincesData(type, code);
|
||||
@PermitAll
|
||||
public CommonResult<List<ProvincesDataRespVO>> getProvincesData(@RequestParam(required = false) String code) {
|
||||
List<ProvincesDataRespVO> provincesDataList = screenDataService.getProvincesData(code);
|
||||
return success(provincesDataList);
|
||||
}
|
||||
|
||||
@GetMapping("/getStaffData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏员工信息数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
@PermitAll
|
||||
public CommonResult<StaffDataRespVO> getStaffData(@RequestParam Long factoryId) {
|
||||
StaffDataRespVO staffDataRespVO = screenDataService.getStaffData(factoryId);
|
||||
return success(staffDataRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getPropertyData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏资产数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
@PermitAll
|
||||
public CommonResult<PropertyDataRespVO> getPropertyData(@RequestParam Long factoryId) {
|
||||
PropertyDataRespVO propertyDataRespVO = screenDataService.getPropertyData(factoryId);
|
||||
return success(propertyDataRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryOperateData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂运营数据 调用接口 http://znkj.ispt.com.cn/prod-api/screen/detail/dateList?factoryId=10000011")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
@PermitAll
|
||||
public CommonResult<OperateDataRespVO> getFactoryOperateData(@RequestParam Long factoryId) {
|
||||
OperateDataRespVO factoryOperateDataRespVO = screenDataService.getFactoryOperateData(factoryId);
|
||||
return success(factoryOperateDataRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryRollData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂滚动数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
@PermitAll
|
||||
public CommonResult<List<FactoryRollDataRespVO>> getFactoryRollData() {
|
||||
List<FactoryRollDataRespVO> list = screenDataService.getFactoryRollData();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryCamerasData")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂监控视频数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
@PermitAll
|
||||
public CommonResult<List<FactoryCameraDataRespVO>> getFactoryCamerasData(@RequestParam Long factoryId) {
|
||||
List<FactoryCameraDataRespVO> factoryCameraDatas = screenDataService.getFactoryCamerasData(factoryId);
|
||||
return success(factoryCameraDatas);
|
||||
}
|
||||
|
||||
@GetMapping("/getFactoryWeatherInfo")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂天气数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
@PermitAll
|
||||
public CommonResult<FactoryWeatherDataRespVO> getFactoryWeatherInfo(@RequestParam Long factoryId) {
|
||||
return success(screenDataService.getFactoryWeatherInfo(factoryId));
|
||||
}
|
||||
@ -100,11 +102,66 @@ public class FactoryScreenDataController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getFactoryPackLineInfo")
|
||||
@PermitAll
|
||||
@Operation(summary = "大屏工厂打包线数据")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<List<PackageDataDO>> getFactoryPackLineInfo(@RequestParam Long factoryId) {
|
||||
@PermitAll
|
||||
public CommonResult<List<FactoryPackLineInfoVO>> getFactoryPackLineInfo(@RequestParam Long factoryId) {
|
||||
return success(screenDataService.getFactoryPackLineInfo(factoryId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAliYunGeo")
|
||||
@Operation(summary = "获取阿里云地址")
|
||||
@PermitAll
|
||||
public CommonResult<String> getAliYunGeo(@RequestParam String code, @RequestParam Integer type) {
|
||||
String data = screenDataService.getAliYunGeo(code, type);
|
||||
return success(data);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getDataOverview")
|
||||
@Operation(summary = "获取大屏数据总览")
|
||||
@PermitAll
|
||||
public CommonResult<DataOverviewVO> getDataOverview() {
|
||||
DataOverviewVO data = screenDataService.getDataOverview();
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@GetMapping("/getInboundAndOutboundOverview")
|
||||
@Operation(summary = "获取大屏出入库top5")
|
||||
@PermitAll
|
||||
public CommonResult<List<InboundAndOutboundOverviewVO>> getInboundAndOutboundOverview() {
|
||||
List<InboundAndOutboundOverviewVO> data = screenDataService.getInboundAndOutboundOverview();
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@GetMapping("/excellentRateRanking")
|
||||
@Operation(summary = "优等率排行")
|
||||
@PermitAll
|
||||
public CommonResult<List<ExcellentRateRankingVO>> excellentRateRanking() {
|
||||
List<ExcellentRateRankingVO> data = screenDataService.excellentRateRanking();
|
||||
return success(data);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/energyConservation")
|
||||
@Operation(summary = "节能减排")
|
||||
@PermitAll
|
||||
public CommonResult<List<EnergyConservationVO>> energyConservation(@RequestParam(required = false) Long factoryId) {
|
||||
List<EnergyConservationVO> data = screenDataService.energyConservation(factoryId);
|
||||
return success(data);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getObtainFactoryInboundAndOutboundStatus")
|
||||
@Operation(summary = "获取工厂出入库情况")
|
||||
@PermitAll
|
||||
public CommonResult<ObtainFactoryInboundAndOutboundStatusVO> getObtainFactoryInboundAndOutboundStatus(@RequestParam Long factoryId) {
|
||||
ObtainFactoryInboundAndOutboundStatusVO data = screenDataService.getObtainFactoryInboundAndOutboundStatus(factoryId);
|
||||
return success(data);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 数据总揽")
|
||||
@Data
|
||||
public class DataOverviewVO {
|
||||
@Schema(description = "员工数量")
|
||||
private Integer total;
|
||||
@Schema(description = "窑炉数量")
|
||||
private Integer ylNum;
|
||||
@Schema(description = "叉车台数")
|
||||
private Integer forkliftTotal;
|
||||
@Schema(description = "叉车运行数量")
|
||||
private Integer truckOnNum;
|
||||
@Schema(description = "叉车未运行数量")
|
||||
private Integer truckOffNum;
|
||||
@Schema(description = "打包线数量")
|
||||
private Integer dbxNum;
|
||||
@Schema(description = "托盘数")
|
||||
private Integer tpNum;
|
||||
@Schema(description = "绑带数")
|
||||
private Integer bdNum;
|
||||
@Schema(description = "出库")
|
||||
private Integer outTotalNum;
|
||||
@Schema(description = "入库")
|
||||
private Integer inTotalNum;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Data
|
||||
public class EnergyConservationVO {
|
||||
@Schema(description = "工厂名称")
|
||||
private String name;
|
||||
@Schema(description = "时间")
|
||||
private String time;
|
||||
@Schema(description = "排放量")
|
||||
private Integer emissions;
|
||||
@Schema(description = "叉车数")
|
||||
private Integer forkliftTotal;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "优等率排行")
|
||||
@Data
|
||||
public class ExcellentRateRankingVO {
|
||||
@Schema(description = "工厂")
|
||||
private String name;
|
||||
@Schema(description = "优等率")
|
||||
private Double excellentRate;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Data
|
||||
public class FactoryPackLineInfoVO {
|
||||
@Schema(description = "规格id")
|
||||
private Long id;
|
||||
@Schema(description = "规格名称")
|
||||
private String name;
|
||||
@Schema(description = "今日打包总数")
|
||||
private Integer dayNum;
|
||||
@Schema(description = "本周打包总数")
|
||||
private Integer weekNum;
|
||||
@Schema(description = "本月打包总数")
|
||||
private Integer monthNum;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Schema(description = "大屏数据 - 出入库")
|
||||
@Data
|
||||
public class InboundAndOutboundOverviewVO {
|
||||
@Schema(description = "工厂")
|
||||
private String name;
|
||||
@Schema(description = "出库")
|
||||
private Integer outTotalNum;
|
||||
@Schema(description = "入库")
|
||||
private Integer inTotalNum;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
*
|
||||
* @author: yj
|
||||
* @date: 2024年03月05日 13:55
|
||||
*/
|
||||
@Data
|
||||
public class ObtainFactoryInboundAndOutboundStatusVO {
|
||||
@Schema(description = "今日入库")
|
||||
private Integer inToday;
|
||||
@Schema(description = "本月入库")
|
||||
private Integer inMonth;
|
||||
|
||||
@Schema(description = "今日出库")
|
||||
private Integer outToday;
|
||||
@Schema(description = "本月出库")
|
||||
private Integer outMonth;
|
||||
|
||||
@Schema(description = "今日破损")
|
||||
private Integer damagedTotal;
|
||||
@Schema(description = "同比昨日上升")
|
||||
private Double increaseCompared;
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydata;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 工厂出库入库数据 DO
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@TableName("sf_factory_data")
|
||||
@KeySequence("sf_factory_data_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FactoryDataDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 工厂id
|
||||
*/
|
||||
private Long factoryId;
|
||||
/**
|
||||
* 进出库类型 1出库 2进库
|
||||
*/
|
||||
private Integer dataType;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private LocalDate date;
|
||||
/**
|
||||
* 搬运工姓名
|
||||
*/
|
||||
private String porterName;
|
||||
/**
|
||||
* 叉车司机姓名
|
||||
*/
|
||||
private String dirverName;
|
||||
/**
|
||||
* 仓库看管员姓名
|
||||
*/
|
||||
private String keeperName;
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
private Integer totalNum;
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
/**
|
||||
* 总车数
|
||||
*/
|
||||
private Integer totalTruck;
|
||||
/**
|
||||
* 搬运总数
|
||||
*/
|
||||
private Integer moveNum;
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 工厂数据总览 DO
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@TableName("sf_factory_data_overview")
|
||||
@KeySequence("sf_factory_data_overview_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FactoryDataOverviewDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 工厂id
|
||||
*/
|
||||
private Long factoryId;
|
||||
/**
|
||||
* 工厂全称
|
||||
*/
|
||||
private String fullName;
|
||||
/**
|
||||
* 员工简称
|
||||
*/
|
||||
private String shortName;
|
||||
/**
|
||||
* 城市名称
|
||||
*/
|
||||
private String cityName;
|
||||
/**
|
||||
* 工人数量
|
||||
*/
|
||||
private Integer workerNum;
|
||||
/**
|
||||
* 叉车总数
|
||||
*/
|
||||
private Integer truckTotalNum;
|
||||
/**
|
||||
* 打包线数量
|
||||
*/
|
||||
private Integer dbxNum;
|
||||
/**
|
||||
* 托盘数量
|
||||
*/
|
||||
private Integer tpNum;
|
||||
/**
|
||||
* 绑带数量
|
||||
*/
|
||||
private Integer bdNum;
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@ -24,8 +25,9 @@ import java.math.BigDecimal;
|
||||
public class FactoryInfoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 1: 省,2 市,3区
|
||||
* 0:全国, 1: 省,2 市,3区
|
||||
*/
|
||||
public static final Integer ADDRESS_TYPE_NATIONWIDE = 0;
|
||||
public static final Integer ADDRESS_TYPE_PROVINCE = 1;
|
||||
public static final Integer ADDRESS_TYPE_CITY = 2;
|
||||
public static final Integer ADDRESS_TYPE_DISTRICT_NAME = 3;
|
||||
@ -69,7 +71,8 @@ public class FactoryInfoDO extends BaseDO {
|
||||
* <p>
|
||||
* 枚举 {@link TODO infra_codegen_template_type 对应的类}
|
||||
*/
|
||||
private Long districtId;
|
||||
@TableField(value = "district_id")
|
||||
private Long adCode;
|
||||
/**
|
||||
* 省名称
|
||||
*/
|
||||
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydata.FactoryDataDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 工厂出库入库数据 Mapper
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Mapper
|
||||
public interface FactoryDataMapper extends BaseMapperX<FactoryDataDO> {
|
||||
|
||||
default PageResult<FactoryDataDO> selectPage(FactoryDataPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FactoryDataDO>()
|
||||
.eqIfPresent(FactoryDataDO::getFactoryId, reqVO.getFactoryId())
|
||||
.eqIfPresent(FactoryDataDO::getDataType, reqVO.getDataType())
|
||||
.betweenIfPresent(FactoryDataDO::getDate, reqVO.getDate())
|
||||
.likeIfPresent(FactoryDataDO::getPorterName, reqVO.getPorterName())
|
||||
.likeIfPresent(FactoryDataDO::getDirverName, reqVO.getDirverName())
|
||||
.likeIfPresent(FactoryDataDO::getKeeperName, reqVO.getKeeperName())
|
||||
.eqIfPresent(FactoryDataDO::getTotalNum, reqVO.getTotalNum())
|
||||
.eqIfPresent(FactoryDataDO::getTotalAmount, reqVO.getTotalAmount())
|
||||
.eqIfPresent(FactoryDataDO::getTotalTruck, reqVO.getTotalTruck())
|
||||
.eqIfPresent(FactoryDataDO::getMoveNum, reqVO.getMoveNum())
|
||||
.betweenIfPresent(FactoryDataDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(FactoryDataDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydataoverview;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview.FactoryDataOverviewDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 工厂数据总览 Mapper
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Mapper
|
||||
public interface FactoryDataOverviewMapper extends BaseMapperX<FactoryDataOverviewDO> {
|
||||
|
||||
default PageResult<FactoryDataOverviewDO> selectPage(FactoryDataOverviewPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FactoryDataOverviewDO>()
|
||||
.eqIfPresent(FactoryDataOverviewDO::getFactoryId, reqVO.getFactoryId())
|
||||
.likeIfPresent(FactoryDataOverviewDO::getFullName, reqVO.getFullName())
|
||||
.likeIfPresent(FactoryDataOverviewDO::getShortName, reqVO.getShortName())
|
||||
.likeIfPresent(FactoryDataOverviewDO::getCityName, reqVO.getCityName())
|
||||
.eqIfPresent(FactoryDataOverviewDO::getWorkerNum, reqVO.getWorkerNum())
|
||||
.eqIfPresent(FactoryDataOverviewDO::getTruckTotalNum, reqVO.getTruckTotalNum())
|
||||
.eqIfPresent(FactoryDataOverviewDO::getDbxNum, reqVO.getDbxNum())
|
||||
.eqIfPresent(FactoryDataOverviewDO::getTpNum, reqVO.getTpNum())
|
||||
.eqIfPresent(FactoryDataOverviewDO::getBdNum, reqVO.getBdNum())
|
||||
.betweenIfPresent(FactoryDataOverviewDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(FactoryDataOverviewDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.Fact
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryRollDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -34,4 +35,12 @@ public interface FactoryInfoMapper extends BaseMapperX<FactoryInfoDO> {
|
||||
* @return
|
||||
*/
|
||||
List<FactoryRollDataRespVO> getFactoryRollData();
|
||||
|
||||
/**
|
||||
* 根据工厂ID获取天气代码。
|
||||
*
|
||||
* @param factoryId 工厂的唯一标识符,类型为Long。
|
||||
* @return 返回与给定工厂ID相关联的天气代码,类型为String。
|
||||
*/
|
||||
String getWeatherCodeByFactoryId(@Param("factoryId") Long factoryId, @Param("areaCode") String areaCode);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.factorydata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydata.FactoryDataDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工厂出库入库数据 Service 接口
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
public interface FactoryDataService {
|
||||
|
||||
/**
|
||||
* 创建工厂出库入库数据
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createData(@Valid FactoryDataSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新工厂出库入库数据
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateData(@Valid FactoryDataSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除工厂出库入库数据
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteData(Long id);
|
||||
|
||||
/**
|
||||
* 获得工厂出库入库数据
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 工厂出库入库数据
|
||||
*/
|
||||
FactoryDataDO getData(Long id);
|
||||
|
||||
/**
|
||||
* 获得工厂出库入库数据分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 工厂出库入库数据分页
|
||||
*/
|
||||
PageResult<FactoryDataDO> getDataPage(FactoryDataPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获取当天的所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FactoryDataDO> getTodayInboundAndOutboundOverview();
|
||||
|
||||
/**
|
||||
* 根据日期和工厂过滤
|
||||
*
|
||||
* @param factoryId
|
||||
* @param beginDay
|
||||
* @param endDay
|
||||
* @return
|
||||
*/
|
||||
List<FactoryDataDO> getByTimeAndFactoryId(Long factoryId, Date beginDay, Date endDay);
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.factorydata;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydata.vo.FactoryDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydata.FactoryDataDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydata.FactoryDataMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 工厂出库入库数据 Service 实现类
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FactoryDataServiceImpl implements FactoryDataService {
|
||||
|
||||
@Resource
|
||||
private FactoryDataMapper dataMapper;
|
||||
|
||||
@Override
|
||||
public Long createData(FactoryDataSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
FactoryDataDO data = BeanUtils.toBean(createReqVO, FactoryDataDO.class);
|
||||
dataMapper.insert(data);
|
||||
// 返回
|
||||
return data.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateData(FactoryDataSaveReqVO updateReqVO) {
|
||||
// 更新
|
||||
FactoryDataDO updateObj = BeanUtils.toBean(updateReqVO, FactoryDataDO.class);
|
||||
dataMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteData(Long id) {
|
||||
// 删除
|
||||
dataMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FactoryDataDO getData(Long id) {
|
||||
return dataMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FactoryDataDO> getDataPage(FactoryDataPageReqVO pageReqVO) {
|
||||
return dataMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryDataDO> getTodayInboundAndOutboundOverview() {
|
||||
return dataMapper.selectList(new LambdaQueryWrapperX<FactoryDataDO>()
|
||||
.eq(FactoryDataDO::getDate, DateUtil.parse("2023-11-05")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryDataDO> getByTimeAndFactoryId(Long factoryId, Date beginDay, Date endDay) {
|
||||
return dataMapper.selectList(new LambdaQueryWrapperX<FactoryDataDO>()
|
||||
.ge(FactoryDataDO::getDate, beginDay)
|
||||
.le(FactoryDataDO::getDate, endDay)
|
||||
.eq(FactoryDataDO::getFactoryId, factoryId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.factorydataoverview;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview.FactoryDataOverviewDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工厂数据总览 Service 接口
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
public interface FactoryDataOverviewService {
|
||||
|
||||
/**
|
||||
* 创建工厂数据总览
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDataOverview(@Valid FactoryDataOverviewSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新工厂数据总览
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDataOverview(@Valid FactoryDataOverviewSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除工厂数据总览
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDataOverview(Long id);
|
||||
|
||||
/**
|
||||
* 获得工厂数据总览
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 工厂数据总览
|
||||
*/
|
||||
FactoryDataOverviewDO getDataOverview(Long id);
|
||||
|
||||
/**
|
||||
* 获得工厂数据总览分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 工厂数据总览分页
|
||||
*/
|
||||
PageResult<FactoryDataOverviewDO> getDataOverviewPage(FactoryDataOverviewPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FactoryDataOverviewDO> list();
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.factorydataoverview;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview.FactoryDataOverviewDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydataoverview.FactoryDataOverviewMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 工厂数据总览 Service 实现类
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FactoryDataOverviewServiceImpl implements FactoryDataOverviewService {
|
||||
|
||||
@Resource
|
||||
private FactoryDataOverviewMapper dataOverviewMapper;
|
||||
|
||||
@Override
|
||||
public Long createDataOverview(FactoryDataOverviewSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
FactoryDataOverviewDO dataOverview = BeanUtils.toBean(createReqVO, FactoryDataOverviewDO.class);
|
||||
dataOverviewMapper.insert(dataOverview);
|
||||
// 返回
|
||||
return dataOverview.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataOverview(FactoryDataOverviewSaveReqVO updateReqVO) {
|
||||
// 更新
|
||||
FactoryDataOverviewDO updateObj = BeanUtils.toBean(updateReqVO, FactoryDataOverviewDO.class);
|
||||
dataOverviewMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDataOverview(Long id) {
|
||||
// 删除
|
||||
dataOverviewMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FactoryDataOverviewDO getDataOverview(Long id) {
|
||||
return dataOverviewMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FactoryDataOverviewDO> getDataOverviewPage(FactoryDataOverviewPageReqVO pageReqVO) {
|
||||
return dataOverviewMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryDataOverviewDO> list() {
|
||||
return dataOverviewMapper.selectList();
|
||||
}
|
||||
|
||||
}
|
@ -58,11 +58,10 @@ public interface FactoryInfoService {
|
||||
/**
|
||||
* 省市区类型 + code 搜索工厂
|
||||
*
|
||||
* @param type
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<ProvincesDataRespVO> getProvincesData(Integer type, String code);
|
||||
List<ProvincesDataRespVO> getProvincesData(String code);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 工厂基础滚动数据
|
||||
@ -70,4 +69,19 @@ public interface FactoryInfoService {
|
||||
* @return
|
||||
*/
|
||||
List<FactoryRollDataRespVO> getFactoryRollData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 工厂列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FactoryInfoDO> list();
|
||||
|
||||
/**
|
||||
* 根据工厂ID获取天气代码。
|
||||
*
|
||||
* @param factoryId 工厂的唯一标识符,类型为Long。
|
||||
* @return 返回与给定工厂ID相关联的天气代码,类型为String。
|
||||
*/
|
||||
String getWeatherCodeByFactoryId(Long factoryId, String areaCode);
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.smartfactory.service.factoryinfo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.ip.core.Area;
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.factoryinfo.vo.FactoryInfoSaveReqVO;
|
||||
@ -77,28 +79,39 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProvincesDataRespVO> getProvincesData(Integer type, String code) {
|
||||
public List<ProvincesDataRespVO> getProvincesData(String code) {
|
||||
// -- 获取当前的地区
|
||||
Area area = AreaUtils.getArea(Integer.valueOf(code));
|
||||
List<ProvincesDataRespVO> vos = new ArrayList<>();
|
||||
List<FactoryInfoDO> dos = factoryInfoMapper.selectList(new LambdaQueryWrapperX<FactoryInfoDO>()
|
||||
.eq(FactoryInfoDO.ADDRESS_TYPE_PROVINCE.equals(type), FactoryInfoDO::getProvinceId, code)
|
||||
.eq(FactoryInfoDO.ADDRESS_TYPE_CITY.equals(type), FactoryInfoDO::getCityId, code)
|
||||
.eq(FactoryInfoDO.ADDRESS_TYPE_DISTRICT_NAME.equals(type), FactoryInfoDO::getDistrictId, code)
|
||||
LambdaQueryWrapperX<FactoryInfoDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<FactoryInfoDO>();
|
||||
lambdaQueryWrapperX.ne(FactoryInfoDO::getId, 1L);
|
||||
Integer type = area.getType() - 1;
|
||||
if (!type.equals(FactoryInfoDO.ADDRESS_TYPE_NATIONWIDE)) {
|
||||
lambdaQueryWrapperX.eq(FactoryInfoDO.ADDRESS_TYPE_PROVINCE.equals(type), FactoryInfoDO::getProvinceId, code)
|
||||
.eq(FactoryInfoDO.ADDRESS_TYPE_CITY.equals(type), FactoryInfoDO::getCityId, code)
|
||||
.eq(FactoryInfoDO.ADDRESS_TYPE_DISTRICT_NAME.equals(type), FactoryInfoDO::getAdCode, code);
|
||||
}
|
||||
List<FactoryInfoDO> dos = factoryInfoMapper.selectList(
|
||||
lambdaQueryWrapperX
|
||||
);
|
||||
Map<Long, List<FactoryInfoDO>> map = new HashMap<>();
|
||||
if (FactoryInfoDO.ADDRESS_TYPE_PROVINCE.equals(type)){
|
||||
if (FactoryInfoDO.ADDRESS_TYPE_NATIONWIDE.equals(type)) {
|
||||
map = dos.stream().collect(Collectors.groupingBy(FactoryInfoDO::getProvinceId));
|
||||
}
|
||||
if (FactoryInfoDO.ADDRESS_TYPE_CITY.equals(type)){
|
||||
if (FactoryInfoDO.ADDRESS_TYPE_PROVINCE.equals(type)) {
|
||||
map = dos.stream().collect(Collectors.groupingBy(FactoryInfoDO::getCityId));
|
||||
}
|
||||
if (FactoryInfoDO.ADDRESS_TYPE_DISTRICT_NAME.equals(type)){
|
||||
map = dos.stream().collect(Collectors.groupingBy(FactoryInfoDO::getDistrictId));
|
||||
if (FactoryInfoDO.ADDRESS_TYPE_CITY.equals(type)) {
|
||||
map = dos.stream().collect(Collectors.groupingBy(FactoryInfoDO::getAdCode));
|
||||
}
|
||||
if (FactoryInfoDO.ADDRESS_TYPE_DISTRICT_NAME.equals(type)) {
|
||||
map = dos.stream().collect(Collectors.groupingBy(FactoryInfoDO::getId));
|
||||
}
|
||||
for (Map.Entry<Long, List<FactoryInfoDO>> entry : map.entrySet()) {
|
||||
ProvincesDataRespVO vo = new ProvincesDataRespVO();
|
||||
vo.setAdCode(entry.getKey());
|
||||
vo.setValue(entry.getValue().size());
|
||||
vo.setVos(dos);
|
||||
vo.setVos(entry.getValue());
|
||||
vos.add(vo);
|
||||
}
|
||||
return vos;
|
||||
@ -109,4 +122,14 @@ public class FactoryInfoServiceImpl implements FactoryInfoService {
|
||||
return factoryInfoMapper.getFactoryRollData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryInfoDO> list() {
|
||||
return factoryInfoMapper.selectList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWeatherCodeByFactoryId(Long factoryId, String areaCode) {
|
||||
return factoryInfoMapper.getWeatherCodeByFactoryId(factoryId, areaCode);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.hik;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.hik.vo.CameraReplayDTO;
|
||||
|
||||
/**
|
||||
* Hik Service 接口
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
public interface HikService {
|
||||
|
||||
/**
|
||||
* 查询播放地址
|
||||
*
|
||||
* @param cameraCode
|
||||
* @param streamType
|
||||
* @return
|
||||
*/
|
||||
String getPreviewUrlsApi(String cameraCode, Integer streamType);
|
||||
|
||||
/**
|
||||
* 获取回放流
|
||||
*
|
||||
* @param cameraReplayDTO
|
||||
* @return
|
||||
*/
|
||||
JSONObject getReplayUrl(CameraReplayDTO cameraReplayDTO);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.hik;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.module.smartfactory.constant.ArtemisApiConstant;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.hik.vo.CameraReplayDTO;
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.IS0_8601;
|
||||
|
||||
/**
|
||||
* Hik Service 接口
|
||||
*
|
||||
* @author 艾楷
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class HikServiceImpl implements HikService {
|
||||
|
||||
@Override
|
||||
public String getPreviewUrlsApi(String cameraCode, Integer streamType) {
|
||||
final String previewUrlsApi = ArtemisApiConstant.previewUrlsApi;
|
||||
Map<String, String> path = new HashMap<String, String>(1) {
|
||||
{
|
||||
put("https://", previewUrlsApi);
|
||||
}
|
||||
};
|
||||
JSONObject body = new JSONObject();
|
||||
body.set("cameraIndexCode", cameraCode);
|
||||
body.set("streamType", streamType);
|
||||
body.set("protocol", "ws");
|
||||
body.set("transmode", 1);
|
||||
body.set("expand", "streamform=ps");
|
||||
try {
|
||||
String result = ArtemisHttpUtil
|
||||
.doPostStringArtemis(path, JSONUtil.toJsonStr(body), null, null, "application/json");
|
||||
log.info("{}监控查看预览地址返回:{}", JSONUtil.toJsonStr(body), result);
|
||||
if (StringUtils.isEmpty(result)) {
|
||||
// throw new ServiceException("监控查看预览地址返回为空");
|
||||
System.out.println("监控查看预览地址返回为空");
|
||||
}
|
||||
JSONObject json = JSONUtil.parseObj(result);
|
||||
String url = "";
|
||||
if (json.getJSONObject("data") != null) {
|
||||
url = json.getJSONObject("data").getStr("url");
|
||||
}
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getReplayUrl(CameraReplayDTO replayDTO) {
|
||||
final String replayUrlApi = ArtemisApiConstant.replayUrlApi;
|
||||
Map<String, String> path = new HashMap<String, String>(1) {
|
||||
{
|
||||
put("https://", replayUrlApi);
|
||||
}
|
||||
};
|
||||
JSONObject body = new JSONObject();
|
||||
body.set("cameraIndexCode", replayDTO.getCameraIndexCode());
|
||||
body.set("recordLocation", replayDTO.getRecordLocation());
|
||||
body.set("protocol", "ws");
|
||||
body.set("transmode", 1);
|
||||
body.set("beginTime", DateUtil.format(DateUtil.parse(replayDTO.getBeginTime()), IS0_8601));
|
||||
body.set("endTime", DateUtil.format(DateUtil.parse(replayDTO.getEndTime()), IS0_8601));
|
||||
try {
|
||||
String result = ArtemisHttpUtil.doPostStringArtemis(path, JSONUtil.toJsonStr(body), null, null, "application/json");
|
||||
JSONObject json = JSONUtil.parseObj(result);
|
||||
return json;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -3,10 +3,10 @@ package cn.iocoder.yudao.module.smartfactory.service.packagedata;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.packagedata.vo.PackageDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.packagedata.vo.PackageDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryPackLineDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.packagedata.PackageDataDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -61,4 +61,14 @@ public interface PackageDataService {
|
||||
* @return
|
||||
*/
|
||||
List<PackageDataDO> getFactoryPackLineInfo(Long factoryId);
|
||||
|
||||
/**
|
||||
* 列表 - 时间参数
|
||||
*
|
||||
* @param factoryId
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
List<PackageDataDO> getFactoryPackLineInfoByTime(Long factoryId, Date beginTime, Date endTime);
|
||||
}
|
@ -5,13 +5,13 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.packagedata.vo.PackageDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.packagedata.vo.PackageDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.FactoryPackLineDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.packagedata.PackageDataDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.packagedata.PackageDataMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -64,4 +64,11 @@ public class PackageDataServiceImpl implements PackageDataService {
|
||||
return packageDataMapper.selectList(new LambdaQueryWrapperX<PackageDataDO>().eq(PackageDataDO::getFactoryId, factoryId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PackageDataDO> getFactoryPackLineInfoByTime(Long factoryId, Date beginTime, Date endTime) {
|
||||
return packageDataMapper.selectList(new LambdaQueryWrapperX<PackageDataDO>().eq(PackageDataDO::getFactoryId, factoryId)
|
||||
.ge(PackageDataDO::getCreateTime, beginTime)
|
||||
.le(PackageDataDO::getCreateTime, endTime));
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.screendata;
|
||||
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.packagedata.PackageDataDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -19,7 +18,7 @@ public interface ScreenDataService {
|
||||
* @param code 省/市/区编码
|
||||
* @return 显示数据
|
||||
*/
|
||||
List<ProvincesDataRespVO> getProvincesData(Integer type, String code);
|
||||
List<ProvincesDataRespVO> getProvincesData(String code);
|
||||
|
||||
|
||||
/**
|
||||
@ -77,5 +76,50 @@ public interface ScreenDataService {
|
||||
* @param factoryId
|
||||
* @return
|
||||
*/
|
||||
List<PackageDataDO> getFactoryPackLineInfo(Long factoryId);
|
||||
List<FactoryPackLineInfoVO> getFactoryPackLineInfo(Long factoryId);
|
||||
|
||||
/**
|
||||
* 获取阿里云地区
|
||||
*
|
||||
* @param code
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
String getAliYunGeo(String code, Integer type);
|
||||
|
||||
/**
|
||||
* 获取大屏数据总揽
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
DataOverviewVO getDataOverview();
|
||||
|
||||
/**
|
||||
* 获取大屏出入库
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<InboundAndOutboundOverviewVO> getInboundAndOutboundOverview();
|
||||
|
||||
/**
|
||||
* 优等率排行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ExcellentRateRankingVO> excellentRateRanking();
|
||||
|
||||
/**
|
||||
* 节能减排
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<EnergyConservationVO> energyConservation(Long factoryId);
|
||||
|
||||
/**
|
||||
* 获取工厂出入库情况
|
||||
*
|
||||
* @param factoryId
|
||||
* @return
|
||||
*/
|
||||
ObtainFactoryInboundAndOutboundStatusVO getObtainFactoryInboundAndOutboundStatus(Long factoryId);
|
||||
}
|
@ -1,10 +1,22 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.screendata;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.Month;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.*;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydata.FactoryDataDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview.FactoryDataOverviewDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factoryinfo.FactoryInfoDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.packagedata.PackageDataDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.screenfactoryextra.ScreenFactoryExtraDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydataoverview.FactoryDataOverviewMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.framework.util.HttpUtil;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factorydata.FactoryDataService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factorydataoverview.FactoryDataOverviewService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.packagedata.PackageDataService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.screenfactoryextra.ScreenFactoryExtraService;
|
||||
@ -13,9 +25,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 功能描述
|
||||
@ -34,10 +45,16 @@ public class ScreenDataServiceImpl implements ScreenDataService {
|
||||
private StaffService staffService;
|
||||
@Resource
|
||||
private PackageDataService packageDataService;
|
||||
@Resource
|
||||
private FactoryDataService factoryDataService;
|
||||
@Resource
|
||||
private FactoryDataOverviewService factoryDataOverviewService;
|
||||
@Resource
|
||||
private FactoryDataOverviewMapper factoryDataOverviewMapper;
|
||||
|
||||
@Override
|
||||
public List<ProvincesDataRespVO> getProvincesData(Integer type, String code) {
|
||||
return factoryInfoService.getProvincesData(type, code);
|
||||
public List<ProvincesDataRespVO> getProvincesData(String code) {
|
||||
return factoryInfoService.getProvincesData(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,31 +88,266 @@ public class ScreenDataServiceImpl implements ScreenDataService {
|
||||
private static final String REFERER_URL = "http://www.weather.com.cn/";
|
||||
private static final String WEATHER_SPLIT = "dataSK=";
|
||||
|
||||
@Override
|
||||
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;
|
||||
// 通过工厂id获取到天气数据code
|
||||
FactoryInfoDO factoryInfoDO = factoryInfoService.getFactoryInfo(factoryId);
|
||||
if (factoryInfoDO != null) {
|
||||
String areaCode = "";
|
||||
if (factoryInfoDO.getAdCode() != null) {
|
||||
areaCode = factoryInfoService.getWeatherCodeByFactoryId(factoryId, String.valueOf(factoryInfoDO.getAdCode()));
|
||||
} else if (StrUtil.isEmpty(areaCode)) {
|
||||
areaCode = factoryInfoService.getWeatherCodeByFactoryId(factoryId, String.valueOf(factoryInfoDO.getCityId()));
|
||||
} else if (StrUtil.isEmpty(areaCode)) {
|
||||
areaCode = factoryInfoService.getWeatherCodeByFactoryId(factoryId, String.valueOf(factoryInfoDO.getProvinceId()));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PackageDataDO> getFactoryPackLineInfo(Long factoryId) {
|
||||
return packageDataService.getFactoryPackLineInfo(factoryId);
|
||||
public List<FactoryPackLineInfoVO> getFactoryPackLineInfo(Long factoryId) {
|
||||
List<FactoryPackLineInfoVO> vos = new ArrayList<>();
|
||||
List<PackageDataDO> list = packageDataService.getFactoryPackLineInfo(factoryId);
|
||||
Map<Long, List<PackageDataDO>> map = list.stream().collect(Collectors.groupingBy(PackageDataDO::getSizeId));
|
||||
Date today = new Date();
|
||||
//本日打包数
|
||||
Date beginDay = DateUtil.beginOfDay(today);
|
||||
Date endDay = DateUtil.endOfDay(today);
|
||||
List<PackageDataDO> todayList = packageDataService.getFactoryPackLineInfoByTime(factoryId, beginDay, endDay);
|
||||
Map<Long, List<PackageDataDO>> todayMap = todayList.stream().collect(Collectors.groupingBy(PackageDataDO::getSizeId));
|
||||
//本周打包數
|
||||
Date beginWeek = DateUtil.beginOfWeek(today);
|
||||
Date endWeek = DateUtil.endOfWeek(today);
|
||||
List<PackageDataDO> weekList = packageDataService.getFactoryPackLineInfoByTime(factoryId, beginWeek, endWeek);
|
||||
Map<Long, List<PackageDataDO>> weekMap = weekList.stream().collect(Collectors.groupingBy(PackageDataDO::getSizeId));
|
||||
|
||||
//本月打包數
|
||||
Date beginMonth = DateUtil.beginOfMonth(today);
|
||||
Date endMonth = DateUtil.endOfMonth(today);
|
||||
List<PackageDataDO> monthList = packageDataService.getFactoryPackLineInfoByTime(factoryId, beginMonth, endMonth);
|
||||
Map<Long, List<PackageDataDO>> monthMap = monthList.stream().collect(Collectors.groupingBy(PackageDataDO::getSizeId));
|
||||
|
||||
for (Long id : map.keySet()) {
|
||||
PackageDataDO item = map.get(id).get(0);
|
||||
FactoryPackLineInfoVO vo = new FactoryPackLineInfoVO();
|
||||
vo.setId(item.getSizeId());
|
||||
vo.setName(item.getSizeName());
|
||||
List<PackageDataDO> todayItemList = todayMap.get(item.getSizeId());
|
||||
if (!CollUtil.isEmpty(todayItemList)) {
|
||||
vo.setDayNum(todayItemList.stream().mapToInt(PackageDataDO::getNum).sum());
|
||||
}
|
||||
List<PackageDataDO> weekItemList = weekMap.get(item.getSizeId());
|
||||
if (!CollUtil.isEmpty(weekItemList)) {
|
||||
vo.setWeekNum(weekItemList.stream().mapToInt(PackageDataDO::getNum).sum());
|
||||
}
|
||||
List<PackageDataDO> monthItemList = monthMap.get(item.getSizeId());
|
||||
if (!CollUtil.isEmpty(monthItemList)) {
|
||||
vo.setMonthNum(monthItemList.stream().mapToInt(PackageDataDO::getNum).sum());
|
||||
}
|
||||
vos.add(vo);
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAliYunGeo(String code, Integer type) {
|
||||
String url = "";
|
||||
if (type == 1) {
|
||||
url = "https://geo.datav.aliyun.com/areas_v3/bound/%s_full.json";
|
||||
} else {
|
||||
url = "https://geo.datav.aliyun.com/areas_v3/bound/%s.json";
|
||||
}
|
||||
url = String.format(url, code);
|
||||
return cn.hutool.http.HttpUtil.get(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataOverviewVO getDataOverview() {
|
||||
DataOverviewVO vo = new DataOverviewVO();
|
||||
List<ScreenFactoryExtraDO> extras = screenFactoryExtraService.list();
|
||||
List<FactoryDataOverviewDO> list = factoryDataOverviewService.list();
|
||||
|
||||
vo.setTotal(list.stream().mapToInt(FactoryDataOverviewDO::getWorkerNum).sum());
|
||||
vo.setYlNum(extras.stream().mapToInt(ScreenFactoryExtraDO::getYlNum).sum());
|
||||
vo.setForkliftTotal(list.stream().mapToInt(FactoryDataOverviewDO::getTruckTotalNum).sum());
|
||||
vo.setTruckOnNum(extras.stream().mapToInt(ScreenFactoryExtraDO::getTruckOnNum).sum());
|
||||
vo.setTruckOffNum(extras.stream().mapToInt(ScreenFactoryExtraDO::getTruckOffNum).sum());
|
||||
vo.setDbxNum(list.stream().mapToInt(FactoryDataOverviewDO::getDbxNum).sum());
|
||||
|
||||
vo.setTpNum(list.stream().mapToInt(FactoryDataOverviewDO::getTpNum).sum());
|
||||
vo.setBdNum(list.stream().mapToInt(FactoryDataOverviewDO::getBdNum).sum());
|
||||
|
||||
List<FactoryDataDO> factoryDataDOS = factoryDataService.getTodayInboundAndOutboundOverview();
|
||||
Integer outTotalNum = factoryDataDOS.stream().filter(a -> a.getDataType() == 1).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
Integer inTotalNum = factoryDataDOS.stream().filter(a -> a.getDataType() == 2).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
vo.setOutTotalNum(outTotalNum);
|
||||
vo.setInTotalNum(inTotalNum);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InboundAndOutboundOverviewVO> getInboundAndOutboundOverview() {
|
||||
List<InboundAndOutboundOverviewVO> vos = new ArrayList<>();
|
||||
//获取当天的所有数据
|
||||
List<FactoryDataDO> list = factoryDataService.getTodayInboundAndOutboundOverview();
|
||||
//根据工厂分组
|
||||
Map<Long, List<FactoryDataDO>> map = list.stream().collect(Collectors.groupingBy(FactoryDataDO::getFactoryId));
|
||||
List<FactoryInfoDO> factoryInfos = factoryInfoService.list();
|
||||
Map<Long, List<FactoryInfoDO>> factoryInfoMap = factoryInfos.stream().collect(Collectors.groupingBy(FactoryInfoDO::getId));
|
||||
for (Map.Entry<Long, List<FactoryDataDO>> entry : map.entrySet()) {
|
||||
List<FactoryDataDO> items = entry.getValue();
|
||||
Integer outTotalNum = items.stream().filter(a -> a.getDataType() == 1).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
Integer inTotalNum = items.stream().filter(a -> a.getDataType() == 2).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
List<FactoryInfoDO> itemDo = factoryInfoMap.get(entry.getKey());
|
||||
if (!CollUtil.isEmpty(itemDo)) {
|
||||
InboundAndOutboundOverviewVO vo = new InboundAndOutboundOverviewVO();
|
||||
vo.setName(itemDo.get(0).getShortName());
|
||||
vo.setOutTotalNum(outTotalNum);
|
||||
vo.setInTotalNum(inTotalNum);
|
||||
vos.add(vo);
|
||||
}
|
||||
}
|
||||
// -- list排序
|
||||
vos = vos.stream()
|
||||
.sorted(Comparator.comparingInt(InboundAndOutboundOverviewVO::getInTotalNum).reversed())
|
||||
.collect(Collectors.toList());
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExcellentRateRankingVO> excellentRateRanking() {
|
||||
List<ExcellentRateRankingVO> list = new ArrayList<>();
|
||||
List<FactoryInfoDO> factoryInfos = factoryInfoService.list();
|
||||
for (FactoryInfoDO factoryInfo : factoryInfos) {
|
||||
// 创建 Random 对象
|
||||
Random random = new Random();
|
||||
// 生成 90 到 100 之间的随机数(包括 90 和 100)
|
||||
double randomNumber = random.nextDouble() * 11 + 90;
|
||||
// 将随机数保留两位小数
|
||||
randomNumber = Math.round(randomNumber * 100.0) / 100.0;
|
||||
if (randomNumber > 100) {
|
||||
randomNumber = 100.00;
|
||||
}
|
||||
ExcellentRateRankingVO vo = new ExcellentRateRankingVO();
|
||||
vo.setName(factoryInfo.getName());
|
||||
vo.setExcellentRate(randomNumber);
|
||||
list.add(vo);
|
||||
}
|
||||
// -- list排序
|
||||
list = list.stream()
|
||||
.sorted(Comparator.comparingDouble(ExcellentRateRankingVO::getExcellentRate).reversed())
|
||||
.collect(Collectors.toList());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnergyConservationVO> energyConservation(Long factoryId) {
|
||||
List<EnergyConservationVO> vos = new ArrayList<>();
|
||||
List<FactoryInfoDO> factoryInfos = factoryInfoService.list();
|
||||
List<Long> ids = factoryInfos.stream().map(FactoryInfoDO::getId).collect(Collectors.toList());
|
||||
List<FactoryDataOverviewDO> dos = factoryDataOverviewMapper.selectList(new LambdaQueryWrapperX<FactoryDataOverviewDO>()
|
||||
.in(FactoryDataOverviewDO::getFactoryId, ids));
|
||||
|
||||
Map<Long, List<FactoryDataOverviewDO>> doMaps = dos.stream().collect(Collectors.groupingBy(FactoryDataOverviewDO::getFactoryId));
|
||||
|
||||
|
||||
if (factoryId != null) {
|
||||
Map<Long, List<FactoryInfoDO>> map = factoryInfos.stream().collect(Collectors.groupingBy(FactoryInfoDO::getId));
|
||||
List<FactoryInfoDO> items = map.get(factoryId);
|
||||
if (!CollUtil.isEmpty(items)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Month month = DateUtil.monthEnum(DateUtil.offsetMonth(DateUtil.date(), -i));
|
||||
EnergyConservationVO vo = new EnergyConservationVO();
|
||||
vo.setName(items.get(0).getShortName());
|
||||
vo.setTime((month.getValue() == 0 ? "12" : String.valueOf(month.getValue())) + "月");
|
||||
Random random = new Random();
|
||||
// 生成50到100之间的随机数
|
||||
int randomNumber = random.nextInt(51) + 50;
|
||||
vo.setEmissions(randomNumber);
|
||||
List<FactoryDataOverviewDO> doItems = doMaps.get(items.get(0).getId());
|
||||
if (CollUtil.isNotEmpty(doItems)) {
|
||||
vo.setForkliftTotal(doItems.get(0).getTruckTotalNum());
|
||||
} else {
|
||||
vo.setForkliftTotal(0);
|
||||
}
|
||||
vos.add(vo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (FactoryInfoDO factoryInfo : factoryInfos) {
|
||||
EnergyConservationVO vo = new EnergyConservationVO();
|
||||
vo.setName(factoryInfo.getShortName());
|
||||
//vo.setTime(String.valueOf(factoryInfo.getValue()));
|
||||
Random random = new Random();
|
||||
// 生成50到100之间的随机数
|
||||
int randomNumber = random.nextInt(51) + 50;
|
||||
vo.setEmissions(randomNumber);
|
||||
List<FactoryDataOverviewDO> doItems = doMaps.get(factoryInfo.getId());
|
||||
if (CollUtil.isNotEmpty(doItems)) {
|
||||
vo.setForkliftTotal(doItems.get(0).getTruckTotalNum());
|
||||
} else {
|
||||
vo.setForkliftTotal(0);
|
||||
}
|
||||
vos.add(vo);
|
||||
}
|
||||
}
|
||||
Collections.reverse(vos);
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObtainFactoryInboundAndOutboundStatusVO getObtainFactoryInboundAndOutboundStatus(Long factoryId) {
|
||||
ObtainFactoryInboundAndOutboundStatusVO vo = new ObtainFactoryInboundAndOutboundStatusVO();
|
||||
|
||||
Date today = new Date();
|
||||
//本日打包数
|
||||
Date beginDay = DateUtil.beginOfDay(today);
|
||||
Date endDay = DateUtil.endOfDay(today);
|
||||
|
||||
List<FactoryDataDO> dayList = factoryDataService.getByTimeAndFactoryId(factoryId, beginDay, endDay);
|
||||
Integer outTotalNum = dayList.stream().filter(a -> a.getDataType() == 1).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
Integer inTotalNum = dayList.stream().filter(a -> a.getDataType() == 2).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
vo.setOutToday(outTotalNum);
|
||||
vo.setInToday(inTotalNum);
|
||||
|
||||
//本月打包數
|
||||
Date beginMonth = DateUtil.beginOfMonth(today);
|
||||
Date endMonth = DateUtil.endOfMonth(today);
|
||||
List<FactoryDataDO> monthList = factoryDataService.getByTimeAndFactoryId(factoryId, beginMonth, endMonth);
|
||||
Integer outMonthNum = monthList.stream().filter(a -> a.getDataType() == 1).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
Integer inMonthNum = monthList.stream().filter(a -> a.getDataType() == 2).mapToInt(FactoryDataDO::getTotalNum).sum();
|
||||
vo.setOutMonth(outMonthNum);
|
||||
vo.setInMonth(inMonthNum);
|
||||
Random random = new Random();
|
||||
int randomNumber = random.nextInt(21); // 生成0到20之间的随机数
|
||||
vo.setDamagedTotal(randomNumber);
|
||||
|
||||
random = new Random();
|
||||
double increaseCompared = (random.nextDouble() * 4) - 2; // 生成-2到2之间的随机数
|
||||
increaseCompared = Math.round(increaseCompared * 100.0) / 100.0; // 保留两位小数
|
||||
vo.setIncreaseCompared(increaseCompared);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.screenfactoryextra.ScreenFactoryExtraDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工厂大屏额外字段 Service 接口
|
||||
@ -54,4 +55,10 @@ public interface ScreenFactoryExtraService {
|
||||
PageResult<ScreenFactoryExtraDO> getScreenFactoryExtraPage(ScreenFactoryExtraPageReqVO pageReqVO);
|
||||
|
||||
PropertyDataRespVO getPropertyData(Long factoryId);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @return
|
||||
*/
|
||||
List<ScreenFactoryExtraDO> list();
|
||||
}
|
@ -6,12 +6,15 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.PropertyDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screenfactoryextra.vo.ScreenFactoryExtraPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screenfactoryextra.vo.ScreenFactoryExtraSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview.FactoryDataOverviewDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.screenfactoryextra.ScreenFactoryExtraDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydataoverview.FactoryDataOverviewMapper;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.screenfactoryextra.ScreenFactoryExtraMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.FACTORY_INFO_NOT_EXISTS;
|
||||
@ -27,6 +30,8 @@ public class ScreenFactoryExtraServiceImpl implements ScreenFactoryExtraService
|
||||
|
||||
@Resource
|
||||
private ScreenFactoryExtraMapper screenFactoryExtraMapper;
|
||||
@Resource
|
||||
private FactoryDataOverviewMapper factoryDataOverviewMapper;
|
||||
|
||||
@Override
|
||||
public Long createScreenFactoryExtra(ScreenFactoryExtraSaveReqVO createReqVO) {
|
||||
@ -75,16 +80,26 @@ public class ScreenFactoryExtraServiceImpl implements ScreenFactoryExtraService
|
||||
PropertyDataRespVO vo = new PropertyDataRespVO();
|
||||
ScreenFactoryExtraDO screenFactoryExtraDO = screenFactoryExtraMapper.selectOne(new LambdaQueryWrapperX<ScreenFactoryExtraDO>()
|
||||
.eq(ScreenFactoryExtraDO::getFactoryId, factoryId));
|
||||
|
||||
FactoryDataOverviewDO factoryDataOverviewDO = factoryDataOverviewMapper.selectOne(new LambdaQueryWrapperX<FactoryDataOverviewDO>()
|
||||
.eq(FactoryDataOverviewDO::getFactoryId, factoryId));
|
||||
if (factoryDataOverviewDO != null) {
|
||||
vo.setPackLineTotal(factoryDataOverviewDO.getDbxNum());
|
||||
vo.setTrayTotal(factoryDataOverviewDO.getTpNum());
|
||||
vo.setTieTotal(factoryDataOverviewDO.getBdNum());
|
||||
vo.setForkliftTotal(factoryDataOverviewDO.getTruckTotalNum());
|
||||
}
|
||||
if (screenFactoryExtraDO != null) {
|
||||
vo.setKilnTotal(screenFactoryExtraDO.getYlNum());
|
||||
vo.setPackLineTotal(screenFactoryExtraDO.getDbxNum());
|
||||
vo.setTrayTotal(screenFactoryExtraDO.getTpNum());
|
||||
vo.setTieTotal(screenFactoryExtraDO.getBdNum());
|
||||
vo.setForkliftTotal(screenFactoryExtraDO.getTruckTotalNum());
|
||||
vo.setOnlineTotal(screenFactoryExtraDO.getTruckOnNum());
|
||||
vo.setOutLineTotal(screenFactoryExtraDO.getTruckOffNum());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScreenFactoryExtraDO> list() {
|
||||
return screenFactoryExtraMapper.selectList();
|
||||
}
|
||||
|
||||
}
|
@ -60,4 +60,10 @@ public interface StaffService {
|
||||
* @return
|
||||
*/
|
||||
StaffDataRespVO getStaffData(Long factoryId);
|
||||
|
||||
/**
|
||||
* 获取人员数量
|
||||
* @return
|
||||
*/
|
||||
Integer getCount();
|
||||
}
|
@ -2,9 +2,10 @@ package cn.iocoder.yudao.module.smartfactory.service.staff;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.StaffDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staff.vo.StaffPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staff.vo.StaffSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.screendata.factory.vo.StaffDataRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staff.StaffDO;
|
||||
import cn.iocoder.yudao.module.smartfactory.dal.mysql.staff.StaffMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -69,4 +70,9 @@ public class StaffServiceImpl implements StaffService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCount() {
|
||||
return Math.toIntExact(staffMapper.selectCount(new LambdaQueryWrapperX<StaffDO>().eq(StaffDO::getStatus, 1)));
|
||||
}
|
||||
|
||||
}
|
@ -183,3 +183,16 @@ justauth:
|
||||
type: REDIS
|
||||
prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
|
||||
timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
|
||||
#海康威视的相关配置
|
||||
isc:
|
||||
previewUrl: https://api.znkj.ispt.com.cn
|
||||
host: 111.75.51.123:10443
|
||||
appKey: 24991430
|
||||
appSecret: jQd4pIYZBzwW8cnuI9IN
|
||||
#视频资源
|
||||
resource:
|
||||
cameras: /artemis/api/resource/v1/cameras
|
||||
#视频能力
|
||||
video:
|
||||
previewUrls: /artemis/api/video/v2/cameras/previewURLs
|
||||
replayUrlApi: /artemis/api/video/v2/cameras/playbackURLs
|
@ -92,5 +92,8 @@ yudao:
|
||||
base-package: ${yudao.info.base-package}
|
||||
tenant: # 多租户相关配置项
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
- sys_region
|
||||
|
||||
debug: false
|
@ -0,0 +1,23 @@
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 47.97.8.94:8848
|
||||
discovery:
|
||||
namespace: prod # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 47.97.8.94:8848 # Nacos 服务器地址
|
||||
namespace: prod # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
@ -0,0 +1,12 @@
|
||||
<?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="cn.iocoder.yudao.module.smartfactory.dal.mysql.packagedata.FactoryDataMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,12 @@
|
||||
<?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="cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydataoverview.FactoryDataOverviewMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -23,4 +23,11 @@
|
||||
FROM sf_factory_info AS a
|
||||
LEFT JOIN sf_screen_factory_extra AS b ON a.id = b.factory_id
|
||||
</select>
|
||||
<select id="getWeatherCodeByFactoryId" resultType="java.lang.String">
|
||||
select
|
||||
a.area_code
|
||||
from sys_region as a
|
||||
left join sf_factory_info as b on a.code = #{areaCode}
|
||||
where b.id = #{factoryId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user