代码提交

This commit is contained in:
zkzh_admin committed 2026-10-16 10:12:06 +08:00
1 parent f872556dab
commit 798878a541
586 files changed
+65645

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aibird</artifactId>
<groupId>net.hzvtc</groupId>
<version>1.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ai-bird-system</artifactId>
<description>
system系统模块
</description>
<dependencies>
<dependency>
<groupId>net.hzvtc</groupId>
<artifactId>ai-bird-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.onvif</groupId>
<artifactId>onvif-java-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-xuggler</artifactId>
<version>5.4</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,25 @@
package net.hzvtc.app.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="AppUpgrade")
@Data
public class AppUpgrade {
private static final long serialVersionUID = 1L;
private Long id;
private int code;
private int updateStatus;
private int versionCode;
private String versionName;
private Date uploadTime;
private String modifyContent;
private String downloadUrl;
private int apkSize;
private String apkMd5;
private String msg;
private int isDeleted;
}
@@ -0,0 +1,9 @@
package net.hzvtc.app.mapper;
import net.hzvtc.app.domain.AppUpgrade;
public interface AppUpgradeMapper {
public AppUpgrade getLastAppUpgradeInfo();
}
@@ -0,0 +1,9 @@
package net.hzvtc.app.service;
import net.hzvtc.app.domain.AppUpgrade;
public interface AppUpgradeService {
public AppUpgrade getLastAppUpgradeInfo();
}
@@ -0,0 +1,32 @@
package net.hzvtc.app.service.impl;
import net.hzvtc.app.domain.AppUpgrade;
import net.hzvtc.app.mapper.AppUpgradeMapper;
import net.hzvtc.app.service.AppUpgradeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class AppUpgradeServiceImpl implements AppUpgradeService {
@Resource
private AppUpgradeMapper appUpgradeMapper;
@Override
public AppUpgrade getLastAppUpgradeInfo() {
AppUpgrade data = appUpgradeMapper.getLastAppUpgradeInfo();
// JSONObject obj = new JSONObject();
// obj.put("Code", data.getCode());
// obj.put("Msg", data.getMsg());
// obj.put("UpdateStatus", data.getUpdateStatus());
// obj.put("VersionCode", data.getVersionCode());
// obj.put("VersionName", data.getVersionName());
// obj.put("UploadTime", data.getUploadTime());
// obj.put("ModifyContent", data.getModifyContent());
// obj.put("DownloadUrl", data.getDownloadUrl());
// obj.put("ApkSize", data.getApkSize());
// obj.put("ApkMd5", data.getApkMd5());
// System.out.println(obj.get("ModifyContent"));
return data;
}
}
@@ -0,0 +1,151 @@
package net.hzvtc.area.controller;
import net.hzvtc.area.domain.ProtectedArea;
import net.hzvtc.area.service.ProtectedAreaService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.SecurityUtils;
import net.hzvtc.common.utils.file.FileUploadUtils;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Set;
/**
* 保护区Controller
*
* @author admin
* @date 2022-07-20
*/
@RestController
@RequestMapping("/area/protectedArea")
public class ProtectedAreaController extends BaseController {
@Autowired
private ProtectedAreaService protectedAreaService;
@GetMapping("/listForPortal")
public AjaxResult getProtectedAreaListForPortal() {
return AjaxResult.success(protectedAreaService.getProtectedAreaListForPortal());
}
/**
* 查询保护区列表
*/
// @PreAuthorize("@ss.hasPermi('area:protectedArea:list')")
@GetMapping("/list")
public TableDataInfo list(ProtectedArea protectedArea) {
startPage();
List<ProtectedArea> list = protectedAreaService.selectProtectedAreaList(protectedArea);
return getDataTable(list);
}
/**
* 导出保护区列表
*/
@PreAuthorize("@ss.hasPermi('area:protectedArea:export')")
@Log(title = "保护区", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProtectedArea protectedArea) {
List<ProtectedArea> list = protectedAreaService.selectProtectedAreaList(protectedArea);
ExcelUtil<ProtectedArea> util = new ExcelUtil<ProtectedArea>(ProtectedArea.class);
util.exportExcel(response, list, "保护区数据");
}
@GetMapping("/treeList")
public AjaxResult getTreeList() {
return AjaxResult.success(protectedAreaService.getProtectedAreaTreeList());
}
/**
* 获取保护区详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
if (checkAreaIsLegal(id)) {
return AjaxResult.success(protectedAreaService.selectProtectedAreaById(id));
} else {
return AjaxResult.error(403, "非法访问未授权的保护区数据,请联系管理员开通权限!");
}
}
@GetMapping(value = "/areaLogo/{id}")
public AjaxResult getAreaLogoInfo(@PathVariable("id") Long id) {
return AjaxResult.success(protectedAreaService.getAreaLogoInfoById(id));
}
private boolean checkAreaIsLegal(Long areaId) {
if (SecurityUtils.getLoginUser().getUser().isAdmin()) {
return true;
}
Set<Long> ids = SecurityUtils.getLoginUser().getAreaIds();
if (ids == null || ids.isEmpty()) {
return false;
} else {
return ids.contains(areaId);
}
}
/**
* 新增保护区
*/
@PreAuthorize("@ss.hasPermi('area:protectedArea:add')")
@Log(title = "保护区", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProtectedArea protectedArea) {
return toAjax(protectedAreaService.insertProtectedArea(protectedArea));
}
/**
* 修改保护区
*/
@PreAuthorize("@ss.hasPermi('area:protectedArea:edit')")
@Log(title = "保护区", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProtectedArea protectedArea) {
return toAjax(protectedAreaService.updateProtectedArea(protectedArea));
}
/**
* 删除保护区
*/
@PreAuthorize("@ss.hasPermi('area:protectedArea:remove')")
@Log(title = "保护区", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(protectedAreaService.deleteProtectedAreaByIds(ids));
}
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<ProtectedArea> util = new ExcelUtil<>(ProtectedArea.class);
List<ProtectedArea> list = util.importExcel(file.getInputStream());
String message = protectedAreaService.importData(list, updateSupport);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<ProtectedArea> util = new ExcelUtil<>(ProtectedArea.class);
util.importTemplateExcel(response, "保护区信息");
}
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) {
String baseDir = FileUploadUtils.getDefaultBaseDir() + "/" + "bgimg" + "/" + SecurityUtils.getDeptId();
try {
String filePath = FileUploadUtils.upload(baseDir, file);
return AjaxResult.success(filePath);
} catch (Exception ex) {
// ex.printStackTrace();
return AjaxResult.error(ex.getMessage());
}
}
}
@@ -0,0 +1,137 @@
package net.hzvtc.area.controller;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import net.hzvtc.area.domain.ProtectedAreaSpecies;
import net.hzvtc.area.service.ProtectedAreaSpeciesService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import net.hzvtc.data.check.service.ResultRecordDetailsService;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping(value={"/area/areaSpecies"})
public class ProtectedAreaSpeciesController
extends BaseController {
private static final Logger log = LoggerFactory.getLogger(ProtectedAreaSpeciesController.class);
@Autowired
private ProtectedAreaSpeciesService protectedAreaSpeciesService;
@Autowired
private ResultRecordDetailsService resultRecordDetailsService;
@PreAuthorize(value="@ss.hasPermi('area:areaSpecies:list')")
@GetMapping(value={"/list"})
public TableDataInfo list(ProtectedAreaSpecies protectedAreaSpecies) {
this.startPage();
List<ProtectedAreaSpecies> list = this.protectedAreaSpeciesService.selectProtectedAreaSpeciesList(protectedAreaSpecies);
return this.getDataTable(list);
}
@PreAuthorize(value="@ss.hasPermi('area:areaSpecies:export')")
@Log(title="\u4fdd\u62a4\u533a\u7269\u79cd", businessType=BusinessType.EXPORT)
@PostMapping(value={"/export"})
public void export(HttpServletResponse response, ProtectedAreaSpecies protectedAreaSpecies) {
List<ProtectedAreaSpecies> list = this.protectedAreaSpeciesService.selectProtectedAreaSpeciesList(protectedAreaSpecies);
ExcelUtil util = new ExcelUtil(ProtectedAreaSpecies.class);
util.exportExcel(response, list, "\u4fdd\u62a4\u533a\u7269\u79cd\u6570\u636e");
}
@PreAuthorize(value="@ss.hasPermi('area:areaSpecies:query')")
@GetMapping(value={"/{id}"})
public AjaxResult getInfo(@PathVariable(value="id") Long id) {
return AjaxResult.success((Object)((Object)this.protectedAreaSpeciesService.selectProtectedAreaSpeciesById(id)));
}
@PreAuthorize(value="@ss.hasPermi('area:areaSpecies:add')")
@Log(title="\u4fdd\u62a4\u533a\u7269\u79cd", businessType=BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProtectedAreaSpecies protectedAreaSpecies) {
return this.toAjax(this.protectedAreaSpeciesService.batchInsertProtectedAreaSpecies(protectedAreaSpecies));
}
@PreAuthorize(value="@ss.hasPermi('area:areaSpecies:edit')")
@Log(title="\u4fdd\u62a4\u533a\u7269\u79cd", businessType=BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProtectedAreaSpecies protectedAreaSpecies) {
return this.toAjax(this.protectedAreaSpeciesService.updateProtectedAreaSpecies(protectedAreaSpecies));
}
@PreAuthorize(value="@ss.hasPermi('area:areaSpecies:remove')")
@Log(title="\u4fdd\u62a4\u533a\u7269\u79cd", businessType=BusinessType.DELETE)
@DeleteMapping(value={"/{ids}"})
public AjaxResult remove(@PathVariable Long[] ids) {
return this.toAjax(this.protectedAreaSpeciesService.deleteProtectedAreaSpeciesByIds(ids));
}
@PostMapping(value={"/importData"})
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil util = new ExcelUtil(ProtectedAreaSpecies.class);
List list = util.importExcel(file.getInputStream());
String message = this.protectedAreaSpeciesService.importData(list, updateSupport);
return AjaxResult.success((String)message);
}
@PostMapping(value={"/importTemplate"})
public void importTemplate(HttpServletResponse response) {
ExcelUtil util = new ExcelUtil(ProtectedAreaSpecies.class);
util.importTemplateExcel(response, "\u4fdd\u62a4\u533a\u9e1f\u7c7b\u4fe1\u606f");
}
@PostMapping(value={"/listSpeciesByParam"})
public AjaxResult getSpeciesListByAreacode(@RequestBody JSONObject obj) {
return AjaxResult.success(this.protectedAreaSpeciesService.getProtectedAreaSpeciesListByParam(obj));
}
@PostMapping(value={"/querySpeciesByQuery"})
public TableDataInfo querySpeciesListByQuery(@RequestBody JSONObject obj) {
return this.protectedAreaSpeciesService.getProtectedAreaSpeciesByQuery(obj);
}
@PostMapping(value={"/querySpeciesByParam"})
public TableDataInfo getBirdResultMediasByParam(@RequestBody JSONObject params) {
Integer pageNum = params.getInteger("pageNum");
Integer pageSize = params.getInteger("pageSize");
this.startPage(pageNum, pageSize);
List<BirdStatDataVo> list = this.resultRecordDetailsService.querySpeciesRecordListByParam(params);
return this.getDataTable(list);
}
@PostMapping(value={"/queryVideoListByParam"})
public TableDataInfo getBirdVidelByParam(@RequestBody JSONObject params) {
Integer pageNum = params.getInteger("pageNum");
Integer pageSize = params.getInteger("pageSize");
this.startPage(pageNum, pageSize);
List<BirdStatDataVo> list = this.resultRecordDetailsService.getResultMediaVideoListByParam(params);
return this.getDataTable(list);
}
@PostMapping(value={"/areaSpeciesByParam"})
public AjaxResult getProtectedAreaSpeciesByParam(@RequestBody JSONObject params) {
return AjaxResult.success(this.protectedAreaSpeciesService.getProtectedAreaSpeciesListByParams(params));
}
@PostMapping(value={"/changeSpeciesInArea"})
public AjaxResult changeProtectedAreaSpeciesByParam(@RequestBody JSONObject params) {
return AjaxResult.success((Object)this.protectedAreaSpeciesService.changeProtectedAreaSpeciesByParam(params));
}
}
@@ -0,0 +1,58 @@
package net.hzvtc.area.controller;
import com.alibaba.fastjson.JSONObject;
import net.hzvtc.area.domain.ProtectedCareSpecies;
import net.hzvtc.area.service.ProtectedCareSpeciesService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
/**
* 保护区关注鸟类Controller
*
* @author admin
* @date 2023-08-16
*/
@RestController
@RequestMapping("/area/care")
public class ProtectedCareSpeciesController extends BaseController {
@Autowired
private ProtectedCareSpeciesService protectedCareSpeciesService;
/**
* 查询保护区关注鸟类列表
*/
@PostMapping("/list")
public AjaxResult list(@RequestBody JSONObject params) {
return AjaxResult.success(protectedCareSpeciesService.selectProtectedCareSpeciesList(params));
}
/**
* 获取保护区关注鸟类详细信息
*/
@PreAuthorize("@ss.hasPermi('area:care:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(protectedCareSpeciesService.selectProtectedCareSpeciesById(id));
}
/**
* 新增保护区关注鸟类
*/
@PreAuthorize("@ss.hasPermi('area:care:add')")
@Log(title = "保护区关注鸟类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProtectedCareSpecies protectedCareSpecies) {
return toAjax(protectedCareSpeciesService.insertProtectedCareSpecies(protectedCareSpecies));
}
@PostMapping("/changeCareSpeciesInArea")
public AjaxResult changeProtectedAreaCareSpeciesByParam(@RequestBody JSONObject params) {
return AjaxResult.success(protectedCareSpeciesService.changeProtectedAreaCareSpeciesByParam(params));
}
}
@@ -0,0 +1,80 @@
package net.hzvtc.area.controller;
import net.hzvtc.area.domain.SpeciesAbnormalInfo;
import net.hzvtc.area.service.SpeciesAbnormalInfoService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 关键物种与异常事件报警Controller
*
* @author admin
* @date 2023-03-10
*/
@RestController
@RequestMapping("/area/abnormalInfo")
public class SpeciesAbnormalInfoController extends BaseController {
@Autowired
private SpeciesAbnormalInfoService speciesAbnormalInfoService;
/**
* 查询关键物种与异常事件报警列表
*/
@GetMapping("/list")
public TableDataInfo list(SpeciesAbnormalInfo speciesAbnormalInfo) {
startPage();
List<SpeciesAbnormalInfo> list = speciesAbnormalInfoService.selectSpeciesAbnormalInfoList(speciesAbnormalInfo);
return getDataTable(list);
}
/**
* 导出关键物种与异常事件报警列表
*/
@Log(title = "关键物种与异常事件报警", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SpeciesAbnormalInfo speciesAbnormalInfo) {
List<SpeciesAbnormalInfo> list = speciesAbnormalInfoService.selectSpeciesAbnormalInfoList(speciesAbnormalInfo);
ExcelUtil<SpeciesAbnormalInfo> util = new ExcelUtil<SpeciesAbnormalInfo>(SpeciesAbnormalInfo.class);
util.exportExcel(response, list, "关键物种与异常事件报警数据");
}
/**
* 获取关键物种与异常事件报警详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(speciesAbnormalInfoService.selectSpeciesAbnormalInfoById(id));
}
/**
* 新增关键物种与异常事件报警
*/
@PreAuthorize("@ss.hasPermi('area:abnormalInfo:add')")
@Log(title = "关键物种与异常事件报警", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SpeciesAbnormalInfo speciesAbnormalInfo) {
return toAjax(speciesAbnormalInfoService.insertSpeciesAbnormalInfo(speciesAbnormalInfo));
}
/**
* 删除关键物种与异常事件报警
*/
@PreAuthorize("@ss.hasPermi('area:abnormalInfo:remove')")
@Log(title = "关键物种与异常事件报警", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(speciesAbnormalInfoService.deleteSpeciesAbnormalInfoByIds(ids));
}
}
@@ -0,0 +1,97 @@
package net.hzvtc.area.controller;
import com.alibaba.fastjson.JSONObject;
import net.hzvtc.area.domain.WinteringPeriod;
import net.hzvtc.area.service.WinteringPeriodService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 越冬期Controller
*
* @author admin
* @date 2022-09-13
*/
@RestController
@RequestMapping("/area/winterperiod")
public class WinteringPeriodController extends BaseController {
@Autowired
private WinteringPeriodService winteringPeriodService;
/**
* 查询越冬期列表
*/
@PreAuthorize("@ss.hasPermi('area:winterperiod:list')")
@GetMapping("/list")
public TableDataInfo list(WinteringPeriod winteringPeriod) {
startPage();
List<WinteringPeriod> list = winteringPeriodService.selectWinteringPeriodList(winteringPeriod);
return getDataTable(list);
}
/**
* 导出越冬期列表
*/
@PreAuthorize("@ss.hasPermi('area:winterperiod:export')")
@Log(title = "越冬期", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WinteringPeriod winteringPeriod) {
List<WinteringPeriod> list = winteringPeriodService.selectWinteringPeriodList(winteringPeriod);
ExcelUtil<WinteringPeriod> util = new ExcelUtil<WinteringPeriod>(WinteringPeriod.class);
util.exportExcel(response, list, "越冬期数据");
}
/**
* 获取越冬期详细信息
*/
@PreAuthorize("@ss.hasPermi('area:winterperiod:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(winteringPeriodService.selectWinteringPeriodById(id));
}
/**
* 新增越冬期
*/
@PreAuthorize("@ss.hasPermi('area:winterperiod:add')")
@Log(title = "越冬期", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WinteringPeriod winteringPeriod) {
return toAjax(winteringPeriodService.insertWinteringPeriod(winteringPeriod));
}
/**
* 修改越冬期
*/
@PreAuthorize("@ss.hasPermi('area:winterperiod:edit')")
@Log(title = "越冬期", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WinteringPeriod winteringPeriod) {
return toAjax(winteringPeriodService.updateWinteringPeriod(winteringPeriod));
}
/**
* 删除越冬期
*/
@PreAuthorize("@ss.hasPermi('area:winterperiod:remove')")
@Log(title = "越冬期", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(winteringPeriodService.deleteWinteringPeriodByIds(ids));
}
@PostMapping("/chartList")
public AjaxResult getWinterPeriodChartData(@RequestBody JSONObject obj) {
return AjaxResult.success(winteringPeriodService.getWinteringPeriodDataList(obj));
}
}
@@ -0,0 +1,39 @@
package net.hzvtc.area.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import java.util.List;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="ProtectedArea")
@Data
public class ProtectedArea extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String code;
private String name;
private String shortName;
private String url;
private String province;
private String provinceName;
private String areaLevel;
private String lon;
private String lat;
private String manager;
private String telephone;
private int sendEmail = 0;
private String email;
private int picWidth;
private int picHeight;
private int picNum;
private String bannerFile;
private String gisFile;
private int zoom;
private String introduction;
private String logoPath;
private String title;
private String enTitle;
private List<DeviceInfo> deviceList;
}
@@ -0,0 +1,24 @@
package net.hzvtc.area.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import java.util.List;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="ProtectedAreaSpecies")
@Data
public class ProtectedAreaSpecies extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private Long speciesId;
private String speciesName;
private Long areaId;
private String areaName;
private int position = 0;
private BirdSpecies birdSpecies;
private int isCommon;
private int isSpecial;
private List<Long> ids;
}
@@ -0,0 +1,17 @@
package net.hzvtc.area.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="ProtectedCareSpecies")
@Data
public class ProtectedCareSpecies {
private static final long serialVersionUID = 1L;
private Long id;
private Long speciesId;
private Long areaId;
private Date createTime;
}
@@ -0,0 +1,29 @@
package net.hzvtc.area.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="SpeciesAbnormalInfo")
@Data
public class SpeciesAbnormalInfo {
private static final long serialVersionUID = 1L;
private Long id;
private Long deviceId;
private String deviceName;
private Long areaId;
private String areaName;
private Date happenTime;
private Long speciesId;
private String speciesName;
private String speciesImageUrl;
private int count;
private int type;
private Long mediaId;
private Long recordId;
private String mediaUrl;
private ResultMedia resultMedia;
private int isDeleted;
}
@@ -0,0 +1,20 @@
package net.hzvtc.area.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="WinteringPeriod")
@Data
public class WinteringPeriod {
private static final long serialVersionUID = 1L;
private Long id;
private Long protectedAreaId;
private String protectedAreaName;
private String year;
private Date startTime;
private Date endTime;
private int amount;
}
@@ -0,0 +1,41 @@
package net.hzvtc.area.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.ProtectedArea;
public interface ProtectedAreaMapper {
public ProtectedArea selectProtectedAreaById(Long var1);
public ProtectedArea selectProtectedAreaByCode(String var1);
public ProtectedArea selectProtectedAreaByName(String var1);
public List<ProtectedArea> selectProtectedAreaList(ProtectedArea var1);
public List<ProtectedArea> getProtectedAreaTreeList(Map<String, Object> var1);
public List<ProtectedArea> getAllProtectedAreaList();
public List<ProtectedArea> getProtectedAreaListByUserId(Map<String, Object> var1);
public List<ProtectedArea> getProtectedAreaEmailList();
public List<Long> getAreaIdsByUserId(Long var1);
public List<ProtectedArea> getAreaListForSelect();
public List<ProtectedArea> getAreaListByUserId(Long var1);
public ProtectedArea getAreaLogoInfoById(Long var1);
public int insertProtectedArea(ProtectedArea var1);
public int updateProtectedArea(ProtectedArea var1);
public int deleteProtectedAreaById(Long var1);
public int deleteProtectedAreaByIds(Long[] var1);
}
@@ -0,0 +1,40 @@
package net.hzvtc.area.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.ProtectedAreaSpecies;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
public interface ProtectedAreaSpeciesMapper {
public ProtectedAreaSpecies selectProtectedAreaSpeciesById(Long var1);
public ProtectedAreaSpecies selectProtectedAreaSpeciesByParam(ProtectedAreaSpecies var1);
public List<ProtectedAreaSpecies> selectProtectedAreaSpeciesList(ProtectedAreaSpecies var1);
public List<Long> getProtectedAreaSpeciesListByParams(Map<String, Object> var1);
public List<ProtectedAreaSpecies> getProtectedAreaSpeciesListByParam(Map<String, Object> var1);
public List<ProtectedAreaSpecies> getProtectedAreaSpeciesByQuery(Map<String, Object> var1);
public List<Long> getProtectedAreaSpeciesIdsByParam(Map<String, Object> var1);
public List<BirdStatDataVo> getProtectedAreaSpeciesListByAreaId(Map<String, Object> var1);
public int insertProtectedAreaSpecies(ProtectedAreaSpecies var1);
public int batchInsertProtectedAreaSpecies(List<ProtectedAreaSpecies> var1);
public int updateProtectedAreaSpecies(ProtectedAreaSpecies var1);
public void batchUpdateProtectedAreaSpecies(Map<String, Object> var1);
public int deleteProtectedAreaSpeciesById(Long var1);
public int deleteProtectedAreaSpeciesByIds(Long[] var1);
public int deleteProtectedAreaSpeciesByParam(Map<String, Object> var1);
}
@@ -0,0 +1,19 @@
package net.hzvtc.area.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.ProtectedCareSpecies;
public interface ProtectedCareSpeciesMapper {
public ProtectedCareSpecies selectProtectedCareSpeciesById(Long var1);
public List<Long> selectProtectedCareSpeciesList(Map<String, Object> var1);
public List<Long> getProtectedCareSpeciesByParam(Map<String, Object> var1);
public int insertProtectedCareSpecies(ProtectedCareSpecies var1);
public int deleteProtectedCareSpeciesById(Map<String, Object> var1);
}
@@ -0,0 +1,30 @@
package net.hzvtc.area.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.SpeciesAbnormalInfo;
import net.hzvtc.system.domain.vo.MessageVo;
public interface SpeciesAbnormalInfoMapper {
public SpeciesAbnormalInfo selectSpeciesAbnormalInfoById(Long var1);
public List<SpeciesAbnormalInfo> selectSpeciesAbnormalInfoList(SpeciesAbnormalInfo var1);
public SpeciesAbnormalInfo getLatestSpeciesAbnormalInfo(Long var1);
public int getSpeciesAbnormalInfoCountByUserId(Map<String, Object> var1);
public int insertSpeciesAbnormalInfo(SpeciesAbnormalInfo var1);
public int batchInsertSpeciesAbnormalInfo(List<SpeciesAbnormalInfo> var1);
public int deleteSpeciesAbnormalInfoById(Long var1);
public int deleteSpeciesAbnormalInfoByMediaId(Long var1);
public int deleteSpeciesAbnormalInfoByIds(Long[] var1);
public List<MessageVo> getSpeciesAbnormalInfoListByParam(Map<String, Object> var1);
}
@@ -0,0 +1,22 @@
package net.hzvtc.area.mapper;
import java.util.List;
import net.hzvtc.area.domain.WinteringPeriod;
public interface WinteringPeriodMapper {
public WinteringPeriod selectWinteringPeriodById(Long var1);
public List<WinteringPeriod> selectWinteringPeriodList(WinteringPeriod var1);
public List<WinteringPeriod> getWinteringPeriodDataList(WinteringPeriod var1);
public int insertWinteringPeriod(WinteringPeriod var1);
public int updateWinteringPeriod(WinteringPeriod var1);
public int deleteWinteringPeriodById(Long var1);
public int deleteWinteringPeriodByIds(Long[] var1);
}
@@ -0,0 +1,41 @@
package net.hzvtc.area.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import net.hzvtc.area.domain.ProtectedArea;
public interface ProtectedAreaService {
public ProtectedArea selectProtectedAreaById(Long var1);
public ProtectedArea selectProtectedAreaByName(String var1);
public List<ProtectedArea> getProtectedAreaListForPortal();
public List<ProtectedArea> selectProtectedAreaList(ProtectedArea var1);
public List<ProtectedArea> getProtectedAreaTreeList();
public int insertProtectedArea(ProtectedArea var1);
public int updateProtectedArea(ProtectedArea var1);
public int deleteProtectedAreaByIds(Long[] var1);
public int deleteProtectedAreaById(Long var1);
public String importData(List<ProtectedArea> var1, boolean var2);
public List<ProtectedArea> getProtectedAreaEmailList();
public ProtectedArea selectProtectedAreaByCode(String var1);
public List<ProtectedArea> getAreaListForSelect();
public List<Long> getAreaIdsByUserId(Long var1);
public List<JSONObject> getAreaListByUserId(Long var1);
public ProtectedArea getAreaLogoInfoById(Long var1);
}
@@ -0,0 +1,38 @@
package net.hzvtc.area.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.ProtectedAreaSpecies;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
public interface ProtectedAreaSpeciesService {
public ProtectedAreaSpecies selectProtectedAreaSpeciesById(Long var1);
public List<ProtectedAreaSpecies> selectProtectedAreaSpeciesList(ProtectedAreaSpecies var1);
public int batchInsertProtectedAreaSpecies(ProtectedAreaSpecies var1);
public int insertProtectedAreaSpecies(ProtectedAreaSpecies var1);
public int updateProtectedAreaSpecies(ProtectedAreaSpecies var1);
public int deleteProtectedAreaSpeciesByIds(Long[] var1);
public List<ProtectedAreaSpecies> getProtectedAreaSpeciesListByParam(JSONObject var1);
public int deleteProtectedAreaSpeciesById(Long var1);
public String importData(List<ProtectedAreaSpecies> var1, boolean var2);
public TableDataInfo getProtectedAreaSpeciesByQuery(JSONObject var1);
public List<Long> getProtectedAreaSpeciesListByParams(JSONObject var1);
public int changeProtectedAreaSpeciesByParam(JSONObject var1);
public List<BirdStatDataVo> getProtectedAreaSpeciesListByAreaId(Map<String, Object> var1);
}
@@ -0,0 +1,20 @@
package net.hzvtc.area.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.ProtectedCareSpecies;
public interface ProtectedCareSpeciesService {
public ProtectedCareSpecies selectProtectedCareSpeciesById(Long var1);
public List<Long> selectProtectedCareSpeciesList(JSONObject var1);
public int insertProtectedCareSpecies(ProtectedCareSpecies var1);
public int changeProtectedAreaCareSpeciesByParam(JSONObject var1);
public List<Long> getProtectedCareSpeciesByParam(Map<String, Object> var1);
}
@@ -0,0 +1,34 @@
package net.hzvtc.area.service;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.SpeciesAbnormalInfo;
import net.hzvtc.system.domain.vo.MessageVo;
public interface SpeciesAbnormalInfoService {
public SpeciesAbnormalInfo selectSpeciesAbnormalInfoById(Long var1);
public List<SpeciesAbnormalInfo> selectSpeciesAbnormalInfoList(SpeciesAbnormalInfo var1);
public int insertSpeciesAbnormalInfo(SpeciesAbnormalInfo var1);
public int deleteSpeciesAbnormalInfoByIds(Long[] var1);
public int deleteSpeciesAbnormalInfoById(Long var1);
public void getDailyLevelOneSpecieResult();
public void getAllLevelOneSpecieResult();
public SpeciesAbnormalInfo getLatestSpeciesAbnormalInfo(Long var1);
public int getSpeciesAbnormalInfoCountByUserId(Map<String, Object> var1);
public List<MessageVo> getSpeciesAbnormalInfoListByParam();
public void getSpeciesAbnormalInfoListForJob();
public int deleteSpeciesAbnormalInfoByMediaId(Long var1);
}
@@ -0,0 +1,24 @@
package net.hzvtc.area.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import net.hzvtc.area.domain.WinteringPeriod;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
public interface WinteringPeriodService {
public WinteringPeriod selectWinteringPeriodById(Long var1);
public List<WinteringPeriod> selectWinteringPeriodList(WinteringPeriod var1);
public int insertWinteringPeriod(WinteringPeriod var1);
public int updateWinteringPeriod(WinteringPeriod var1);
public int deleteWinteringPeriodByIds(Long[] var1);
public int deleteWinteringPeriodById(Long var1);
public List<BirdStatDataVo> getWinteringPeriodDataList(JSONObject var1);
}
@@ -0,0 +1,191 @@
package net.hzvtc.area.service.impl;
import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.validation.Validator;
import net.hzvtc.area.domain.ProtectedArea;
import net.hzvtc.area.mapper.ProtectedAreaMapper;
import net.hzvtc.area.service.ProtectedAreaService;
import net.hzvtc.common.exception.ServiceException;
import net.hzvtc.common.utils.DateUtils;
import net.hzvtc.common.utils.SecurityUtils;
import net.hzvtc.common.utils.StringUtils;
import net.hzvtc.common.utils.bean.BeanValidators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ProtectedAreaServiceImpl
implements ProtectedAreaService {
private static final Logger log = LoggerFactory.getLogger(ProtectedAreaServiceImpl.class);
@Autowired
protected Validator validator;
@Resource
private ProtectedAreaMapper protectedAreaMapper;
@Override
public ProtectedArea selectProtectedAreaById(Long id) {
return this.protectedAreaMapper.selectProtectedAreaById(id);
}
@Override
public ProtectedArea selectProtectedAreaByName(String name) {
return this.protectedAreaMapper.selectProtectedAreaByName(name);
}
@Override
public List<ProtectedArea> getProtectedAreaListForPortal() {
Long userId = SecurityUtils.getUserId();
if (userId <= 1L) {
return this.protectedAreaMapper.getAllProtectedAreaList();
}
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("userId", userId);
return this.protectedAreaMapper.getProtectedAreaListByUserId(map);
}
@Override
public List<ProtectedArea> selectProtectedAreaList(ProtectedArea protectedArea) {
Long userId = SecurityUtils.getUserId();
if (userId > 1L) {
protectedArea.setId(userId);
} else {
protectedArea.setId(null);
}
return this.protectedAreaMapper.selectProtectedAreaList(protectedArea);
}
@Override
public List<ProtectedArea> getProtectedAreaTreeList() {
HashMap<String, Object> map = new HashMap<String, Object>();
Long userId = SecurityUtils.getUserId();
if (userId > 1L) {
map.put("userId", userId);
}
return this.protectedAreaMapper.getProtectedAreaTreeList(map);
}
@Override
public int insertProtectedArea(ProtectedArea protectedArea) {
protectedArea.setCreateTime(DateUtils.getNowDate());
if (protectedArea.getShortName() == null || protectedArea.getShortName().isEmpty()) {
protectedArea.setShortName(protectedArea.getName());
}
return this.protectedAreaMapper.insertProtectedArea(protectedArea);
}
@Override
public int updateProtectedArea(ProtectedArea protectedArea) {
if (protectedArea.getShortName() == null || protectedArea.getShortName().isEmpty()) {
protectedArea.setShortName(protectedArea.getName());
}
return this.protectedAreaMapper.updateProtectedArea(protectedArea);
}
@Override
public int deleteProtectedAreaByIds(Long[] ids) {
return this.protectedAreaMapper.deleteProtectedAreaByIds(ids);
}
@Override
public int deleteProtectedAreaById(Long id) {
return this.protectedAreaMapper.deleteProtectedAreaById(id);
}
@Override
public String importData(List<ProtectedArea> list, boolean updateSupport) {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("\u5bfc\u5165\u4fdd\u62a4\u533a\u6570\u636e\u4e0d\u80fd\u4e3a\u7a7a\uff01");
}
AtomicInteger[] successNum = new AtomicInteger[]{new AtomicInteger()};
int[] failureNum = new int[]{0};
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
list.stream().forEach(data -> {
try {
ProtectedArea protectedArea = this.protectedAreaMapper.selectProtectedAreaByName(data.getName());
if (Objects.isNull((Object)protectedArea)) {
BeanValidators.validateWithException((Validator)this.validator, (Object)data, (Class[])new Class[0]);
data.setIsDeleted(0);
this.insertProtectedArea((ProtectedArea)((Object)data));
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "\u3001\u4fdd\u62a4\u533a " + data.getName() + " \u5bfc\u5165\u6210\u529f");
} else if (updateSupport) {
BeanValidators.validateWithException((Validator)this.validator, (Object)data, (Class[])new Class[0]);
data.setId(protectedArea.getId());
this.updateProtectedArea((ProtectedArea)((Object)data));
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "\u3001\u4fdd\u62a4\u533a " + data.getName() + " \u66f4\u65b0\u6210\u529f");
} else {
failureNum[0] = failureNum[0] + 1;
failureMsg.append("<br/>" + failureNum[0] + "\u3001\u4fdd\u62a4\u533a " + data.getName() + " \u5df2\u5b58\u5728");
}
}
catch (Exception e) {
failureNum[0] = failureNum[0] + 1;
String msg = "<br/>" + failureNum + "\u3001\u4fdd\u62a4\u533a " + data.getName() + " \u5bfc\u5165\u5931\u8d25\uff1a";
failureMsg.append(msg + e.getMessage());
log.error(msg, (Throwable)e);
}
});
if (failureNum[0] > 0) {
failureMsg.insert(0, "\u5f88\u62b1\u6b49\uff0c\u5bfc\u5165\u5931\u8d25\uff01\u5171 " + failureNum[0] + " \u6761\u6570\u636e\u683c\u5f0f\u4e0d\u6b63\u786e\uff0c\u9519\u8bef\u5982\u4e0b\uff1a");
throw new ServiceException(failureMsg.toString());
}
successMsg.insert(0, "\u606d\u559c\u60a8\uff0c\u6570\u636e\u5df2\u5168\u90e8\u5bfc\u5165\u6210\u529f\uff01\u5171 " + successNum + " \u6761\uff0c\u6570\u636e\u5982\u4e0b\uff1a");
return successMsg.toString();
}
@Override
public List<ProtectedArea> getProtectedAreaEmailList() {
return this.protectedAreaMapper.getProtectedAreaEmailList();
}
@Override
public ProtectedArea selectProtectedAreaByCode(String code) {
return this.protectedAreaMapper.selectProtectedAreaByCode(code);
}
@Override
public List<ProtectedArea> getAreaListForSelect() {
return this.protectedAreaMapper.getAreaListForSelect();
}
@Override
public List<Long> getAreaIdsByUserId(Long userId) {
return this.protectedAreaMapper.getAreaIdsByUserId(userId);
}
@Override
public List<JSONObject> getAreaListByUserId(Long userId) {
if (userId <= 1L) {
userId = null;
}
List<ProtectedArea> list = this.protectedAreaMapper.getAreaListByUserId(userId);
List<JSONObject> objectList = list.stream().map(item -> {
JSONObject obj = new JSONObject();
obj.put("id", (Object)item.getId());
obj.put("name", (Object)item.getName());
obj.put("provinceName", (Object)item.getProvinceName());
obj.put("code", (Object)item.getProvince());
obj.put("lat", (Object)item.getLat());
obj.put("lon", (Object)item.getLon());
return obj;
}).collect(Collectors.toList());
return objectList;
}
@Override
public ProtectedArea getAreaLogoInfoById(Long id) {
return this.protectedAreaMapper.getAreaLogoInfoById(id);
}
}
@@ -0,0 +1,330 @@
package net.hzvtc.area.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import net.hzvtc.area.domain.ProtectedArea;
import net.hzvtc.area.domain.ProtectedAreaSpecies;
import net.hzvtc.area.mapper.ProtectedAreaSpeciesMapper;
import net.hzvtc.area.service.ProtectedAreaService;
import net.hzvtc.area.service.ProtectedAreaSpeciesService;
import net.hzvtc.bird.domain.BirdSpecies;
import net.hzvtc.bird.service.BirdSpeciesService;
import net.hzvtc.common.constant.HttpStatus;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.exception.ServiceException;
import net.hzvtc.common.utils.DateUtils;
import net.hzvtc.common.utils.PageUtils;
import net.hzvtc.common.utils.StringUtils;
import net.hzvtc.common.utils.bean.BeanValidators;
import net.hzvtc.data.check.domain.ResultRecord;
import net.hzvtc.data.check.service.ResultRecordService;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 保护区物种Service业务层处理
*
* @author admin
* @date 2022-07-20
*/
@Service
@RequiredArgsConstructor
public class ProtectedAreaSpeciesServiceImpl implements ProtectedAreaSpeciesService {
private static final Logger log = LoggerFactory.getLogger(ProtectedAreaServiceImpl.class);
@Resource
protected Validator validator;
@Resource
private ProtectedAreaSpeciesMapper protectedAreaSpeciesMapper;
private final ProtectedAreaService protectedAreaService;
private final BirdSpeciesService birdSpeciesService;
private final ResultRecordService resultRecordService;
/**
* 查询保护区物种
*
* @param id 保护区物种主键
* @return 保护区物种
*/
@Override
public ProtectedAreaSpecies selectProtectedAreaSpeciesById(Long id) {
return protectedAreaSpeciesMapper.selectProtectedAreaSpeciesById(id);
}
/**
* 查询保护区物种列表
*
* @param protectedAreaSpecies 保护区物种
* @return 保护区物种
*/
@Override
public List<ProtectedAreaSpecies> selectProtectedAreaSpeciesList(ProtectedAreaSpecies protectedAreaSpecies) {
return protectedAreaSpeciesMapper.selectProtectedAreaSpeciesList(protectedAreaSpecies);
}
/**
* 新增保护区物种
*
* @param species 保护区物种
* @return 结果
*/
@Override
@Transactional
public int batchInsertProtectedAreaSpecies(ProtectedAreaSpecies species) {
species.setCreateTime(DateUtils.getNowDate());
Map<String, Object> map = new HashMap<>();
map.put("areaId", species.getAreaId());
map.put("list", species.getIds());
List<Long> birdIds = protectedAreaSpeciesMapper.getProtectedAreaSpeciesListByParams(map);
if (birdIds != null && birdIds.size() > 0) {
map.clear();
map.put("isCommon", species.getIsCommon());
map.put("list", birdIds);
map.put("areaId", species.getAreaId());
protectedAreaSpeciesMapper.batchUpdateProtectedAreaSpecies(map);
}
List<Long> newIds = listRemove(species.getIds(), birdIds);
if (newIds != null && newIds.size() > 0) {
List<ProtectedAreaSpecies> list = new ArrayList<>();
newIds.stream().forEach(id -> {
ProtectedAreaSpecies data = new ProtectedAreaSpecies();
data.setAreaId(species.getAreaId());
data.setIsCommon(species.getIsCommon());
data.setIsDeleted(0);
data.setCreateTime(species.getCreateTime());
data.setSpeciesId(id);
list.add(data);
});
return protectedAreaSpeciesMapper.batchInsertProtectedAreaSpecies(list);
} else {
return 1;
}
}
@Override
public int insertProtectedAreaSpecies(ProtectedAreaSpecies protectedAreaSpecies) {
return protectedAreaSpeciesMapper.insertProtectedAreaSpecies(protectedAreaSpecies);
}
private List<Long> listRemove(List<Long> fromList, List<Long> toList) {
HashSet hs1 = new HashSet(fromList);
HashSet hs2 = new HashSet(toList);
hs1.removeAll(hs2);
List<Long> list = new ArrayList<Long>();
list.addAll(hs1);
return list;
}
/**
* 修改保护区物种
*
* @param protectedAreaSpecies 保护区物种
* @return 结果
*/
@Override
public int updateProtectedAreaSpecies(ProtectedAreaSpecies protectedAreaSpecies) {
return protectedAreaSpeciesMapper.updateProtectedAreaSpecies(protectedAreaSpecies);
}
/**
* 批量删除保护区物种
*
* @param ids 需要删除的保护区物种主键
* @return 结果
*/
@Override
public int deleteProtectedAreaSpeciesByIds(Long[] ids) {
return protectedAreaSpeciesMapper.deleteProtectedAreaSpeciesByIds(ids);
}
@Override
public List<ProtectedAreaSpecies> getProtectedAreaSpeciesListByParam(JSONObject obj) {
Map<String, Object> map = new HashMap<>();
Integer isCommon = obj.getInteger("isCommon");
if (isCommon != null) {
map.put("isCommon", isCommon);
}
String code = obj.getString("code");
if (code != null && !code.isEmpty()) {
map.put("code", code);
}
Long areaId = obj.getLong("areaId");
map.put("areaId", areaId);
return protectedAreaSpeciesMapper.getProtectedAreaSpeciesListByParam(map);
}
/**
* 删除保护区物种信息
*
* @param id 保护区物种主键
* @return 结果
*/
@Override
public int deleteProtectedAreaSpeciesById(Long id) {
return protectedAreaSpeciesMapper.deleteProtectedAreaSpeciesById(id);
}
@Override
public String importData(List<ProtectedAreaSpecies> list, boolean updateSupport) {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入保护区鸟类不能为空!");
}
AtomicInteger[] successNum = {new AtomicInteger()};
int[] failureNum = {0};
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
list.stream().forEach(data -> {
try {
ProtectedArea protectedArea = protectedAreaService.selectProtectedAreaByName(data.getAreaName());
BirdSpecies birdSpecies = birdSpeciesService.selectBirdSpeciesByName(data.getSpeciesName());
if (Objects.isNull(protectedArea)) {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、保护区 " + data.getAreaName() + " 不存在");
} else if (Objects.isNull(birdSpecies)) {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、鸟类 " + data.getSpeciesName() + " 不存在");
} else {
ProtectedAreaSpecies param = new ProtectedAreaSpecies();
param.setAreaId(protectedArea.getId());
param.setSpeciesId(birdSpecies.getId());
ProtectedAreaSpecies areaSpecies = protectedAreaSpeciesMapper.selectProtectedAreaSpeciesByParam(param);
if (Objects.isNull(areaSpecies)) {
BeanValidators.validateWithException(validator, data);
data.setIsDeleted(0);
data.setAreaId(protectedArea.getId());
data.setSpeciesId(birdSpecies.getId());
data.setCreateTime(new Date());
insertProtectedAreaSpecies(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟类 " + data.getSpeciesName() + " 导入成功");
} else if (updateSupport) {
BeanValidators.validateWithException(validator, data);
data.setId(areaSpecies.getId());
data.setIsDeleted(0);
data.setAreaId(protectedArea.getId());
data.setSpeciesId(birdSpecies.getId());
updateProtectedAreaSpecies(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟类 " + data.getSpeciesName() + " 更新成功");
} else {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、鸟类 " + data.getSpeciesName() + " 已存在");
}
}
} catch (Exception e) {
failureNum[0]++;
String msg = "<br/>" + failureNum + "、鸟类 " + data.getSpeciesName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
});
if (failureNum[0] > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum[0] + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
@Override
public TableDataInfo getProtectedAreaSpeciesByQuery(JSONObject param) {
Map<String, Object> map = new HashMap<>();
String areaName = "";
Long areaId = param.getLong("areaId");
map.put("areaId", areaId);
if (areaId != null) {
areaName = protectedAreaService.selectProtectedAreaById(areaId).getName();
}
String name = param.getString("name");
map.put("name", name);
Integer pageNum = param.getInteger("pageNum");
Integer pageSize = param.getInteger("pageSize");
PageUtils.startPage(pageNum, pageSize);
List<BirdSpecies> birdSpecies = birdSpeciesService.getBirdSpeciesListByQuery(map);
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setTotal(new PageInfo(birdSpecies).getTotal());
// List<Long> ids = protectedAreaSpeciesMapper.getProtectedAreaSpeciesIdsByParam(map);
List<ProtectedAreaSpecies> list = new ArrayList<>();
for (BirdSpecies item : birdSpecies) {
ProtectedAreaSpecies data = new ProtectedAreaSpecies();
data.setSpeciesId(item.getId());
data.setBirdSpecies(item);
map.put("speciesId", item.getId());
ResultRecord resultRecord = resultRecordService.getResultRecordInfoBySpeciesId(map);
if (resultRecord != null) {
data.setAreaName(areaName);
data.setUpdateTime(resultRecord.getRecordTime());
} else {
data.setAreaName("当前未监测到");
}
list.add(data);
}
rspData.setRows(list);
return rspData;
}
@Override
public List<Long> getProtectedAreaSpeciesListByParams(JSONObject param) {
Map<String, Object> map = new HashMap<>();
Long areaId = param.getLong("areaId");
map.put("areaId", areaId);
String str = param.getString("list");
if (str != null && !str.isEmpty()) {
List<Long> list = JSON.parseArray(str, Long.class);
if (list != null && !list.isEmpty()) {
map.put("list", list);
}
}
return protectedAreaSpeciesMapper.getProtectedAreaSpeciesListByParams(map);
}
@Override
public int changeProtectedAreaSpeciesByParam(JSONObject param) {
Long id = param.getLong("id");
int val = param.getInteger("val");
Long areaId = param.getLong("areaId");
if (val == 0) {
Map<String, Object> map = new HashMap<>();
map.put("areaId", areaId);
map.put("speciesId", id);
return protectedAreaSpeciesMapper.deleteProtectedAreaSpeciesByParam(map);
} else {
ProtectedAreaSpecies data = new ProtectedAreaSpecies();
data.setIsCommon(1);
data.setSpeciesId(id);
data.setAreaId(areaId);
data.setCreateTime(new Date());
data.setPosition(99);
data.setIsDeleted(0);
return protectedAreaSpeciesMapper.insertProtectedAreaSpecies(data);
}
}
@Override
public List<BirdStatDataVo> getProtectedAreaSpeciesListByAreaId(Map<String, Object> map) {
return protectedAreaSpeciesMapper.getProtectedAreaSpeciesListByAreaId(map);
}
}
@@ -0,0 +1,73 @@
package net.hzvtc.area.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import net.hzvtc.area.domain.ProtectedCareSpecies;
import net.hzvtc.area.mapper.ProtectedCareSpeciesMapper;
import net.hzvtc.area.service.ProtectedCareSpeciesService;
import net.hzvtc.common.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@Service
public class ProtectedCareSpeciesServiceImpl
implements ProtectedCareSpeciesService {
private static final Logger log = LoggerFactory.getLogger(ProtectedCareSpeciesServiceImpl.class);
@Resource
private ProtectedCareSpeciesMapper protectedCareSpeciesMapper;
@Override
public ProtectedCareSpecies selectProtectedCareSpeciesById(Long id) {
return this.protectedCareSpeciesMapper.selectProtectedCareSpeciesById(id);
}
@Override
public List<Long> selectProtectedCareSpeciesList(JSONObject param) {
List list;
HashMap<String, Object> map = new HashMap<String, Object>();
Long areaId = param.getLong("areaId");
map.put("areaId", areaId);
String str = param.getString("list");
if (str != null && !str.isEmpty() && (list = JSON.parseArray((String)str, Long.class)) != null && !list.isEmpty()) {
map.put("list", list);
}
return this.protectedCareSpeciesMapper.selectProtectedCareSpeciesList(map);
}
@Override
public int insertProtectedCareSpecies(ProtectedCareSpecies protectedCareSpecies) {
protectedCareSpecies.setCreateTime(DateUtils.getNowDate());
return this.protectedCareSpeciesMapper.insertProtectedCareSpecies(protectedCareSpecies);
}
@Override
public int changeProtectedAreaCareSpeciesByParam(JSONObject param) {
Long id = param.getLong("id");
int val = param.getInteger("val");
Long areaId = param.getLong("areaId");
if (val == 0) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("areaId", areaId);
map.put("speciesId", id);
return this.protectedCareSpeciesMapper.deleteProtectedCareSpeciesById(map);
}
ProtectedCareSpecies data = new ProtectedCareSpecies();
data.setSpeciesId(id);
data.setAreaId(areaId);
data.setCreateTime(new Date());
return this.protectedCareSpeciesMapper.insertProtectedCareSpecies(data);
}
@Override
public List<Long> getProtectedCareSpeciesByParam(Map<String, Object> map) {
return this.protectedCareSpeciesMapper.getProtectedCareSpeciesByParam(map);
}
}
@@ -0,0 +1,214 @@
package net.hzvtc.area.service.impl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import net.hzvtc.area.domain.SpeciesAbnormalInfo;
import net.hzvtc.area.mapper.SpeciesAbnormalInfoMapper;
import net.hzvtc.area.service.ProtectedCareSpeciesService;
import net.hzvtc.area.service.SpeciesAbnormalInfoService;
import net.hzvtc.common.utils.SecurityUtils;
import net.hzvtc.data.check.service.ResultRecordDetailsService;
import net.hzvtc.data.check.service.ResultRecordService;
import net.hzvtc.data.job.domain.TableStatInfo;
import net.hzvtc.data.job.service.TableStatInfoService;
import net.hzvtc.system.domain.vo.MessageVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class SpeciesAbnormalInfoServiceImpl
implements SpeciesAbnormalInfoService {
private static final Logger log = LoggerFactory.getLogger(SpeciesAbnormalInfoServiceImpl.class);
@Resource
private SpeciesAbnormalInfoMapper speciesAbnormalInfoMapper;
@Autowired
private ResultRecordDetailsService resultRecordDetailsService;
@Autowired
private TableStatInfoService tableStatInfoService;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private ProtectedCareSpeciesService careSpeciesService;
@Override
public SpeciesAbnormalInfo selectSpeciesAbnormalInfoById(Long id) {
return this.speciesAbnormalInfoMapper.selectSpeciesAbnormalInfoById(id);
}
@Override
public List<SpeciesAbnormalInfo> selectSpeciesAbnormalInfoList(SpeciesAbnormalInfo speciesAbnormalInfo) {
return this.speciesAbnormalInfoMapper.selectSpeciesAbnormalInfoList(speciesAbnormalInfo);
}
@Override
public int insertSpeciesAbnormalInfo(SpeciesAbnormalInfo speciesAbnormalInfo) {
return this.speciesAbnormalInfoMapper.insertSpeciesAbnormalInfo(speciesAbnormalInfo);
}
@Override
public int deleteSpeciesAbnormalInfoByIds(Long[] ids) {
return this.speciesAbnormalInfoMapper.deleteSpeciesAbnormalInfoByIds(ids);
}
@Override
public int deleteSpeciesAbnormalInfoById(Long id) {
return this.speciesAbnormalInfoMapper.deleteSpeciesAbnormalInfoById(id);
}
@Override
public void getDailyLevelOneSpecieResult() {
HashMap<String, Object> map = new HashMap<String, Object>();
DateTimeFormatter fmDate = DateTimeFormatter.ofPattern("yyyy-MM-dd");
map.put("happenTime", fmDate.format(LocalDate.now()));
List<SpeciesAbnormalInfo> list = this.resultRecordDetailsService.getLevelOneSpeciesLitByParam(map);
if (list != null && !list.isEmpty()) {
list.forEach(item -> item.setType(1));
this.speciesAbnormalInfoMapper.batchInsertSpeciesAbnormalInfo(list);
}
if ((list = this.resultRecordDetailsService.getCrOrEnSpeciesLitByParam(map)) != null && !list.isEmpty()) {
list.forEach(item -> item.setType(2));
this.speciesAbnormalInfoMapper.batchInsertSpeciesAbnormalInfo(list);
}
}
@Override
public void getAllLevelOneSpecieResult() {
HashMap<String, Object> map = new HashMap<String, Object>();
List<SpeciesAbnormalInfo> list = this.resultRecordDetailsService.getLevelOneSpeciesLitByParam(map);
if (list != null && !list.isEmpty()) {
this.speciesAbnormalInfoMapper.batchInsertSpeciesAbnormalInfo(list);
}
}
@Override
public SpeciesAbnormalInfo getLatestSpeciesAbnormalInfo(Long userId) {
return this.speciesAbnormalInfoMapper.getLatestSpeciesAbnormalInfo(userId);
}
@Override
public int getSpeciesAbnormalInfoCountByUserId(Map<String, Object> map) {
return this.speciesAbnormalInfoMapper.getSpeciesAbnormalInfoCountByUserId(map);
}
@Override
public List<MessageVo> getSpeciesAbnormalInfoListByParam() {
HashMap<String, Object> map = new HashMap<String, Object>();
Long userId = SecurityUtils.getUserId();
map.put("readerId", userId);
if (userId <= 1L) {
userId = null;
}
map.put("userId", userId);
return this.speciesAbnormalInfoMapper.getSpeciesAbnormalInfoListByParam(map);
}
@Override
@Transactional
public void getSpeciesAbnormalInfoListForJob() {
TableStatInfo data;
TableStatInfo param = new TableStatInfo();
param.setType(0);
Long miniId = null;
List<TableStatInfo> list = this.tableStatInfoService.selectTableStatInfoList(param);
HashMap<String, Object> map = new HashMap<String, Object>();
if (list == null || list.isEmpty()) {
map.put("recordTime", new Date());
} else {
Long id = list.get(0).getTableId();
map.put("recordId", id);
}
List<Long> ids = this.resultRecordService.getResultRecordIdsByParam(map);
if (ids == null || ids.isEmpty()) {
return;
}
if (list == null || list.isEmpty()) {
data = new TableStatInfo();
data.setType(0);
data.setTableId(ids.get(0));
this.tableStatInfoService.insertTableStatInfo(data);
} else {
data = list.get(0);
data.setTableId(ids.get(0));
this.tableStatInfoService.updateTableStatInfo(data);
}
miniId = ids.get(ids.size() - 1);
map.clear();
map.put("list", ids);
ArrayList<SpeciesAbnormalInfo> speciesList = new ArrayList<SpeciesAbnormalInfo>();
List<SpeciesAbnormalInfo> nlist = this.resultRecordDetailsService.getCrOrEnSpeciesLitByParam(map);
if (nlist != null && nlist.size() > 0) {
nlist.forEach(item -> {
if (!this.containsItem((List<SpeciesAbnormalInfo>)speciesList, (SpeciesAbnormalInfo)item)) {
item.setType(2);
speciesList.add((SpeciesAbnormalInfo)item);
}
});
}
nlist = this.resultRecordDetailsService.getSpeciesDateListByParam(map);
map.clear();
map.put("recordId", miniId);
nlist.forEach(item -> {
if (!this.containsItem((List<SpeciesAbnormalInfo>)speciesList, (SpeciesAbnormalInfo)item)) {
map.put("speciesId", item.getSpeciesId());
map.put("areaId", item.getAreaId());
List<Long> subIds = this.resultRecordDetailsService.checkIsNewSpeciesByParam(map);
if ((subIds == null || subIds.isEmpty()) && !this.containsItem((List<SpeciesAbnormalInfo>)speciesList, (SpeciesAbnormalInfo)item)) {
item.setType(3);
speciesList.add((SpeciesAbnormalInfo)item);
}
}
});
map.clear();
map.put("list", ids);
nlist.forEach(item -> {
if (!this.containsItem((List<SpeciesAbnormalInfo>)speciesList, (SpeciesAbnormalInfo)item)) {
map.put("speciesId", item.getSpeciesId());
map.put("areaId", item.getAreaId());
List<Long> subIds = this.careSpeciesService.getProtectedCareSpeciesByParam(map);
if (subIds != null && !subIds.isEmpty() && !this.containsItem((List<SpeciesAbnormalInfo>)speciesList, (SpeciesAbnormalInfo)item)) {
item.setType(4);
speciesList.add((SpeciesAbnormalInfo)item);
}
}
});
map.clear();
map.put("list", ids);
nlist = this.resultRecordDetailsService.getLevelOneSpeciesLitByParam(map);
if (nlist != null && !nlist.isEmpty()) {
nlist.forEach(item -> {
if (!this.containsItem((List<SpeciesAbnormalInfo>)speciesList, (SpeciesAbnormalInfo)item)) {
item.setType(1);
speciesList.add((SpeciesAbnormalInfo)item);
}
});
}
if (!speciesList.isEmpty()) {
this.speciesAbnormalInfoMapper.batchInsertSpeciesAbnormalInfo(speciesList);
}
}
@Override
public int deleteSpeciesAbnormalInfoByMediaId(Long id) {
return this.speciesAbnormalInfoMapper.deleteSpeciesAbnormalInfoByMediaId(id);
}
private boolean containsItem(List<SpeciesAbnormalInfo> list, SpeciesAbnormalInfo item) {
if (list == null || list.size() == 0) {
return false;
}
List slist = list.stream().filter(sitem -> sitem.getRecordId().longValue() == item.getRecordId().longValue() && sitem.getSpeciesId().longValue() == item.getSpeciesId().longValue()).collect(Collectors.toList());
return slist != null && slist.size() != 0;
}
}
@@ -0,0 +1,120 @@
package net.hzvtc.area.service.impl;
import com.alibaba.fastjson.JSONObject;
import net.hzvtc.area.domain.ProtectedArea;
import net.hzvtc.area.domain.WinteringPeriod;
import net.hzvtc.area.mapper.WinteringPeriodMapper;
import net.hzvtc.area.service.ProtectedAreaService;
import net.hzvtc.area.service.WinteringPeriodService;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 越冬期Service业务层处理
*
* @author admin
* @date 2022-09-13
*/
@Service
public class WinteringPeriodServiceImpl implements WinteringPeriodService {
@Resource
private WinteringPeriodMapper winteringPeriodMapper;
@Autowired
private ProtectedAreaService protectedAreaService;
/**
* 查询越冬期
*
* @param id 越冬期主键
* @return 越冬期
*/
@Override
public WinteringPeriod selectWinteringPeriodById(Long id) {
return winteringPeriodMapper.selectWinteringPeriodById(id);
}
/**
* 查询越冬期列表
*
* @param winteringPeriod 越冬期
* @return 越冬期
*/
@Override
public List<WinteringPeriod> selectWinteringPeriodList(WinteringPeriod winteringPeriod) {
return winteringPeriodMapper.selectWinteringPeriodList(winteringPeriod);
}
/**
* 新增越冬期
*
* @param winteringPeriod 越冬期
* @return 结果
*/
@Override
public int insertWinteringPeriod(WinteringPeriod winteringPeriod) {
return winteringPeriodMapper.insertWinteringPeriod(winteringPeriod);
}
/**
* 修改越冬期
*
* @param winteringPeriod 越冬期
* @return 结果
*/
@Override
public int updateWinteringPeriod(WinteringPeriod winteringPeriod) {
return winteringPeriodMapper.updateWinteringPeriod(winteringPeriod);
}
/**
* 批量删除越冬期
*
* @param ids 需要删除的越冬期主键
* @return 结果
*/
@Override
public int deleteWinteringPeriodByIds(Long[] ids) {
return winteringPeriodMapper.deleteWinteringPeriodByIds(ids);
}
/**
* 删除越冬期信息
*
* @param id 越冬期主键
* @return 结果
*/
@Override
public int deleteWinteringPeriodById(Long id) {
return winteringPeriodMapper.deleteWinteringPeriodById(id);
}
@Override
public List<BirdStatDataVo> getWinteringPeriodDataList(JSONObject param) {
String areaCode = param.getString("areaCode");
if (areaCode != null) {
ProtectedArea data = protectedAreaService.selectProtectedAreaByCode(areaCode);
WinteringPeriod winteringPeriod = new WinteringPeriod();
winteringPeriod.setProtectedAreaId(data.getId());
List<WinteringPeriod> list = winteringPeriodMapper.getWinteringPeriodDataList(winteringPeriod);
Collections.reverse(list);
SimpleDateFormat df = new SimpleDateFormat("yyyy");
List<BirdStatDataVo> datalist = list.stream().map(item -> {
BirdStatDataVo statDataVo = new BirdStatDataVo();
statDataVo.setValue(item.getAmount());
String code = df.format(item.getStartTime()) + "-" + df.format(item.getEndTime());
statDataVo.setCode(code);
return statDataVo;
}).collect(Collectors.toList());
return datalist;
}
return null;
}
}
@@ -0,0 +1,112 @@
package net.hzvtc.bird.controller;
import net.hzvtc.bird.domain.BirdCatalogue;
import net.hzvtc.bird.service.BirdCatalogueService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 鸟类目Controller
*
* @author admin
* @date 2022-07-16
*/
@RestController
@RequestMapping("/birdInfo/catalogue")
public class BirdCatalogueController extends BaseController {
@Autowired
private BirdCatalogueService birdCatalogueService;
/**
* 查询鸟类目列表
*/
// @PreAuthorize("@ss.hasPermi('birdInfo:catalogue:list')")
@GetMapping("/list")
public TableDataInfo list(BirdCatalogue birdCatalogue) {
startPage();
List<BirdCatalogue> list = birdCatalogueService.selectBirdCatalogueList(birdCatalogue);
return getDataTable(list);
}
@GetMapping("/selectList")
public AjaxResult getBirdCatalogueSelectList() {
return AjaxResult.success(birdCatalogueService.getBirdCatalogueSelectList());
}
/**
* 导出鸟类目列表
*/
@PreAuthorize("@ss.hasPermi('birdInfo:catalogue:export')")
@Log(title = "鸟类目", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BirdCatalogue birdCatalogue) {
List<BirdCatalogue> list = birdCatalogueService.selectBirdCatalogueList(birdCatalogue);
ExcelUtil<BirdCatalogue> util = new ExcelUtil<BirdCatalogue>(BirdCatalogue.class);
util.exportExcel(response, list, "鸟类目数据");
}
@Log(title = "鸟类目", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<BirdCatalogue> util = new ExcelUtil<BirdCatalogue>(BirdCatalogue.class);
List<BirdCatalogue> list = util.importExcel(file.getInputStream());
String message = birdCatalogueService.importData(list, updateSupport);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<BirdCatalogue> util = new ExcelUtil<>(BirdCatalogue.class);
util.importTemplateExcel(response, "鸟类目数据");
}
/**
* 获取鸟类目详细信息
*/
@PreAuthorize("@ss.hasPermi('birdInfo:catalogue:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(birdCatalogueService.selectBirdCatalogueById(id));
}
/**
* 新增鸟类目
*/
@PreAuthorize("@ss.hasPermi('birdInfo:catalogue:add')")
@Log(title = "鸟类目", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BirdCatalogue birdCatalogue) {
return toAjax(birdCatalogueService.insertBirdCatalogue(birdCatalogue));
}
/**
* 修改鸟类目
*/
@PreAuthorize("@ss.hasPermi('birdInfo:catalogue:edit')")
@Log(title = "鸟类目", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BirdCatalogue birdCatalogue) {
return toAjax(birdCatalogueService.updateBirdCatalogue(birdCatalogue));
}
/**
* 删除鸟类目
*/
@PreAuthorize("@ss.hasPermi('birdInfo:catalogue:remove')")
@Log(title = "鸟类目", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(birdCatalogueService.deleteBirdCatalogueByIds(ids));
}
}
@@ -0,0 +1,111 @@
package net.hzvtc.bird.controller;
import net.hzvtc.bird.domain.BirdFamily;
import net.hzvtc.bird.service.BirdFamilyService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 鸟类科Controller
*
* @author admin
* @date 2022-07-16
*/
@RestController
@RequestMapping("/birdInfo/family")
public class BirdFamilyController extends BaseController {
@Autowired
private BirdFamilyService birdFamilyService;
/**
* 查询鸟类科列表
*/
// @PreAuthorize("@ss.hasPermi('birdInfo:family:list')")
@GetMapping("/list")
public TableDataInfo list(BirdFamily birdFamily) {
startPage();
List<BirdFamily> list = birdFamilyService.selectBirdFamilyList(birdFamily);
return getDataTable(list);
}
@GetMapping("/listByCataId")
public AjaxResult getBirdFamilyListByCatalogueId(@RequestParam(name = "id") Long id) {
return AjaxResult.success(birdFamilyService.getBirdFamilyListByCataId(id));
}
/**
* 导出鸟类科列表
*/
@PreAuthorize("@ss.hasPermi('birdInfo:family:export')")
@Log(title = "鸟类科", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BirdFamily birdFamily) {
List<BirdFamily> list = birdFamilyService.selectBirdFamilyList(birdFamily);
ExcelUtil<BirdFamily> util = new ExcelUtil<BirdFamily>(BirdFamily.class);
util.exportExcel(response, list, "鸟类科数据");
}
/**
* 获取鸟类科详细信息
*/
@PreAuthorize("@ss.hasPermi('birdInfo:family:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(birdFamilyService.selectBirdFamilyById(id));
}
/**
* 新增鸟类科
*/
@PreAuthorize("@ss.hasPermi('birdInfo:family:add')")
@Log(title = "鸟类科", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BirdFamily birdFamily) {
return toAjax(birdFamilyService.insertBirdFamily(birdFamily));
}
/**
* 修改鸟类科
*/
@PreAuthorize("@ss.hasPermi('birdInfo:family:edit')")
@Log(title = "鸟类科", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BirdFamily birdFamily) {
return toAjax(birdFamilyService.updateBirdFamily(birdFamily));
}
/**
* 删除鸟类科
*/
@PreAuthorize("@ss.hasPermi('birdInfo:family:remove')")
@Log(title = "鸟类科", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(birdFamilyService.deleteBirdFamilyByIds(ids));
}
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<BirdFamily> util = new ExcelUtil<BirdFamily>(BirdFamily.class);
List<BirdFamily> list = util.importExcel(file.getInputStream());
String message = birdFamilyService.importData(list, updateSupport);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<BirdFamily> util = new ExcelUtil<>(BirdFamily.class);
util.importTemplateExcel(response, "鸟类科数据");
}
}
@@ -0,0 +1,96 @@
package net.hzvtc.bird.controller;
import net.hzvtc.bird.domain.BirdFlyingInfo;
import net.hzvtc.bird.service.BirdFlyingInfoService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 鸟类越冬飞行路线图Controller
*
* @author admin
* @date 2022-07-30
*/
@RestController
@RequestMapping("/birdInfo/flyingInfo")
public class BirdFlyingInfoController extends BaseController {
@Autowired
private BirdFlyingInfoService birdFlyingInfoService;
@GetMapping("/allList")
public AjaxResult getAll() {
return AjaxResult.success(birdFlyingInfoService.getAllBirdFlyingInfoList());
}
/**
* 查询鸟类越冬飞行路线图列表
*/
// @PreAuthorize("@ss.hasPermi('birdInfo:flyingInfo:list')")
@GetMapping("/list")
public TableDataInfo list(BirdFlyingInfo birdFlyingInfo) {
startPage();
List<BirdFlyingInfo> list = birdFlyingInfoService.selectBirdFlyingInfoList(birdFlyingInfo);
return getDataTable(list);
}
/**
* 导出鸟类越冬飞行路线图列表
*/
@PreAuthorize("@ss.hasPermi('birdInfo:flyingInfo:export')")
@Log(title = "鸟类越冬飞行路线图", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BirdFlyingInfo birdFlyingInfo) {
List<BirdFlyingInfo> list = birdFlyingInfoService.selectBirdFlyingInfoList(birdFlyingInfo);
ExcelUtil<BirdFlyingInfo> util = new ExcelUtil<BirdFlyingInfo>(BirdFlyingInfo.class);
util.exportExcel(response, list, "鸟类越冬飞行路线图数据");
}
/**
* 获取鸟类越冬飞行路线图详细信息
*/
@PreAuthorize("@ss.hasPermi('birdInfo:flyingInfo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(birdFlyingInfoService.selectBirdFlyingInfoById(id));
}
/**
* 新增鸟类越冬飞行路线图
*/
@PreAuthorize("@ss.hasPermi('birdInfo:flyingInfo:add')")
@Log(title = "鸟类越冬飞行路线图", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BirdFlyingInfo birdFlyingInfo) {
return toAjax(birdFlyingInfoService.insertBirdFlyingInfo(birdFlyingInfo));
}
/**
* 修改鸟类越冬飞行路线图
*/
@PreAuthorize("@ss.hasPermi('birdInfo:flyingInfo:edit')")
@Log(title = "鸟类越冬飞行路线图", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BirdFlyingInfo birdFlyingInfo) {
return toAjax(birdFlyingInfoService.updateBirdFlyingInfo(birdFlyingInfo));
}
/**
* 删除鸟类越冬飞行路线图
*/
@PreAuthorize("@ss.hasPermi('birdInfo:flyingInfo:remove')")
@Log(title = "鸟类越冬飞行路线图", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(birdFlyingInfoService.deleteBirdFlyingInfoByIds(ids));
}
}
@@ -0,0 +1,113 @@
package net.hzvtc.bird.controller;
import net.hzvtc.bird.domain.BirdGenus;
import net.hzvtc.bird.service.BirdGenusService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 鸟类属Controller
*
* @author admin
* @date 2022-07-18
*/
@RestController
@RequestMapping("/birdInfo/genus")
public class BirdGenusController extends BaseController {
@Autowired
private BirdGenusService birdGenusService;
/**
* 查询鸟类属列表
*/
// @PreAuthorize("@ss.hasPermi('birdInfo:genus:list')")
@GetMapping("/list")
public TableDataInfo list(BirdGenus birdGenus) {
startPage();
List<BirdGenus> list = birdGenusService.selectBirdGenusList(birdGenus);
return getDataTable(list);
}
@GetMapping("/listByFamilyId")
public AjaxResult getBirdFamilyListByCatalogueId(@RequestParam(name = "id") Long id) {
return AjaxResult.success(birdGenusService.getBirdGenusListByFamilyId(id));
}
/**
* 导出鸟类属列表
*/
@PreAuthorize("@ss.hasPermi('birdInfo:genus:export')")
@Log(title = "鸟类属", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BirdGenus birdGenus) {
List<BirdGenus> list = birdGenusService.selectBirdGenusList(birdGenus);
ExcelUtil<BirdGenus> util = new ExcelUtil<BirdGenus>(BirdGenus.class);
util.exportExcel(response, list, "鸟类属数据");
}
/**
* 获取鸟类属详细信息
*/
@PreAuthorize("@ss.hasPermi('birdInfo:genus:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(birdGenusService.selectBirdGenusById(id));
}
/**
* 新增鸟类属
*/
@PreAuthorize("@ss.hasPermi('birdInfo:genus:add')")
@Log(title = "鸟类属", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BirdGenus birdGenus) {
return toAjax(birdGenusService.insertBirdGenus(birdGenus));
}
/**
* 修改鸟类属
*/
@PreAuthorize("@ss.hasPermi('birdInfo:genus:edit')")
@Log(title = "鸟类属", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BirdGenus birdGenus) {
return toAjax(birdGenusService.updateBirdGenus(birdGenus));
}
/**
* 删除鸟类属
*/
@PreAuthorize("@ss.hasPermi('birdInfo:genus:remove')")
@Log(title = "鸟类属", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(birdGenusService.deleteBirdGenusByIds(ids));
}
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<BirdGenus> util = new ExcelUtil<BirdGenus>(BirdGenus.class);
List<BirdGenus> list = util.importExcel(file.getInputStream());
String message = birdGenusService.importData(list, updateSupport);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
ExcelUtil<BirdGenus> util = new ExcelUtil<>(BirdGenus.class);
util.importTemplateExcel(response, "鸟类科数据");
}
}
@@ -0,0 +1,98 @@
package net.hzvtc.bird.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.bird.domain.BirdLeaveArriveInfo;
import net.hzvtc.bird.service.BirdLeaveArriveInfoService;
import net.hzvtc.common.utils.poi.ExcelUtil;
import net.hzvtc.common.core.page.TableDataInfo;
/**
* 候鸟飞离和抵达时间Controller
*
* @author admin
* @date 2023-03-27
*/
@RestController
@RequestMapping("/bird/leaveArrive")
public class BirdLeaveArriveInfoController extends BaseController {
@Autowired
private BirdLeaveArriveInfoService birdLeaveArriveInfoService;
/**
* 查询候鸟飞离和抵达时间列表
*/
@PreAuthorize("@ss.hasPermi('bird:leaveArrive:list')")
@GetMapping("/list")
public TableDataInfo list(BirdLeaveArriveInfo birdLeaveArriveInfo) {
startPage();
List<BirdLeaveArriveInfo> list = birdLeaveArriveInfoService.selectBirdLeaveArriveInfoList(birdLeaveArriveInfo);
return getDataTable(list);
}
/**
* 导出候鸟飞离和抵达时间列表
*/
@PreAuthorize("@ss.hasPermi('bird:leaveArrive:export')")
@Log(title = "候鸟飞离和抵达时间", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BirdLeaveArriveInfo birdLeaveArriveInfo) {
List<BirdLeaveArriveInfo> list = birdLeaveArriveInfoService.selectBirdLeaveArriveInfoList(birdLeaveArriveInfo);
ExcelUtil<BirdLeaveArriveInfo> util = new ExcelUtil<BirdLeaveArriveInfo>(BirdLeaveArriveInfo. class);
util.exportExcel(response, list, "候鸟飞离和抵达时间数据");
}
/**
* 获取候鸟飞离和抵达时间详细信息
*/
@PreAuthorize("@ss.hasPermi('bird:leaveArrive:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(birdLeaveArriveInfoService.selectBirdLeaveArriveInfoById(id));
}
/**
* 新增候鸟飞离和抵达时间
*/
@PreAuthorize("@ss.hasPermi('bird:leaveArrive:add')")
@Log(title = "候鸟飞离和抵达时间", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BirdLeaveArriveInfo birdLeaveArriveInfo) {
return toAjax(birdLeaveArriveInfoService.insertBirdLeaveArriveInfo(birdLeaveArriveInfo));
}
/**
* 修改候鸟飞离和抵达时间
*/
@PreAuthorize("@ss.hasPermi('bird:leaveArrive:edit')")
@Log(title = "候鸟飞离和抵达时间", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BirdLeaveArriveInfo birdLeaveArriveInfo) {
return toAjax(birdLeaveArriveInfoService.updateBirdLeaveArriveInfo(birdLeaveArriveInfo));
}
/**
* 删除候鸟飞离和抵达时间
*/
@PreAuthorize("@ss.hasPermi('bird:leaveArrive:remove')")
@Log(title = "候鸟飞离和抵达时间", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(birdLeaveArriveInfoService.deleteBirdLeaveArriveInfoByIds(ids));
}
}
@@ -0,0 +1,103 @@
package net.hzvtc.bird.controller;
import net.hzvtc.bird.domain.BirdMedia;
import net.hzvtc.bird.service.BirdMediaService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 鸟类媒体Controller
*
* @author admin
* @date 2022-07-19
*/
@RestController
@RequestMapping("/birdInfo/media")
public class BirdMediaController extends BaseController {
@Autowired
private BirdMediaService birdMediaService;
/**
* 查询鸟类媒体列表
*/
// @PreAuthorize("@ss.hasPermi('birdInfo:media:list')")
@GetMapping("/list")
public TableDataInfo list(BirdMedia birdMedia) {
startPage();
List<BirdMedia> list = birdMediaService.selectBirdMediaList(birdMedia);
return getDataTable(list);
}
/**
* 导出鸟类媒体列表
*/
@PreAuthorize("@ss.hasPermi('birdInfo:media:export')")
@Log(title = "鸟类媒体", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BirdMedia birdMedia) {
List<BirdMedia> list = birdMediaService.selectBirdMediaList(birdMedia);
ExcelUtil<BirdMedia> util = new ExcelUtil<BirdMedia>(BirdMedia.class);
util.exportExcel(response, list, "鸟类媒体数据");
}
/**
* 获取鸟类媒体详细信息
*/
@PreAuthorize("@ss.hasPermi('birdInfo:media:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(birdMediaService.selectBirdMediaById(id));
}
/**
* 新增鸟类媒体
*/
@PreAuthorize("@ss.hasPermi('birdInfo:media:add')")
@Log(title = "鸟类媒体", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BirdMedia birdMedia) {
return toAjax(birdMediaService.insertBirdMedia(birdMedia));
}
/**
* 修改鸟类媒体
*/
@PreAuthorize("@ss.hasPermi('birdInfo:media:edit')")
@Log(title = "鸟类媒体", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BirdMedia birdMedia) {
return toAjax(birdMediaService.updateBirdMedia(birdMedia));
}
/**
* 删除鸟类媒体
*/
@PreAuthorize("@ss.hasPermi('birdInfo:media:remove')")
@Log(title = "鸟类媒体", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(birdMediaService.deleteBirdMediaByIds(ids));
}
@PostMapping("/upload")
public AjaxResult upload(MultipartFile file) {
return birdMediaService.uploadFile(file);
}
@GetMapping("/listForPage")
public AjaxResult listByParam(BirdMedia birdMedia) {
return AjaxResult.success(birdMediaService.selectBirdMediaList(birdMedia));
}
}
@@ -0,0 +1,183 @@
package net.hzvtc.bird.controller;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import net.hzvtc.bird.domain.BirdSpecies;
import net.hzvtc.bird.domain.SpeciesAnswer;
import net.hzvtc.bird.domain.SpeciesIntro;
import net.hzvtc.bird.domain.SpeciesList;
import net.hzvtc.bird.service.BirdSpeciesService;
import net.hzvtc.bird.service.SpeciesAnswerService;
import net.hzvtc.bird.service.SpeciesIntroService;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import net.hzvtc.data.check.domain.ResultMedia;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping(value={"/birdInfo/species"})
public class BirdSpeciesController
extends BaseController {
private static final Logger log = LoggerFactory.getLogger(BirdSpeciesController.class);
@Autowired
private BirdSpeciesService birdSpeciesService;
@Autowired
private SpeciesIntroService speciesIntroService;
@Autowired
private SpeciesAnswerService speciesAnswerService;
@GetMapping(value={"/list"})
public TableDataInfo list(BirdSpecies birdSpecies) {
this.startPage();
List<BirdSpecies> list = this.birdSpeciesService.selectBirdSpeciesList(birdSpecies);
return this.getDataTable(list);
}
@PreAuthorize(value="@ss.hasPermi('birdInfo:species:export')")
@Log(title="\u9e1f\u7c7b\u79cd\u7c7b", businessType=BusinessType.EXPORT)
@PostMapping(value={"/export"})
public void export(HttpServletResponse response, BirdSpecies birdSpecies) {
List<BirdSpecies> list = this.birdSpeciesService.selectBirdSpeciesList(birdSpecies);
ExcelUtil util = new ExcelUtil(BirdSpecies.class);
util.exportExcel(response, list, "\u9e1f\u7c7b\u79cd\u7c7b\u6570\u636e");
}
@GetMapping(value={"/{id}"})
public AjaxResult getInfo(@PathVariable(value="id") Long id) {
return AjaxResult.success((Object)((Object)this.birdSpeciesService.selectBirdSpeciesById(id)));
}
@PreAuthorize(value="@ss.hasPermi('birdInfo:species:add')")
@Log(title="\u9e1f\u7c7b\u79cd\u7c7b", businessType=BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BirdSpecies birdSpecies) {
return this.toAjax(this.birdSpeciesService.insertBirdSpecies(birdSpecies));
}
@PreAuthorize(value="@ss.hasPermi('birdInfo:species:edit')")
@Log(title="\u9e1f\u7c7b\u79cd\u7c7b", businessType=BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BirdSpecies birdSpecies) {
return this.toAjax(this.birdSpeciesService.updateBirdSpecies(birdSpecies));
}
@PreAuthorize(value="@ss.hasPermi('birdInfo:species:remove')")
@Log(title="\u9e1f\u7c7b\u79cd\u7c7b", businessType=BusinessType.DELETE)
@DeleteMapping(value={"/{ids}"})
public AjaxResult remove(@PathVariable Long[] ids) {
return this.toAjax(this.birdSpeciesService.deleteBirdSpeciesByIds(ids));
}
@PostMapping(value={"/importData"})
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil util = new ExcelUtil(BirdSpecies.class);
List list = util.importExcel(file.getInputStream());
String message = this.birdSpeciesService.importData(list, updateSupport);
return AjaxResult.success((String)message);
}
@PostMapping(value={"/importTemplate"})
public void importTemplate(HttpServletResponse response) {
ExcelUtil util = new ExcelUtil(BirdSpecies.class);
util.importTemplateExcel(response, "\u9e1f\u7c7b\u6570\u636e");
}
@PostMapping(value={"/birdResultMedias"})
public TableDataInfo getBirdResultMediasByParam(@RequestBody JSONObject params) {
Integer pageNum = params.getInteger("pageNum");
Integer pageSize = params.getInteger("pageSize");
this.startPage(pageNum == null ? 1 : pageNum, pageSize == null ? 10 : pageSize);
List<ResultMedia> list = this.birdSpeciesService.getResultMediaListByParam(params);
return this.getDataTable(list);
}
@PostMapping(value={"/birdResultAudioMedias"})
public TableDataInfo getBirdResultAudioMediasByParam(@RequestBody JSONObject params) {
Integer pageNum = params.getInteger("pageNum");
Integer pageSize = params.getInteger("pageSize");
this.startPage(pageNum == null ? 1 : pageNum, pageSize == null ? 10 : pageSize);
List<ResultMedia> list = this.birdSpeciesService.getResultAudioMediaListByParam(params);
return this.getDataTable(list);
}
@PostMapping(value={"/birdMediaesByParam"})
public TableDataInfo getSpeciesResultMediasByParam(@RequestBody JSONObject params) {
Integer pageNum = params.getInteger("pageNum");
pageNum = pageNum == null ? 1 : pageNum;
Integer pageSize = params.getInteger("pageSize");
pageSize = pageSize == null ? 10 : pageSize;
this.startPage(pageNum, pageSize);
return this.getDataTable(this.birdSpeciesService.getBirdMediaListByParam(params));
}
@PostMapping(value={"/birdMediaesForPageByParam"})
public TableDataInfo getSpeciesResultMediasForPageFirstByParam(@RequestBody JSONObject params) {
return this.getDataTable(this.birdSpeciesService.getBirdMediaListByParam(params));
}
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u9644\u4ef6\u5bfc\u51fa", businessType=BusinessType.EXPORT)
@PostMapping(value={"/mediaExport"})
public void export(HttpServletResponse response, @RequestBody JSONObject params) {
List<ResultMedia> list = this.birdSpeciesService.getResultMediaListByParam(params);
ExcelUtil util = new ExcelUtil(ResultMedia.class);
util.exportExcel(response, list, "\u76d1\u6d4b\u5a92\u4f53\u6570\u636e");
}
@Log(title="media\u6570\u636e\u6062\u590d", businessType=BusinessType.UPDATE)
@PostMapping(value={"/media/recovery"})
public AjaxResult recoverBirdMediaByParam(@RequestBody JSONObject params) {
return AjaxResult.success((Object)this.birdSpeciesService.recoverResultMediaStateByParam(params));
}
@PostMapping(value={"/getListForSelect"})
public AjaxResult getSpeciesSelectListFromDetails(@RequestBody JSONObject params) {
return AjaxResult.success(this.birdSpeciesService.getSpeciesSelectListFromDetails(params));
}
@GetMapping(value={"/getSpeciesListPages"})
public TableDataInfo getSpeciesListPages(SpeciesList speciesList) {
this.startPage();
List<SpeciesList> list = this.birdSpeciesService.getSpeciesListPages();
return this.getDataTable(list);
}
@GetMapping(value={"/getSpeciesIntroListPages"})
public TableDataInfo getSpeciesIntroListPages(SpeciesIntro param) {
this.startPage();
List<SpeciesIntro> list = this.speciesIntroService.getSpeciesIntroList(param);
return this.getDataTable(list);
}
@GetMapping(value={"/getSpeciesIntroOtherListPages"})
public TableDataInfo getSpeciesIntroOtherListPages(SpeciesIntro param) {
this.startPage();
List<SpeciesIntro> list = this.speciesIntroService.getSpeciesIntroOtherList(param);
return this.getDataTable(list);
}
@GetMapping(value={"/getSpeciesAnswerListPages"})
public TableDataInfo getSpeciesAnswerListPages(SpeciesAnswer param) {
this.startPage();
List<SpeciesAnswer> list = this.speciesAnswerService.getSpeciesAnswerList();
return this.getDataTable(list);
}
}
@@ -0,0 +1,18 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="BirdCatalogue")
@Data
public class BirdCatalogue extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
private String scientificName;
private String englishName;
private String description;
}
@@ -0,0 +1,20 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="BirdFamily")
@Data
public class BirdFamily extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String familyName;
private String scientificName;
private String englishName;
private String description;
private Long catalogueId;
private String catalogueName;
}
@@ -0,0 +1,21 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="BirdFlyingInfo")
@Data
public class BirdFlyingInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private Long speciesId;
private String source;
private String sourceLongitude;
private String sourceLatitude;
private String target;
private String targetLongitude;
private String targetLatitude;
}
@@ -0,0 +1,21 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="BirdGenus")
@Data
public class BirdGenus extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
private String scientificName;
private String englishName;
private Long catalogueId;
private Long familyId;
private String description;
private String familyName;
}
@@ -0,0 +1,23 @@
package net.hzvtc.bird.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="BirdLeaveArriveInfo")
@Data
public class BirdLeaveArriveInfo {
private static final long serialVersionUID = 1L;
private Long id;
private Long areaId;
private String name;
private Long speciesId;
private int statYear;
private Date leaveDate;
private String strLeaveDate;
private Date arriveDate;
private String strArriveDate;
private int isDeleted = 0;
}
@@ -0,0 +1,20 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="BirdMedia")
@Data
public class BirdMedia extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private Long speciesId;
private String name;
private String mediaType;
private String url;
private String description;
private Integer pcShow = 0;
}
@@ -0,0 +1,39 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import java.util.List;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="BirdSpecies")
@Data
public class BirdSpecies extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
private String scientificName;
private String englishName;
private String morphology;
private String habitat;
private String voice;
private String distribution;
private String overseasDistribution;
private String domesticDistribution;
private String avatar;
private String protectLevel;
private String protectLevelName;
private String iucn;
private String iucnName;
private String residenceType;
private String speciesType;
private String speciesTypeName;
private Long catalogueId;
private String catalogueName;
private Long familyId;
private String familyName;
private Long genusId;
private String genusName;
private List<BirdMedia> mediaList;
}
@@ -0,0 +1,18 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import org.apache.ibatis.type.Alias;
import lombok.Data;
@Alias(value="SpeciesAnswer")
@Data
public class SpeciesAnswer extends BaseEntity {
private Long id;
private Long speciesId;
private String speciesName;
private String scientificName;
}
@@ -0,0 +1,16 @@
package net.hzvtc.bird.domain;
import org.apache.ibatis.type.Alias;
import lombok.Data;
@Alias(value="SpeciesAnswerItem")
@Data
public class SpeciesAnswerItem {
private Long id;
private String cn;
private String en;
private Long pid;
}
@@ -0,0 +1,25 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import org.apache.ibatis.type.Alias;
import lombok.Data;
@Alias(value="SpeciesIntro")
@Data
public class SpeciesIntro extends BaseEntity {
private Long id;
private Long speciesId;
private String speciesName;
private String scientificName;
private String audio;
private String frame;
private String image;
private String spectrogram;
private String txt;
private String video;
private String videoImg;
}
@@ -0,0 +1,21 @@
package net.hzvtc.bird.domain;
import net.hzvtc.common.core.domain.BaseEntity;
import org.apache.ibatis.type.Alias;
import lombok.Data;
@Alias(value="SpeciesList")
@Data
public class SpeciesList extends BaseEntity {
private Long id;
private String name;
private String scientificName;
private String mediaUrl;
private String catalogueName;
private String familyName;
private String genusName;
}
@@ -0,0 +1,24 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import net.hzvtc.bird.domain.BirdCatalogue;
public interface BirdCatalogueMapper {
public BirdCatalogue selectBirdCatalogueById(Long var1);
public BirdCatalogue selectBirdCatalogueByName(String var1);
public List<BirdCatalogue> selectBirdCatalogueList(BirdCatalogue var1);
public List<BirdCatalogue> getBirdCatalogueSelectList();
public int insertBirdCatalogue(BirdCatalogue var1);
public int updateBirdCatalogue(BirdCatalogue var1);
public int deleteBirdCatalogueById(Long var1);
public int deleteBirdCatalogueByIds(Long[] var1);
}
@@ -0,0 +1,24 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import net.hzvtc.bird.domain.BirdFamily;
public interface BirdFamilyMapper {
public BirdFamily selectBirdFamilyById(Long var1);
public BirdFamily selectBirdFamilyByName(String var1);
public List<BirdFamily> selectBirdFamilyList(BirdFamily var1);
public List<BirdFamily> getBirdFamilyListByCataId(Long var1);
public int insertBirdFamily(BirdFamily var1);
public int updateBirdFamily(BirdFamily var1);
public int deleteBirdFamilyById(Long var1);
public int deleteBirdFamilyByIds(Long[] var1);
}
@@ -0,0 +1,63 @@
package net.hzvtc.bird.mapper;
import net.hzvtc.bird.domain.BirdFlyingInfo;
import java.util.List;
/**
* 鸟类越冬飞行路线图Mapper接口
*
* @author admin
* @date 2022-07-30
*/
public interface BirdFlyingInfoMapper {
/**
* 查询鸟类越冬飞行路线图
*
* @param id 鸟类越冬飞行路线图主键
* @return 鸟类越冬飞行路线图
*/
public BirdFlyingInfo selectBirdFlyingInfoById(Long id);
/**
* 查询鸟类越冬飞行路线图列表
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 鸟类越冬飞行路线图集合
*/
public List<BirdFlyingInfo> selectBirdFlyingInfoList(BirdFlyingInfo birdFlyingInfo);
public List<BirdFlyingInfo> getAllBirdFlyingInfoList();
/**
* 新增鸟类越冬飞行路线图
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 结果
*/
public int insertBirdFlyingInfo(BirdFlyingInfo birdFlyingInfo);
/**
* 修改鸟类越冬飞行路线图
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 结果
*/
public int updateBirdFlyingInfo(BirdFlyingInfo birdFlyingInfo);
/**
* 删除鸟类越冬飞行路线图
*
* @param id 鸟类越冬飞行路线图主键
* @return 结果
*/
public int deleteBirdFlyingInfoById(Long id);
/**
* 批量删除鸟类越冬飞行路线图
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBirdFlyingInfoByIds(Long[] ids);
}
@@ -0,0 +1,24 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import net.hzvtc.bird.domain.BirdGenus;
public interface BirdGenusMapper {
public BirdGenus selectBirdGenusById(Long var1);
public BirdGenus selectBirdGenusByName(String var1);
public List<BirdGenus> selectBirdGenusList(BirdGenus var1);
public List<BirdGenus> getBirdGenusListByFamilyId(Long var1);
public int insertBirdGenus(BirdGenus var1);
public int updateBirdGenus(BirdGenus var1);
public int deleteBirdGenusById(Long var1);
public int deleteBirdGenusByIds(Long[] var1);
}
@@ -0,0 +1,27 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.bird.domain.BirdLeaveArriveInfo;
public interface BirdLeaveArriveInfoMapper {
public BirdLeaveArriveInfo selectBirdLeaveArriveInfoById(Long var1);
public List<BirdLeaveArriveInfo> selectBirdLeaveArriveInfoList(BirdLeaveArriveInfo var1);
public List<BirdLeaveArriveInfo> getBirdArrivalDateByParam(Map<String, Object> var1);
public List<BirdLeaveArriveInfo> getBirdLeaveDateByParam(Map<String, Object> var1);
public int insertBirdLeaveArriveInfo(BirdLeaveArriveInfo var1);
public int batchInsertBirdLeaveArriveInfo(List<BirdLeaveArriveInfo> var1);
public int updateBirdLeaveArriveInfo(BirdLeaveArriveInfo var1);
public int deleteBirdLeaveArriveInfoById(Long var1);
public int deleteBirdLeaveArriveInfoByIds(Long[] var1);
}
@@ -0,0 +1,22 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import net.hzvtc.bird.domain.BirdMedia;
public interface BirdMediaMapper {
public BirdMedia selectBirdMediaById(Long var1);
public List<BirdMedia> selectBirdMediaList(BirdMedia var1);
public int insertBirdMedia(BirdMedia var1);
public int updateBirdMedia(BirdMedia var1);
public int deleteBirdMediaById(Long var1);
public int deleteBirdMediaByIds(Long[] var1);
public String getBirdIconImageBySpeciesId(Long var1);
}
@@ -0,0 +1,42 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.bird.domain.BirdSpecies;
import net.hzvtc.bird.domain.SpeciesList;
public interface BirdSpeciesMapper {
public BirdSpecies selectBirdSpeciesById(Long var1);
public BirdSpecies selectBirdSpeciesForEsById(Long var1);
public BirdSpecies selectBirdSpeciesByName(String var1);
public List<BirdSpecies> selectBirdSpeciesList(BirdSpecies var1);
public List<BirdSpecies> getBirdSpeciesListByQuery(Map<String, Object> var1);
public int insertBirdSpecies(BirdSpecies var1);
public int updateBirdSpecies(BirdSpecies var1);
public int deleteBirdSpeciesById(Long var1);
public int deleteBirdSpeciesByIds(Long[] var1);
public List<BirdSpecies> getBirdSpeciesInfoByName(String var1);
public Long getBirdSpeciesIdByName(String var1);
public Long getBirdSpeciesIdByScientificName(String var1);
public BirdSpecies getBirdSpeciesInfoById(Long var1);
public List<BirdSpecies> getSpeciesSelectListByParam(Map<String, Object> var1);
public List<BirdSpecies> getSpeciesSelectListFromDetails(Map<String, Object> var1);
public List<SpeciesList> getSpeciesListPages();
}
@@ -0,0 +1,15 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import net.hzvtc.bird.domain.SpeciesAnswer;
import net.hzvtc.bird.domain.SpeciesAnswerItem;
public interface SpeciesAnswerMapper {
public int addSpeciesAnswer(SpeciesAnswer var1);
public int batchAddSpeciesAnswerItem(List<SpeciesAnswerItem> var1);
public List<SpeciesAnswer> getSpeciesAnswerList();
}
@@ -0,0 +1,18 @@
package net.hzvtc.bird.mapper;
import java.util.List;
import net.hzvtc.bird.domain.SpeciesIntro;
public interface SpeciesIntroMapper {
public int addSpeciesIntro(SpeciesIntro var1);
public int batchAddSpeciesIntro(List<SpeciesIntro> var1);
public List<SpeciesIntro> getSpeciesIntroList(SpeciesIntro var1);
public List<SpeciesIntro> getSpeciesIntroOtherList(SpeciesIntro var1);
public void updateImageUrl(SpeciesIntro var1);
}
@@ -0,0 +1,26 @@
package net.hzvtc.bird.service;
import java.util.List;
import net.hzvtc.bird.domain.BirdCatalogue;
public interface BirdCatalogueService {
public BirdCatalogue selectBirdCatalogueById(Long var1);
public BirdCatalogue selectBirdCatalogueByName(String var1);
public List<BirdCatalogue> selectBirdCatalogueList(BirdCatalogue var1);
public List<BirdCatalogue> getBirdCatalogueSelectList();
public int insertBirdCatalogue(BirdCatalogue var1);
public int updateBirdCatalogue(BirdCatalogue var1);
public int deleteBirdCatalogueByIds(Long[] var1);
public int deleteBirdCatalogueById(Long var1);
public String importData(List<BirdCatalogue> var1, boolean var2);
}
@@ -0,0 +1,26 @@
package net.hzvtc.bird.service;
import java.util.List;
import net.hzvtc.bird.domain.BirdFamily;
public interface BirdFamilyService {
public BirdFamily selectBirdFamilyById(Long var1);
public List<BirdFamily> selectBirdFamilyList(BirdFamily var1);
public List<BirdFamily> getBirdFamilyListByCataId(Long var1);
public int insertBirdFamily(BirdFamily var1);
public int updateBirdFamily(BirdFamily var1);
public int deleteBirdFamilyByIds(Long[] var1);
public int deleteBirdFamilyById(Long var1);
public String importData(List<BirdFamily> var1, boolean var2);
public BirdFamily selectBirdFamilyByName(String var1);
}
@@ -0,0 +1,63 @@
package net.hzvtc.bird.service;
import net.hzvtc.bird.domain.BirdFlyingInfo;
import java.util.List;
/**
* 鸟类越冬飞行路线图Service接口
*
* @author admin
* @date 2022-07-30
*/
public interface BirdFlyingInfoService {
/**
* 查询鸟类越冬飞行路线图
*
* @param id 鸟类越冬飞行路线图主键
* @return 鸟类越冬飞行路线图
*/
public BirdFlyingInfo selectBirdFlyingInfoById(Long id);
/**
* 查询鸟类越冬飞行路线图列表
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 鸟类越冬飞行路线图集合
*/
public List<BirdFlyingInfo> selectBirdFlyingInfoList(BirdFlyingInfo birdFlyingInfo);
public List<BirdFlyingInfo> getAllBirdFlyingInfoList();
/**
* 新增鸟类越冬飞行路线图
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 结果
*/
public int insertBirdFlyingInfo(BirdFlyingInfo birdFlyingInfo);
/**
* 修改鸟类越冬飞行路线图
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 结果
*/
public int updateBirdFlyingInfo(BirdFlyingInfo birdFlyingInfo);
/**
* 批量删除鸟类越冬飞行路线图
*
* @param ids 需要删除的鸟类越冬飞行路线图主键集合
* @return 结果
*/
public int deleteBirdFlyingInfoByIds(Long[] ids);
/**
* 删除鸟类越冬飞行路线图信息
*
* @param id 鸟类越冬飞行路线图主键
* @return 结果
*/
public int deleteBirdFlyingInfoById(Long id);
}
@@ -0,0 +1,26 @@
package net.hzvtc.bird.service;
import java.util.List;
import net.hzvtc.bird.domain.BirdGenus;
public interface BirdGenusService {
public BirdGenus selectBirdGenusById(Long var1);
public List<BirdGenus> selectBirdGenusList(BirdGenus var1);
public int insertBirdGenus(BirdGenus var1);
public int updateBirdGenus(BirdGenus var1);
public int deleteBirdGenusByIds(Long[] var1);
public int deleteBirdGenusById(Long var1);
public List<BirdGenus> getBirdGenusListByFamilyId(Long var1);
public String importData(List<BirdGenus> var1, boolean var2);
public BirdGenus selectBirdGenusByName(String var1);
}
@@ -0,0 +1,22 @@
package net.hzvtc.bird.service;
import java.util.List;
import net.hzvtc.bird.domain.BirdLeaveArriveInfo;
public interface BirdLeaveArriveInfoService {
public BirdLeaveArriveInfo selectBirdLeaveArriveInfoById(Long var1);
public List<BirdLeaveArriveInfo> selectBirdLeaveArriveInfoList(BirdLeaveArriveInfo var1);
public int insertBirdLeaveArriveInfo(BirdLeaveArriveInfo var1);
public int updateBirdLeaveArriveInfo(BirdLeaveArriveInfo var1);
public int deleteBirdLeaveArriveInfoByIds(Long[] var1);
public int deleteBirdLeaveArriveInfoById(Long var1);
public void calcBirdLeaveArriveInfoByParam();
}
@@ -0,0 +1,26 @@
package net.hzvtc.bird.service;
import java.util.List;
import net.hzvtc.bird.domain.BirdMedia;
import net.hzvtc.common.core.domain.AjaxResult;
import org.springframework.web.multipart.MultipartFile;
public interface BirdMediaService {
public BirdMedia selectBirdMediaById(Long var1);
public List<BirdMedia> selectBirdMediaList(BirdMedia var1);
public int insertBirdMedia(BirdMedia var1);
public int updateBirdMedia(BirdMedia var1);
public int deleteBirdMediaByIds(Long[] var1);
public int deleteBirdMediaById(Long var1);
public AjaxResult uploadFile(MultipartFile var1);
public String getBirdIconImageBySpeciesId(Long var1);
}
@@ -0,0 +1,56 @@
package net.hzvtc.bird.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
import net.hzvtc.bird.domain.BirdSpecies;
import net.hzvtc.bird.domain.SpeciesList;
import net.hzvtc.data.check.domain.ResultMedia;
public interface BirdSpeciesService {
public BirdSpecies selectBirdSpeciesById(Long var1);
public BirdSpecies selectBirdSpeciesByName(String var1);
public List<BirdSpecies> selectBirdSpeciesList(BirdSpecies var1);
public int insertBirdSpecies(BirdSpecies var1);
public int updateBirdSpecies(BirdSpecies var1);
public int deleteBirdSpeciesByIds(Long[] var1);
public int deleteBirdSpeciesById(Long var1);
public String importData(List<BirdSpecies> var1, boolean var2);
public List<ResultMedia> getResultMediaListByParam(JSONObject var1);
public int recoverResultMediaStateByParam(JSONObject var1);
public List<ResultMedia> getResultAudioMediaListByParam(JSONObject var1);
public List<ResultMedia> getBirdMediaListByParam(JSONObject var1);
public List<BirdSpecies> getBirdSpeciesListByQuery(Map<String, Object> var1);
public Long getBirdSpeciesInfoIdByName(String var1);
public Long getBirdSpeciesInfoIdByScientificName(String var1);
public BirdSpecies selectBirdSpeciesForEsById(Long var1);
public BirdSpecies getBirdSpeciesInfoById(Long var1);
public List<BirdSpecies> getSpeciesSelectListByParam(Map<String, Object> var1);
public Long getBirdSpeciesIdByScientificName(String var1);
public Long getBirdSpeciesIdByName(String var1);
public List<BirdSpecies> getSpeciesSelectListFromDetails(JSONObject var1);
public List<SpeciesList> getSpeciesListPages();
}
@@ -0,0 +1,15 @@
package net.hzvtc.bird.service;
import java.util.List;
import net.hzvtc.bird.domain.SpeciesAnswer;
import net.hzvtc.bird.domain.SpeciesAnswerItem;
public interface SpeciesAnswerService {
public void addSpeciesAnswer(SpeciesAnswer var1);
public void batchAddSpeciesAnswerItem(List<SpeciesAnswerItem> var1);
public List<SpeciesAnswer> getSpeciesAnswerList();
}
@@ -0,0 +1,18 @@
package net.hzvtc.bird.service;
import java.util.List;
import net.hzvtc.bird.domain.SpeciesIntro;
public interface SpeciesIntroService {
public int addSpeciesIntro(SpeciesIntro var1);
public void batchAddSpeciesIntro(List<SpeciesIntro> var1);
public List<SpeciesIntro> getSpeciesIntroList(SpeciesIntro var1);
public List<SpeciesIntro> getSpeciesIntroOtherList(SpeciesIntro var1);
public void updateImageUrl(SpeciesIntro var1);
}
@@ -0,0 +1,153 @@
package net.hzvtc.bird.service.impl;
import net.hzvtc.bird.domain.BirdCatalogue;
import net.hzvtc.bird.mapper.BirdCatalogueMapper;
import net.hzvtc.bird.service.BirdCatalogueService;
import net.hzvtc.common.exception.ServiceException;
import net.hzvtc.common.utils.StringUtils;
import net.hzvtc.common.utils.bean.BeanValidators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 鸟类目Service业务层处理
*
* @author admin
* @date 2022-07-16
*/
@Service
public class BirdCatalogueServiceImpl implements BirdCatalogueService {
private static final Logger log = LoggerFactory.getLogger(BirdCatalogueServiceImpl.class);
@Autowired
protected Validator validator;
@Resource
private BirdCatalogueMapper birdCatalogueMapper;
/**
* 查询鸟类目
*
* @param id 鸟类目主键
* @return 鸟类目
*/
@Override
public BirdCatalogue selectBirdCatalogueById(Long id) {
return birdCatalogueMapper.selectBirdCatalogueById(id);
}
@Override
public BirdCatalogue selectBirdCatalogueByName(String name) {
return birdCatalogueMapper.selectBirdCatalogueByName(name);
}
/**
* 查询鸟类目列表
*
* @param birdCatalogue 鸟类目
* @return 鸟类目
*/
@Override
public List<BirdCatalogue> selectBirdCatalogueList(BirdCatalogue birdCatalogue) {
return birdCatalogueMapper.selectBirdCatalogueList(birdCatalogue);
}
@Override
public List<BirdCatalogue> getBirdCatalogueSelectList() {
return birdCatalogueMapper.getBirdCatalogueSelectList();
}
/**
* 新增鸟类目
*
* @param birdCatalogue 鸟类目
* @return 结果
*/
@Override
public int insertBirdCatalogue(BirdCatalogue birdCatalogue) {
return birdCatalogueMapper.insertBirdCatalogue(birdCatalogue);
}
/**
* 修改鸟类目
*
* @param birdCatalogue 鸟类目
* @return 结果
*/
@Override
public int updateBirdCatalogue(BirdCatalogue birdCatalogue) {
return birdCatalogueMapper.updateBirdCatalogue(birdCatalogue);
}
/**
* 批量删除鸟类目
*
* @param ids 需要删除的鸟类目主键
* @return 结果
*/
@Override
public int deleteBirdCatalogueByIds(Long[] ids) {
return birdCatalogueMapper.deleteBirdCatalogueByIds(ids);
}
/**
* 删除鸟类目信息
*
* @param id 鸟类目主键
* @return 结果
*/
@Override
public int deleteBirdCatalogueById(Long id) {
return birdCatalogueMapper.deleteBirdCatalogueById(id);
}
@Override
public String importData(List<BirdCatalogue> list, boolean isUpdateSupport) {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入鸟类目数据不能为空!");
}
AtomicInteger[] successNum = {new AtomicInteger()};
int[] failureNum = {0};
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
list.stream().forEach(data -> {
try {
BirdCatalogue catalogue = birdCatalogueMapper.selectBirdCatalogueByName(data.getName());
if (Objects.isNull(catalogue)) {
BeanValidators.validateWithException(validator, data);
data.setIsDeleted(0);
insertBirdCatalogue(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟类目 " + data.getName() + " 导入成功");
} else if (isUpdateSupport) {
BeanValidators.validateWithException(validator, data);
data.setId(catalogue.getId());
updateBirdCatalogue(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟类目 " + data.getName() + " 更新成功");
} else {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、鸟类目 " + data.getName() + " 已存在");
}
} catch (Exception e) {
failureNum[0]++;
String msg = "<br/>" + failureNum + "、鸟类目 " + data.getName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
});
if (failureNum[0] > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum[0] + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
}
@@ -0,0 +1,165 @@
package net.hzvtc.bird.service.impl;
import net.hzvtc.bird.domain.BirdCatalogue;
import net.hzvtc.bird.domain.BirdFamily;
import net.hzvtc.bird.mapper.BirdFamilyMapper;
import net.hzvtc.bird.service.BirdCatalogueService;
import net.hzvtc.bird.service.BirdFamilyService;
import net.hzvtc.common.exception.ServiceException;
import net.hzvtc.common.utils.StringUtils;
import net.hzvtc.common.utils.bean.BeanValidators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 鸟类科Service业务层处理
*
* @author admin
* @date 2022-07-16
*/
@Service
public class BirdFamilyServiceImpl implements BirdFamilyService {
private static final Logger log = LoggerFactory.getLogger(BirdFamilyServiceImpl.class);
@Autowired
protected Validator validator;
@Resource
private BirdFamilyMapper birdFamilyMapper;
@Autowired
private BirdCatalogueService catalogueService;
/**
* 查询鸟类科
*
* @param id 鸟类科主键
* @return 鸟类科
*/
@Override
public BirdFamily selectBirdFamilyById(Long id) {
return birdFamilyMapper.selectBirdFamilyById(id);
}
/**
* 查询鸟类科列表
*
* @param birdFamily 鸟类科
* @return 鸟类科
*/
@Override
public List<BirdFamily> selectBirdFamilyList(BirdFamily birdFamily) {
return birdFamilyMapper.selectBirdFamilyList(birdFamily);
}
@Override
public List<BirdFamily> getBirdFamilyListByCataId(Long catalogueId) {
return birdFamilyMapper.getBirdFamilyListByCataId(catalogueId);
}
/**
* 新增鸟类科
*
* @param birdFamily 鸟类科
* @return 结果
*/
@Override
public int insertBirdFamily(BirdFamily birdFamily) {
return birdFamilyMapper.insertBirdFamily(birdFamily);
}
/**
* 修改鸟类科
*
* @param birdFamily 鸟类科
* @return 结果
*/
@Override
public int updateBirdFamily(BirdFamily birdFamily) {
return birdFamilyMapper.updateBirdFamily(birdFamily);
}
/**
* 批量删除鸟类科
*
* @param ids 需要删除的鸟类科主键
* @return 结果
*/
@Override
public int deleteBirdFamilyByIds(Long[] ids) {
return birdFamilyMapper.deleteBirdFamilyByIds(ids);
}
/**
* 删除鸟类科信息
*
* @param id 鸟类科主键
* @return 结果
*/
@Override
public int deleteBirdFamilyById(Long id) {
return birdFamilyMapper.deleteBirdFamilyById(id);
}
@Override
public String importData(List<BirdFamily> list, boolean isUpdateSupport) {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入鸟类科数据不能为空!");
}
AtomicInteger[] successNum = {new AtomicInteger()};
int[] failureNum = {0};
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
list.stream().forEach(data -> {
try {
BirdFamily birdFamily = birdFamilyMapper.selectBirdFamilyByName(data.getFamilyName());
BirdCatalogue birdCatalogue = catalogueService.selectBirdCatalogueByName(data.getCatalogueName());
if (Objects.isNull(birdCatalogue)) {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、鸟目 " + data.getFamilyName() + " 不存在");
} else {
if (Objects.isNull(birdFamily)) {
BeanValidators.validateWithException(validator, data);
data.setIsDeleted(0);
data.setCatalogueId(birdCatalogue.getId());
insertBirdFamily(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟科 " + data.getFamilyName() + " 导入成功");
} else if (isUpdateSupport) {
BeanValidators.validateWithException(validator, data);
data.setId(birdFamily.getId());
data.setCatalogueId(birdCatalogue.getId());
updateBirdFamily(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟科 " + data.getFamilyName() + " 更新成功");
} else {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、鸟科 " + data.getFamilyName() + " 已存在");
}
}
} catch (Exception e) {
failureNum[0]++;
String msg = "<br/>" + failureNum + "、鸟科 " + data.getFamilyName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
});
if (failureNum[0] > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum[0] + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
@Override
public BirdFamily selectBirdFamilyByName(String name) {
return birdFamilyMapper.selectBirdFamilyByName(name);
}
}
@@ -0,0 +1,92 @@
package net.hzvtc.bird.service.impl;
import net.hzvtc.bird.domain.BirdFlyingInfo;
import net.hzvtc.bird.mapper.BirdFlyingInfoMapper;
import net.hzvtc.bird.service.BirdFlyingInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 鸟类越冬飞行路线图Service业务层处理
*
* @author admin
* @date 2022-07-30
*/
@Service
public class BirdFlyingInfoServiceImpl implements BirdFlyingInfoService {
@Resource
private BirdFlyingInfoMapper birdFlyingInfoMapper;
/**
* 查询鸟类越冬飞行路线图
*
* @param id 鸟类越冬飞行路线图主键
* @return 鸟类越冬飞行路线图
*/
@Override
public BirdFlyingInfo selectBirdFlyingInfoById(Long id) {
return birdFlyingInfoMapper.selectBirdFlyingInfoById(id);
}
/**
* 查询鸟类越冬飞行路线图列表
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 鸟类越冬飞行路线图
*/
@Override
public List<BirdFlyingInfo> selectBirdFlyingInfoList(BirdFlyingInfo birdFlyingInfo) {
return birdFlyingInfoMapper.selectBirdFlyingInfoList(birdFlyingInfo);
}
@Override
public List<BirdFlyingInfo> getAllBirdFlyingInfoList() {
return birdFlyingInfoMapper.getAllBirdFlyingInfoList();
}
/**
* 新增鸟类越冬飞行路线图
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 结果
*/
@Override
public int insertBirdFlyingInfo(BirdFlyingInfo birdFlyingInfo) {
return birdFlyingInfoMapper.insertBirdFlyingInfo(birdFlyingInfo);
}
/**
* 修改鸟类越冬飞行路线图
*
* @param birdFlyingInfo 鸟类越冬飞行路线图
* @return 结果
*/
@Override
public int updateBirdFlyingInfo(BirdFlyingInfo birdFlyingInfo) {
return birdFlyingInfoMapper.updateBirdFlyingInfo(birdFlyingInfo);
}
/**
* 批量删除鸟类越冬飞行路线图
*
* @param ids 需要删除的鸟类越冬飞行路线图主键
* @return 结果
*/
@Override
public int deleteBirdFlyingInfoByIds(Long[] ids) {
return birdFlyingInfoMapper.deleteBirdFlyingInfoByIds(ids);
}
/**
* 删除鸟类越冬飞行路线图信息
*
* @param id 鸟类越冬飞行路线图主键
* @return 结果
*/
@Override
public int deleteBirdFlyingInfoById(Long id) {
return birdFlyingInfoMapper.deleteBirdFlyingInfoById(id);
}
}
@@ -0,0 +1,170 @@
package net.hzvtc.bird.service.impl;
import net.hzvtc.bird.domain.BirdFamily;
import net.hzvtc.bird.domain.BirdGenus;
import net.hzvtc.bird.mapper.BirdGenusMapper;
import net.hzvtc.bird.service.BirdFamilyService;
import net.hzvtc.bird.service.BirdGenusService;
import net.hzvtc.common.exception.ServiceException;
import net.hzvtc.common.utils.StringUtils;
import net.hzvtc.common.utils.bean.BeanValidators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 鸟类属Service业务层处理
*
* @author admin
* @date 2022-07-18
*/
@Service
public class BirdGenusServiceImpl implements BirdGenusService {
private static final Logger log = LoggerFactory.getLogger(BirdGenusServiceImpl.class);
@Autowired
protected Validator validator;
@Resource
private BirdGenusMapper birdGenusMapper;
@Autowired
private BirdFamilyService familyService;
/**
* 查询鸟类属
*
* @param id 鸟类属主键
* @return 鸟类属
*/
@Override
public BirdGenus selectBirdGenusById(Long id) {
BirdGenus data = birdGenusMapper.selectBirdGenusById(id);
if (data.getFamilyId() != null) {
BirdFamily birdFamily = familyService.selectBirdFamilyById(data.getFamilyId());
data.setCatalogueId(birdFamily.getCatalogueId());
}
return data;
}
/**
* 查询鸟类属列表
*
* @param birdGenus 鸟类属
* @return 鸟类属
*/
@Override
public List<BirdGenus> selectBirdGenusList(BirdGenus birdGenus) {
return birdGenusMapper.selectBirdGenusList(birdGenus);
}
/**
* 新增鸟类属
*
* @param birdGenus 鸟类属
* @return 结果
*/
@Override
public int insertBirdGenus(BirdGenus birdGenus) {
return birdGenusMapper.insertBirdGenus(birdGenus);
}
/**
* 修改鸟类属
*
* @param birdGenus 鸟类属
* @return 结果
*/
@Override
public int updateBirdGenus(BirdGenus birdGenus) {
return birdGenusMapper.updateBirdGenus(birdGenus);
}
/**
* 批量删除鸟类属
*
* @param ids 需要删除的鸟类属主键
* @return 结果
*/
@Override
public int deleteBirdGenusByIds(Long[] ids) {
return birdGenusMapper.deleteBirdGenusByIds(ids);
}
/**
* 删除鸟类属信息
*
* @param id 鸟类属主键
* @return 结果
*/
@Override
public int deleteBirdGenusById(Long id) {
return birdGenusMapper.deleteBirdGenusById(id);
}
@Override
public List<BirdGenus> getBirdGenusListByFamilyId(Long familyId) {
return birdGenusMapper.getBirdGenusListByFamilyId(familyId);
}
@Override
public String importData(List<BirdGenus> list, boolean isUpdateSupport) {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("导入鸟类属数据不能为空!");
}
AtomicInteger[] successNum = {new AtomicInteger()};
int[] failureNum = {0};
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
list.stream().forEach(data -> {
try {
BirdGenus birdGenus = birdGenusMapper.selectBirdGenusByName(data.getName());
BirdFamily birdFamily = familyService.selectBirdFamilyByName(data.getFamilyName());
if (Objects.isNull(birdFamily)) {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、鸟科 " + data.getFamilyName() + " 不存在");
} else {
if (Objects.isNull(birdGenus)) {
BeanValidators.validateWithException(validator, data);
data.setIsDeleted(0);
data.setFamilyId(birdFamily.getId());
insertBirdGenus(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟属 " + data.getFamilyName() + " 导入成功");
} else if (isUpdateSupport) {
BeanValidators.validateWithException(validator, data);
data.setId(birdGenus.getId());
data.setFamilyId(birdFamily.getId());
updateBirdGenus(data);
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "、鸟属 " + data.getFamilyName() + " 更新成功");
} else {
failureNum[0]++;
failureMsg.append("<br/>" + failureNum[0] + "、鸟属 " + data.getFamilyName() + " 已存在");
}
}
} catch (Exception e) {
failureNum[0]++;
String msg = "<br/>" + failureNum + "、鸟属 " + data.getFamilyName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
});
if (failureNum[0] > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum[0] + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
@Override
public BirdGenus selectBirdGenusByName(String name) {
return birdGenusMapper.selectBirdGenusByName(name);
}
}
@@ -0,0 +1,107 @@
package net.hzvtc.bird.service.impl;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import net.hzvtc.bird.domain.BirdLeaveArriveInfo;
import net.hzvtc.bird.mapper.BirdLeaveArriveInfoMapper;
import net.hzvtc.bird.service.BirdLeaveArriveInfoService;
import net.hzvtc.data.check.service.ResultRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class BirdLeaveArriveInfoServiceImpl
implements BirdLeaveArriveInfoService {
private static final Logger log = LoggerFactory.getLogger(BirdLeaveArriveInfoServiceImpl.class);
@Resource
private BirdLeaveArriveInfoMapper birdLeaveArriveInfoMapper;
@Autowired
private ResultRecordService resultRecordService;
@Override
public BirdLeaveArriveInfo selectBirdLeaveArriveInfoById(Long id) {
return this.birdLeaveArriveInfoMapper.selectBirdLeaveArriveInfoById(id);
}
@Override
public List<BirdLeaveArriveInfo> selectBirdLeaveArriveInfoList(BirdLeaveArriveInfo birdLeaveArriveInfo) {
return this.birdLeaveArriveInfoMapper.selectBirdLeaveArriveInfoList(birdLeaveArriveInfo);
}
@Override
public int insertBirdLeaveArriveInfo(BirdLeaveArriveInfo birdLeaveArriveInfo) {
return this.birdLeaveArriveInfoMapper.insertBirdLeaveArriveInfo(birdLeaveArriveInfo);
}
@Override
public int updateBirdLeaveArriveInfo(BirdLeaveArriveInfo birdLeaveArriveInfo) {
return this.birdLeaveArriveInfoMapper.updateBirdLeaveArriveInfo(birdLeaveArriveInfo);
}
@Override
public int deleteBirdLeaveArriveInfoByIds(Long[] ids) {
return this.birdLeaveArriveInfoMapper.deleteBirdLeaveArriveInfoByIds(ids);
}
@Override
public int deleteBirdLeaveArriveInfoById(Long id) {
return this.birdLeaveArriveInfoMapper.deleteBirdLeaveArriveInfoById(id);
}
@Override
public void calcBirdLeaveArriveInfoByParam() {
Integer statYear = LocalDate.now().getYear() - 1;
HashMap<String, Object> map = new HashMap<String, Object>();
List<Long> areaIds = this.resultRecordService.getResultAreaListByParam(map);
ArrayList<BirdLeaveArriveInfo> allList = new ArrayList<BirdLeaveArriveInfo>();
areaIds.stream().forEach(areaId -> {
map.put("areaId", areaId);
map.put("statYear", statYear + 1);
List<BirdLeaveArriveInfo> leaveList = this.birdLeaveArriveInfoMapper.getBirdLeaveDateByParam(map);
map.put("statYear", statYear);
List<BirdLeaveArriveInfo> arriveList = this.birdLeaveArriveInfoMapper.getBirdArrivalDateByParam(map);
leaveList = this.concatList(leaveList, arriveList);
if (leaveList != null) {
leaveList.stream().forEach(item -> {
item.setAreaId((Long)areaId);
item.setStatYear(statYear);
item.setIsDeleted(0);
});
allList.addAll(leaveList);
}
});
if (allList.size() > 0) {
this.birdLeaveArriveInfoMapper.batchInsertBirdLeaveArriveInfo(allList);
}
}
private List<BirdLeaveArriveInfo> concatList(List<BirdLeaveArriveInfo> leaveList, List<BirdLeaveArriveInfo> arriveList) {
if (leaveList == null || leaveList.isEmpty()) {
return arriveList;
}
if (arriveList == null || arriveList.isEmpty()) {
return leaveList;
}
leaveList.stream().forEach(item -> {
List sameList = arriveList.stream().filter(aitem -> aitem.getSpeciesId() == item.getSpeciesId()).collect(Collectors.toList());
if (sameList != null && !sameList.isEmpty()) {
item.setArriveDate(((BirdLeaveArriveInfo)sameList.get(0)).getArriveDate());
}
});
arriveList.stream().forEach(item -> {
List sameList = leaveList.stream().filter(aitem -> aitem.getSpeciesId() == item.getSpeciesId()).collect(Collectors.toList());
if (sameList == null || sameList.size() == 0) {
leaveList.add((BirdLeaveArriveInfo)item);
}
});
return leaveList;
}
}
@@ -0,0 +1,117 @@
package net.hzvtc.bird.service.impl;
import java.io.IOException;
import java.util.List;
import javax.annotation.Resource;
import net.hzvtc.bird.domain.BirdMedia;
import net.hzvtc.bird.mapper.BirdMediaMapper;
import net.hzvtc.bird.service.BirdMediaService;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.redis.RedisCache;
import net.hzvtc.common.utils.DateUtils;
import net.hzvtc.common.utils.file.FileUploadUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@Service
public class BirdMediaServiceImpl
implements BirdMediaService {
@Resource
private BirdMediaMapper birdMediaMapper;
private final RedisCache redisCache;
@Override
public BirdMedia selectBirdMediaById(Long id) {
return this.birdMediaMapper.selectBirdMediaById(id);
}
@Override
public List<BirdMedia> selectBirdMediaList(BirdMedia birdMedia) {
return this.birdMediaMapper.selectBirdMediaList(birdMedia);
}
@Override
public int insertBirdMedia(BirdMedia birdMedia) {
birdMedia.setCreateTime(DateUtils.getNowDate());
return this.birdMediaMapper.insertBirdMedia(birdMedia);
}
@Override
public int updateBirdMedia(BirdMedia birdMedia) {
return this.birdMediaMapper.updateBirdMedia(birdMedia);
}
@Override
public int deleteBirdMediaByIds(Long[] ids) {
return this.birdMediaMapper.deleteBirdMediaByIds(ids);
}
@Override
public int deleteBirdMediaById(Long id) {
return this.birdMediaMapper.deleteBirdMediaById(id);
}
@Override
public AjaxResult uploadFile(MultipartFile file) {
String fileName = file.getOriginalFilename();
String mediaType = this.getMediaType(fileName);
String baseDir = FileUploadUtils.getBirdMediaPath() + "/" + mediaType;
try {
BirdMedia data = new BirdMedia();
String path = FileUploadUtils.upload((String)baseDir, (MultipartFile)file);
data.setMediaType(mediaType);
data.setName(this.removeFileExt(fileName));
data.setUrl(path);
return AjaxResult.success((Object)((Object)data));
}
catch (IOException e) {
return AjaxResult.error((String)e.getMessage());
}
}
@Override
public String getBirdIconImageBySpeciesId(Long speciesId) {
String key = "birdIcon_" + speciesId;
String str = (String)this.redisCache.getCacheObject(key);
if (str == null) {
str = this.birdMediaMapper.getBirdIconImageBySpeciesId(speciesId);
this.redisCache.setCacheObject(key, (Object)str);
}
return str;
}
private String removeFileExt(String fileName) {
int pos = fileName.lastIndexOf(".");
if (pos == -1) {
return fileName;
}
return fileName.substring(0, pos);
}
private String getMediaType(String fileName) {
if (fileName == null) {
return "";
}
int pos = fileName.lastIndexOf(".");
if (pos == -1) {
return "";
}
String ext = fileName.substring(pos + 1);
if (ext.equalsIgnoreCase("png") || ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("jpeg")) {
return "images";
}
if (ext.equalsIgnoreCase("mp3") || ext.equalsIgnoreCase("wav")) {
return "audio";
}
if (ext.equalsIgnoreCase("mp4") || ext.equalsIgnoreCase("mkv") || ext.equalsIgnoreCase("m4v") || ext.equalsIgnoreCase("wmv")) {
return "video";
}
return "file";
}
public BirdMediaServiceImpl(RedisCache redisCache) {
this.redisCache = redisCache;
}
}
@@ -0,0 +1,263 @@
package net.hzvtc.bird.service.impl;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Resource;
import javax.validation.Validator;
import net.hzvtc.bird.domain.BirdGenus;
import net.hzvtc.bird.domain.BirdSpecies;
import net.hzvtc.bird.domain.SpeciesList;
import net.hzvtc.bird.mapper.BirdSpeciesMapper;
import net.hzvtc.bird.service.BirdGenusService;
import net.hzvtc.bird.service.BirdSpeciesService;
import net.hzvtc.common.exception.ServiceException;
import net.hzvtc.common.utils.DateUtils;
import net.hzvtc.common.utils.SecurityUtils;
import net.hzvtc.common.utils.StringUtils;
import net.hzvtc.common.utils.bean.BeanValidators;
import net.hzvtc.data.check.domain.ResultMedia;
import net.hzvtc.data.check.service.ResultMediaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class BirdSpeciesServiceImpl
implements BirdSpeciesService {
private static final Logger log = LoggerFactory.getLogger(BirdSpeciesServiceImpl.class);
@Autowired
protected Validator validator;
@Resource
private BirdSpeciesMapper birdSpeciesMapper;
@Autowired
private BirdGenusService genusService;
@Autowired
private ResultMediaService resultMediaService;
@Override
public BirdSpecies selectBirdSpeciesById(Long id) {
return this.birdSpeciesMapper.selectBirdSpeciesById(id);
}
@Override
public BirdSpecies selectBirdSpeciesByName(String name) {
return this.birdSpeciesMapper.selectBirdSpeciesByName(name);
}
@Override
public List<BirdSpecies> selectBirdSpeciesList(BirdSpecies birdSpecies) {
return this.birdSpeciesMapper.selectBirdSpeciesList(birdSpecies);
}
@Override
public int insertBirdSpecies(BirdSpecies birdSpecies) {
birdSpecies.setCreateTime(DateUtils.getNowDate());
birdSpecies.setIsDeleted(0);
birdSpecies.setCreateBy(SecurityUtils.getUsername());
return this.birdSpeciesMapper.insertBirdSpecies(birdSpecies);
}
@Override
public int updateBirdSpecies(BirdSpecies birdSpecies) {
birdSpecies.setUpdateTime(DateUtils.getNowDate());
birdSpecies.setUpdateBy(SecurityUtils.getUsername());
return this.birdSpeciesMapper.updateBirdSpecies(birdSpecies);
}
@Override
public int deleteBirdSpeciesByIds(Long[] ids) {
return this.birdSpeciesMapper.deleteBirdSpeciesByIds(ids);
}
@Override
public int deleteBirdSpeciesById(Long id) {
return this.birdSpeciesMapper.deleteBirdSpeciesById(id);
}
@Override
public String importData(List<BirdSpecies> list, boolean updateSupport) {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new ServiceException("\u5bfc\u5165\u9e1f\u7c7b\u6570\u636e\u4e0d\u80fd\u4e3a\u7a7a\uff01");
}
AtomicInteger[] successNum = new AtomicInteger[]{new AtomicInteger()};
int[] failureNum = new int[]{0};
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
list.stream().forEach(data -> {
try {
BirdSpecies birdSpecies = this.birdSpeciesMapper.selectBirdSpeciesByName(data.getName());
BirdGenus birdGenus = this.genusService.selectBirdGenusByName(data.getGenusName());
if (Objects.isNull((Object)birdGenus)) {
failureNum[0] = failureNum[0] + 1;
failureMsg.append("<br/>" + failureNum[0] + "\u3001\u9e1f\u5c5e " + data.getGenusName() + " \u4e0d\u5b58\u5728");
} else if (Objects.isNull((Object)birdSpecies)) {
BeanValidators.validateWithException((Validator)this.validator, (Object)data, (Class[])new Class[0]);
data.setIsDeleted(0);
data.setGenusId(birdGenus.getId());
data.setFamilyId(birdGenus.getFamilyId());
this.insertBirdSpecies((BirdSpecies)((Object)data));
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "\u3001\u9e1f\u7c7b " + data.getName() + " \u5bfc\u5165\u6210\u529f");
} else if (updateSupport) {
BeanValidators.validateWithException((Validator)this.validator, (Object)data, (Class[])new Class[0]);
data.setId(birdSpecies.getId());
data.setGenusId(birdGenus.getId());
data.setFamilyId(birdGenus.getFamilyId());
this.updateBirdSpecies((BirdSpecies)((Object)data));
successNum[0].getAndIncrement();
successMsg.append("<br/>" + successNum[0] + "\u3001\u9e1f\u7c7b " + data.getName() + " \u66f4\u65b0\u6210\u529f");
} else {
failureNum[0] = failureNum[0] + 1;
failureMsg.append("<br/>" + failureNum[0] + "\u3001\u9e1f\u7c7b " + data.getName() + " \u5df2\u5b58\u5728");
}
}
catch (Exception e) {
failureNum[0] = failureNum[0] + 1;
String msg = "<br/>" + failureNum + "\u3001\u9e1f\u7c7b " + data.getName() + " \u5bfc\u5165\u5931\u8d25\uff1a";
failureMsg.append(msg + e.getMessage());
log.error(msg, (Throwable)e);
}
});
if (failureNum[0] > 0) {
failureMsg.insert(0, "\u5f88\u62b1\u6b49\uff0c\u5bfc\u5165\u5931\u8d25\uff01\u5171 " + failureNum[0] + " \u6761\u6570\u636e\u683c\u5f0f\u4e0d\u6b63\u786e\uff0c\u9519\u8bef\u5982\u4e0b\uff1a");
throw new ServiceException(failureMsg.toString());
}
successMsg.insert(0, "\u606d\u559c\u60a8\uff0c\u6570\u636e\u5df2\u5168\u90e8\u5bfc\u5165\u6210\u529f\uff01\u5171 " + successNum + " \u6761\uff0c\u6570\u636e\u5982\u4e0b\uff1a");
return successMsg.toString();
}
@Override
public List<ResultMedia> getResultMediaListByParam(JSONObject jsonObject) {
Long mediaId = jsonObject.getLong("mediaId");
if (mediaId != null) {
ArrayList<ResultMedia> list = new ArrayList<ResultMedia>();
ResultMedia data = this.resultMediaService.getResultMediaListById(mediaId);
list.add(data);
return list;
}
return this.resultMediaService.getResultMediaListByParam(this.createQueryParameter(jsonObject));
}
@Override
public int recoverResultMediaStateByParam(JSONObject jsonObject) {
return this.resultMediaService.recoverResultMediaStateByParam(this.createQueryParameter(jsonObject));
}
private Map<String, Object> createQueryParameter(JSONObject jsonObject) {
HashMap<String, Object> map = new HashMap<String, Object>();
Long mediaId = jsonObject.getLong("mediaId");
map.put("mediaId", mediaId);
Long areaId = jsonObject.getLong("areaId");
map.put("areaId", areaId);
String mediaType = jsonObject.getString("mediaType");
map.put("mediaType", mediaType);
Long speciesId = jsonObject.getLong("speciesId");
map.put("speciesId", speciesId);
Long deviceId = jsonObject.getLong("deviceId");
map.put("deviceId", deviceId);
String mediaTypes = jsonObject.getString("mediaTypes");
if (mediaTypes != null && !mediaTypes.isEmpty()) {
String[] arr = mediaTypes.split(",");
map.put("mediaTypes", arr);
}
Integer isDeleted = jsonObject.getInteger("isDeleted");
map.put("isDeleted", isDeleted);
String dateFrom = jsonObject.getString("dateFrom");
map.put("dateFrom", dateFrom);
String dateTo = jsonObject.getString("dateTo");
map.put("dateTo", dateTo);
Integer limit = jsonObject.getInteger("limit");
map.put("limit", limit);
Integer isCommon = jsonObject.getInteger("isCommon");
map.put("isCommon", isCommon);
return map;
}
@Override
public List<ResultMedia> getResultAudioMediaListByParam(JSONObject jsonObject) {
return this.resultMediaService.getResultAudioMediaListByParam(this.createQueryParameter(jsonObject));
}
@Override
public List<ResultMedia> getBirdMediaListByParam(JSONObject jsonObject) {
Map<String, Object> map = this.createQueryParameter(jsonObject);
String dateFrom = jsonObject.getString("dateFrom");
String dateTo = jsonObject.getString("dateTo");
map.put("dateFrom", dateFrom);
map.put("dateTo", dateTo);
Integer recordType = jsonObject.getInteger("recordType");
map.put("recordType", recordType);
Integer recordTypeNot = jsonObject.getInteger("recordTypeNot");
map.put("recordTypeNot", recordTypeNot);
Integer pageLimit = jsonObject.getInteger("pageLimit");
map.put("pageLimit", pageLimit);
return this.resultMediaService.getBirdMediaListByParam(map);
}
@Override
public List<BirdSpecies> getBirdSpeciesListByQuery(Map<String, Object> map) {
return this.birdSpeciesMapper.getBirdSpeciesListByQuery(map);
}
@Override
public Long getBirdSpeciesInfoIdByName(String name) {
List<BirdSpecies> list = this.birdSpeciesMapper.getBirdSpeciesInfoByName(name);
if (list != null && !list.isEmpty()) {
return list.get(0).getId();
}
return null;
}
@Override
public Long getBirdSpeciesInfoIdByScientificName(String name) {
return 0L;
}
@Override
public BirdSpecies selectBirdSpeciesForEsById(Long id) {
return this.birdSpeciesMapper.selectBirdSpeciesForEsById(id);
}
@Override
public BirdSpecies getBirdSpeciesInfoById(Long id) {
return this.birdSpeciesMapper.getBirdSpeciesInfoById(id);
}
@Override
public List<BirdSpecies> getSpeciesSelectListByParam(Map<String, Object> param) {
return this.birdSpeciesMapper.getSpeciesSelectListByParam(param);
}
@Override
public Long getBirdSpeciesIdByScientificName(String name) {
return this.birdSpeciesMapper.getBirdSpeciesIdByScientificName(name);
}
@Override
public Long getBirdSpeciesIdByName(String name) {
return this.birdSpeciesMapper.getBirdSpeciesIdByName(name);
}
@Override
public List<BirdSpecies> getSpeciesSelectListFromDetails(JSONObject params) {
HashMap<String, Object> map = new HashMap<String, Object>();
Integer mediaType = params.getInteger("mediaType");
map.put("mediaType", mediaType);
Integer subType = params.getInteger("subType");
map.put("subType", subType);
return this.birdSpeciesMapper.getSpeciesSelectListFromDetails(map);
}
@Override
public List<SpeciesList> getSpeciesListPages() {
return this.birdSpeciesMapper.getSpeciesListPages();
}
}
@@ -0,0 +1,33 @@
package net.hzvtc.bird.service.impl;
import java.util.List;
import javax.annotation.Resource;
import net.hzvtc.bird.domain.SpeciesAnswer;
import net.hzvtc.bird.domain.SpeciesAnswerItem;
import net.hzvtc.bird.mapper.SpeciesAnswerMapper;
import net.hzvtc.bird.service.SpeciesAnswerService;
import org.springframework.stereotype.Service;
@Service
public class SpeciesAnswerServiceImpl
implements SpeciesAnswerService {
@Resource
private SpeciesAnswerMapper speciesAnswerMapper;
@Override
public void addSpeciesAnswer(SpeciesAnswer speciesAnswer) {
this.speciesAnswerMapper.addSpeciesAnswer(speciesAnswer);
}
@Override
public void batchAddSpeciesAnswerItem(List<SpeciesAnswerItem> list) {
this.speciesAnswerMapper.batchAddSpeciesAnswerItem(list);
}
@Override
public List<SpeciesAnswer> getSpeciesAnswerList() {
return this.speciesAnswerMapper.getSpeciesAnswerList();
}
}
@@ -0,0 +1,42 @@
package net.hzvtc.bird.service.impl;
import java.util.List;
import javax.annotation.Resource;
import net.hzvtc.bird.domain.SpeciesIntro;
import net.hzvtc.bird.mapper.SpeciesIntroMapper;
import net.hzvtc.bird.service.SpeciesIntroService;
import org.springframework.stereotype.Service;
@Service
public class SpeciesIntroServiceImpl
implements SpeciesIntroService {
@Resource
private SpeciesIntroMapper speciesIntroMapper;
@Override
public int addSpeciesIntro(SpeciesIntro data) {
return this.speciesIntroMapper.addSpeciesIntro(data);
}
@Override
public void batchAddSpeciesIntro(List<SpeciesIntro> list) {
this.speciesIntroMapper.batchAddSpeciesIntro(list);
}
@Override
public List<SpeciesIntro> getSpeciesIntroList(SpeciesIntro param) {
return this.speciesIntroMapper.getSpeciesIntroList(param);
}
@Override
public List<SpeciesIntro> getSpeciesIntroOtherList(SpeciesIntro param) {
return this.speciesIntroMapper.getSpeciesIntroOtherList(param);
}
@Override
public void updateImageUrl(SpeciesIntro data) {
this.speciesIntroMapper.updateImageUrl(data);
}
}
@@ -0,0 +1,101 @@
package net.hzvtc.data.check.controller;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import net.hzvtc.data.check.domain.FavoriteMedia;
import net.hzvtc.data.check.service.FavoriteMediaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 收藏的视频Controller
*
* @author admin
* @date 2024-06-18
*/
@RestController
@RequestMapping("/media/favorite")
public class FavoriteMediaController extends BaseController {
@Autowired
private FavoriteMediaService favoriteMediaService;
/**
* 查询收藏的视频列表
*/
@PreAuthorize("@ss.hasPermi('media:favorite:list')")
@GetMapping("/list")
public TableDataInfo list(FavoriteMedia favoriteMedia) {
startPage();
List<FavoriteMedia> list = favoriteMediaService.selectFavoriteMediaList(favoriteMedia);
return getDataTable(list);
}
/**
* 导出收藏的视频列表
*/
@PreAuthorize("@ss.hasPermi('media:favorite:export')")
@Log(title = "收藏的视频", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, FavoriteMedia favoriteMedia) {
List<FavoriteMedia> list = favoriteMediaService.selectFavoriteMediaList(favoriteMedia);
ExcelUtil<FavoriteMedia> util = new ExcelUtil<FavoriteMedia>(FavoriteMedia.class);
util.exportExcel(response, list, "收藏的视频数据");
}
/**
* 获取收藏的视频详细信息
*/
@PreAuthorize("@ss.hasPermi('media:favorite:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(favoriteMediaService.selectFavoriteMediaById(id));
}
/**
* 新增收藏的视频
*/
@PreAuthorize("@ss.hasPermi('media:favorite:add')")
@Log(title = "收藏的视频", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FavoriteMedia favoriteMedia) {
return toAjax(favoriteMediaService.insertFavoriteMedia(favoriteMedia));
}
/**
* 修改收藏的视频
*/
@PreAuthorize("@ss.hasPermi('media:favorite:edit')")
@Log(title = "收藏的视频", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FavoriteMedia favoriteMedia) {
return toAjax(favoriteMediaService.updateFavoriteMedia(favoriteMedia));
}
/**
* 删除收藏的视频
*/
@PreAuthorize("@ss.hasPermi('media:favorite:remove')")
@Log(title = "收藏的视频", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(favoriteMediaService.deleteFavoriteMediaByIds(ids));
}
@GetMapping(value = "/byMediaId/{id}")
public AjaxResult getFavoriteIdByMediaId(@PathVariable("id") Long id) {
return AjaxResult.success(favoriteMediaService.getFavoriteMediaByMediaId(id));
}
@PostMapping("/handle")
public AjaxResult handleAction(@RequestBody FavoriteMedia favoriteMedia) {
return AjaxResult.success(favoriteMediaService.handleAction(favoriteMedia));
}
}
@@ -0,0 +1,23 @@
package net.hzvtc.data.check.controller;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.data.check.service.MediaItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/dataCheck/mediaItem")
public class MediaItemController extends BaseController {
@Autowired
private MediaItemService mediaItemService;
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(mediaItemService.selectMediaItemById(id));
}
}
@@ -0,0 +1,77 @@
package net.hzvtc.data.check.controller;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.poi.ExcelUtil;
import net.hzvtc.data.check.domain.ResultMedia;
import net.hzvtc.data.check.service.ResultMediaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value={"/dataCheck/resultMedia"})
public class ResultMediaController
extends BaseController {
@Autowired
private ResultMediaService resultMediaService;
@PreAuthorize(value="@ss.hasPermi('dataCheck:resultMedia:list')")
@GetMapping(value={"/list"})
public TableDataInfo list(ResultMedia resultMedia) {
this.startPage();
List<ResultMedia> list = this.resultMediaService.selectResultMediaListByParam(resultMedia);
return this.getDataTable(list);
}
@PreAuthorize(value="@ss.hasPermi('dataCheck:resultMedia:export')")
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u9644\u4ef6", businessType=BusinessType.EXPORT)
@PostMapping(value={"/export"})
public void export(HttpServletResponse response, ResultMedia resultMedia) {
List<ResultMedia> list = this.resultMediaService.selectResultMediaList(resultMedia);
ExcelUtil util = new ExcelUtil(ResultMedia.class);
util.exportExcel(response, list, "\u76d1\u6d4b\u5a92\u4f53\u6570\u636e");
}
@PreAuthorize(value="@ss.hasPermi('dataCheck:resultMedia:add')")
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u9644\u4ef6", businessType=BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ResultMedia resultMedia) {
return this.toAjax(this.resultMediaService.insertResultMedia(resultMedia));
}
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u9644\u4ef6", businessType=BusinessType.DELETE)
@DeleteMapping(value={"/{mediaIds}"})
public AjaxResult remove(@PathVariable Long[] mediaIds) {
return this.toAjax(this.resultMediaService.deleteResultMediaByMediaIds(mediaIds));
}
@PostMapping(value={"/updateStatus"})
public AjaxResult updateStatus(@RequestBody ResultMedia param) {
return AjaxResult.success((Object)this.resultMediaService.updateResultMediaStatusByParam(param));
}
@PostMapping(value={"/favoriteList"})
public AjaxResult getFavoriteList(@RequestBody JSONObject object) {
return AjaxResult.success(this.resultMediaService.getFavoriteVideoListByParam(object));
}
@GetMapping(value={"/mediaStatInfo"})
public JSONObject getStatAmount() {
return this.resultMediaService.getResultMediaStatByParam();
}
}
@@ -0,0 +1,180 @@
package net.hzvtc.data.check.controller;
import com.alibaba.fastjson.JSONObject;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.file.FileUtils;
import net.hzvtc.common.utils.poi.ExcelUtil;
import net.hzvtc.data.check.domain.ResultRecord;
import net.hzvtc.data.check.service.ResultRecordExtractService;
import net.hzvtc.data.check.service.ResultRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping(value={"/dataCheck/checkRecord"})
public class ResultRecordController
extends BaseController {
private static final Logger log = LoggerFactory.getLogger(ResultRecordController.class);
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private ResultRecordExtractService resultRecordExtractService;
@PreAuthorize(value="@ss.hasPermi('dataCheck:checkRecord:list')")
@GetMapping(value={"/list"})
public TableDataInfo list(ResultRecord resultRecord) {
this.startPage();
List<ResultRecord> list = this.resultRecordService.selectResultRecordList(resultRecord);
return this.getDataTable(list);
}
@PreAuthorize(value="@ss.hasPermi('dataCheck:checkRecord:export')")
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u8bb0\u5f55", businessType=BusinessType.EXPORT)
@PostMapping(value={"/export"})
public void export(HttpServletResponse response, ResultRecord resultRecord) {
List<ResultRecord> list = this.resultRecordService.selectResultRecordList(resultRecord);
ExcelUtil util = new ExcelUtil(ResultRecord.class);
util.exportExcel(response, list, "\u76d1\u6d4b\u7ed3\u679c\u8bb0\u5f55\u6570\u636e");
}
@PreAuthorize(value="@ss.hasPermi('dataCheck:checkRecord:query')")
@GetMapping(value={"/{recordId}"})
public AjaxResult getInfo(@PathVariable(value="recordId") Long recordId) {
return AjaxResult.success((Object)((Object)this.resultRecordService.selectResultRecordByRecordId(recordId)));
}
@PreAuthorize(value="@ss.hasPermi('dataCheck:checkRecord:add')")
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u8bb0\u5f55", businessType=BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ResultRecord resultRecord) {
return this.toAjax(this.resultRecordService.insertResultRecord(resultRecord));
}
@PreAuthorize(value="@ss.hasPermi('dataCheck:checkRecord:edit')")
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u8bb0\u5f55", businessType=BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ResultRecord resultRecord) {
return this.toAjax(this.resultRecordService.updateResultRecord(resultRecord));
}
@PreAuthorize(value="@ss.hasPermi('dataCheck:checkRecord:remove')")
@Log(title="\u76d1\u6d4b\u7ed3\u679c\u8bb0\u5f55", businessType=BusinessType.DELETE)
@DeleteMapping(value={"/{recordIds}"})
public AjaxResult remove(@PathVariable Long[] recordIds) {
return this.toAjax(this.resultRecordService.deleteResultRecordByRecordIds(recordIds));
}
@PostMapping(value={"/getBirdStatData"})
public AjaxResult getBirdStatData(@RequestBody JSONObject object) {
return AjaxResult.success((Object)this.resultRecordService.getBirdDataStatByParam(object));
}
@PostMapping(value={"/getBirdWeeklyStatData"})
public AjaxResult getBirdWeeklyStatData(@RequestBody JSONObject object) {
return AjaxResult.success((Object)this.resultRecordService.getBirdDataWeeklyStatByParam(object));
}
@PostMapping(value={"/sendEmail"})
public AjaxResult sendEmail(@RequestBody JSONObject object) {
return AjaxResult.success((Object)this.resultRecordService.sendBirdDataStatEmail(object));
}
@PostMapping(value={"/sendWeeklyEmail"})
public AjaxResult sendWeeklyEmail(@RequestBody JSONObject object) {
return AjaxResult.success((Object)this.resultRecordService.sendBirdDataWeeklyStatEmail(object));
}
@PostMapping(value={"/downloadReport"})
public void downloadReport(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
JSONObject obj = new JSONObject();
obj.put("areaId", params.get("areaId"));
obj.put("calcDate", params.get("calcDate"));
String filePath = this.resultRecordService.getBirdDataStatFileByParam(obj);
if (filePath != null) {
try {
String realFileName = System.currentTimeMillis() + ".xlsx";
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
FileUtils.setAttachmentResponseHeader((HttpServletResponse)response, (String)realFileName);
FileUtils.writeBytes((String)filePath, (OutputStream)response.getOutputStream());
}
catch (Exception exception) {
// empty catch block
}
}
}
@PostMapping(value={"/downloadWeeklyReport"})
public void downloadWeeklyReport(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
JSONObject obj = new JSONObject();
obj.put("areaId", params.get("areaId"));
obj.put("calcDate", params.get("calcDate"));
String filePath = this.resultRecordService.getBirdDataWeeklyStatFileByParam(obj);
if (filePath != null) {
try {
String realFileName = System.currentTimeMillis() + ".xlsx";
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
FileUtils.setAttachmentResponseHeader((HttpServletResponse)response, (String)realFileName);
FileUtils.writeBytes((String)filePath, (OutputStream)response.getOutputStream());
}
catch (Exception ex) {
log.error("error", (Throwable)ex);
}
}
}
@GetMapping(value={"/test"})
public void doTest() {
this.resultRecordExtractService.extraAudioRecordDataList();
}
@GetMapping(value={"/maxId"})
public Long getMaxId() {
return this.resultRecordExtractService.getMaxId(null);
}
@GetMapping(value={"/extractAudioList"})
public AjaxResult extractAudioList() {
this.resultRecordExtractService.extraAudioRecordDataList();
return AjaxResult.success();
}
@PostMapping(value={"/savePushDataList"})
public AjaxResult pushResultRecordDataList(@RequestBody JSONObject object) {
return AjaxResult.success((Object)this.resultRecordExtractService.saveResultRecordPostData(object));
}
@PostMapping(value={"/pushDataList"})
public AjaxResult getResultRecordListToPush(@RequestBody JSONObject object) {
return AjaxResult.success((Object)this.resultRecordExtractService.getResultRecordListToPush(object));
}
@PostMapping(value={"/pushFileToServer"})
public AjaxResult receiveFile(@RequestParam(value="file") MultipartFile file, @RequestParam(value="fileName") String fileName) {
return AjaxResult.success((Object)this.resultRecordExtractService.saveRemoteFile(file, fileName));
}
}
@@ -0,0 +1,185 @@
package net.hzvtc.data.check.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import net.hzvtc.common.annotation.Log;
import net.hzvtc.common.core.controller.BaseController;
import net.hzvtc.common.core.domain.AjaxResult;
import net.hzvtc.common.core.page.TableDataInfo;
import net.hzvtc.common.enums.BusinessType;
import net.hzvtc.common.utils.file.FileUtils;
import net.hzvtc.common.utils.poi.ExcelUtil;
import net.hzvtc.data.check.domain.ResultRecordDetails;
import net.hzvtc.data.check.service.ResultRecordDetailsService;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 监测记录详细信息Controller
*
* @author admin
* @date 2022-08-22
*/
@RestController
@RequestMapping("/dataCheck/checkDetails")
public class ResultRecordDetailsController extends BaseController {
@Autowired
private ResultRecordDetailsService resultRecordDetailsService;
/**
* 查询监测记录详细信息列表
*/
// @PreAuthorize("@ss.hasPermi('dataCheck:checkDetails:list')")
@GetMapping("/list")
public TableDataInfo list(ResultRecordDetails resultRecordDetails) {
startPage();
List<ResultRecordDetails> list = resultRecordDetailsService.selectResultRecordDetailsList(resultRecordDetails);
return getDataTable(list);
}
/**
* 导出监测记录详细信息列表
*/
// @PreAuthorize("@ss.hasPermi('dataCheck:checkDetails:export')")
@Log(title = "监测记录详细信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ResultRecordDetails resultRecordDetails) {
List<ResultRecordDetails> list = resultRecordDetailsService.selectResultRecordDetailsList(resultRecordDetails);
ExcelUtil<ResultRecordDetails> util = new ExcelUtil<ResultRecordDetails>(ResultRecordDetails.class);
util.exportExcel(response, list, "监测记录详细信息数据");
}
/**
* 获取监测记录详细信息详细信息
*/
// @PreAuthorize("@ss.hasPermi('dataCheck:checkDetails:query')")
@GetMapping(value = "/{detailsId}")
public AjaxResult getInfo(@PathVariable("detailsId") Long detailsId) {
return AjaxResult.success(resultRecordDetailsService.selectResultRecordDetailsByDetailsId(detailsId));
}
/**
* 新增监测记录详细信息
*/
// @PreAuthorize("@ss.hasPermi('dataCheck:checkDetails:add')")
@Log(title = "监测记录详细信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ResultRecordDetails resultRecordDetails) {
return toAjax(resultRecordDetailsService.insertResultRecordDetails(resultRecordDetails));
}
/**
* 修改监测记录详细信息
*/
// @PreAuthorize("@ss.hasPermi('dataCheck:checkDetails:edit')")
@Log(title = "监测记录详细信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ResultRecordDetails resultRecordDetails) {
return toAjax(resultRecordDetailsService.updateResultRecordDetails(resultRecordDetails));
}
@PostMapping("/updateByIds")
public AjaxResult updateByIds(@RequestBody JSONObject object) {
return toAjax(resultRecordDetailsService.updateResultRecordDetailsByIds(object));
}
/**
* 删除监测记录详细信息
*/
// @PreAuthorize("@ss.hasPermi('dataCheck:checkDetails:remove')")
@Log(title = "监测记录详细信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{detailsIds}")
public AjaxResult remove(@PathVariable Long[] detailsIds) {
return toAjax(resultRecordDetailsService.deleteResultRecordDetailsByDetailsIds(detailsIds));
}
@PostMapping("/areaSpeciesListByParam")
public AjaxResult getSpeciesListByParam(@RequestBody JSONObject params) {
return AjaxResult.success(resultRecordDetailsService.getSpeciesListByParam(params));
}
@PostMapping("/updateCheckState")
public AjaxResult updateCheckedState(@RequestBody JSONObject params) {
Long id = params.getLong("id");
return AjaxResult.success(resultRecordDetailsService.updateResultRecordDetailsCheckState(id));
}
@PostMapping("/updateCheckStateByIds")
public AjaxResult updateCheckedStateByIds(@RequestBody JSONObject params) {
String ids = params.getString("ids");
return AjaxResult.success(resultRecordDetailsService.updateResultRecordDetailsCheckState(ids));
}
@PostMapping("/delRecordDetails")
public AjaxResult delRecordDetails(@RequestBody JSONObject obj) {
return AjaxResult.success(resultRecordDetailsService.deleteResultRecordDetails(obj));
}
@PostMapping("/delRecordDetailsByIds")
public AjaxResult delRecordDetailsByIds(@RequestBody JSONObject object) {
return AjaxResult.success(resultRecordDetailsService.deleteResultRecordDetailsByParam(object));
}
@GetMapping("/speciesListByUserId")
public AjaxResult getSpeciesListByUserId(Long areaId) {
return AjaxResult.success(resultRecordDetailsService.getSpeciesListByUserId(areaId));
}
@PostMapping("/speciesMediaList")
public TableDataInfo getSpeciesMediaListByParam(@RequestBody JSONObject params) {
Integer pageNum = params.getInteger("pageNum");
Integer pageSize = params.getInteger("pageSize");
startPage(pageNum == null ? 1 : pageNum, pageSize == null ? 10 : pageSize);
List<BirdStatDataVo> list = resultRecordDetailsService.getSpeciesMediaListByParam(params);
return getDataTable(list);
}
@PostMapping("/speciesHourAmount")
public JSONArray getSpeciesHourAmountListByParam(@RequestBody JSONObject params) {
return resultRecordDetailsService.getSpeciesHourAmountListByParam(params);
}
@PostMapping("/speciesAudioAmountListByParam")
public JSONObject getSpeciesAudioAmountReportByParam(@RequestBody JSONObject param) {
return resultRecordDetailsService.getSpeciesAudioAmountReportByParam(param);
}
@PostMapping("/audioReportList")
public List<BirdStatDataVo> getAudioStatListByParam(@RequestBody JSONObject param) {
return resultRecordDetailsService.getAudioStatListByParam(param);
}
@PostMapping("/audioErrorStat")
public long getAudioErrorStatByParam(@RequestBody JSONObject param) {
return resultRecordDetailsService.getAudioErrorStatByParam(param);
}
@PostMapping("/updateStatus")
public AjaxResult updateStatus(@RequestBody JSONObject param) {
return AjaxResult.success(resultRecordDetailsService.updateResultRecordDetailsStatusById(param));
}
@PostMapping("/downloadAudioReport")
public void downloadAudioReport(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
String filePath = resultRecordDetailsService.createAudioReportFile(params);
if (filePath != null) {
try {
String realFileName = System.currentTimeMillis() + ".xlsx";
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
@@ -0,0 +1,17 @@
package net.hzvtc.data.check.domain;
import java.util.Date;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="FavoriteMedia")
@Data
public class FavoriteMedia {
private static final long serialVersionUID = 1L;
private Long id;
private Long mediaId;
private Long userId;
private Date createDate;
private int isDeleted;
}
@@ -0,0 +1,22 @@
package net.hzvtc.data.check.domain;
import lombok.Data;
import net.hzvtc.common.annotation.Excel;
import org.apache.ibatis.type.Alias;
@Alias(value="MediaItem")
@Data
public class MediaItem {
private static final long serialVersionUID = 1L;
private Long id;
private Long deviceId;
private double cameraVolt;
private double solarVolt;
private double extraVolt;
private double temperature;
private double humidity;
private double atmosphere;
private String lat;
private String lon;
private Long parentId;
}
@@ -0,0 +1,467 @@
package net.hzvtc.data.check.domain;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import net.hzvtc.common.annotation.Excel;
import net.hzvtc.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.type.Alias;
@Alias(value="ResultMedia")
public class ResultMedia
extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long mediaId;
private Long areaId;
private String areaName;
@Excel(name="\u8bbe\u5907id")
private Long deviceId;
@Excel(name="\u8bbe\u5907\u540d\u79f0")
private String deviceName;
@Excel(name="\u7c7b\u578b")
private Integer mediaType;
@Excel(name="\u5a92\u4f53url")
private String mediaUrl;
@Excel(name="\u89c6\u9891\u53ca\u58f0\u97f3URL")
private String metaUrl;
@JsonFormat(pattern="yyyy\u5e74MM\u6708dd\u65e5 HH:mm:ss", timezone="GMT+8")
@Excel(name="\u65f6\u95f4", width=30.0, dateFormat="yyyy\u5e74MM\u6708dd\u65e5 HH\u65f6mm\u5206ss\u79d2")
private Date time;
private String strTime;
private Integer width;
private Integer height;
private Long speciesId;
private String speciesName;
private Integer limit;
private int isDeleted;
private Long itemId;
private Long oldMediaId;
private BigDecimal longitude;
private BigDecimal latitude;
private String description;
private Integer subType;
private String fileUrl;
private List<JSONObject> array;
public String getMediaTypeName() {
if (this.mediaType == null) {
return null;
}
if (this.mediaType == 1) {
return "audio";
}
if (this.mediaType == 2) {
return "image";
}
if (this.mediaType == 3) {
return "video";
}
if (this.mediaType == 4) {
return "real";
}
return "";
}
public String toString() {
return new ToStringBuilder((Object)this, ToStringStyle.MULTI_LINE_STYLE).append("mediaId", (Object)this.getMediaId()).append("deviceId", (Object)this.getDeviceId()).append("mediaType", (Object)this.getMediaType()).append("mediaUrl", (Object)this.getMediaUrl()).append("metaUrl", (Object)this.getMetaUrl()).append("time", (Object)this.getTime()).toString();
}
public static ResultMedia parserObject(JSONObject object) {
ResultMedia data = new ResultMedia();
data.setMediaId(object.getLong("mediaId"));
data.setDeviceId(object.getLong("deviceId"));
data.setMediaType(object.getInteger("mediaType"));
data.setMediaUrl(object.getString("mediaUrl"));
data.setMetaUrl(object.getString("metaUrl"));
data.setStrTime(object.getString("strTime"));
data.setWidth(object.getInteger("width"));
data.setHeight(object.getInteger("height"));
data.setIsDeleted(object.getInteger("isDeleted"));
return data;
}
public Long getMediaId() {
return this.mediaId;
}
public Long getAreaId() {
return this.areaId;
}
public String getAreaName() {
return this.areaName;
}
public Long getDeviceId() {
return this.deviceId;
}
public String getDeviceName() {
return this.deviceName;
}
public Integer getMediaType() {
return this.mediaType;
}
public String getMediaUrl() {
return this.mediaUrl;
}
public String getMetaUrl() {
return this.metaUrl;
}
public Date getTime() {
return this.time;
}
public String getStrTime() {
return this.strTime;
}
public Integer getWidth() {
return this.width;
}
public Integer getHeight() {
return this.height;
}
public Long getSpeciesId() {
return this.speciesId;
}
public String getSpeciesName() {
return this.speciesName;
}
public Integer getLimit() {
return this.limit;
}
public int getIsDeleted() {
return this.isDeleted;
}
public Long getItemId() {
return this.itemId;
}
public Long getOldMediaId() {
return this.oldMediaId;
}
public BigDecimal getLongitude() {
return this.longitude;
}
public BigDecimal getLatitude() {
return this.latitude;
}
public String getDescription() {
return this.description;
}
public Integer getSubType() {
return this.subType;
}
public String getFileUrl() {
return this.fileUrl;
}
public List<JSONObject> getArray() {
return this.array;
}
public void setMediaId(Long mediaId) {
this.mediaId = mediaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public void setMediaType(Integer mediaType) {
this.mediaType = mediaType;
}
public void setMediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
}
public void setMetaUrl(String metaUrl) {
this.metaUrl = metaUrl;
}
@JsonFormat(pattern="yyyy\u5e74MM\u6708dd\u65e5 HH:mm:ss", timezone="GMT+8")
public void setTime(Date time) {
this.time = time;
}
public void setStrTime(String strTime) {
this.strTime = strTime;
}
public void setWidth(Integer width) {
this.width = width;
}
public void setHeight(Integer height) {
this.height = height;
}
public void setSpeciesId(Long speciesId) {
this.speciesId = speciesId;
}
public void setSpeciesName(String speciesName) {
this.speciesName = speciesName;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public void setIsDeleted(int isDeleted) {
this.isDeleted = isDeleted;
}
public void setItemId(Long itemId) {
this.itemId = itemId;
}
public void setOldMediaId(Long oldMediaId) {
this.oldMediaId = oldMediaId;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public void setLatitude(BigDecimal latitude) {
this.latitude = latitude;
}
public void setDescription(String description) {
this.description = description;
}
public void setSubType(Integer subType) {
this.subType = subType;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public void setArray(List<JSONObject> array) {
this.array = array;
}
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ResultMedia)) {
return false;
}
ResultMedia other = (ResultMedia)((Object)o);
if (!other.canEqual((Object)this)) {
return false;
}
if (this.getIsDeleted() != other.getIsDeleted()) {
return false;
}
Long this$mediaId = this.getMediaId();
Long other$mediaId = other.getMediaId();
if (this$mediaId == null ? other$mediaId != null : !((Object)this$mediaId).equals(other$mediaId)) {
return false;
}
Long this$areaId = this.getAreaId();
Long other$areaId = other.getAreaId();
if (this$areaId == null ? other$areaId != null : !((Object)this$areaId).equals(other$areaId)) {
return false;
}
Long this$deviceId = this.getDeviceId();
Long other$deviceId = other.getDeviceId();
if (this$deviceId == null ? other$deviceId != null : !((Object)this$deviceId).equals(other$deviceId)) {
return false;
}
Integer this$mediaType = this.getMediaType();
Integer other$mediaType = other.getMediaType();
if (this$mediaType == null ? other$mediaType != null : !((Object)this$mediaType).equals(other$mediaType)) {
return false;
}
Integer this$width = this.getWidth();
Integer other$width = other.getWidth();
if (this$width == null ? other$width != null : !((Object)this$width).equals(other$width)) {
return false;
}
Integer this$height = this.getHeight();
Integer other$height = other.getHeight();
if (this$height == null ? other$height != null : !((Object)this$height).equals(other$height)) {
return false;
}
Long this$speciesId = this.getSpeciesId();
Long other$speciesId = other.getSpeciesId();
if (this$speciesId == null ? other$speciesId != null : !((Object)this$speciesId).equals(other$speciesId)) {
return false;
}
Integer this$limit = this.getLimit();
Integer other$limit = other.getLimit();
if (this$limit == null ? other$limit != null : !((Object)this$limit).equals(other$limit)) {
return false;
}
Long this$itemId = this.getItemId();
Long other$itemId = other.getItemId();
if (this$itemId == null ? other$itemId != null : !((Object)this$itemId).equals(other$itemId)) {
return false;
}
Long this$oldMediaId = this.getOldMediaId();
Long other$oldMediaId = other.getOldMediaId();
if (this$oldMediaId == null ? other$oldMediaId != null : !((Object)this$oldMediaId).equals(other$oldMediaId)) {
return false;
}
Integer this$subType = this.getSubType();
Integer other$subType = other.getSubType();
if (this$subType == null ? other$subType != null : !((Object)this$subType).equals(other$subType)) {
return false;
}
String this$areaName = this.getAreaName();
String other$areaName = other.getAreaName();
if (this$areaName == null ? other$areaName != null : !this$areaName.equals(other$areaName)) {
return false;
}
String this$deviceName = this.getDeviceName();
String other$deviceName = other.getDeviceName();
if (this$deviceName == null ? other$deviceName != null : !this$deviceName.equals(other$deviceName)) {
return false;
}
String this$mediaUrl = this.getMediaUrl();
String other$mediaUrl = other.getMediaUrl();
if (this$mediaUrl == null ? other$mediaUrl != null : !this$mediaUrl.equals(other$mediaUrl)) {
return false;
}
String this$metaUrl = this.getMetaUrl();
String other$metaUrl = other.getMetaUrl();
if (this$metaUrl == null ? other$metaUrl != null : !this$metaUrl.equals(other$metaUrl)) {
return false;
}
Date this$time = this.getTime();
Date other$time = other.getTime();
if (this$time == null ? other$time != null : !((Object)this$time).equals(other$time)) {
return false;
}
String this$strTime = this.getStrTime();
String other$strTime = other.getStrTime();
if (this$strTime == null ? other$strTime != null : !this$strTime.equals(other$strTime)) {
return false;
}
String this$speciesName = this.getSpeciesName();
String other$speciesName = other.getSpeciesName();
if (this$speciesName == null ? other$speciesName != null : !this$speciesName.equals(other$speciesName)) {
return false;
}
BigDecimal this$longitude = this.getLongitude();
BigDecimal other$longitude = other.getLongitude();
if (this$longitude == null ? other$longitude != null : !((Object)this$longitude).equals(other$longitude)) {
return false;
}
BigDecimal this$latitude = this.getLatitude();
BigDecimal other$latitude = other.getLatitude();
if (this$latitude == null ? other$latitude != null : !((Object)this$latitude).equals(other$latitude)) {
return false;
}
String this$description = this.getDescription();
String other$description = other.getDescription();
if (this$description == null ? other$description != null : !this$description.equals(other$description)) {
return false;
}
String this$fileUrl = this.getFileUrl();
String other$fileUrl = other.getFileUrl();
if (this$fileUrl == null ? other$fileUrl != null : !this$fileUrl.equals(other$fileUrl)) {
return false;
}
List<JSONObject> this$array = this.getArray();
List<JSONObject> other$array = other.getArray();
return !(this$array == null ? other$array != null : !((Object)this$array).equals(other$array));
}
protected boolean canEqual(Object other) {
return other instanceof ResultMedia;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
result = result * 59 + this.getIsDeleted();
Long $mediaId = this.getMediaId();
result = result * 59 + ($mediaId == null ? 43 : ((Object)$mediaId).hashCode());
Long $areaId = this.getAreaId();
result = result * 59 + ($areaId == null ? 43 : ((Object)$areaId).hashCode());
Long $deviceId = this.getDeviceId();
result = result * 59 + ($deviceId == null ? 43 : ((Object)$deviceId).hashCode());
Integer $mediaType = this.getMediaType();
result = result * 59 + ($mediaType == null ? 43 : ((Object)$mediaType).hashCode());
Integer $width = this.getWidth();
result = result * 59 + ($width == null ? 43 : ((Object)$width).hashCode());
Integer $height = this.getHeight();
result = result * 59 + ($height == null ? 43 : ((Object)$height).hashCode());
Long $speciesId = this.getSpeciesId();
result = result * 59 + ($speciesId == null ? 43 : ((Object)$speciesId).hashCode());
Integer $limit = this.getLimit();
result = result * 59 + ($limit == null ? 43 : ((Object)$limit).hashCode());
Long $itemId = this.getItemId();
result = result * 59 + ($itemId == null ? 43 : ((Object)$itemId).hashCode());
Long $oldMediaId = this.getOldMediaId();
result = result * 59 + ($oldMediaId == null ? 43 : ((Object)$oldMediaId).hashCode());
Integer $subType = this.getSubType();
result = result * 59 + ($subType == null ? 43 : ((Object)$subType).hashCode());
String $areaName = this.getAreaName();
result = result * 59 + ($areaName == null ? 43 : $areaName.hashCode());
String $deviceName = this.getDeviceName();
result = result * 59 + ($deviceName == null ? 43 : $deviceName.hashCode());
String $mediaUrl = this.getMediaUrl();
result = result * 59 + ($mediaUrl == null ? 43 : $mediaUrl.hashCode());
String $metaUrl = this.getMetaUrl();
result = result * 59 + ($metaUrl == null ? 43 : $metaUrl.hashCode());
Date $time = this.getTime();
result = result * 59 + ($time == null ? 43 : ((Object)$time).hashCode());
String $strTime = this.getStrTime();
result = result * 59 + ($strTime == null ? 43 : $strTime.hashCode());
String $speciesName = this.getSpeciesName();
result = result * 59 + ($speciesName == null ? 43 : $speciesName.hashCode());
BigDecimal $longitude = this.getLongitude();
result = result * 59 + ($longitude == null ? 43 : ((Object)$longitude).hashCode());
BigDecimal $latitude = this.getLatitude();
result = result * 59 + ($latitude == null ? 43 : ((Object)$latitude).hashCode());
String $description = this.getDescription();
result = result * 59 + ($description == null ? 43 : $description.hashCode());
String $fileUrl = this.getFileUrl();
result = result * 59 + ($fileUrl == null ? 43 : $fileUrl.hashCode());
List<JSONObject> $array = this.getArray();
result = result * 59 + ($array == null ? 43 : ((Object)$array).hashCode());
return result;
}
}
@@ -0,0 +1,209 @@
package net.hzvtc.data.check.domain;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
import net.hzvtc.common.annotation.Excel;
import net.hzvtc.common.core.domain.BaseEntity;
import net.hzvtc.data.check.domain.ResultRecordDetails;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.type.Alias;
@Alias(value="ResultRecord")
public class ResultRecord
extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long recordId;
@Excel(name="\u8bbe\u5907id")
private Long deviceId;
@Excel(name="\u8bbe\u5907\u540d\u79f0")
private String deviceName;
private Long areaId;
@JsonFormat(pattern="yyyy-MM-dd")
@Excel(name="\u76d1\u6d4b\u65f6\u95f4", width=30.0, dateFormat="yyyy-MM-dd HH:mm:ss")
private Date recordTime;
private String strRecordTime;
@Excel(name="\u76d1\u6d4b\u7c7b\u578b")
private String recordType;
private Long oldRecordId;
private List<ResultRecordDetails> list;
public String toString() {
return new ToStringBuilder((Object)this, ToStringStyle.MULTI_LINE_STYLE).append("recordId", (Object)this.getRecordId()).append("deviceId", (Object)this.getDeviceId()).append("recordTime", (Object)this.getRecordTime()).append("recordType", (Object)this.getRecordType()).toString();
}
public static ResultRecord parserObject(JSONObject object) {
ResultRecord data = new ResultRecord();
data.setRecordId(object.getLong("recordId"));
data.setRecordType(object.getString("recordType"));
data.setDeviceId(object.getLong("deviceId"));
data.setStrRecordTime(object.getString("strRecordTime"));
JSONArray array = JSONArray.parseArray((String)object.getString("list"));
if (array != null) {
data.setList(array.toJavaList(ResultRecordDetails.class));
}
return data;
}
public Long getRecordId() {
return this.recordId;
}
public Long getDeviceId() {
return this.deviceId;
}
public String getDeviceName() {
return this.deviceName;
}
public Long getAreaId() {
return this.areaId;
}
public Date getRecordTime() {
return this.recordTime;
}
public String getStrRecordTime() {
return this.strRecordTime;
}
public String getRecordType() {
return this.recordType;
}
public Long getOldRecordId() {
return this.oldRecordId;
}
public List<ResultRecordDetails> getList() {
return this.list;
}
public void setRecordId(Long recordId) {
this.recordId = recordId;
}
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
@JsonFormat(pattern="yyyy-MM-dd")
public void setRecordTime(Date recordTime) {
this.recordTime = recordTime;
}
public void setStrRecordTime(String strRecordTime) {
this.strRecordTime = strRecordTime;
}
public void setRecordType(String recordType) {
this.recordType = recordType;
}
public void setOldRecordId(Long oldRecordId) {
this.oldRecordId = oldRecordId;
}
public void setList(List<ResultRecordDetails> list) {
this.list = list;
}
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ResultRecord)) {
return false;
}
ResultRecord other = (ResultRecord)((Object)o);
if (!other.canEqual((Object)this)) {
return false;
}
Long this$recordId = this.getRecordId();
Long other$recordId = other.getRecordId();
if (this$recordId == null ? other$recordId != null : !((Object)this$recordId).equals(other$recordId)) {
return false;
}
Long this$deviceId = this.getDeviceId();
Long other$deviceId = other.getDeviceId();
if (this$deviceId == null ? other$deviceId != null : !((Object)this$deviceId).equals(other$deviceId)) {
return false;
}
Long this$areaId = this.getAreaId();
Long other$areaId = other.getAreaId();
if (this$areaId == null ? other$areaId != null : !((Object)this$areaId).equals(other$areaId)) {
return false;
}
Long this$oldRecordId = this.getOldRecordId();
Long other$oldRecordId = other.getOldRecordId();
if (this$oldRecordId == null ? other$oldRecordId != null : !((Object)this$oldRecordId).equals(other$oldRecordId)) {
return false;
}
String this$deviceName = this.getDeviceName();
String other$deviceName = other.getDeviceName();
if (this$deviceName == null ? other$deviceName != null : !this$deviceName.equals(other$deviceName)) {
return false;
}
Date this$recordTime = this.getRecordTime();
Date other$recordTime = other.getRecordTime();
if (this$recordTime == null ? other$recordTime != null : !((Object)this$recordTime).equals(other$recordTime)) {
return false;
}
String this$strRecordTime = this.getStrRecordTime();
String other$strRecordTime = other.getStrRecordTime();
if (this$strRecordTime == null ? other$strRecordTime != null : !this$strRecordTime.equals(other$strRecordTime)) {
return false;
}
String this$recordType = this.getRecordType();
String other$recordType = other.getRecordType();
if (this$recordType == null ? other$recordType != null : !this$recordType.equals(other$recordType)) {
return false;
}
List<ResultRecordDetails> this$list = this.getList();
List<ResultRecordDetails> other$list = other.getList();
return !(this$list == null ? other$list != null : !((Object)this$list).equals(other$list));
}
protected boolean canEqual(Object other) {
return other instanceof ResultRecord;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
Long $recordId = this.getRecordId();
result = result * 59 + ($recordId == null ? 43 : ((Object)$recordId).hashCode());
Long $deviceId = this.getDeviceId();
result = result * 59 + ($deviceId == null ? 43 : ((Object)$deviceId).hashCode());
Long $areaId = this.getAreaId();
result = result * 59 + ($areaId == null ? 43 : ((Object)$areaId).hashCode());
Long $oldRecordId = this.getOldRecordId();
result = result * 59 + ($oldRecordId == null ? 43 : ((Object)$oldRecordId).hashCode());
String $deviceName = this.getDeviceName();
result = result * 59 + ($deviceName == null ? 43 : $deviceName.hashCode());
Date $recordTime = this.getRecordTime();
result = result * 59 + ($recordTime == null ? 43 : ((Object)$recordTime).hashCode());
String $strRecordTime = this.getStrRecordTime();
result = result * 59 + ($strRecordTime == null ? 43 : $strRecordTime.hashCode());
String $recordType = this.getRecordType();
result = result * 59 + ($recordType == null ? 43 : $recordType.hashCode());
List<ResultRecordDetails> $list = this.getList();
result = result * 59 + ($list == null ? 43 : ((Object)$list).hashCode());
return result;
}
}
@@ -0,0 +1,345 @@
package net.hzvtc.data.check.domain;
import com.alibaba.fastjson.JSONObject;
import java.io.Serializable;
import net.hzvtc.common.annotation.Excel;
import net.hzvtc.data.check.domain.ResultMedia;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.type.Alias;
@Alias(value="ResultRecordDetails")
public class ResultRecordDetails
implements Serializable {
private static final long serialVersionUID = 1L;
private Long detailsId;
@Excel(name="\u8bb0\u5f55id")
private Long recordId;
@Excel(name="\u7269\u79cdid")
private Long speciesId;
@Excel(name="\u7269\u79cd\u540d\u79f0")
private String speciesName;
@Excel(name="\u751f\u5883")
private String habitat;
@Excel(name="\u6570\u91cf")
private int count;
@Excel(name="\u4f4d\u7f6e")
private String location;
@Excel(name="\u7f6e\u4fe1\u5ea6")
private double confidence;
@Excel(name="\u5a92\u4f53id")
private Long mediaId;
@Excel(name="\u4f4d\u7f6e\u6a2a\u5750\u6807")
private String locationSiteX;
@Excel(name="\u4f4d\u7f6e\u7eb5\u5750\u6807")
private String locationSiteY;
private boolean checked;
private int isDeleted = 0;
private ResultMedia resultMedia;
private Long oldRecordId;
private Long oldMediaId;
private Long areaId;
private String recordTime;
public String toString() {
return new ToStringBuilder((Object)this, ToStringStyle.MULTI_LINE_STYLE).append("detailsId", (Object)this.getDetailsId()).append("recordId", (Object)this.getRecordId()).append("speciesId", (Object)this.getSpeciesId()).append("habitat", (Object)this.getHabitat()).append("count", this.getCount()).append("location", (Object)this.getLocation()).append("confidence", this.getConfidence()).append("mediaId", (Object)this.getMediaId()).append("locationSiteX", (Object)this.getLocationSiteX()).append("locationSiteY", (Object)this.getLocationSiteY()).toString();
}
public static ResultRecordDetails parserObject(JSONObject object) {
ResultRecordDetails data = new ResultRecordDetails();
data.setDetailsId(object.getLong("detailsId"));
data.setRecordId(object.getLong("recordId"));
data.setHabitat(object.getString("habitat"));
data.setCount(object.getInteger("count"));
data.setSpeciesId(object.getLong("speciesId"));
data.setConfidence(object.getDouble("confidence"));
data.setMediaId(object.getLong("mediaId"));
data.setLocationSiteX(object.getString("locationSiteX"));
data.setLocationSiteY(object.getString("locationSiteY"));
data.setChecked(object.getBoolean("checked"));
data.setIsDeleted(object.getInteger("isDeleted"));
return data;
}
public Long getDetailsId() {
return this.detailsId;
}
public Long getRecordId() {
return this.recordId;
}
public Long getSpeciesId() {
return this.speciesId;
}
public String getSpeciesName() {
return this.speciesName;
}
public String getHabitat() {
return this.habitat;
}
public int getCount() {
return this.count;
}
public String getLocation() {
return this.location;
}
public double getConfidence() {
return this.confidence;
}
public Long getMediaId() {
return this.mediaId;
}
public String getLocationSiteX() {
return this.locationSiteX;
}
public String getLocationSiteY() {
return this.locationSiteY;
}
public boolean isChecked() {
return this.checked;
}
public int getIsDeleted() {
return this.isDeleted;
}
public ResultMedia getResultMedia() {
return this.resultMedia;
}
public Long getOldRecordId() {
return this.oldRecordId;
}
public Long getOldMediaId() {
return this.oldMediaId;
}
public Long getAreaId() {
return this.areaId;
}
public String getRecordTime() {
return this.recordTime;
}
public void setDetailsId(Long detailsId) {
this.detailsId = detailsId;
}
public void setRecordId(Long recordId) {
this.recordId = recordId;
}
public void setSpeciesId(Long speciesId) {
this.speciesId = speciesId;
}
public void setSpeciesName(String speciesName) {
this.speciesName = speciesName;
}
public void setHabitat(String habitat) {
this.habitat = habitat;
}
public void setCount(int count) {
this.count = count;
}
public void setLocation(String location) {
this.location = location;
}
public void setConfidence(double confidence) {
this.confidence = confidence;
}
public void setMediaId(Long mediaId) {
this.mediaId = mediaId;
}
public void setLocationSiteX(String locationSiteX) {
this.locationSiteX = locationSiteX;
}
public void setLocationSiteY(String locationSiteY) {
this.locationSiteY = locationSiteY;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public void setIsDeleted(int isDeleted) {
this.isDeleted = isDeleted;
}
public void setResultMedia(ResultMedia resultMedia) {
this.resultMedia = resultMedia;
}
public void setOldRecordId(Long oldRecordId) {
this.oldRecordId = oldRecordId;
}
public void setOldMediaId(Long oldMediaId) {
this.oldMediaId = oldMediaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public void setRecordTime(String recordTime) {
this.recordTime = recordTime;
}
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ResultRecordDetails)) {
return false;
}
ResultRecordDetails other = (ResultRecordDetails)o;
if (!other.canEqual(this)) {
return false;
}
if (this.getCount() != other.getCount()) {
return false;
}
if (Double.compare(this.getConfidence(), other.getConfidence()) != 0) {
return false;
}
if (this.isChecked() != other.isChecked()) {
return false;
}
if (this.getIsDeleted() != other.getIsDeleted()) {
return false;
}
Long this$detailsId = this.getDetailsId();
Long other$detailsId = other.getDetailsId();
if (this$detailsId == null ? other$detailsId != null : !((Object)this$detailsId).equals(other$detailsId)) {
return false;
}
Long this$recordId = this.getRecordId();
Long other$recordId = other.getRecordId();
if (this$recordId == null ? other$recordId != null : !((Object)this$recordId).equals(other$recordId)) {
return false;
}
Long this$speciesId = this.getSpeciesId();
Long other$speciesId = other.getSpeciesId();
if (this$speciesId == null ? other$speciesId != null : !((Object)this$speciesId).equals(other$speciesId)) {
return false;
}
Long this$mediaId = this.getMediaId();
Long other$mediaId = other.getMediaId();
if (this$mediaId == null ? other$mediaId != null : !((Object)this$mediaId).equals(other$mediaId)) {
return false;
}
Long this$oldRecordId = this.getOldRecordId();
Long other$oldRecordId = other.getOldRecordId();
if (this$oldRecordId == null ? other$oldRecordId != null : !((Object)this$oldRecordId).equals(other$oldRecordId)) {
return false;
}
Long this$oldMediaId = this.getOldMediaId();
Long other$oldMediaId = other.getOldMediaId();
if (this$oldMediaId == null ? other$oldMediaId != null : !((Object)this$oldMediaId).equals(other$oldMediaId)) {
return false;
}
Long this$areaId = this.getAreaId();
Long other$areaId = other.getAreaId();
if (this$areaId == null ? other$areaId != null : !((Object)this$areaId).equals(other$areaId)) {
return false;
}
String this$speciesName = this.getSpeciesName();
String other$speciesName = other.getSpeciesName();
if (this$speciesName == null ? other$speciesName != null : !this$speciesName.equals(other$speciesName)) {
return false;
}
String this$habitat = this.getHabitat();
String other$habitat = other.getHabitat();
if (this$habitat == null ? other$habitat != null : !this$habitat.equals(other$habitat)) {
return false;
}
String this$location = this.getLocation();
String other$location = other.getLocation();
if (this$location == null ? other$location != null : !this$location.equals(other$location)) {
return false;
}
String this$locationSiteX = this.getLocationSiteX();
String other$locationSiteX = other.getLocationSiteX();
if (this$locationSiteX == null ? other$locationSiteX != null : !this$locationSiteX.equals(other$locationSiteX)) {
return false;
}
String this$locationSiteY = this.getLocationSiteY();
String other$locationSiteY = other.getLocationSiteY();
if (this$locationSiteY == null ? other$locationSiteY != null : !this$locationSiteY.equals(other$locationSiteY)) {
return false;
}
ResultMedia this$resultMedia = this.getResultMedia();
ResultMedia other$resultMedia = other.getResultMedia();
if (this$resultMedia == null ? other$resultMedia != null : !((Object)((Object)this$resultMedia)).equals((Object)other$resultMedia)) {
return false;
}
String this$recordTime = this.getRecordTime();
String other$recordTime = other.getRecordTime();
return !(this$recordTime == null ? other$recordTime != null : !this$recordTime.equals(other$recordTime));
}
protected boolean canEqual(Object other) {
return other instanceof ResultRecordDetails;
}
public int hashCode() {
int PRIME = 59;
int result = 1;
result = result * 59 + this.getCount();
long $confidence = Double.doubleToLongBits(this.getConfidence());
result = result * 59 + (int)($confidence >>> 32 ^ $confidence);
result = result * 59 + (this.isChecked() ? 79 : 97);
result = result * 59 + this.getIsDeleted();
Long $detailsId = this.getDetailsId();
result = result * 59 + ($detailsId == null ? 43 : ((Object)$detailsId).hashCode());
Long $recordId = this.getRecordId();
result = result * 59 + ($recordId == null ? 43 : ((Object)$recordId).hashCode());
Long $speciesId = this.getSpeciesId();
result = result * 59 + ($speciesId == null ? 43 : ((Object)$speciesId).hashCode());
Long $mediaId = this.getMediaId();
result = result * 59 + ($mediaId == null ? 43 : ((Object)$mediaId).hashCode());
Long $oldRecordId = this.getOldRecordId();
result = result * 59 + ($oldRecordId == null ? 43 : ((Object)$oldRecordId).hashCode());
Long $oldMediaId = this.getOldMediaId();
result = result * 59 + ($oldMediaId == null ? 43 : ((Object)$oldMediaId).hashCode());
Long $areaId = this.getAreaId();
result = result * 59 + ($areaId == null ? 43 : ((Object)$areaId).hashCode());
String $speciesName = this.getSpeciesName();
result = result * 59 + ($speciesName == null ? 43 : $speciesName.hashCode());
String $habitat = this.getHabitat();
result = result * 59 + ($habitat == null ? 43 : $habitat.hashCode());
String $location = this.getLocation();
result = result * 59 + ($location == null ? 43 : $location.hashCode());
String $locationSiteX = this.getLocationSiteX();
result = result * 59 + ($locationSiteX == null ? 43 : $locationSiteX.hashCode());
String $locationSiteY = this.getLocationSiteY();
result = result * 59 + ($locationSiteY == null ? 43 : $locationSiteY.hashCode());
ResultMedia $resultMedia = this.getResultMedia();
result = result * 59 + ($resultMedia == null ? 43 : ((Object)((Object)$resultMedia)).hashCode());
String $recordTime = this.getRecordTime();
result = result * 59 + ($recordTime == null ? 43 : $recordTime.hashCode());
return result;
}
}
@@ -0,0 +1,24 @@
package net.hzvtc.data.check.mapper;
import java.util.List;
import net.hzvtc.data.check.domain.FavoriteMedia;
public interface FavoriteMediaMapper {
public FavoriteMedia selectFavoriteMediaById(Long var1);
public List<FavoriteMedia> selectFavoriteMediaList(FavoriteMedia var1);
public int insertFavoriteMedia(FavoriteMedia var1);
public int updateFavoriteMedia(FavoriteMedia var1);
public int deleteFavoriteMediaById(Long var1);
public int deleteFavoriteMediaByIds(Long[] var1);
public Long getFavoriteMediaByMediaId(Long var1);
public int deleteFavoriteMediaByMediaId(Long var1);
}
@@ -0,0 +1,61 @@
package net.hzvtc.data.check.mapper;
import java.util.List;
import net.hzvtc.data.check.domain.MediaItem;
/**
* 视频(图像)状态参数Mapper接口
*
* @author admin
* @date 2024-06-18
*/
public interface MediaItemMapper
{
/**
* 查询视频(图像)状态参数
*
* @param id 视频(图像)状态参数主键
* @return 视频(图像)状态参数
*/
public MediaItem selectMediaItemById(Long id);
/**
* 查询视频(图像)状态参数列表
*
* @param mediaItem 视频(图像)状态参数
* @return 视频(图像)状态参数集合
*/
public List<MediaItem> selectMediaItemList(MediaItem mediaItem);
/**
* 新增视频(图像)状态参数
*
* @param mediaItem 视频(图像)状态参数
* @return 结果
*/
public int insertMediaItem(MediaItem mediaItem);
/**
* 修改视频(图像)状态参数
*
* @param mediaItem 视频(图像)状态参数
* @return 结果
*/
public int updateMediaItem(MediaItem mediaItem);
/**
* 删除视频(图像)状态参数
*
* @param id 视频(图像)状态参数主键
* @return 结果
*/
public int deleteMediaItemById(Long id);
/**
* 批量删除视频(图像)状态参数
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMediaItemByIds(Long[] ids);
}
@@ -0,0 +1,69 @@
package net.hzvtc.data.check.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.data.check.domain.ResultMedia;
public interface ResultMediaMapper {
public List<ResultMedia> selectResultMediaList(ResultMedia var1);
public List<ResultMedia> selectResultMediaListByParam(ResultMedia var1);
public List<ResultMedia> getResultMediaListByParam(Map<String, Object> var1);
public List<ResultMedia> getResultAudioMediaListByParam(Map<String, Object> var1);
public ResultMedia getResultMediaListById(Long var1);
public List<ResultMedia> getBirdMediaListByParam(Map<String, Object> var1);
public List<ResultMedia> getSpeciesMediaListForQuery(Map<String, Object> var1);
public List<ResultMedia> getVideoMediaListByParam(Map<String, Object> var1);
public List<ResultMedia> getAudioMediaListByParam(Map<String, Object> var1);
public List<ResultMedia> getFavoriteVideoListByParam(Map<String, Object> var1);
public Integer getResultMediaStatAmountByParam(Map<String, Object> var1);
public int deleteResultRealMediaByParam(Long var1);
public int insertResultMedia(ResultMedia var1);
public int deleteResultMediaByMediaIds(Long[] var1);
public ResultMedia getResultMediaById(Long var1);
public int deleteResultMediaById(Long var1);
public ResultMedia getResultInfoForStatByParam(Map<String, Object> var1);
public int getResultMediaAmountByParam(Map<String, Object> var1);
public List<Long> getResultMediaDeviceListByParam(Map<String, Object> var1);
public int updateResultMediaStatusByParam(ResultMedia var1);
public int recoverResultMediaStateByParam(Map<String, Object> var1);
public List<ResultMedia> getRecordMediaDataList(Map<String, Object> var1);
public long getMaxMediaId();
public List<ResultMedia> getVideoListForPush(Map<String, Object> var1);
public List<ResultMedia> getResultMediaByIds(List<Long> var1);
public int batchInsertResultMedia(List<ResultMedia> var1);
public List<ResultMedia> getVideoListForPostByParam(Map<String, Object> var1);
public List<ResultMedia> getMediaVideoUrlListByParam(Map<String, Object> var1);
public List<ResultMedia> getResultMediaEmptyFileUrlList();
public int updateFileUrl(ResultMedia var1);
}
@@ -0,0 +1,71 @@
package net.hzvtc.data.check.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.SpeciesAbnormalInfo;
import net.hzvtc.data.check.domain.ResultRecordDetails;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
public interface ResultRecordDetailsMapper {
public ResultRecordDetails selectResultRecordDetailsByDetailsId(Long var1);
public List<ResultRecordDetails> selectResultRecordDetailsList(ResultRecordDetails var1);
public int insertResultRecordDetails(ResultRecordDetails var1);
public int updateResultRecordDetails(ResultRecordDetails var1);
public int updateResultRecordDetailsByIds(Map<String, Object> var1);
public List<Long> checkResultRecordsByParam(ResultRecordDetails var1);
public int updateResultRecordDetailsCheckState(Long var1);
public int updateResultStatByIds(List<Long> var1);
public int deleteResultRecordDetailsByDetailsId(Long var1);
public int updateResultRecordDetailsStatusById(Map<String, Object> var1);
public int deleteResultRecordDetailsByDetailsIds(Long[] var1);
public List<BirdStatDataVo> querySpeciesRecordListByParam(Map<String, Object> var1);
public List<BirdStatDataVo> querySpeciesRecordNewListByParam(Map<String, Object> var1);
public List<BirdStatDataVo> getSpeciesMediaListByParam(Map<String, Object> var1);
public List<BirdStatDataVo> getResultMediaVideoListByParam(Map<String, Object> var1);
public List<ResultRecordDetails> getSpeciesListByParam(Long var1);
public List<ResultRecordDetails> getSpeciesListByUserId(Map<String, Object> var1);
public List<SpeciesAbnormalInfo> getSpeciesDateListByParam(Map<String, Object> var1);
public List<Long> checkIsNewSpeciesByParam(Map<String, Object> var1);
public List<SpeciesAbnormalInfo> getLevelOneSpeciesLitByParam(Map<String, Object> var1);
public List<SpeciesAbnormalInfo> getCrOrEnSpeciesLitByParam(Map<String, Object> var1);
public List<BirdStatDataVo> getSpeciesHourAmountListByParam(Map<String, Object> var1);
public List<BirdStatDataVo> getSpeciesAudioAmountReportByParam(Map<String, Object> var1);
public List<BirdStatDataVo> getAudioStatListByParam(Map<String, Object> var1);
public long getAudioErrorStatByParam(Map<String, Object> var1);
public List<Long> getResultMediaByMediaId(Long var1);
public long getRecordDetailCountByDeviceId(long var1);
public int batchInsertResultRecordDetails(List<ResultRecordDetails> var1);
public int updateByOldRecordId(Long var1);
public int updateByOldMediaId(Long var1);
}
@@ -0,0 +1,37 @@
package net.hzvtc.data.check.mapper;
import java.util.List;
import java.util.Map;
import net.hzvtc.data.check.domain.ResultRecord;
public interface ResultRecordMapper {
public ResultRecord selectResultRecordByRecordId(Long var1);
public List<ResultRecord> selectResultRecordList(ResultRecord var1);
public List<Long> getResultAreaListByParam(Map<String, Object> var1);
public List<Long> getResultRecordIdsByParam(Map<String, Object> var1);
public int insertResultRecord(ResultRecord var1);
public int updateResultRecord(ResultRecord var1);
public int deleteResultRecordByRecordId(Long var1);
public int deleteResultRecordByRecordIds(Long[] var1);
public List<ResultRecord> getCurrentDateResultRecordList(Map<String, Object> var1);
public List<ResultRecord> getAudioResultRecordDataListForApi(Map<String, Object> var1);
public List<ResultRecord> getResultRecordDataPushList(Map<String, Object> var1);
public int batchInsertResultRecord(List<ResultRecord> var1);
public ResultRecord getResultRecordInfoBySpeciesId(Map<String, Object> var1);
public long getMaxId(Integer var1);
}
@@ -0,0 +1,24 @@
package net.hzvtc.data.check.service;
import java.util.List;
import net.hzvtc.data.check.domain.FavoriteMedia;
public interface FavoriteMediaService {
public FavoriteMedia selectFavoriteMediaById(Long var1);
public List<FavoriteMedia> selectFavoriteMediaList(FavoriteMedia var1);
public int insertFavoriteMedia(FavoriteMedia var1);
public int updateFavoriteMedia(FavoriteMedia var1);
public int deleteFavoriteMediaByIds(Long[] var1);
public int deleteFavoriteMediaById(Long var1);
public Long getFavoriteMediaByMediaId(Long var1);
public Long handleAction(FavoriteMedia var1);
}
@@ -0,0 +1,61 @@
package net.hzvtc.data.check.service;
import net.hzvtc.data.check.domain.MediaItem;
import java.util.List;
/**
* 视频(图像)状态参数Service接口
*
* @author admin
* @date 2024-06-18
*/
public interface MediaItemService {
/**
* 查询视频(图像)状态参数
*
* @param id 视频(图像)状态参数主键
* @return 视频(图像)状态参数
*/
public MediaItem selectMediaItemById(Long id);
/**
* 查询视频(图像)状态参数列表
*
* @param mediaItem 视频(图像)状态参数
* @return 视频(图像)状态参数集合
*/
public List<MediaItem> selectMediaItemList(MediaItem mediaItem);
/**
* 新增视频(图像)状态参数
*
* @param mediaItem 视频(图像)状态参数
* @return 结果
*/
public int insertMediaItem(MediaItem mediaItem);
/**
* 修改视频(图像)状态参数
*
* @param mediaItem 视频(图像)状态参数
* @return 结果
*/
public int updateMediaItem(MediaItem mediaItem);
/**
* 批量删除视频(图像)状态参数
*
* @param ids 需要删除的视频(图像)状态参数主键集合
* @return 结果
*/
public int deleteMediaItemByIds(Long[] ids);
/**
* 删除视频(图像)状态参数信息
*
* @param id 视频(图像)状态参数主键
* @return 结果
*/
public int deleteMediaItemById(Long id);
}
@@ -0,0 +1,68 @@
package net.hzvtc.data.check.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
import net.hzvtc.data.check.domain.ResultMedia;
public interface ResultMediaService {
public List<ResultMedia> selectResultMediaList(ResultMedia var1);
public List<ResultMedia> getResultMediaListByParam(Map<String, Object> var1);
public List<ResultMedia> getResultAudioMediaListByParam(Map<String, Object> var1);
public List<ResultMedia> getBirdMediaListByParam(Map<String, Object> var1);
public List<ResultMedia> selectResultMediaListByParam(ResultMedia var1);
public List<ResultMedia> getSpeciesMediaListForQuery(JSONObject var1);
public int deleteResultRealMediaByParam(Long var1);
public int insertResultMedia(ResultMedia var1);
public ResultMedia getResultMediaListById(Long var1);
public int deleteResultMediaByMediaIds(Long[] var1);
public ResultMedia getResultInfoForStatByParam(Map<String, Object> var1);
public int updateResultMediaStatusByParam(ResultMedia var1);
public int recoverResultMediaStateByParam(Map<String, Object> var1);
public List<ResultMedia> getVideoMediaListByParam(Map<String, Object> var1);
public int getResultMediaAmountByParam(Map<String, Object> var1);
public List<Long> getResultMediaDeviceListByParam(Map<String, Object> var1);
public List<ResultMedia> getFavoriteVideoListByParam(JSONObject var1);
public JSONObject getResultMediaStatByParam();
public List<ResultMedia> getRecordMediaDataList(JSONObject var1);
public long getMaxMediaId();
public int batchInsertResultMedia(List<ResultMedia> var1);
public int deleteResultMediaById(Long var1);
public void getVideoListForPush(Long var1);
public void getVideoListForHuiXianPost();
public List<ResultMedia> getAudioMediaListByParam(Map<String, Object> var1);
public ResultMedia getMediaVideoUrlListByParam(Map<String, Object> var1);
public List<ResultMedia> getResultMediaByIds(List<Long> var1);
public List<ResultMedia> getResultMediaEmptyFileUrlList();
public int updateFileUrl(ResultMedia var1);
}
@@ -0,0 +1,73 @@
package net.hzvtc.data.check.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
import net.hzvtc.area.domain.SpeciesAbnormalInfo;
import net.hzvtc.data.check.domain.ResultRecordDetails;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
public interface ResultRecordDetailsService {
public ResultRecordDetails selectResultRecordDetailsByDetailsId(Long var1);
public List<ResultRecordDetails> selectResultRecordDetailsList(ResultRecordDetails var1);
public int insertResultRecordDetails(ResultRecordDetails var1);
public int updateResultRecordDetails(ResultRecordDetails var1);
public int updateResultRecordDetailsByIds(JSONObject var1);
public int deleteResultRecordDetailsByDetailsIds(Long[] var1);
public int deleteResultRecordDetails(JSONObject var1);
public int deleteResultRecordDetailsByParam(JSONObject var1);
public int deleteResultRecordDetailsByDetailsId(Long var1);
public List<BirdStatDataVo> querySpeciesRecordListByParam(JSONObject var1);
public List<BirdStatDataVo> getSpeciesMediaListByParam(JSONObject var1);
public List<BirdStatDataVo> getResultMediaVideoListByParam(JSONObject var1);
public JSONArray getSpeciesHourAmountListByParam(JSONObject var1);
public JSONArray getSpeciesListByParam(JSONObject var1);
public int updateResultRecordDetailsCheckState(Long var1);
public int updateResultRecordDetailsCheckState(String var1);
public List<SpeciesAbnormalInfo> getLevelOneSpeciesLitByParam(Map<String, Object> var1);
public List<SpeciesAbnormalInfo> getCrOrEnSpeciesLitByParam(Map<String, Object> var1);
public List<ResultRecordDetails> getSpeciesListByUserId(Long var1);
public List<SpeciesAbnormalInfo> getSpeciesDateListByParam(Map<String, Object> var1);
public List<Long> checkIsNewSpeciesByParam(Map<String, Object> var1);
public JSONObject getSpeciesAudioAmountReportByParam(JSONObject var1);
public long getRecordDetailCountByDeviceId(long var1);
public int batchInsertResultRecordDetails(List<ResultRecordDetails> var1);
public int updateByOldRecordId(Long var1);
public int updateByOldMediaId(Long var1);
public List<BirdStatDataVo> getAudioStatListByParam(JSONObject var1);
public long getAudioErrorStatByParam(JSONObject var1);
public String createAudioReportFile(Map<String, Object> var1);
public int updateResultRecordDetailsStatusById(JSONObject var1);
}
@@ -0,0 +1,18 @@
package net.hzvtc.data.check.service;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.multipart.MultipartFile;
public interface ResultRecordExtractService {
public void extraAudioRecordDataList();
public long getMaxId(Integer var1);
public boolean saveResultRecordPostData(JSONObject var1);
public boolean getResultRecordListToPush(JSONObject var1);
public boolean saveRemoteFile(MultipartFile var1, String var2);
}
@@ -0,0 +1,52 @@
package net.hzvtc.data.check.service;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
import java.util.Map;
import net.hzvtc.data.check.domain.ResultRecord;
public interface ResultRecordService {
public ResultRecord selectResultRecordByRecordId(Long var1);
public List<ResultRecord> selectResultRecordList(ResultRecord var1);
public int insertResultRecord(ResultRecord var1);
public int updateResultRecord(ResultRecord var1);
public int deleteResultRecordByRecordIds(Long[] var1);
public int deleteResultRecordByRecordId(Long var1);
public JSONObject getBirdDataStatByParam(JSONObject var1);
public String getBirdDataStatFileByParam(JSONObject var1);
public void sendBirdDataStatEmail();
public void sendBirdDataWeeklyStatEmail();
public boolean sendBirdDataStatEmail(JSONObject var1);
public boolean sendBirdDataWeeklyStatEmail(JSONObject var1);
public JSONObject getBirdDataWeeklyStatByParam(JSONObject var1);
public String getBirdDataWeeklyStatFileByParam(JSONObject var1);
public String getBirdDataMonthlyStatFileByParam(JSONObject var1);
public List<Long> getResultAreaListByParam(Map<String, Object> var1);
public List<Long> getResultRecordIdsByParam(Map<String, Object> var1);
public List<ResultRecord> getCurrentDateResultRecordList(JSONObject var1);
public JSONObject getAudioResultRecordDataListForApi(JSONObject var1);
public int batchInsertResultRecord(List<ResultRecord> var1);
public ResultRecord getResultRecordInfoBySpeciesId(Map<String, Object> var1);
}
@@ -0,0 +1,108 @@
package net.hzvtc.data.check.service.impl;
import net.hzvtc.common.utils.SecurityUtils;
import net.hzvtc.data.check.domain.FavoriteMedia;
import net.hzvtc.data.check.mapper.FavoriteMediaMapper;
import net.hzvtc.data.check.service.FavoriteMediaService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* 收藏的视频Service业务层处理
*
* @author admin
* @date 2024-06-18
*/
@Service
public class FavoriteMediaServiceImpl implements FavoriteMediaService {
@Resource
private FavoriteMediaMapper favoriteMediaMapper;
/**
* 查询收藏的视频
*
* @param id 收藏的视频主键
* @return 收藏的视频
*/
@Override
public FavoriteMedia selectFavoriteMediaById(Long id) {
return favoriteMediaMapper.selectFavoriteMediaById(id);
}
/**
* 查询收藏的视频列表
*
* @param favoriteMedia 收藏的视频
* @return 收藏的视频
*/
@Override
public List<FavoriteMedia> selectFavoriteMediaList(FavoriteMedia favoriteMedia) {
return favoriteMediaMapper.selectFavoriteMediaList(favoriteMedia);
}
/**
* 新增收藏的视频
*
* @param favoriteMedia 收藏的视频
* @return 结果
*/
@Override
public int insertFavoriteMedia(FavoriteMedia favoriteMedia) {
return favoriteMediaMapper.insertFavoriteMedia(favoriteMedia);
}
/**
* 修改收藏的视频
*
* @param favoriteMedia 收藏的视频
* @return 结果
*/
@Override
public int updateFavoriteMedia(FavoriteMedia favoriteMedia) {
return favoriteMediaMapper.updateFavoriteMedia(favoriteMedia);
}
/**
* 批量删除收藏的视频
*
* @param ids 需要删除的收藏的视频主键
* @return 结果
*/
@Override
public int deleteFavoriteMediaByIds(Long[] ids) {
return favoriteMediaMapper.deleteFavoriteMediaByIds(ids);
}
/**
* 删除收藏的视频信息
*
* @param id 收藏的视频主键
* @return 结果
*/
@Override
public int deleteFavoriteMediaById(Long id) {
return favoriteMediaMapper.deleteFavoriteMediaById(id);
}
@Override
public Long getFavoriteMediaByMediaId(Long id) {
return favoriteMediaMapper.getFavoriteMediaByMediaId(id);
}
@Override
public Long handleAction(FavoriteMedia favoriteMedia) {
if (favoriteMedia.getId() == null || favoriteMedia.getId() == 0L) {
favoriteMedia.setUserId(SecurityUtils.getUserId());
favoriteMedia.setCreateDate(new Date());
favoriteMedia.setIsDeleted(0);
favoriteMediaMapper.insertFavoriteMedia(favoriteMedia);
return favoriteMedia.getId();
} else {
favoriteMediaMapper.deleteFavoriteMediaByMediaId(favoriteMedia.getMediaId());
return 0L;
}
}
}
@@ -0,0 +1,87 @@
package net.hzvtc.data.check.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import net.hzvtc.data.check.mapper.MediaItemMapper;
import net.hzvtc.data.check.domain.MediaItem;
import net.hzvtc.data.check.service.MediaItemService;
/**
* 视频(图像)状态参数Service业务层处理
*
* @author admin
* @date 2024-06-18
*/
@Service
public class MediaItemServiceImpl implements MediaItemService {
@Resource
private MediaItemMapper mediaItemMapper;
/**
* 查询视频(图像)状态参数
*
* @param id 视频(图像)状态参数主键
* @return 视频(图像)状态参数
*/
@Override
public MediaItem selectMediaItemById(Long id) {
return mediaItemMapper.selectMediaItemById(id);
}
/**
* 查询视频(图像)状态参数列表
*
* @param mediaItem 视频(图像)状态参数
* @return 视频(图像)状态参数
*/
@Override
public List<MediaItem> selectMediaItemList(MediaItem mediaItem) {
return mediaItemMapper.selectMediaItemList(mediaItem);
}
/**
* 新增视频(图像)状态参数
*
* @param mediaItem 视频(图像)状态参数
* @return 结果
*/
@Override
public int insertMediaItem(MediaItem mediaItem) {
return mediaItemMapper.insertMediaItem(mediaItem);
}
/**
* 修改视频(图像)状态参数
*
* @param mediaItem 视频(图像)状态参数
* @return 结果
*/
@Override
public int updateMediaItem(MediaItem mediaItem) {
return mediaItemMapper.updateMediaItem(mediaItem);
}
/**
* 批量删除视频(图像)状态参数
*
* @param ids 需要删除的视频(图像)状态参数主键
* @return 结果
*/
@Override
public int deleteMediaItemByIds(Long[] ids) {
return mediaItemMapper.deleteMediaItemByIds(ids);
}
/**
* 删除视频(图像)状态参数信息
*
* @param id 视频(图像)状态参数主键
* @return 结果
*/
@Override
public int deleteMediaItemById(Long id) {
return mediaItemMapper.deleteMediaItemById(id);
}
}
@@ -0,0 +1,388 @@
package net.hzvtc.data.check.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import net.hzvtc.data.check.domain.ResultMedia;
import net.hzvtc.data.check.mapper.ResultMediaMapper;
import net.hzvtc.data.check.service.ResultMediaService;
import net.hzvtc.data.job.domain.TableStatInfo;
import net.hzvtc.data.job.service.TableStatInfoService;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class ResultMediaServiceImpl
implements ResultMediaService {
private static final Logger log = LoggerFactory.getLogger(ResultMediaServiceImpl.class);
@Resource
private ResultMediaMapper resultMediaMapper;
@Value(value="${VideoPostUrl.yuyuantanUrl}")
private String postUrl;
@Value(value="${VideoPostUrl.huiXianPostUrl}")
private String huixianPostUrl;
@Value(value="${hzvtc.fileServerUrl}")
private String fileServerUrl;
private final TableStatInfoService tableStatInfoService;
@Override
public List<ResultMedia> selectResultMediaList(ResultMedia resultMedia) {
return this.resultMediaMapper.selectResultMediaList(resultMedia);
}
@Override
public List<ResultMedia> getResultMediaListByParam(Map<String, Object> map) {
return this.resultMediaMapper.getResultMediaListByParam(map);
}
@Override
public List<ResultMedia> getResultAudioMediaListByParam(Map<String, Object> map) {
return this.resultMediaMapper.getResultAudioMediaListByParam(map);
}
@Override
public List<ResultMedia> getBirdMediaListByParam(Map<String, Object> map) {
return this.resultMediaMapper.getBirdMediaListByParam(map);
}
@Override
public List<ResultMedia> selectResultMediaListByParam(ResultMedia resultMedia) {
return this.resultMediaMapper.selectResultMediaListByParam(resultMedia);
}
@Override
public List<ResultMedia> getSpeciesMediaListForQuery(JSONObject object) {
HashMap<String, Object> map = new HashMap<String, Object>();
Long areaId = object.getLong("areaId");
map.put("areaId", areaId);
Long deviceId = object.getLong("deviceId");
map.put("deviceId", deviceId);
String dateFrom = object.getString("dateFrom");
map.put("dateFrom", dateFrom);
String dateTo = object.getString("dateTo");
map.put("dateTo", dateTo);
String mediaTypes = object.getString("mediaTypes");
if (mediaTypes != null && !mediaTypes.isEmpty()) {
String[] arrs = mediaTypes.split(",");
int[] arr = Arrays.stream(arrs).mapToInt(Integer::parseInt).toArray();
map.put("mediaTypes", arr);
}
Integer limit = object.getInteger("limit");
map.put("limit", limit);
return this.resultMediaMapper.getSpeciesMediaListForQuery(map);
}
@Override
public int deleteResultRealMediaByParam(Long deviceId) {
return this.resultMediaMapper.deleteResultRealMediaByParam(deviceId);
}
@Override
public int insertResultMedia(ResultMedia data) {
return this.resultMediaMapper.insertResultMedia(data);
}
@Override
public ResultMedia getResultMediaListById(Long id) {
return this.resultMediaMapper.getResultMediaListById(id);
}
@Override
public int deleteResultMediaByMediaIds(Long[] mediaIds) {
return this.resultMediaMapper.deleteResultMediaByMediaIds(mediaIds);
}
@Override
public ResultMedia getResultInfoForStatByParam(Map<String, Object> map) {
return this.resultMediaMapper.getResultInfoForStatByParam(map);
}
@Override
@Transactional
public int updateResultMediaStatusByParam(ResultMedia param) {
HashMap<String, Number> data = new HashMap<String, Number>();
data.put("isDeleted", param.getIsDeleted());
data.put("mediaId", param.getMediaId());
return this.resultMediaMapper.updateResultMediaStatusByParam(param);
}
@Override
public int recoverResultMediaStateByParam(Map<String, Object> map) {
return this.resultMediaMapper.recoverResultMediaStateByParam(map);
}
@Override
public List<ResultMedia> getVideoMediaListByParam(Map<String, Object> map) {
return this.resultMediaMapper.getVideoMediaListByParam(map);
}
@Override
public int getResultMediaAmountByParam(Map<String, Object> map) {
return this.resultMediaMapper.getResultMediaAmountByParam(map);
}
@Override
public List<Long> getResultMediaDeviceListByParam(Map<String, Object> map) {
return this.resultMediaMapper.getResultMediaDeviceListByParam(map);
}
@Override
public List<ResultMedia> getFavoriteVideoListByParam(JSONObject object) {
HashMap<String, Object> map = new HashMap<String, Object>();
return this.resultMediaMapper.getFavoriteVideoListByParam(map);
}
@Override
public JSONObject getResultMediaStatByParam() {
JSONObject result = new JSONObject();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("mediaType", 3);
Integer count = this.resultMediaMapper.getResultMediaStatAmountByParam(map);
result.put("videoAmount", (Object)(count == null ? 0 : count));
map.put("mediaType", 2);
count = this.resultMediaMapper.getResultMediaStatAmountByParam(map);
result.put("imageAmount", (Object)(count == null ? 0 : count));
return result;
}
@Override
public List<ResultMedia> getRecordMediaDataList(JSONObject param) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("mediaType", 1);
Long mediaId = param.getLong("mediaId");
map.put("mediaId", mediaId);
Long areaId = param.getLong("areaId");
map.put("areaId", areaId);
return this.resultMediaMapper.getRecordMediaDataList(map);
}
@Override
public long getMaxMediaId() {
return this.resultMediaMapper.getMaxMediaId();
}
@Override
public int batchInsertResultMedia(List<ResultMedia> list) {
return this.resultMediaMapper.batchInsertResultMedia(list);
}
@Override
public int deleteResultMediaById(Long mediaId) {
return this.resultMediaMapper.deleteResultMediaById(mediaId);
}
@Override
public void getVideoListForPush(Long areaId) {
TableStatInfo data = new TableStatInfo();
data.setType(2);
List<TableStatInfo> list = this.tableStatInfoService.selectTableStatInfoList(data);
Long maxId = 0L;
if (list != null && !list.isEmpty()) {
maxId = list.get(0).getTableId();
data = list.get(0);
}
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("areaId", areaId);
map.put("maxId", maxId);
List<ResultMedia> mediaList = this.resultMediaMapper.getVideoListForPush(map);
if (mediaList != null && !mediaList.isEmpty()) {
JSONArray array = new JSONArray();
mediaList.forEach(item -> {
JSONObject obj = new JSONObject();
obj.put("mediaId", (Object)item.getMediaId());
String url = item.getMediaUrl();
if (url.startsWith("/")) {
obj.put("mediaUrl", (Object)(this.fileServerUrl + url));
} else {
obj.put("mediaUrl", (Object)(this.fileServerUrl + "/" + url));
}
url = item.getMetaUrl();
if (url.startsWith("/")) {
obj.put("posterImg", (Object)(this.fileServerUrl + url));
} else {
obj.put("posterImg", (Object)(this.fileServerUrl + "/" + url));
}
obj.put("time", (Object)item.getTime());
obj.put("deviceId", (Object)item.getDeviceId());
obj.put("deviceName", (Object)item.getDeviceName());
array.add((Object)obj);
});
JSONObject postData = new JSONObject();
postData.put("data", (Object)array);
postData.put("type", (Object)"type1");
this.postVideoData(postData);
maxId = mediaList.get(mediaList.size() - 1).getMediaId();
data.setTableId(maxId);
if (data.getId() == null) {
this.tableStatInfoService.insertTableStatInfo(data);
} else {
this.tableStatInfoService.updateTableStatInfo(data);
}
}
}
@Override
public void getVideoListForHuiXianPost() {
TableStatInfo data = new TableStatInfo();
data.setType(5);
List<TableStatInfo> list = this.tableStatInfoService.selectTableStatInfoList(data);
Long maxId = 0L;
if (list != null && !list.isEmpty()) {
maxId = list.get(0).getTableId();
data = list.get(0);
}
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("areaId", 58);
map.put("maxId", maxId);
List<ResultMedia> resultMedias = this.resultMediaMapper.getVideoListForPostByParam(map);
if (resultMedias == null || resultMedias.isEmpty()) {
return;
}
for (ResultMedia item : resultMedias) {
JSONObject object = new JSONObject();
object.put("speciesName", (Object)item.getSpeciesName());
String url = item.getMediaUrl();
if (url != null) {
if (url.startsWith("/")) {
object.put("mediaUrl", (Object)(this.fileServerUrl + url));
} else {
object.put("mediaUrl", (Object)(this.fileServerUrl + "/" + url));
}
}
if ((url = item.getMetaUrl()) != null) {
if (url.startsWith("/")) {
object.put("imgPath", (Object)(this.fileServerUrl + url));
} else {
object.put("imgPath", (Object)(this.fileServerUrl + "/" + url));
}
}
object.put("time", (Object)item.getTime());
object.put("mediaId", (Object)item.getMediaId());
object.put("deviceId", (Object)item.getDeviceId());
object.put("deviceName", (Object)item.getDeviceName());
object.put("lat", (Object)item.getLatitude());
object.put("lon", (Object)item.getLongitude());
this.sentData(object);
}
maxId = resultMedias.get(resultMedias.size() - 1).getMediaId();
data.setTableId(maxId);
if (data.getId() == null) {
this.tableStatInfoService.insertTableStatInfo(data);
} else {
this.tableStatInfoService.updateTableStatInfo(data);
}
}
@Override
public List<ResultMedia> getAudioMediaListByParam(Map<String, Object> map) {
return this.resultMediaMapper.getAudioMediaListByParam(map);
}
@Override
public ResultMedia getMediaVideoUrlListByParam(Map<String, Object> param) {
List<ResultMedia> list = this.resultMediaMapper.getMediaVideoUrlListByParam(param);
if (list.isEmpty()) {
return null;
}
for (ResultMedia item : list) {
if (item.getMetaUrl() == null) continue;
return item;
}
return list.get(0);
}
@Override
public List<ResultMedia> getResultMediaByIds(List<Long> list) {
return this.resultMediaMapper.getResultMediaByIds(list);
}
@Override
public List<ResultMedia> getResultMediaEmptyFileUrlList() {
return this.resultMediaMapper.getResultMediaEmptyFileUrlList();
}
@Override
public int updateFileUrl(ResultMedia resultMedia) {
return this.resultMediaMapper.updateFileUrl(resultMedia);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
private void sentData(JSONObject object) {
CloseableHttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(this.huixianPostUrl);
try {
StringEntity s = new StringEntity(object.toString(), StandardCharsets.UTF_8);
log.info(object.toString());
s.setContentEncoding("UTF-8");
s.setContentType("application/json");
post.setEntity((HttpEntity)s);
CloseableHttpResponse res = client.execute((HttpUriRequest)post);
if (res.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = res.getEntity();
String result = EntityUtils.toString((HttpEntity)res.getEntity());
System.out.println(result);
}
}
catch (Exception e) {
log.error("===error===", (Throwable)e);
}
finally {
try {
client.close();
}
catch (Exception exception) {}
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
private void postVideoData(JSONObject data) {
CloseableHttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(this.postUrl);
try {
StringEntity s = new StringEntity(data.toString(), StandardCharsets.UTF_8);
s.setContentEncoding("UTF-8");
s.setContentType("application/json");
post.setEntity((HttpEntity)s);
CloseableHttpResponse res = client.execute((HttpUriRequest)post);
if (res.getStatusLine().getStatusCode() == 200) {
String result = EntityUtils.toString((HttpEntity)res.getEntity());
System.out.println(result);
}
}
catch (Exception e) {
log.error("error", (Throwable)e);
}
finally {
try {
client.close();
}
catch (Exception exception) {}
}
}
public ResultMediaServiceImpl(TableStatInfoService tableStatInfoService) {
this.tableStatInfoService = tableStatInfoService;
}
}
@@ -0,0 +1,686 @@
package net.hzvtc.data.check.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import net.hzvtc.area.domain.ProtectedArea;
import net.hzvtc.area.domain.SpeciesAbnormalInfo;
import net.hzvtc.area.mapper.SpeciesAbnormalInfoMapper;
import net.hzvtc.area.service.ProtectedAreaService;
import net.hzvtc.area.service.ProtectedAreaSpeciesService;
import net.hzvtc.common.utils.CommonUtils;
import net.hzvtc.common.utils.SecurityUtils;
import net.hzvtc.data.check.domain.ResultRecordDetails;
import net.hzvtc.data.check.mapper.ResultMediaMapper;
import net.hzvtc.data.check.mapper.ResultRecordDetailsMapper;
import net.hzvtc.data.check.service.ResultRecordDetailsService;
import net.hzvtc.echart.domain.vo.BirdStatDataVo;
import net.hzvtc.web.stat.service.SpeciesDailyStatService;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xddf.usermodel.chart.*;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
/**
* 监测记录详细信息Service业务层处理
*
* @author admin
* @date 2022-08-22
*/
@Service
@RequiredArgsConstructor
public class ResultRecordDetailsServiceImpl implements ResultRecordDetailsService {
@Resource
private ResultRecordDetailsMapper resultRecordDetailsMapper;
@Resource
private ResultMediaMapper resultMediaMapper;
private final ProtectedAreaService protectedAreaService;
private final SpeciesDailyStatService speciesDailyStatService;
private final ProtectedAreaSpeciesService protectedAreaSpeciesService;
@Resource
private SpeciesAbnormalInfoMapper speciesAbnormalInfoMapper;
@Value("${hzvtc.dailyReportFilePath}")
private String dailyReportFilePath;
@Value("${hzvtc.dailyReportFileOutPath}")
private String dailyReportFileOutPath;
/**
* 查询监测记录详细信息
*
* @param detailsId 监测记录详细信息主键
* @return 监测记录详细信息
*/
@Override
public ResultRecordDetails selectResultRecordDetailsByDetailsId(Long detailsId) {
return resultRecordDetailsMapper.selectResultRecordDetailsByDetailsId(detailsId);
}
/**
* 查询监测记录详细信息列表
*
* @param resultRecordDetails 监测记录详细信息
* @return 监测记录详细信息
*/
@Override
public List<ResultRecordDetails> selectResultRecordDetailsList(ResultRecordDetails resultRecordDetails) {
return resultRecordDetailsMapper.selectResultRecordDetailsList(resultRecordDetails);
}
/**
* 新增监测记录详细信息
*
* @param resultRecordDetails 监测记录详细信息
* @return 结果
*/
@Override
public int insertResultRecordDetails(ResultRecordDetails resultRecordDetails) {
return resultRecordDetailsMapper.insertResultRecordDetails(resultRecordDetails);
}
/**
* 修改监测记录详细信息
*
* @param resultRecordDetails 监测记录详细信息
* @return 结果
*/
@Override
@Transactional
public int updateResultRecordDetails(ResultRecordDetails resultRecordDetails) {
List<Long> list = resultRecordDetailsMapper.checkResultRecordsByParam(resultRecordDetails);
if (list == null || list.isEmpty()) {
resultRecordDetailsMapper.updateResultRecordDetails(resultRecordDetails);
} else {
resultRecordDetailsMapper.deleteResultRecordDetailsByDetailsId(resultRecordDetails.getDetailsId());
}
JSONObject param = new JSONObject();
param.put("areaId", resultRecordDetails.getAreaId());
if (resultRecordDetails.getRecordTime() != null) {
param.put("calcDate", resultRecordDetails.getRecordTime().substring(0, 10));
}
speciesDailyStatService.calculateDailyResultRecordByParam(param);
return 1;
}
@Override
@Transactional
public int updateResultRecordDetailsByIds(JSONObject object) {
List<Long> list = new ArrayList<>();
String location = object.getString("location");
String[] arr = location.split(",");
for (String str : arr) {
list.add(Long.parseLong(str));
}
Map<String, Object> map = new HashMap<>();
map.put("list", list);
map.put("speciesId", object.getLong("speciesId"));
map.put("checked", true);
resultRecordDetailsMapper.updateResultRecordDetailsByIds(map);
String str = object.getString("recordTime");
if (str != null) {
String[] array = str.split(",");
JSONObject param = new JSONObject();
param.put("areaId", object.getLong("areaId"));
for (String time : array) {
param.put("calcDate", time.substring(0, 10));
speciesDailyStatService.calculateDailyResultRecordByParam(param);
}
}
return 1;
}
/**
* 批量删除监测记录详细信息
*
* @param detailsIds 需要删除的监测记录详细信息主键
* @return 结果
*/
@Override
public int deleteResultRecordDetailsByDetailsIds(Long[] detailsIds) {
return resultRecordDetailsMapper.deleteResultRecordDetailsByDetailsIds(detailsIds);
}
@Override
@Transactional
public int deleteResultRecordDetails(JSONObject obj) {
Long id = obj.getLong("id");
int count = resultRecordDetailsMapper.deleteResultRecordDetailsByDetailsId(id);
Long mediaId = obj.getLong("mediaId");
String recordTime = obj.getString("recordTime");
if (recordTime != null && !recordTime.isEmpty()) {
recordTime = recordTime.substring(0, 10);
obj.put("calcDate", recordTime);
}
speciesDailyStatService.calculateDailyResultRecordByParam(obj);
List<Long> list = resultRecordDetailsMapper.getResultMediaByMediaId(mediaId);
speciesAbnormalInfoMapper.deleteSpeciesAbnormalInfoByMediaId(mediaId);
if (list == null || list.isEmpty()) {
resultMediaMapper.deleteResultMediaById(mediaId);
}
return count;
}
@Override
@Transactional
public int deleteResultRecordDetailsByParam(JSONObject object) {
JSONArray array = object.getJSONArray("list");
if (array.isEmpty()) {
return 0;
}
Long areaId = object.getLong("areaId");
Set<String> dateSet = new HashSet<>();
Long[] mids = new Long[array.size()];
Long[] ids = new Long[array.size()];
int i = 0;
for (Object obj : array) {
JSONObject jobj = JSONObject.parseObject(JSON.toJSONString(obj));
mids[i] = jobj.getLong("mediaId");
ids[i++] = jobj.getLong("id");
String recordTime = jobj.getString("recordTime");
if (recordTime != null && !recordTime.isEmpty()) {
dateSet.add(recordTime.substring(0, 10));
}
}
resultRecordDetailsMapper.deleteResultRecordDetailsByDetailsIds(ids);
for (Long mediaId : mids) {
List<Long> list = resultRecordDetailsMapper.getResultMediaByMediaId(mediaId);
if (list == null || list.isEmpty()) {
resultMediaMapper.deleteResultMediaById(mediaId);
}
}
JSONObject obj = new JSONObject();
obj.put("areaId", areaId);
dateSet.forEach(item -> {
// System.out.println("================" + item);
obj.put("calcDate", item);
speciesDailyStatService.calculateDailyResultRecordByParam(obj);
});
// resultMediaMapper.deleteResultMediaByMediaIds(mids);
return array.size();
}
/**
* 删除监测记录详细信息信息
*
* @param detailsId 监测记录详细信息主键
* @return 结果
*/
@Override
public int deleteResultRecordDetailsByDetailsId(Long detailsId) {
return resultRecordDetailsMapper.deleteResultRecordDetailsByDetailsId(detailsId);
}
@Override
public List<BirdStatDataVo> querySpeciesRecordListByParam(JSONObject obj) {
Map<String, Object> map = new HashMap<>();
Integer queryType = obj.getInteger("queryType");
if (queryType == null || queryType != 1) {
Long areaId = obj.getLong("areaId");
if (areaId == null) {
Long userId = SecurityUtils.getUserId();
if (userId != 1L) {
List<Long> ids = protectedAreaService.getAreaIdsByUserId(userId);
if (ids != null && !ids.isEmpty()) {
map.put("areaIds", ids);
} else {
return new ArrayList<>();
}
}
} else {
map.put("areaId", areaId);
}
}
Long speciesId = obj.getLong("speciesId");
map.put("speciesId", speciesId);
String dateFrom = obj.getString("dateFrom");
String dateTo = obj.getString("dateTo");
map.put("dateFrom", dateFrom);
map.put("dateTo", dateTo);
Long deviceId = obj.getLong("deviceId");
map.put("deviceId", deviceId);
Integer mediaType = obj.getInteger("mediaType");
map.put("mediaType", mediaType);
String mediaTypes = obj.getString("mediaTypes");
if (mediaTypes != null && !mediaTypes.isEmpty()) {
String[] arr = mediaTypes.split(",");
map.put("mediaTypes", arr);
}
// return resultRecordDetailsMapper.querySpeciesRecordListByParam(map);
return resultRecordDetailsMapper.querySpeciesRecordNewListByParam(map);
}
@Override
public List<BirdStatDataVo> getSpeciesMediaListByParam(JSONObject obj) {
Map<String, Object> map = new HashMap<>();
Long areaId = obj.getLong("areaId");
map.put("areaId", areaId);
Integer mediaType = obj.getInteger("mediaType");
map.put("mediaType", mediaType);
Long deviceId = obj.getLong("deviceId");
map.put("deviceId", deviceId);
String dateFrom = obj.getString("dateFrom");
map.put("dateFrom", dateFrom);
String dateTo = obj.getString("dateTo");
map.put("dateTo", dateTo);
return resultRecordDetailsMapper.getSpeciesMediaListByParam(map);
}
@Override
public List<BirdStatDataVo> getResultMediaVideoListByParam(JSONObject obj) {
Map<String, Object> map = new HashMap<>();
Long areaId = obj.getLong("areaId");
map.put("areaId", areaId);
Long deviceId = obj.getLong("deviceId");
map.put("deviceId", deviceId);
String dateFrom = obj.getString("dateFrom");
map.put("dateFrom", dateFrom);
String dateTo = obj.getString("dateTo");
map.put("dateTo", dateTo);
return resultRecordDetailsMapper.getResultMediaVideoListByParam(map);
}
@Override
public JSONArray getSpeciesHourAmountListByParam(JSONObject param) {
JSONArray result = new JSONArray();
Map<String, Object> map = new HashMap<>();
Long areaId = param.getLong("areaId");
map.put("areaId", areaId);
Long deviceId = param.getLong("deviceId");
map.put("deviceId", deviceId);
if (deviceId == null && areaId == null) {
return result;
}
Integer recordTypeNot = param.getInteger("recordTypeNot");
map.put("recordTypeNot", recordTypeNot);
Integer recordType = param.getInteger("recordType");
map.put("recordType", recordType);
Integer calcYear = param.getInteger("calcYear");
if (calcYear == null) {
calcYear = LocalDate.now().getYear();
}
map.put("calcYear", calcYear);
for (int i = 0; i < 4; i++) {
JSONObject obj = new JSONObject();
obj.put("name", (i + 1) + "季度");
obj.put("code", i + 1);
map.put("monthFrom", i * 3 + 1);
map.put("monthTo", i * 3 + 3);
List<BirdStatDataVo> list = resultRecordDetailsMapper.getSpeciesHourAmountListByParam(map);
obj.put("list", list);
result.add(obj);
}
return result;
}
@Override
public JSONArray getSpeciesListByParam(JSONObject obj) {
Long areaId = obj.getLong("areaId");
JSONArray array = new JSONArray();
if (areaId == null) {
return array;
}
List<ResultRecordDetails> list = resultRecordDetailsMapper.getSpeciesListByParam(areaId);
if (list == null || list.isEmpty()) {
return array;
} else {
list.forEach(item -> {
JSONObject object = new JSONObject();
object.put("speciesId", item.getSpeciesId());
object.put("speciesName", item.getSpeciesName());
array.add(object);
});
List<Long> ids = protectedAreaSpeciesService.getProtectedAreaSpeciesListByParams(obj);
if (ids != null && !ids.isEmpty()) {
CommonUtils.sortArrayByParam(array, ids);
}
}
return array;
}
@Override
public int updateResultRecordDetailsCheckState(Long id) {
return resultRecordDetailsMapper.updateResultRecordDetailsCheckState(id);
}
@Override
public int updateResultRecordDetailsCheckState(String ids) {
String[] arr = ids.split(",");
List<Long> list = new ArrayList<>();
for (String str : arr) {
list.add(Long.parseLong(str));
}
return resultRecordDetailsMapper.updateResultStatByIds(list);
}
@Override
public List<SpeciesAbnormalInfo> getLevelOneSpeciesLitByParam(Map<String, Object> map) {
return resultRecordDetailsMapper.getLevelOneSpeciesLitByParam(map);
}
@Override
public List<SpeciesAbnormalInfo> getCrOrEnSpeciesLitByParam(Map<String, Object> map) {
return resultRecordDetailsMapper.getCrOrEnSpeciesLitByParam(map);
}
@Override
public List<ResultRecordDetails> getSpeciesListByUserId(Long areaId) {
Map<String, Object> map = new HashMap<>();
if (areaId != null) {
map.put("areaId", areaId);
} else {
Long userId = SecurityUtils.getUserId();
if (userId == null) {
userId = 0L;
} else if (userId <= 1L) {
userId = null;
}
map.put("userId", userId);
}
return resultRecordDetailsMapper.getSpeciesListByUserId(map);
}
@Override
public List<SpeciesAbnormalInfo> getSpeciesDateListByParam(Map<String, Object> map) {
return resultRecordDetailsMapper.getSpeciesDateListByParam(map);
}
@Override
public List<Long> checkIsNewSpeciesByParam(Map<String, Object> map) {
return resultRecordDetailsMapper.checkIsNewSpeciesByParam(map);
}
@Override
public JSONObject getSpeciesAudioAmountReportByParam(JSONObject param) {
JSONObject result = new JSONObject();
Long areaId = param.getLong("areaId");
Long deviceId = param.getLong("deviceId");
if (areaId == null && deviceId == null) {
return result;
}
Map<String, Object> map = new HashMap<>();
map.put("areaId", areaId);
map.put("deviceId", deviceId);
Integer calcYear = param.getInteger("calcYear");
map.put("calcYear", calcYear);
Integer calcMonth = param.getInteger("calcMonth");
map.put("calcMonth", calcMonth);
Integer monthFrom = param.getInteger("monthFrom");
map.put("monthFrom", monthFrom);
Integer monthTo = param.getInteger("monthTo");
map.put("monthTo", monthTo);
List<BirdStatDataVo> list = resultRecordDetailsMapper.getSpeciesAudioAmountReportByParam(map);
result.put("list", list);
result.put("catalogueAmount", speciesDailyStatService.getBirdCatalogueAmount());
result.put("familyAmount", speciesDailyStatService.getBirdFamilyAmount());
result.put("genusAmount", speciesDailyStatService.getBirdGenusAmount());
return result;
}
@Override
public long getRecordDetailCountByDeviceId(long deviceId) {
return resultRecordDetailsMapper.getRecordDetailCountByDeviceId(deviceId);
}
@Override
public int batchInsertResultRecordDetails(List<ResultRecordDetails> list) {
return resultRecordDetailsMapper.batchInsertResultRecordDetails(list);
}
@Override
public int updateByOldRecordId(Long oldRecordId) {
return resultRecordDetailsMapper.updateByOldRecordId(oldRecordId);
}
@Override
public int updateByOldMediaId(Long oldRecordId) {
return resultRecordDetailsMapper.updateByOldMediaId(oldRecordId);
}
@Override
public List<BirdStatDataVo> getAudioStatListByParam(JSONObject param) {
Map<String, Object> map = new HashMap<>();
Long areaId = param.getLong("areaId");
if (areaId == null) {
return new ArrayList<>();
}
map.put("areaId", areaId);
String dateFrom = param.getString("dateFrom");
map.put("dateFrom", dateFrom);
String dateTo = param.getString("dateTo");
map.put("dateTo", dateTo);
String calcDate = param.getString("calcDate");
map.put("calcDate", calcDate);
// try {
// createAudioReportFile(null);
// } catch (Exception ex) {
// ex.printStackTrace();
// }
return resultRecordDetailsMapper.getAudioStatListByParam(map);
}
@Override
public long getAudioErrorStatByParam(JSONObject param) {
Map<String, Object> map = new HashMap<>();
Long areaId = param.getLong("areaId");
if (areaId == null) {
return 0;
}
map.put("areaId", areaId);
String dateFrom = param.getString("dateFrom");
map.put("dateFrom", dateFrom);
String dateTo = param.getString("dateTo");
map.put("dateTo", dateTo);
String calcDate = param.getString("calcDate");
map.put("calcDate", calcDate);
return resultRecordDetailsMapper.getAudioErrorStatByParam(map);
}
@Override
public String createAudioReportFile(Map<String, Object> param) {
String str = (String) param.get("areaId");
if (str == null || str.isEmpty()) {
return "500";
}
Long areaId = Long.parseLong(str);
String areaName = "";
if (areaId != null) {
ProtectedArea protectedArea = protectedAreaService.selectProtectedAreaById(areaId);
areaName = protectedArea.getName();
}
try {
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(new FileInputStream(dailyReportFilePath + "audio_report_tmpl.xlsx"));
XSSFSheet sheet = xssfWorkbook.getSheetAt(0);
sheet.getRow(0).getCell(0).setCellValue(areaName + "鸟类音频监测简报");
String calcDate = (String) param.get("calcDate");
String dateFrom = "";
String dateTo = "";
if (calcDate != null) {
String arr[] = calcDate.split("-");
dateFrom = arr[0] + "年" + arr[1] + "月" + arr[2] + "日";
dateTo = dateFrom;
} else {
dateFrom = (String) param.get("dateFrom");
if (dateFrom == null) {
dateFrom = "系统部署开始";
} else {
String arr[] = dateFrom.split("-");
dateFrom = arr[0] + "年" + arr[1] + "月";
}
dateTo = (String) param.get("dateFrom");
if (dateTo == null) {
dateFrom = "今天";
} else {
String arr[] = dateTo.split("-");
dateTo = arr[0] + "年" + arr[1] + "月";
}
}
long errorRecords = resultRecordDetailsMapper.getAudioErrorStatByParam(param);
List<BirdStatDataVo> list = resultRecordDetailsMapper.getAudioStatListByParam(param);
long totalRecords = list.stream().mapToLong(BirdStatDataVo::getCount).sum();
Map<String, List<BirdStatDataVo>> groupedByDate = list.stream().collect(Collectors.groupingBy(BirdStatDataVo::getShortDate));
Map<Long, List<BirdStatDataVo>> groupedBySpeciesId = list.stream().collect(Collectors.groupingBy(BirdStatDataVo::getId));
sheet.getRow(2).getCell(0).setCellValue(String.format(" 中国科学院半导体研究所联合%s管理单位在%s开展鸟类音频智能监测示范应用,截止到%s,系统共采集有效音频记录%d条,经过智能识别与校对,监测到有效物种%d种。", areaName, areaName, dateTo, totalRecords, groupedBySpeciesId.size()));
sheet.getRow(4).getCell(0).setCellValue(String.format(" 从%s开始,统计截止%s,系统共收到%d条音频记录,有效音频记录%d条,共监测到%d个物种。", dateFrom, dateTo, totalRecords + errorRecords, totalRecords, groupedBySpeciesId.size()));
sheet.getRow(5).getCell(0).setCellValue(String.format("%s至%s监测记录柱状图及饼图如下:", dateFrom, dateTo));
int row = 0;
for (Map.Entry<String, List<BirdStatDataVo>> entry : groupedByDate.entrySet()) {
XSSFCell cell = sheet.getRow(row).getCell(3);
if (cell == null) {
cell = sheet.getRow(row).createCell(3);
}
cell.setCellValue(entry.getKey());
List<BirdStatDataVo> elist = entry.getValue();
long amount = elist.stream().mapToLong(BirdStatDataVo::getCount).sum();
cell = sheet.getRow(row).getCell(4);
if (cell == null) {
cell = sheet.getRow(row).createCell(4);
}
cell.setCellValue(amount);
row++;
}
// sheet.setColumnHidden(3, true);
// sheet.setColumnHidden(4, true);
XSSFDrawing drawing = sheet.createDrawingPatriarch();
// XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 6, 3, 6);
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 6, 3, 11);
XSSFChart chart = drawing.createChart(anchor);
chart.setTitleText("鸟类声音监测按月统计");
chart.setTitleOverlay(false);
int len = groupedByDate.size();
XDDFDataSource<String> categories = XDDFDataSourcesFactory.fromStringCellRange(sheet, new CellRangeAddress(0, len - 1, 3, 3));
XDDFNumericalDataSource<Double> values = XDDFDataSourcesFactory.fromNumericCellRange(sheet, new CellRangeAddress(0, len - 1, 4, 4));
XDDFChartAxis bottomAxis = chart.createCategoryAxis(AxisPosition.BOTTOM);
XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT);
XDDFBarChartData dataChart = (XDDFBarChartData) chart.createData(ChartTypes.BAR, bottomAxis, leftAxis);
XDDFChartData.Series series = dataChart.addSeries(categories, values);
series.setTitle("Values", null);
dataChart.setBarDirection(BarDirection.COL);
// XDDFBarChart barChart = (XDDFBarChart) dataChart;
// barChart.setBarDirection(BarDirection.BAR);
chart.plot(dataChart);
row = 19;
long sum = 0;
XSSFRow xlsRow = null;
XSSFCell cell = null;
len = groupedBySpeciesId.size();
for (Map.Entry<Long, List<BirdStatDataVo>> entry : groupedBySpeciesId.entrySet()) {
List<BirdStatDataVo> elist = entry.getValue();
BirdStatDataVo data = elist.get(0);
long amount = elist.stream().mapToLong(BirdStatDataVo::getCount).sum();
sum += amount;
xlsRow = sheet.getRow(row);
if (xlsRow == null) {
xlsRow = sheet.createRow(row);
}
cell = xlsRow.getCell(0);
if (cell == null) {
cell = xlsRow.createCell(0);
}
cell.setCellValue(data.getName());
cell = xlsRow.getCell(1);
if (cell == null) {
cell = xlsRow.createCell(1);
}
cell.setCellValue(data.getEname());
cell = xlsRow.getCell(2);
if (cell == null) {
cell = xlsRow.createCell(2);
}
cell.setCellValue(amount);
row++;
}
xlsRow = sheet.getRow(row);
if (xlsRow == null) {
xlsRow = sheet.createRow(row);
}
cell = xlsRow.getCell(0);
if (cell == null) {
cell = xlsRow.createCell(0);
}
cell.setCellValue("总计");
cell = xlsRow.getCell(2);
if (cell == null) {
cell = xlsRow.createCell(2);
}
cell.setCellValue(sum);
drawing = sheet.createDrawingPatriarch();
xlsRow = sheet.getRow(7);
if (xlsRow == null) {
xlsRow = sheet.createRow(7);
}
cell = xlsRow.getCell(0);
if (cell == null) {
cell = xlsRow.createCell(0);
}
// Define the anchor point for the chart
anchor = drawing.createAnchor(0, 0, 0, 0, 0, 11, 3, 18);
// Create a chart object
chart = drawing.createChart(anchor);
chart.setTitleText("鸟类物种监测统计");
chart.setTitleOverlay(false);
// Create a data source for the chart
categories = XDDFDataSourcesFactory.fromStringCellRange(sheet, new CellRangeAddress(19, 19 + len - 1, 0, 0));
values = XDDFDataSourcesFactory.fromNumericCellRange(sheet, new CellRangeAddress(19, 19 + len - 1, 2, 2));
// Create the pie chart data
XDDFChartData pieChart = chart.createData(ChartTypes.PIE, null, null);
series = pieChart.addSeries(categories, values);
series.setTitle("Categories", null);
chart.plot(pieChart);
String outfile = dailyReportFileOutPath + areaName + "(鸟类音频监测简报)" + ".xlsx";
FileOutputStream fileOut = new FileOutputStream(outfile);
xssfWorkbook.write(fileOut);
xssfWorkbook.close();
fileOut.close();
return outfile;
} catch (Exception ex) {
// ex.printStackTrace();
return null;
}
}
@Override
public int updateResultRecordDetailsStatusById(JSONObject param) {
Map<String, Object> data = new HashMap<>();
Integer isDeleted = param.getInteger("isDeleted");
data.put("isDeleted", isDeleted);
Long id = param.getLong("detailsId");
data.put("id", id);
return resultRecordDetailsMapper.updateResultRecordDetailsStatusById(data);
}
}
Loaded 100 of 586 files, more files were not shown because too many files have changed in this diff. Show more