1、灌溉记录从php获取
2、设备接口改成无需权限获取
This commit is contained in:
@ -112,7 +112,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers("/login", "/register", "/captchaImage", "/iot/tool/register", "/iot/tool/ntp", "/iot/tool/download",
|
.antMatchers("/login", "/register", "/captchaImage", "/iot/tool/register", "/iot/tool/ntp", "/iot/tool/download",
|
||||||
"/iot/tool/mqtt/auth", "/iot/tool/mqtt/authv5", "/iot/tool/mqtt/webhook", "/iot/tool/mqtt/webhookv5", "/auth/**/**",
|
"/iot/tool/mqtt/auth", "/iot/tool/mqtt/authv5", "/iot/tool/mqtt/webhook", "/iot/tool/mqtt/webhookv5", "/auth/**/**",
|
||||||
"/wechat/mobileLogin", "/wechat/miniLogin", "/wechat/wxBind/callback","/waterele/rechargerecord/queryUnchargeAmount",
|
"/wechat/mobileLogin", "/wechat/miniLogin", "/wechat/wxBind/callback","/waterele/rechargerecord/queryUnchargeAmount",
|
||||||
"/waterele/rechargerecord/rechargeReply").permitAll()
|
"/waterele/rechargerecord/rechargeReply","/iot/device/**").permitAll()
|
||||||
.antMatchers("/zlmhook/**").permitAll()
|
.antMatchers("/zlmhook/**").permitAll()
|
||||||
.antMatchers("/ruleengine/rulemanager/**").permitAll()
|
.antMatchers("/ruleengine/rulemanager/**").permitAll()
|
||||||
.antMatchers("/goview/sys/login", "/goview/project/getData").permitAll()
|
.antMatchers("/goview/sys/login", "/goview/project/getData").permitAll()
|
||||||
|
@ -60,7 +60,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询设备列表
|
* 查询设备列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("设备分页列表")
|
@ApiOperation("设备分页列表")
|
||||||
public TableDataInfo list(Device device) {
|
public TableDataInfo list(Device device) {
|
||||||
@ -75,7 +75,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询未分配授权码设备列表
|
* 查询未分配授权码设备列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/unAuthlist")
|
@GetMapping("/unAuthlist")
|
||||||
@ApiOperation("设备分页列表")
|
@ApiOperation("设备分页列表")
|
||||||
public TableDataInfo unAuthlist(Device device) {
|
public TableDataInfo unAuthlist(Device device) {
|
||||||
@ -89,7 +89,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询分组可添加设备
|
* 查询分组可添加设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/listByGroup")
|
@GetMapping("/listByGroup")
|
||||||
@ApiOperation("查询分组可添加设备分页列表")
|
@ApiOperation("查询分组可添加设备分页列表")
|
||||||
public TableDataInfo listByGroup(Device device) {
|
public TableDataInfo listByGroup(Device device) {
|
||||||
@ -108,7 +108,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询设备简短列表,主页列表数据
|
* 查询设备简短列表,主页列表数据
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/shortList")
|
@GetMapping("/shortList")
|
||||||
@ApiOperation("设备分页简短列表")
|
@ApiOperation("设备分页简短列表")
|
||||||
public TableDataInfo shortList(Device device) {
|
public TableDataInfo shortList(Device device) {
|
||||||
@ -134,7 +134,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询所有设备简短列表
|
* 查询所有设备简短列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
@ApiOperation("查询所有设备简短列表")
|
@ApiOperation("查询所有设备简短列表")
|
||||||
public TableDataInfo allShortList() {
|
public TableDataInfo allShortList() {
|
||||||
@ -147,7 +147,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 导出设备列表
|
* 导出设备列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:export')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:export')")
|
||||||
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ApiOperation("导出设备")
|
@ApiOperation("导出设备")
|
||||||
@ -160,7 +160,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 获取设备详细信息
|
* 获取设备详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/{deviceId}")
|
@GetMapping(value = "/{deviceId}")
|
||||||
@ApiOperation("获取设备详情")
|
@ApiOperation("获取设备详情")
|
||||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
||||||
@ -185,7 +185,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 设备数据同步
|
* 设备数据同步
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/synchronization/{serialNumber}")
|
@GetMapping(value = "/synchronization/{serialNumber}")
|
||||||
@ApiOperation("设备数据同步")
|
@ApiOperation("设备数据同步")
|
||||||
public AjaxResult deviceSynchronization(@PathVariable("serialNumber") String serialNumber) {
|
public AjaxResult deviceSynchronization(@PathVariable("serialNumber") String serialNumber) {
|
||||||
@ -195,7 +195,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 根据设备编号详细信息
|
* 根据设备编号详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/getDeviceBySerialNumber/{serialNumber}")
|
@GetMapping(value = "/getDeviceBySerialNumber/{serialNumber}")
|
||||||
@ApiOperation("根据设备编号获取设备详情")
|
@ApiOperation("根据设备编号获取设备详情")
|
||||||
public AjaxResult getInfoBySerialNumber(@PathVariable("serialNumber") String serialNumber) {
|
public AjaxResult getInfoBySerialNumber(@PathVariable("serialNumber") String serialNumber) {
|
||||||
@ -205,7 +205,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 获取设备统计信息
|
* 获取设备统计信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/statistic")
|
@GetMapping(value = "/statistic")
|
||||||
@ApiOperation("获取设备统计信息")
|
@ApiOperation("获取设备统计信息")
|
||||||
public AjaxResult getDeviceStatistic() {
|
public AjaxResult getDeviceStatistic() {
|
||||||
@ -215,7 +215,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 获取设备详细信息
|
* 获取设备详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping(value = "/runningStatus")
|
@GetMapping(value = "/runningStatus")
|
||||||
@ApiOperation("获取设备详情和运行状态")
|
@ApiOperation("获取设备详情和运行状态")
|
||||||
public AjaxResult getRunningStatusInfo(Long deviceId) {
|
public AjaxResult getRunningStatusInfo(Long deviceId) {
|
||||||
@ -225,7 +225,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 新增设备
|
* 新增设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@Log(title = "添加设备", businessType = BusinessType.INSERT)
|
@Log(title = "添加设备", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("添加设备")
|
@ApiOperation("添加设备")
|
||||||
@ -237,7 +237,7 @@ public class DeviceController extends BaseController {
|
|||||||
* TODO --APP
|
* TODO --APP
|
||||||
* 终端用户绑定设备
|
* 终端用户绑定设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@Log(title = "设备关联用户", businessType = BusinessType.UPDATE)
|
@Log(title = "设备关联用户", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/relateUser")
|
@PostMapping("/relateUser")
|
||||||
@ApiOperation("终端-设备关联用户")
|
@ApiOperation("终端-设备关联用户")
|
||||||
@ -254,7 +254,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 修改设备
|
* 修改设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||||
@Log(title = "修改设备", businessType = BusinessType.UPDATE)
|
@Log(title = "修改设备", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改设备")
|
@ApiOperation("修改设备")
|
||||||
@ -265,7 +265,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 重置设备状态
|
* 重置设备状态
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||||
@Log(title = "重置设备状态", businessType = BusinessType.UPDATE)
|
@Log(title = "重置设备状态", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/reset/{serialNumber}")
|
@PutMapping("/reset/{serialNumber}")
|
||||||
@ApiOperation("重置设备状态")
|
@ApiOperation("重置设备状态")
|
||||||
@ -278,7 +278,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 删除设备
|
* 删除设备
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||||
@Log(title = "删除设备", businessType = BusinessType.DELETE)
|
@Log(title = "删除设备", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deviceIds}")
|
@DeleteMapping("/{deviceIds}")
|
||||||
@ApiOperation("批量删除设备")
|
@ApiOperation("批量删除设备")
|
||||||
@ -289,7 +289,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 生成设备编号
|
* 生成设备编号
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@GetMapping("/generator")
|
@GetMapping("/generator")
|
||||||
@ApiOperation("生成设备编号")
|
@ApiOperation("生成设备编号")
|
||||||
public AjaxResult generatorDeviceNum(Integer type) {
|
public AjaxResult generatorDeviceNum(Integer type) {
|
||||||
@ -302,14 +302,14 @@ public class DeviceController extends BaseController {
|
|||||||
* @param deviceId 设备主键id
|
* @param deviceId 设备主键id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping("/getMqttConnectData")
|
@GetMapping("/getMqttConnectData")
|
||||||
@ApiOperation("获取设备MQTT连接参数")
|
@ApiOperation("获取设备MQTT连接参数")
|
||||||
public AjaxResult getMqttConnectData(Long deviceId) {
|
public AjaxResult getMqttConnectData(Long deviceId) {
|
||||||
return AjaxResult.success(deviceService.getMqttConnectData(deviceId));
|
return AjaxResult.success(deviceService.getMqttConnectData(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@ApiOperation("下载设备导入模板")
|
@ApiOperation("下载设备导入模板")
|
||||||
@PostMapping("/uploadTemplate")
|
@PostMapping("/uploadTemplate")
|
||||||
public void uploadTemplate(HttpServletResponse response, @RequestParam(name = "type") Integer type) {
|
public void uploadTemplate(HttpServletResponse response, @RequestParam(name = "type") Integer type) {
|
||||||
@ -323,7 +323,7 @@ public class DeviceController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||||
@ApiOperation("批量导入设备")
|
@ApiOperation("批量导入设备")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
@ -344,7 +344,7 @@ public class DeviceController extends BaseController {
|
|||||||
return StringUtils.isEmpty(message) ? success(MessageUtils.message("import.success")) : error(message);
|
return StringUtils.isEmpty(message) ? success(MessageUtils.message("import.success")) : error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:assignment')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:assignment')")
|
||||||
@ApiOperation("批量导入分配设备")
|
@ApiOperation("批量导入分配设备")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/importAssignmentData")
|
@PostMapping("/importAssignmentData")
|
||||||
@ -372,7 +372,7 @@ public class DeviceController extends BaseController {
|
|||||||
* @return com.fastbee.common.core.domain.AjaxResult
|
* @return com.fastbee.common.core.domain.AjaxResult
|
||||||
* @param: deviceIds 设备id字符串
|
* @param: deviceIds 设备id字符串
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:assignment')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:assignment')")
|
||||||
@ApiOperation("分配设备")
|
@ApiOperation("分配设备")
|
||||||
@PostMapping("/assignment")
|
@PostMapping("/assignment")
|
||||||
public AjaxResult assignment(@RequestParam("deptId") Long deptId, @RequestParam("deviceIds") String deviceIds) {
|
public AjaxResult assignment(@RequestParam("deptId") Long deptId, @RequestParam("deviceIds") String deviceIds) {
|
||||||
@ -391,7 +391,7 @@ public class DeviceController extends BaseController {
|
|||||||
* @return com.fastbee.common.core.domain.AjaxResult
|
* @return com.fastbee.common.core.domain.AjaxResult
|
||||||
* @param: deviceIds 设备id字符串
|
* @param: deviceIds 设备id字符串
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:recovery')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:recovery')")
|
||||||
@ApiOperation("回收设备")
|
@ApiOperation("回收设备")
|
||||||
@PostMapping("/recovery")
|
@PostMapping("/recovery")
|
||||||
public AjaxResult recovery(@RequestParam("deviceIds") String deviceIds, @RequestParam("recoveryDeptId") Long recoveryDeptId) {
|
public AjaxResult recovery(@RequestParam("deviceIds") String deviceIds, @RequestParam("recoveryDeptId") Long recoveryDeptId) {
|
||||||
@ -404,7 +404,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 批量生成设备编号
|
* 批量生成设备编号
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:batchGenerator')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:batchGenerator')")
|
||||||
@PostMapping("/batchGenerator")
|
@PostMapping("/batchGenerator")
|
||||||
@ApiOperation("批量生成设备编号")
|
@ApiOperation("批量生成设备编号")
|
||||||
public void batchGeneratorDeviceNum(HttpServletResponse response, @RequestParam("count") Integer count) {
|
public void batchGeneratorDeviceNum(HttpServletResponse response, @RequestParam("count") Integer count) {
|
||||||
@ -425,7 +425,7 @@ public class DeviceController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询变量概况
|
* 查询变量概况
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
// @PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||||
@GetMapping("/listThingsModel")
|
@GetMapping("/listThingsModel")
|
||||||
@ApiOperation("查询变量概况")
|
@ApiOperation("查询变量概况")
|
||||||
public TableDataInfo listThingsModel(Integer pageNum, Integer pageSize, Long deviceId, String modelName, Integer type) {
|
public TableDataInfo listThingsModel(Integer pageNum, Integer pageSize, Long deviceId, String modelName, Integer type) {
|
||||||
|
@ -46,10 +46,10 @@ public class MaGuangaiRecordController extends BaseController
|
|||||||
@ApiOperation("查询灌溉记录列表")
|
@ApiOperation("查询灌溉记录列表")
|
||||||
public TableDataInfo list(MaGuangaiRecord maGuangaiRecord)
|
public TableDataInfo list(MaGuangaiRecord maGuangaiRecord)
|
||||||
{
|
{
|
||||||
startPage();
|
// startPage();
|
||||||
List<MaGuangaiRecord> list
|
TableDataInfo tableDataInfo
|
||||||
= maGuangaiRecordService.selectMaGuangaiRecordList(maGuangaiRecord);
|
= maGuangaiRecordService.selectMaGuangaiRecordList(maGuangaiRecord);
|
||||||
return getDataTable(list);
|
return tableDataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,8 @@ public class MaGuangaiRecordController extends BaseController
|
|||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, MaGuangaiRecord maGuangaiRecord)
|
public void export(HttpServletResponse response, MaGuangaiRecord maGuangaiRecord)
|
||||||
{
|
{
|
||||||
List<MaGuangaiRecord> list = maGuangaiRecordService.selectMaGuangaiRecordList(maGuangaiRecord);
|
TableDataInfo tableDataInfo = maGuangaiRecordService.selectMaGuangaiRecordList(maGuangaiRecord);
|
||||||
|
List<MaGuangaiRecord> list = (List<MaGuangaiRecord>) tableDataInfo.getRows();
|
||||||
ExcelUtil<MaGuangaiRecord> util = new ExcelUtil<MaGuangaiRecord>(MaGuangaiRecord.class);
|
ExcelUtil<MaGuangaiRecord> util = new ExcelUtil<MaGuangaiRecord>(MaGuangaiRecord.class);
|
||||||
util.exportExcel(response, list, "灌溉记录数据");
|
util.exportExcel(response, list, "灌溉记录数据");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.fastbee.waterele.service;
|
package com.fastbee.waterele.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fastbee.common.core.page.TableDataInfo;
|
||||||
import com.fastbee.waterele.domain.MaGuangaiRecord;
|
import com.fastbee.waterele.domain.MaGuangaiRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +27,7 @@ public interface IMaGuangaiRecordService
|
|||||||
* @param maGuangaiRecord 灌溉记录
|
* @param maGuangaiRecord 灌溉记录
|
||||||
* @return 灌溉记录集合
|
* @return 灌溉记录集合
|
||||||
*/
|
*/
|
||||||
public List<MaGuangaiRecord> selectMaGuangaiRecordList(MaGuangaiRecord maGuangaiRecord);
|
public TableDataInfo selectMaGuangaiRecordList(MaGuangaiRecord maGuangaiRecord);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增灌溉记录
|
* 新增灌溉记录
|
||||||
|
@ -1,13 +1,27 @@
|
|||||||
package com.fastbee.waterele.service.impl;
|
package com.fastbee.waterele.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSON;
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.fastbee.common.core.page.PageDomain;
|
||||||
|
import com.fastbee.common.core.page.TableDataInfo;
|
||||||
|
import com.fastbee.common.core.page.TableSupport;
|
||||||
import com.fastbee.common.utils.DateUtils;
|
import com.fastbee.common.utils.DateUtils;
|
||||||
|
import com.fastbee.common.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.fastbee.waterele.mapper.MaGuangaiRecordMapper;
|
import com.fastbee.waterele.mapper.MaGuangaiRecordMapper;
|
||||||
import com.fastbee.waterele.domain.MaGuangaiRecord;
|
import com.fastbee.waterele.domain.MaGuangaiRecord;
|
||||||
import com.fastbee.waterele.service.IMaGuangaiRecordService;
|
import com.fastbee.waterele.service.IMaGuangaiRecordService;
|
||||||
|
|
||||||
|
import static com.fastbee.common.utils.PageUtils.startPage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 灌溉记录Service业务层处理
|
* 灌溉记录Service业务层处理
|
||||||
*
|
*
|
||||||
@ -39,11 +53,99 @@ public class MaGuangaiRecordServiceImpl implements IMaGuangaiRecordService
|
|||||||
* @return 灌溉记录
|
* @return 灌溉记录
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MaGuangaiRecord> selectMaGuangaiRecordList(MaGuangaiRecord maGuangaiRecord)
|
public TableDataInfo selectMaGuangaiRecordList(MaGuangaiRecord maGuangaiRecord)
|
||||||
{
|
{
|
||||||
return maGuangaiRecordMapper.selectMaGuangaiRecordList(maGuangaiRecord);
|
//
|
||||||
|
Long endTime = 0L;
|
||||||
|
Long startTime = 0L;
|
||||||
|
if(null == maGuangaiRecord.getParams()){
|
||||||
|
endTime = new Date().getTime()/1000;
|
||||||
|
startTime = endTime - 86400*3;
|
||||||
|
}else{
|
||||||
|
if(!maGuangaiRecord.getParams().containsKey("endCreateTime")){
|
||||||
|
endTime = new Date().getTime()/1000;
|
||||||
|
}else{
|
||||||
|
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,
|
||||||
|
maGuangaiRecord.getParams().get("endCreateTime").toString()).getTime();
|
||||||
|
}
|
||||||
|
if(!maGuangaiRecord.getParams().containsKey("beginCreateTime")){
|
||||||
|
startTime = endTime - 86400*3;
|
||||||
|
}else{
|
||||||
|
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,
|
||||||
|
maGuangaiRecord.getParams().get("beginCreateTime").toString()).getTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Date startDate = new Date();
|
||||||
|
startDate.setTime(startTime*1000);
|
||||||
|
String startDateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,startDate);
|
||||||
|
Date endDate = new Date();
|
||||||
|
endDate.setTime(endTime*1000);
|
||||||
|
String endDateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,endDate);
|
||||||
|
String url = "https://zhwly.sdhzwl.cn/api/java/xinjiangup/getGuangaiRecord?devSn="
|
||||||
|
+maGuangaiRecord.getDevSn()+"&startTime="+startDateStr+"&endTime="+endDateStr;
|
||||||
|
String result =HttpUtil.get(url);
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject(result);
|
||||||
|
List<MaGuangaiRecord> list = new ArrayList<>();
|
||||||
|
if(jsonObject != null){
|
||||||
|
if(jsonObject.containsKey("code") && Integer.parseInt(jsonObject.get("code").toString()) == 200){
|
||||||
|
if(jsonObject.containsKey("data") && jsonObject.get("data") != null){
|
||||||
|
JSONArray dataList = (JSONArray)jsonObject.get("data");
|
||||||
|
for (Object object : dataList) {
|
||||||
|
JSONObject item = (JSONObject)object;
|
||||||
|
MaGuangaiRecord record = new MaGuangaiRecord();
|
||||||
|
record.setDevSn(item.get("dev_sn").toString());
|
||||||
|
if(StringUtils.isNotEmpty(item.get("start_time").toString())){
|
||||||
|
Date date = new Date(Long.parseLong(item.get("start_time").toString())*1000);
|
||||||
|
record.setStartTime(date);
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(item.get("end_time").toString())){
|
||||||
|
Date date = new Date(Long.parseLong(item.get("end_time").toString())*1000);
|
||||||
|
record.setEndTime(date);
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(item.get("last_time").toString())){
|
||||||
|
Date date = new Date(Long.parseLong(item.get("last_time").toString())*1000);
|
||||||
|
record.setLastTime(date);
|
||||||
|
}
|
||||||
|
record.setCurEle(item.get("cur_ele").toString());
|
||||||
|
record.setCardId(item.get("card_id").toString());
|
||||||
|
record.setAreaCode(item.get("area_code").toString());
|
||||||
|
record.setUserBalance(item.get("user_balance").toString());
|
||||||
|
record.setCurFlow(item.get("cur_flow").toString());
|
||||||
|
record.setCurEle(item.get("cur_ele").toString());
|
||||||
|
record.setStatus(Integer.parseInt(item.get("status").toString()));
|
||||||
|
if(StringUtils.isNotEmpty(item.get("create_time").toString())){
|
||||||
|
Date date = new Date(Long.parseLong(item.get("create_time").toString())*1000);
|
||||||
|
record.setCreateTime(date);
|
||||||
|
}
|
||||||
|
list.add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
Integer pageNum = pageDomain.getPageNum();
|
||||||
|
Integer pageSize = pageDomain.getPageSize();
|
||||||
|
List<MaGuangaiRecord> subList = new ArrayList<>();
|
||||||
|
if(list.size() > (pageNum-1)*pageSize){
|
||||||
|
if(list.size() < pageNum*pageSize){
|
||||||
|
subList = list.subList((pageNum-1)*pageSize, list.size());
|
||||||
|
}else{
|
||||||
|
subList = list.subList((pageNum-1)*pageSize, pageNum*pageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||||
|
tableDataInfo.setMsg("获取成功");
|
||||||
|
tableDataInfo.setTotal(list.size());
|
||||||
|
tableDataInfo.setRows(subList);
|
||||||
|
tableDataInfo.setCode(200);
|
||||||
|
return tableDataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增灌溉记录
|
* 新增灌溉记录
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="curFlow != null and curFlow != ''"> and cur_flow = #{curFlow}</if>
|
<if test="curFlow != null and curFlow != ''"> and cur_flow = #{curFlow}</if>
|
||||||
<if test="curEle != null and curEle != ''"> and cur_ele = #{curEle}</if>
|
<if test="curEle != null and curEle != ''"> and cur_ele = #{curEle}</if>
|
||||||
<if test="status != null "> and status = #{status}</if>
|
<if test="status != null "> and status = #{status}</if>
|
||||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
|
||||||
|
and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user