Merge branch 'master' of https://codeup.aliyun.com/6428039c708c83a3fd907211/hzwmiot/hzwmiot24_java
This commit is contained in:
@ -156,6 +156,10 @@
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
<version>1.5.36</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fastbee</groupId>
|
||||
<artifactId>fastbee-waterele-service</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
@ -1,155 +0,0 @@
|
||||
package com.fastbee.iot.anfang.controller;
|
||||
|
||||
import com.fastbee.common.annotation.Log;
|
||||
import com.fastbee.common.config.RuoYiConfig;
|
||||
import com.fastbee.common.core.controller.BaseController;
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.common.enums.BusinessType;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import com.fastbee.common.utils.file.FileUploadUtils;
|
||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||
import com.fastbee.iot.anfang.service.IUploadedPhotosService;
|
||||
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||
import io.swagger.annotations.Api;
|
||||
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.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fastbee.common.utils.StringUtils.isEmpty;
|
||||
|
||||
/**
|
||||
* 设备告警上传Controller
|
||||
*
|
||||
* @author Dunxi Zang
|
||||
* @date 2024-06-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/photos")
|
||||
@Api(tags = "安防小板")
|
||||
public class UploadedPhotosController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUploadedPhotosService uploadedPhotosService;
|
||||
|
||||
/**
|
||||
* 查询设备告警上传列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
startPage();
|
||||
List<UploadedPhotos> list = uploadedPhotosService.selectUploadedPhotosList(uploadedPhotos);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备告警上传列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:export')")
|
||||
@Log(title = "设备告警上传", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
List<UploadedPhotos> list = uploadedPhotosService.selectUploadedPhotosList(uploadedPhotos);
|
||||
ExcelUtil<UploadedPhotos> util = new ExcelUtil<UploadedPhotos>(UploadedPhotos.class);
|
||||
util.exportExcel(response, list, "设备告警上传数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备告警上传详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(uploadedPhotosService.selectUploadedPhotosById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备告警上传
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult uploadPhoto(
|
||||
@RequestParam("fileToUpload") MultipartFile photo,
|
||||
@RequestParam("imei") String imei,
|
||||
@RequestParam("sn") String sn,
|
||||
@RequestParam("lat") String lat,
|
||||
@RequestParam("lng") String lng,
|
||||
@RequestParam("temp") String temp,
|
||||
@RequestParam("doorState") String doorState,
|
||||
@RequestParam("shakeState") String shakeState,
|
||||
@RequestParam("time") String time) {
|
||||
|
||||
if (photo.isEmpty()) {
|
||||
throw new ServiceException("照片为空,上传失败");
|
||||
}
|
||||
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, photo);
|
||||
|
||||
// 处理可能为空的字段
|
||||
Double latitude = isEmpty(lat) ? 0.0 : Double.valueOf(lat);
|
||||
Double longitude = isEmpty(lng) ? 0.0 : Double.valueOf(lng);
|
||||
Double temperature = isEmpty(temp) ? 0.0 : convertAndRoundTemperature(temp);
|
||||
if(doorState.equals("0")){
|
||||
shakeState = "1";
|
||||
}
|
||||
// 处理时间戳
|
||||
long timestamp = Long.parseLong(time + "000");
|
||||
Date date = new Date(timestamp);
|
||||
|
||||
UploadedPhotos uploadedPhotos = new UploadedPhotos(
|
||||
null, fileName, imei, sn, latitude, longitude, temperature, doorState, shakeState, date
|
||||
);
|
||||
return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException("设备告警信息上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备告警上传
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:edit')")
|
||||
@Log(title = "设备告警上传", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return toAjax(uploadedPhotosService.updateUploadedPhotos(uploadedPhotos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备告警上传
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:remove')")
|
||||
@Log(title = "设备告警上传", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(uploadedPhotosService.deleteUploadedPhotosByIds(ids));
|
||||
}
|
||||
public static Double convertAndRoundTemperature(String tempStr) {
|
||||
// 将字符串转换为double
|
||||
double temp = Double.parseDouble(tempStr);
|
||||
|
||||
// 使用BigDecimal进行四舍五入,保留两位小数
|
||||
BigDecimal bd = BigDecimal.valueOf(temp);
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
// 返回转换后的double值
|
||||
return bd.doubleValue();
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package com.fastbee.iot.anfang.service;
|
||||
|
||||
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 存储上传的照片信息Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-06-20
|
||||
*/
|
||||
public interface IUploadedPhotosService
|
||||
{
|
||||
/**
|
||||
* 查询存储上传的照片信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 存储上传的照片信息
|
||||
*/
|
||||
public UploadedPhotos selectUploadedPhotosById(Long id);
|
||||
|
||||
/**
|
||||
* 查询存储上传的照片信息列表
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 存储上传的照片信息集合
|
||||
*/
|
||||
public List<UploadedPhotos> selectUploadedPhotosList(UploadedPhotos uploadedPhotos);
|
||||
|
||||
/**
|
||||
* 新增存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUploadedPhotos(UploadedPhotos uploadedPhotos);
|
||||
|
||||
/**
|
||||
* 修改存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUploadedPhotos(UploadedPhotos uploadedPhotos);
|
||||
|
||||
/**
|
||||
* 批量删除存储上传的照片信息
|
||||
*
|
||||
* @param ids 需要删除的存储上传的照片信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUploadedPhotosByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除存储上传的照片信息信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUploadedPhotosById(Long id);
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package com.fastbee.iot.anfang.service.impl;
|
||||
|
||||
import com.fastbee.iot.anfang.service.IUploadedPhotosService;
|
||||
import com.fastbee.iot.mapper.UploadedPhotosMapper;
|
||||
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 存储上传的照片信息Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-06-20
|
||||
*/
|
||||
@Service
|
||||
public class UploadedPhotosServiceImpl implements IUploadedPhotosService
|
||||
{
|
||||
@Resource
|
||||
private UploadedPhotosMapper uploadedPhotosMapper;
|
||||
|
||||
/**
|
||||
* 查询存储上传的照片信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 存储上传的照片信息
|
||||
*/
|
||||
@Override
|
||||
public UploadedPhotos selectUploadedPhotosById(Long id)
|
||||
{
|
||||
return uploadedPhotosMapper.selectUploadedPhotosById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询存储上传的照片信息列表
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 存储上传的照片信息
|
||||
*/
|
||||
@Override
|
||||
public List<UploadedPhotos> selectUploadedPhotosList(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return uploadedPhotosMapper.selectUploadedPhotosList(uploadedPhotos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUploadedPhotos(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return uploadedPhotosMapper.insertUploadedPhotos(uploadedPhotos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUploadedPhotos(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return uploadedPhotosMapper.updateUploadedPhotos(uploadedPhotos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除存储上传的照片信息
|
||||
*
|
||||
* @param ids 需要删除的存储上传的照片信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUploadedPhotosByIds(Long[] ids)
|
||||
{
|
||||
return uploadedPhotosMapper.deleteUploadedPhotosByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除存储上传的照片信息信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUploadedPhotosById(Long id)
|
||||
{
|
||||
return uploadedPhotosMapper.deleteUploadedPhotosById(id);
|
||||
}
|
||||
}
|
@ -178,6 +178,12 @@ public class Device extends BaseEntity
|
||||
|
||||
@ApiModelProperty("设备参数")
|
||||
private String devParams;
|
||||
@ApiModelProperty("管护人")
|
||||
private String caretaker;
|
||||
@ApiModelProperty("管护单位")
|
||||
private String managementUnit;
|
||||
@ApiModelProperty("联系电话")
|
||||
private String tel;
|
||||
|
||||
/**
|
||||
* 关联组态,来源产品
|
||||
|
@ -0,0 +1,50 @@
|
||||
package com.fastbee.iot.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备参数设置对象 device_param_config
|
||||
*
|
||||
* @author mafa
|
||||
* @date 2023-08-22
|
||||
*/
|
||||
@Data
|
||||
public class JiankongDeviceParam
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 设备id */
|
||||
private Long deviceId;
|
||||
/** ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 */
|
||||
private String startTime;
|
||||
/** ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 */
|
||||
private String stopTime;
|
||||
/** ezopen协议地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1 */
|
||||
private String type;
|
||||
/** ezopen协议地址的设备的视频加密密码 */
|
||||
private String code;
|
||||
/** 流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1 */
|
||||
private String protocol;
|
||||
|
||||
/** 视频清晰度,1-高清(主码流)、2-流畅(子码流) */
|
||||
private String quality;
|
||||
|
||||
/** 云台操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 */
|
||||
private String direction;
|
||||
/** 云台操作命令:速度 */
|
||||
private String speed;
|
||||
|
||||
/** 云台操作命令:传了一直动 不传移动一格 */
|
||||
private String notStop;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.fastbee.iot.haikang;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 点点控api界面
|
||||
*/
|
||||
public class HaikangYingshiApi {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getToken(Map<String, Object> params) {
|
||||
String url = UrlConstant.getToken;//指定URL
|
||||
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
// System.out.println("jsonObject = " + jsonObject);
|
||||
// Map<String,Object> data =null;
|
||||
// if (jsonObject.get("code").equals("200")) {
|
||||
// data= (Map<String,Object>) jsonObject.get("data");
|
||||
// }
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 直播源,例如427734222,均采用英文符号,限制50个 Y
|
||||
* channelNo Integer 通道号,,非必选,默认为1 N
|
||||
* code String ezopen协议地址的设备的视频加密密码 N
|
||||
* expireTime Integer 过期时长,单位秒;针对hls/rtmp设置有效期,相对时间;30秒-720天 N
|
||||
* protocol Integer 流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1 N
|
||||
* quality Integer 视频清晰度,1-高清(主码流)、2-流畅(子码流) N
|
||||
* startTime String ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 N
|
||||
* stopTime String ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 N
|
||||
* type String ezopen协议地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1 N
|
||||
* supportH265 Integer 是否要求播放视频为H265编码格式,1表示需要,0表示不要求 N
|
||||
* gbchannel String 国标设备的通道编号,视频通道编号ID N
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getAddress(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.address;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
// System.out.println("result = " + result);
|
||||
// Map<String,Object> data =(Map<String,Object>) jsonObject.get("data");
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||
* channelNo int 通道号 Y
|
||||
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||
* speed int 云台速度:0-慢,1-适中,2-快,海康设备参数不可为0
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject startMove(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.startyuntai;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||
* channelNo int 通道号 Y
|
||||
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject stopMove(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.stopyuntai;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||
* channelNo int 通道号 Y
|
||||
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getDeviceInfo(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.deviceInfo;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 直播源,例如427734222,均采用英文符号,限制50个 Y
|
||||
* channelNo Integer 通道号,,非必选,默认为1 N
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject capture(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.capture;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
// System.out.println("result = " + result);
|
||||
// Map<String,Object> data =(Map<String,Object>) jsonObject.get("data");
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.fastbee.iot.haikang;
|
||||
|
||||
/**
|
||||
* 点点控
|
||||
*/
|
||||
public class UrlConstant {
|
||||
|
||||
public static String appKey = "be85054cf4504710861fad77ec4e4af9";
|
||||
public static String appSecret = "104f39e29f9847e5d819a99c1c32fc88";
|
||||
|
||||
//获取 token
|
||||
public static String getToken = "https://open.ys7.com/api/lapp/token/get";
|
||||
//获取 直播地址
|
||||
public static String address = "https://open.ys7.com/api/lapp/v2/live/address/get";
|
||||
//开始云台
|
||||
public static String startyuntai = "https://open.ys7.com/api/lapp/device/ptz/start";
|
||||
//停止云台
|
||||
public static String stopyuntai = "https://open.ys7.com/api/lapp/device/ptz/stop";
|
||||
//设备信息
|
||||
public static String deviceInfo = "https://open.ys7.com/api/lapp/device/info";
|
||||
//设备抓拍图片
|
||||
public static String capture = "https://open.ys7.com/api/lapp/device/capture";
|
||||
//关闭设备视频加密
|
||||
public static String deviceEncryptOff = "https://open.ys7.com/api/lapp/device/encrypt/off";
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.fastbee.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -66,6 +67,12 @@ public class DeviceAllShortOutput
|
||||
private Integer isOwner;
|
||||
|
||||
private Integer subDeviceCount;
|
||||
@ApiModelProperty("管护人")
|
||||
private String caretaker;
|
||||
@ApiModelProperty("管护单位")
|
||||
private String managementUnit;
|
||||
@ApiModelProperty("联系电话")
|
||||
private String tel;
|
||||
|
||||
public Integer getSubDeviceCount() {
|
||||
return subDeviceCount;
|
||||
|
@ -94,6 +94,13 @@ public class DeviceShortOutput
|
||||
@Excel(name = "网关设备编号(子设备使用)")
|
||||
private String gwDevCode;
|
||||
|
||||
@ApiModelProperty("管护人")
|
||||
private String caretaker;
|
||||
@ApiModelProperty("管护单位")
|
||||
private String managementUnit;
|
||||
@ApiModelProperty("联系电话")
|
||||
private String tel;
|
||||
|
||||
/** 是否自定义位置 **/
|
||||
private Integer locationWay;
|
||||
|
||||
|
@ -28,7 +28,9 @@ public class UploadedPhotos extends BaseEntity
|
||||
/** 照片存储路径 */
|
||||
@Excel(name = "照片存储路径")
|
||||
private String photoPath;
|
||||
|
||||
/** 监控抓拍 */
|
||||
@Excel(name = "监控抓拍")
|
||||
private String monitorPath;
|
||||
/** 设备IMEI号 */
|
||||
@Excel(name = "设备IMEI号")
|
||||
private String imei;
|
||||
|
@ -6,6 +6,7 @@ import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
|
||||
import com.fastbee.common.enums.DeviceStatus;
|
||||
import com.fastbee.iot.domain.Device;
|
||||
import com.fastbee.iot.domain.DeviceGroup;
|
||||
import com.fastbee.iot.domain.JiankongDeviceParam;
|
||||
import com.fastbee.iot.model.*;
|
||||
import com.fastbee.iot.model.ThingsModels.ThingsModelShadow;
|
||||
import com.fastbee.iot.model.ThingsModels.ThingsModelValueItem;
|
||||
@ -334,5 +335,5 @@ public interface IDeviceService
|
||||
|
||||
|
||||
ArrayList<Object> getDeviceLogAllCurves(Long deviceId, String beginTime, String endTime);
|
||||
|
||||
Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam);
|
||||
}
|
||||
|
@ -10,21 +10,20 @@ import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.core.domain.entity.SysDept;
|
||||
import com.fastbee.common.core.domain.entity.SysUser;
|
||||
import com.fastbee.common.core.domain.model.LoginUser;
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.common.core.redis.RedisCache;
|
||||
import com.fastbee.common.core.redis.RedisKeyBuilder;
|
||||
import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
|
||||
import com.fastbee.common.core.thingsModel.ThingsModelValuesInput;
|
||||
import com.fastbee.common.enums.*;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import com.fastbee.common.utils.CaculateUtils;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.common.utils.SecurityUtils;
|
||||
import com.fastbee.common.utils.StringUtils;
|
||||
import com.fastbee.common.utils.*;
|
||||
import com.fastbee.common.utils.http.HttpUtils;
|
||||
import com.fastbee.common.utils.ip.IpUtils;
|
||||
import com.fastbee.common.utils.json.JsonUtils;
|
||||
import com.fastbee.iot.cache.ITSLCache;
|
||||
import com.fastbee.iot.domain.*;
|
||||
import com.fastbee.iot.haikang.HaikangYingshiApi;
|
||||
import com.fastbee.iot.mapper.*;
|
||||
import com.fastbee.iot.model.*;
|
||||
import com.fastbee.iot.model.ThingsModelItem.Datatype;
|
||||
@ -39,6 +38,8 @@ import com.fastbee.iot.cache.ITSLValueCache;
|
||||
import com.fastbee.iot.tdengine.service.ILogService;
|
||||
import com.fastbee.system.mapper.SysDeptMapper;
|
||||
import com.fastbee.system.service.ISysUserService;
|
||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||
import com.fastbee.waterele.service.IMaWatereleRecordService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -123,7 +124,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
private SubGatewayMapper subGatewayMapper;
|
||||
@Resource
|
||||
private IOrderControlService orderControlService;
|
||||
|
||||
@Resource
|
||||
private IMaWatereleRecordService watereleRecordService;
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
@ -135,6 +137,9 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
@Override
|
||||
public Device selectDeviceByDeviceId(Long deviceId) {
|
||||
Device device = deviceMapper.selectDeviceByDeviceId(deviceId);
|
||||
if (device == null) {
|
||||
return null;
|
||||
}
|
||||
List<ValueItem> list = itslValueCache.getCacheDeviceStatus(device.getProductId(), device.getSerialNumber());
|
||||
if (list != null && list.size() > 0) {
|
||||
// redis中获取设备状态(物模型值)
|
||||
@ -1600,13 +1605,24 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
@Override
|
||||
public List<Map<String, Object>> devicePointInfo(Device devices) {
|
||||
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
|
||||
devices.setProductId(136L);
|
||||
List<Device> deviceList = selectDeviceList(devices);
|
||||
|
||||
for (Device device : deviceList) {
|
||||
// MaWatereleRecord maWatereleRecord = new MaWatereleRecord();
|
||||
// maWatereleRecord.setDevSn(device.getSerialNumber());
|
||||
// TableDataInfo tableDataInfo = watereleRecordService.selectMaWatereleRecordList(maWatereleRecord);
|
||||
// List<MaWatereleRecord> list = (List<MaWatereleRecord>) tableDataInfo.getRows();
|
||||
// int status = 4;
|
||||
// if(list.size() > 0){
|
||||
// MaWatereleRecord record = list.get(0);
|
||||
// if(new Date().getTime() - record.getCreateTime().getTime() < 3600000){
|
||||
// status = 3;
|
||||
// }
|
||||
// }
|
||||
// device.setStatus(status);
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
resultList.add(itemMap);
|
||||
Integer integer = 0;
|
||||
|
||||
itemMap.put("device",device);
|
||||
if (device.getStatus() != null) {
|
||||
if (device.getStatus().equals(4)) {
|
||||
@ -1614,7 +1630,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
}
|
||||
itemMap.put("online",integer);
|
||||
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@ -1636,12 +1651,17 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
kvHashMap.put("beginTime", beginTime);
|
||||
kvHashMap.put("endTime", endTime);
|
||||
List<ThingsModel> thingsModels = thingsModelService.selectThingsModelList(new ThingsModel(device.getProductId()));
|
||||
thingsModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||
List<DeviceLog> deviceLogs= logService.selectDataList(kvHashMap);
|
||||
Map<String, List<DeviceLog>> collect = deviceLogs != null ? deviceLogs.stream().collect(Collectors.groupingBy(t -> t.getIdentity())): new HashMap();
|
||||
for (ThingsModel modelDevice : thingsModels) {
|
||||
if(modelDevice.getIsChart().equals(0)){
|
||||
continue;
|
||||
}
|
||||
HashMap<String, Object> dataListMap = new HashMap<>();
|
||||
|
||||
List<DeviceLog> deviceLogs1 = collect.get(modelDevice.getIdentifier());
|
||||
deviceLogs1.sort(Comparator.comparing(DeviceLog::getCreateTime));
|
||||
dataListMap.put("name", modelDevice.getModelName());
|
||||
if (StringUtils.isNotEmpty(modelDevice.getSpecs())) {
|
||||
cn.hutool.json.JSONObject object = new cn.hutool.json.JSONObject(modelDevice.getSpecs());
|
||||
@ -1651,7 +1671,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
if (deviceLogs1 != null) {
|
||||
System.out.println(deviceLogs1);
|
||||
dataListMap.put("time",deviceLogs1.stream().map(t->t.getCreateTime()).collect(Collectors.toList()));
|
||||
dataListMap.put("time",deviceLogs1.stream().map(t->DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,t.getCreateTime())).collect(Collectors.toList()));
|
||||
dataListMap.put("data",deviceLogs1.stream().map(t->t.getLogValue()).collect(Collectors.toList()));
|
||||
}else{
|
||||
dataListMap.put("time",new ArrayList<>());
|
||||
@ -1663,4 +1683,76 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam) {
|
||||
if (jiankongDeviceParam.getDeviceId() == null) {
|
||||
throw new RuntimeException("请上传设备id");
|
||||
}
|
||||
Device device = selectDeviceByDeviceId(jiankongDeviceParam.getDeviceId());
|
||||
|
||||
if (device == null) {
|
||||
throw new RuntimeException("设备未找到");
|
||||
}
|
||||
Map devData = DevParamsUtils.getDevParams(device.getDevParams());
|
||||
if (devData.get("appKey") == null) {
|
||||
throw new RuntimeException("未绑定设备参数appKey");
|
||||
}
|
||||
if (devData.get("appSecret") == null) {
|
||||
throw new RuntimeException("未绑定设备参数appSecret");
|
||||
}
|
||||
if (devData.get("channelNo") == null) {
|
||||
throw new RuntimeException("未绑定设备参数channelNo");
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();//存放参数
|
||||
map.put("appKey", devData.get("appKey"));
|
||||
map.put("appSecret", devData.get("appSecret"));
|
||||
cn.hutool.json.JSONObject token = HaikangYingshiApi.getToken(map);
|
||||
if (token != null && token.get("code").equals("200")) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
token = (cn.hutool.json.JSONObject) token.get("data");
|
||||
params.put("accessToken", token.get("accessToken"));
|
||||
params.put("deviceSerial", device.getSerialNumber());
|
||||
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getStartTime())) {
|
||||
params.put("startTime", jiankongDeviceParam.getStartTime());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getStopTime())) {
|
||||
params.put("stopTime", jiankongDeviceParam.getStopTime());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getType())) {
|
||||
params.put("type", jiankongDeviceParam.getType());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getCode())) {
|
||||
params.put("code", jiankongDeviceParam.getCode());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getProtocol())) {
|
||||
params.put("protocol", jiankongDeviceParam.getProtocol());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getQuality())) {
|
||||
params.put("quality", jiankongDeviceParam.getQuality());
|
||||
}
|
||||
|
||||
cn.hutool.json.JSONObject response = HaikangYingshiApi.getAddress(params);
|
||||
if (response != null && response.get("code").equals("200")) {
|
||||
Map data = (cn.hutool.json.JSONObject) response.get("data");
|
||||
Map<String, Object> reMap = new HashMap<>();
|
||||
reMap.put("url", data.get("url"));
|
||||
reMap.put("devName", device.getDeviceName());
|
||||
reMap.put("accessToken", token.get("accessToken"));
|
||||
reMap.put("id", device.getDeviceId());
|
||||
reMap.put("status", device.getStatus() == null || device.getStatus() == 4 ? "离线" : "在线");
|
||||
return reMap;
|
||||
} else {
|
||||
throw new RuntimeException(response.get("msg").toString());
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class ThingsModelServiceImpl implements IThingsModelService {
|
||||
*/
|
||||
@Override
|
||||
public ThingsModel selectSingleThingsModel(ThingsModel model) {
|
||||
model.setLanguage(SecurityUtils.getLanguage());
|
||||
// model.setLanguage(SecurityUtils.getLanguage());
|
||||
return thingsModelMapper.selectSingleThingsModel(model);
|
||||
}
|
||||
|
||||
|
@ -151,32 +151,36 @@ public class MySqlLogServiceImpl implements ILogService {
|
||||
|
||||
@Override
|
||||
public List<DeviceLog> selectDataList(HashMap<String, Object> kvHashMap) {
|
||||
if (kvHashMap.get("endTime") != null) {
|
||||
DateTime endTime = DateUtil.parse(kvHashMap.get("endTime").toString());
|
||||
String yyyyMM = endTime.toString("yyyyMM");
|
||||
String yyyyMM2 = DateUtil.offsetMonth(endTime, -1).toString("yyyyMM");
|
||||
if (tableMapper.getTableByName(tableName + yyyyMM) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + yyyyMM);
|
||||
}
|
||||
if (tableMapper.getTableByName(tableName + yyyyMM2) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + yyyyMM2);
|
||||
}
|
||||
kvHashMap.put("tableName", tableName + yyyyMM);
|
||||
kvHashMap.put("tableName2", tableName + yyyyMM2);
|
||||
}
|
||||
if (kvHashMap.get("tableName") == null) {
|
||||
Date date = new Date();
|
||||
String ym = DateUtils.parseDateToStr(DateUtils.YYYYMM, date);
|
||||
String ym2 = DateUtils.parseDateToStr(DateUtils.YYYYMM, DateUtil.offsetMonth(new Date(), -1));
|
||||
if (tableMapper.getTableByName(tableName + ym) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + ym);
|
||||
}
|
||||
if (tableMapper.getTableByName(tableName + ym2) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + ym2);
|
||||
}
|
||||
kvHashMap.put("tableName", tableName + ym);
|
||||
kvHashMap.put("tableName2", tableName + ym2);
|
||||
}
|
||||
return deviceLogMapper.selectDataList(kvHashMap);
|
||||
DeviceLog deviceLog = new DeviceLog();
|
||||
deviceLog.setBeginTime(kvHashMap.get("beginTime").toString());
|
||||
deviceLog.setEndTime(kvHashMap.get("endTime").toString());
|
||||
deviceLog.setSerialNumber((kvHashMap.get("serialNumber").toString()));
|
||||
// if (kvHashMap.get("endTime") != null) {
|
||||
// DateTime endTime = DateUtil.parse(kvHashMap.get("endTime").toString());
|
||||
// String yyyyMM = endTime.toString("yyyyMM");
|
||||
// String yyyyMM2 = DateUtil.offsetMonth(endTime, -1).toString("yyyyMM");
|
||||
// if (tableMapper.getTableByName(tableName + yyyyMM) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + yyyyMM);
|
||||
// }
|
||||
// if (tableMapper.getTableByName(tableName + yyyyMM2) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + yyyyMM2);
|
||||
// }
|
||||
// kvHashMap.put("tableName", tableName + yyyyMM);
|
||||
// kvHashMap.put("tableName2", tableName + yyyyMM2);
|
||||
// }
|
||||
// if (kvHashMap.get("tableName") == null) {
|
||||
// Date date = new Date();
|
||||
// String ym = DateUtils.parseDateToStr(DateUtils.YYYYMM, date);
|
||||
// String ym2 = DateUtils.parseDateToStr(DateUtils.YYYYMM, DateUtil.offsetMonth(new Date(), -1));
|
||||
// if (tableMapper.getTableByName(tableName + ym) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + ym);
|
||||
// }
|
||||
// if (tableMapper.getTableByName(tableName + ym2) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + ym2);
|
||||
// }
|
||||
// kvHashMap.put("tableName", tableName + ym);
|
||||
// kvHashMap.put("tableName2", tableName + ym2);
|
||||
// }
|
||||
return deviceLogMapper.selectDeviceLogList(deviceLog);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastbee.iot.timer;//package com.fastbee.farming;
|
||||
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.common.core.redis.RedisCache;
|
||||
import com.fastbee.common.core.redis.RedisKeyBuilder;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
@ -17,6 +18,8 @@ import com.fastbee.iot.model.haiwei.HaiWeiPropertyVo;
|
||||
import com.fastbee.iot.service.IDeviceService;
|
||||
import com.fastbee.iot.tdengine.service.ILogService;
|
||||
import com.fastbee.iot.tdengine.service.model.TdLogDto;
|
||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||
import com.fastbee.waterele.service.IMaWatereleRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -43,7 +46,8 @@ public class QxtrTask {
|
||||
private ILogService iLogService;
|
||||
@Resource
|
||||
RedisCache redisCache;
|
||||
|
||||
@Resource
|
||||
private IMaWatereleRecordService watereleRecordService;
|
||||
private static Pattern pattern = Pattern.compile("[-+]?[0-9]+(\\.[0-9]+)?$");
|
||||
|
||||
/**
|
||||
@ -57,6 +61,33 @@ public class QxtrTask {
|
||||
getDeviceInfo(Long.valueOf(SOLAR_DEVICE.getType()), devices);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务 更新设备在线状态
|
||||
*/
|
||||
public void updateDeviceStatus() throws Exception {
|
||||
log.info("定时任务,更新设备在线状态");
|
||||
Device device = new Device();
|
||||
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
|
||||
device.setProductId(136L);
|
||||
List<Device> deviceList = iDeviceService.selectDeviceList(device);
|
||||
for (Device item : deviceList) {
|
||||
MaWatereleRecord maWatereleRecord = new MaWatereleRecord();
|
||||
maWatereleRecord.setDevSn(item.getSerialNumber());
|
||||
List<MaWatereleRecord> list = watereleRecordService.getList(maWatereleRecord);
|
||||
int status = 4;
|
||||
if(list.size() > 0){
|
||||
MaWatereleRecord record = list.get(0);
|
||||
if(new Date().getTime() - record.getCreateTime().getTime() < 3600000){
|
||||
status = 3;
|
||||
}
|
||||
}
|
||||
item.setStatus(status);
|
||||
iDeviceService.updateDevice(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 定时任务 流量计设备
|
||||
*/
|
||||
|
@ -36,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="transport" column="transport" />
|
||||
<result property="guid" column="guid" />
|
||||
<result property="devParams" column="dev_params" />
|
||||
<result property="tel" column="tel" />
|
||||
<result property="caretaker" column="caretaker" />
|
||||
<result property="managementUnit" column="management_unit" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
||||
@ -65,6 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="transport" column="transport" />
|
||||
<result property="guid" column="guid" />
|
||||
<result property="devParams" column="dev_params" />
|
||||
<result property="tel" column="tel" />
|
||||
<result property="caretaker" column="caretaker" />
|
||||
<result property="managementUnit" column="management_unit" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.fastbee.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
||||
@ -86,6 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="isOwner" column="is_owner" />
|
||||
<result property="subDeviceCount" column="sub_device_count"/>
|
||||
<result property="devParams" column="dev_params" />
|
||||
<result property="tel" column="tel" />
|
||||
<result property="caretaker" column="caretaker" />
|
||||
<result property="managementUnit" column="management_unit" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.fastbee.iot.model.UserAndTenant" id="UserAndTenantResult">
|
||||
@ -203,7 +212,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectUnAuthDeviceList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
||||
select d.device_id, d.device_name, d.product_id, d.product_name, d.tenant_id, d.tenant_name,
|
||||
d.serial_number,d.gw_dev_code,d.dev_params, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.serial_number,d.gw_dev_code,d.dev_params, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,
|
||||
d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
||||
from iot_device d
|
||||
left join iot_product_authorize a on a.device_id=d.device_id
|
||||
<where>
|
||||
@ -230,7 +241,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceListByGroup" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
||||
select d.device_id, d.device_name, d.dev_params, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
select d.device_id, d.device_name, d.dev_params, d.product_name,
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||
from iot_device d
|
||||
<where>
|
||||
@ -257,7 +270,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectAllDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceAllShortResult">
|
||||
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type,
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
@ -307,7 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, d.dev_params, p.product_id, p.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,d.management_unit, d.caretaker, d.tel,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||
case
|
||||
@ -352,7 +367,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
||||
select d.device_id, d.device_name, d.dev_params, d.product_id, p.product_name,p.device_type, d.tenant_id, d.tenant_name,
|
||||
d.serial_number, d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
||||
d.serial_number, d.management_unit, d.caretaker, d.tel,
|
||||
d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
||||
d.network_address, d.network_ip, d.longitude, d.latitude, d.active_time, d.create_time, d.update_time,
|
||||
d.img_url,d.summary,d.remark,p.guid from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
@ -518,6 +534,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isSimulate != null">is_simulate,</if>
|
||||
<if test="slaveId != null">slave_id,</if>
|
||||
<if test="devParams != null">dev_params,</if>
|
||||
<if test="managementUnit != null">management_unit,</if>
|
||||
<if test="caretaker != null">caretaker,</if>
|
||||
<if test="tel != null">tel,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
@ -549,11 +568,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isSimulate != null">#{isSimulate},</if>
|
||||
<if test="slaveId != null">#{slaveId},</if>
|
||||
<if test="devParams != null">#{devParams},</if>
|
||||
<if test="managementUnit != null">#{managementUnit},</if>
|
||||
<if test="caretaker != null">#{caretaker},</if>
|
||||
<if test="tel != null">#{tel},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatchDevice" parameterType="com.fastbee.iot.domain.Device" useGeneratedKeys="true" keyProperty="deviceId">
|
||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, rssi, is_shadow, location_way,dev_params, create_by, create_time)
|
||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number,
|
||||
firmware_version, rssi, is_shadow, location_way,dev_params, create_by, create_time)
|
||||
values
|
||||
<foreach collection="deviceList" item="device" separator=",">
|
||||
(#{device.deviceName},
|
||||
@ -604,6 +627,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="summary != null">summary = #{summary},</if>
|
||||
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||
<if test="devParams != null">dev_params = #{devParams},</if>
|
||||
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
|
||||
<if test="caretaker != null">caretaker = #{caretaker},</if>
|
||||
<if test="tel != null">tel = #{tel},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
@ -665,6 +691,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="summary != null">summary = #{summary},</if>
|
||||
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
|
||||
<if test="devParams != null">dev_params = #{devParams},</if>
|
||||
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
|
||||
<if test="caretaker != null">caretaker = #{caretaker},</if>
|
||||
<if test="tel != null">tel = #{tel},</if>
|
||||
</trim>
|
||||
where serial_number = #{serialNumber}
|
||||
</update>
|
||||
@ -812,6 +841,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="listTerminalUser" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||
d.things_model_value, d.active_time,d.create_time,d.img_url,d.dev_params,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
@ -879,7 +909,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="listTerminalUserByGroup" resultType="com.fastbee.iot.domain.Device">
|
||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code,
|
||||
d.management_unit, d.caretaker, d.tel,d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.dev_params,d.network_address,d.longitude,d.latitude
|
||||
from (
|
||||
select device_id, 1 AS is_owner
|
||||
|
@ -70,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="!showSenior and tenantId != null and tenantId != 0 and !isAdmin">
|
||||
and p.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="productId != null and productId != ''"> and p.product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="categoryName != null and categoryName != ''"> and p.category_name like concat('%', #{categoryName}, '%')</if>
|
||||
<if test="status != null "> and p.status = #{status}</if>
|
||||
|
@ -409,7 +409,7 @@
|
||||
specs = #{specs},
|
||||
</if>
|
||||
<if test="group != null and group != ''">
|
||||
group = #{group},
|
||||
`group` = #{group},
|
||||
</if>
|
||||
<if test="isChart != null">
|
||||
is_chart = #{isChart},
|
||||
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="com.fastbee.iot.model.anfang.UploadedPhotos" id="UploadedPhotosResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="photoPath" column="photo_path" />
|
||||
<result property="monitorPath" column="monitor_path" />
|
||||
<result property="imei" column="imei" />
|
||||
<result property="sn" column="sn" />
|
||||
<result property="lat" column="lat" />
|
||||
@ -18,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUploadedPhotosVo">
|
||||
select id, photo_path, imei, sn, lat, lng, temp, door_state, shake_state, upload_time from uploaded_photos
|
||||
select id, photo_path,monitor_path, imei, sn, lat, lng, temp, door_state, shake_state, upload_time from uploaded_photos
|
||||
</sql>
|
||||
|
||||
<select id="selectUploadedPhotosList" parameterType="com.fastbee.iot.model.anfang.UploadedPhotos" resultMap="UploadedPhotosResult">
|
||||
<select id="selectUploadedPhotosList" parameterType="com.fastbee.iot.model.anfang.UploadedPhotos"
|
||||
resultMap="UploadedPhotosResult">
|
||||
<include refid="selectUploadedPhotosVo"/>
|
||||
<where>
|
||||
<if test="photoPath != null and photoPath != ''"> and photo_path = #{photoPath}</if>
|
||||
@ -46,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into uploaded_photos
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="photoPath != null and photoPath != ''">photo_path,</if>
|
||||
<if test="monitorPath != null and monitorPath != ''">monitor_path,</if>
|
||||
<if test="imei != null and imei != ''">imei,</if>
|
||||
<if test="sn != null">sn,</if>
|
||||
<if test="lat != null">lat,</if>
|
||||
@ -57,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="photoPath != null and photoPath != ''">#{photoPath},</if>
|
||||
<if test="monitorPath != null and monitorPath != ''">#{monitorPath},</if>
|
||||
<if test="imei != null and imei != ''">#{imei},</if>
|
||||
<if test="sn != null">#{sn},</if>
|
||||
<if test="lat != null">#{lat},</if>
|
||||
@ -72,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update uploaded_photos
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="photoPath != null and photoPath != ''">photo_path = #{photoPath},</if>
|
||||
<if test="monitorPath != null and monitorPath != ''">monitor_path = #{monitorPath},</if>
|
||||
<if test="imei != null and imei != ''">imei = #{imei},</if>
|
||||
<if test="sn != null">sn = #{sn},</if>
|
||||
<if test="lat != null">lat = #{lat},</if>
|
||||
|
@ -246,7 +246,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
break;
|
||||
case ZH_CN:
|
||||
for (SysDictData data : list) {
|
||||
data.setDictLabel(data.getDictLabel_zh_CN());
|
||||
data.setDictLabel(data.getDictLabel());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -15,44 +15,64 @@ import com.fastbee.common.core.domain.BaseEntity;
|
||||
* @author kerwincui
|
||||
* @date 2024-08-12
|
||||
*/
|
||||
@ApiModel(value = "MaRechargerecord",description = "充值记录 ma_rechargerecord")
|
||||
@ApiModel(value = "MaRechargerecord", description = "充值记录 ma_rechargerecord")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MaRechargerecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
public class MaRechargerecord extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 序号 */
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/** 余额 */
|
||||
@Excel(name = "余额")
|
||||
@ApiModelProperty("余额")
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
@Excel(name = "余额")
|
||||
@ApiModelProperty("余额")
|
||||
private String balance;
|
||||
|
||||
/** 充值金额 */
|
||||
@Excel(name = "充值金额")
|
||||
@ApiModelProperty("充值金额")
|
||||
/**
|
||||
* 充值金额
|
||||
*/
|
||||
@Excel(name = "充值金额")
|
||||
@ApiModelProperty("充值金额")
|
||||
private String investval;
|
||||
|
||||
/** 卡编号 */
|
||||
@Excel(name = "卡编号")
|
||||
@ApiModelProperty("卡编号")
|
||||
/**
|
||||
* 卡编号
|
||||
*/
|
||||
@Excel(name = "卡编号")
|
||||
@ApiModelProperty("卡编号")
|
||||
private String cardNum;
|
||||
|
||||
/** 区域号 */
|
||||
@Excel(name = "区域号")
|
||||
@ApiModelProperty("区域号")
|
||||
/**
|
||||
* 区域号
|
||||
*/
|
||||
@Excel(name = "区域号")
|
||||
@ApiModelProperty("区域号")
|
||||
private String areaCode;
|
||||
|
||||
/** 卡ID */
|
||||
@Excel(name = "卡ID")
|
||||
@ApiModelProperty("卡ID")
|
||||
/**
|
||||
* 卡ID
|
||||
*/
|
||||
@Excel(name = "卡ID")
|
||||
@ApiModelProperty("卡ID")
|
||||
private String cardId;
|
||||
|
||||
/** mcuSn */
|
||||
@Excel(name = "mcuSn")
|
||||
@ApiModelProperty("mcuSn")
|
||||
/**
|
||||
* mcuSn
|
||||
*/
|
||||
@Excel(name = "mcuSn")
|
||||
@ApiModelProperty("mcuSn")
|
||||
private String mcusn;
|
||||
|
||||
/**
|
||||
* 充值状态
|
||||
*/
|
||||
@Excel(name = "充值状态")
|
||||
@ApiModelProperty("充值状态:2=未充值,1=充值成功")
|
||||
private Integer isRecharge;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fastbee.waterele.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UnchargeAmountVo {
|
||||
//卡编号
|
||||
private String cardNum;
|
||||
//区域号
|
||||
private String areaCode;
|
||||
//充值金额
|
||||
private float investVal;
|
||||
|
||||
|
||||
}
|
@ -58,4 +58,6 @@ public interface MaRechargerecordMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMaRechargerecordByIds(Long[] ids);
|
||||
|
||||
int updateByCardNumAndAreaCode(MaRechargerecord maRechargerecord);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.fastbee.waterele.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.waterele.domain.MaGuangaiRecord;
|
||||
|
||||
/**
|
||||
@ -25,7 +27,7 @@ public interface IMaGuangaiRecordService
|
||||
* @param maGuangaiRecord 灌溉记录
|
||||
* @return 灌溉记录集合
|
||||
*/
|
||||
public List<MaGuangaiRecord> selectMaGuangaiRecordList(MaGuangaiRecord maGuangaiRecord);
|
||||
public TableDataInfo selectMaGuangaiRecordList(MaGuangaiRecord maGuangaiRecord);
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
|
@ -2,6 +2,7 @@ package com.fastbee.waterele.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.waterele.domain.MaRechargerecord;
|
||||
import com.fastbee.waterele.domain.vo.UnchargeAmountVo;
|
||||
|
||||
/**
|
||||
* 充值记录Service接口
|
||||
@ -58,4 +59,18 @@ public interface IMaRechargerecordService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMaRechargerecordById(Long id);
|
||||
|
||||
/**
|
||||
* 获取未充值的总金额
|
||||
* @param maRechargerecord
|
||||
* @return
|
||||
*/
|
||||
UnchargeAmountVo queryUnchargeAmount(MaRechargerecord maRechargerecord);
|
||||
|
||||
/**
|
||||
* 充值成功反馈
|
||||
* @param maRechargerecord
|
||||
* @return
|
||||
*/
|
||||
String rechargeReply(MaRechargerecord maRechargerecord);
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
package com.fastbee.waterele.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||
|
||||
/**
|
||||
@ -25,8 +29,9 @@ public interface IMaWatereleRecordService
|
||||
* @param maWatereleRecord 水电双计数据记录
|
||||
* @return 水电双计数据记录集合
|
||||
*/
|
||||
public List<MaWatereleRecord> selectMaWatereleRecordList(MaWatereleRecord maWatereleRecord);
|
||||
public TableDataInfo selectMaWatereleRecordList(MaWatereleRecord maWatereleRecord);
|
||||
|
||||
List<MaWatereleRecord> getList(MaWatereleRecord maWatereleRecord);
|
||||
/**
|
||||
* 新增水电双计数据记录
|
||||
*
|
||||
@ -58,4 +63,8 @@ public interface IMaWatereleRecordService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMaWatereleRecordById(Long id);
|
||||
|
||||
ArrayList<Object> chartData(MaWatereleRecord maWatereleRecord);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,29 @@
|
||||
package com.fastbee.waterele.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.alibaba.excel.util.NumberUtils;
|
||||
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.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.waterele.mapper.MaGuangaiRecordMapper;
|
||||
import com.fastbee.waterele.domain.MaGuangaiRecord;
|
||||
import com.fastbee.waterele.service.IMaGuangaiRecordService;
|
||||
|
||||
import static com.fastbee.common.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* 灌溉记录Service业务层处理
|
||||
*
|
||||
@ -39,11 +55,107 @@ public class MaGuangaiRecordServiceImpl implements IMaGuangaiRecordService
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
@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())){
|
||||
if(NumberUtil.isNumber(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())){
|
||||
if(NumberUtil.isNumber(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())){
|
||||
if(NumberUtil.isNumber(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(com.fastbee.common.utils.NumberUtils.formatFloat(Float.parseFloat(item.get("user_balance").toString())/100)+"");
|
||||
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())){
|
||||
if(NumberUtil.isNumber(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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*
|
||||
|
@ -1,7 +1,13 @@
|
||||
package com.fastbee.waterele.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.common.utils.StringUtils;
|
||||
import com.fastbee.waterele.domain.vo.UnchargeAmountVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.waterele.mapper.MaRechargerecordMapper;
|
||||
@ -10,87 +16,117 @@ import com.fastbee.waterele.service.IMaRechargerecordService;
|
||||
|
||||
/**
|
||||
* 充值记录Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-08-12
|
||||
*/
|
||||
@Service
|
||||
public class MaRechargerecordServiceImpl implements IMaRechargerecordService
|
||||
{
|
||||
public class MaRechargerecordServiceImpl implements IMaRechargerecordService {
|
||||
@Autowired
|
||||
private MaRechargerecordMapper maRechargerecordMapper;
|
||||
|
||||
/**
|
||||
* 查询充值记录
|
||||
*
|
||||
*
|
||||
* @param id 充值记录主键
|
||||
* @return 充值记录
|
||||
*/
|
||||
@Override
|
||||
public MaRechargerecord selectMaRechargerecordById(Long id)
|
||||
{
|
||||
public MaRechargerecord selectMaRechargerecordById(Long id) {
|
||||
return maRechargerecordMapper.selectMaRechargerecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充值记录列表
|
||||
*
|
||||
*
|
||||
* @param maRechargerecord 充值记录
|
||||
* @return 充值记录
|
||||
*/
|
||||
@Override
|
||||
public List<MaRechargerecord> selectMaRechargerecordList(MaRechargerecord maRechargerecord)
|
||||
{
|
||||
public List<MaRechargerecord> selectMaRechargerecordList(MaRechargerecord maRechargerecord) {
|
||||
return maRechargerecordMapper.selectMaRechargerecordList(maRechargerecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增充值记录
|
||||
*
|
||||
*
|
||||
* @param maRechargerecord 充值记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMaRechargerecord(MaRechargerecord maRechargerecord)
|
||||
{
|
||||
public int insertMaRechargerecord(MaRechargerecord maRechargerecord) {
|
||||
maRechargerecord.setCreateTime(DateUtils.getNowDate());
|
||||
return maRechargerecordMapper.insertMaRechargerecord(maRechargerecord);
|
||||
// https://zhwly.sdhzwl.cn/api/java/xinjiangup/recharge?cardNum=1&areaCode=123&jine=20
|
||||
String url = "https://zhwly.sdhzwl.cn/api/java/xinjiangup/recharge?cardNum="
|
||||
+ maRechargerecord.getCardNum()+"&areaCode="+maRechargerecord.getAreaCode()+"&jine="+maRechargerecord.getInvestval();
|
||||
String result = HttpUtil.get(url);
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
if(jsonObject != null){
|
||||
if(jsonObject.containsKey("code") && Integer.parseInt(jsonObject.get("code").toString()) == 200){
|
||||
return maRechargerecordMapper.insertMaRechargerecord(maRechargerecord);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改充值记录
|
||||
*
|
||||
*
|
||||
* @param maRechargerecord 充值记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMaRechargerecord(MaRechargerecord maRechargerecord)
|
||||
{
|
||||
public int updateMaRechargerecord(MaRechargerecord maRechargerecord) {
|
||||
maRechargerecord.setUpdateTime(DateUtils.getNowDate());
|
||||
return maRechargerecordMapper.updateMaRechargerecord(maRechargerecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除充值记录
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的充值记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMaRechargerecordByIds(Long[] ids)
|
||||
{
|
||||
public int deleteMaRechargerecordByIds(Long[] ids) {
|
||||
return maRechargerecordMapper.deleteMaRechargerecordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除充值记录信息
|
||||
*
|
||||
*
|
||||
* @param id 充值记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMaRechargerecordById(Long id)
|
||||
{
|
||||
public int deleteMaRechargerecordById(Long id) {
|
||||
return maRechargerecordMapper.deleteMaRechargerecordById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnchargeAmountVo queryUnchargeAmount(MaRechargerecord maRechargerecord) {
|
||||
maRechargerecord.setIsRecharge(2);
|
||||
List<MaRechargerecord> maRechargerecords = maRechargerecordMapper.selectMaRechargerecordList(maRechargerecord);
|
||||
float total = 0;
|
||||
for (MaRechargerecord record : maRechargerecords) {
|
||||
total += Float.parseFloat(record.getInvestval());
|
||||
}
|
||||
UnchargeAmountVo vo = new UnchargeAmountVo();
|
||||
vo.setInvestVal(total);
|
||||
vo.setCardNum(maRechargerecord.getCardNum());
|
||||
vo.setAreaCode(maRechargerecord.getAreaCode());
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String rechargeReply(MaRechargerecord maRechargerecord) {
|
||||
if (StringUtils.isNotEmpty(maRechargerecord.getCardNum()) && StringUtils.isNotEmpty(maRechargerecord.getAreaCode())) {
|
||||
if (maRechargerecord.getIsRecharge() == 1) {
|
||||
maRechargerecord.setUpdateTime(new Date());
|
||||
int count = maRechargerecordMapper.updateByCardNumAndAreaCode(maRechargerecord);
|
||||
}
|
||||
}
|
||||
return "更新成功";
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,18 @@
|
||||
package com.fastbee.waterele.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
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.StringUtils;
|
||||
import com.fastbee.waterele.domain.MaGuangaiRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.waterele.mapper.MaWatereleRecordMapper;
|
||||
@ -15,7 +26,7 @@ import com.fastbee.waterele.service.IMaWatereleRecordService;
|
||||
* @date 2024-08-12
|
||||
*/
|
||||
@Service
|
||||
public class MaWatereleRecordServiceImpl implements IMaWatereleRecordService
|
||||
public class MaWatereleRecordServiceImpl implements IMaWatereleRecordService
|
||||
{
|
||||
@Autowired
|
||||
private MaWatereleRecordMapper maWatereleRecordMapper;
|
||||
@ -39,9 +50,103 @@ public class MaWatereleRecordServiceImpl implements IMaWatereleRecordService
|
||||
* @return 水电双计数据记录
|
||||
*/
|
||||
@Override
|
||||
public List<MaWatereleRecord> selectMaWatereleRecordList(MaWatereleRecord maWatereleRecord)
|
||||
public TableDataInfo selectMaWatereleRecordList(MaWatereleRecord maWatereleRecord)
|
||||
{
|
||||
return maWatereleRecordMapper.selectMaWatereleRecordList(maWatereleRecord);
|
||||
List<MaWatereleRecord> list = getList(maWatereleRecord);
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Integer pageNum = pageDomain.getPageNum();
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
List<MaWatereleRecord> 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MaWatereleRecord> getList(MaWatereleRecord maWatereleRecord){
|
||||
Long endTime = 0L;
|
||||
Long startTime = 0L;
|
||||
if(null == maWatereleRecord.getParams()){
|
||||
endTime = new Date().getTime()/1000;
|
||||
startTime = endTime - 86400*3;
|
||||
}else{
|
||||
if(!maWatereleRecord.getParams().containsKey("endCreateTime")){
|
||||
endTime = new Date().getTime()/1000;
|
||||
}else{
|
||||
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,
|
||||
maWatereleRecord.getParams().get("endCreateTime").toString()).getTime();
|
||||
}
|
||||
if(!maWatereleRecord.getParams().containsKey("beginCreateTime")){
|
||||
startTime = endTime - 86400*3;
|
||||
}else{
|
||||
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,
|
||||
maWatereleRecord.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/getShuakaRecord?devSn="
|
||||
+maWatereleRecord.getDevSn()+"&startTime="+startDateStr+"&endTime="+endDateStr;
|
||||
String result = HttpUtil.get(url);
|
||||
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
List<MaWatereleRecord> 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;
|
||||
MaWatereleRecord record = new MaWatereleRecord();
|
||||
record.setDevSn(item.get("dev_sn").toString());
|
||||
record.setWorkstate(Integer.parseInt(item.get("workState").toString()));
|
||||
record.setUsersumflow(item.get("userSumFlow").toString());
|
||||
record.setUsersumele(item.get("userSumEle").toString());
|
||||
record.setUserbalance(item.get("userBalance").toString());
|
||||
record.setSumflow(item.get("sumFlow").toString());
|
||||
record.setSumele(item.get("sumEle").toString());
|
||||
record.setMcusn(item.get("mcuSn").toString());
|
||||
record.setInspower(item.get("insPower").toString());
|
||||
record.setInsflow(item.get("insFlow").toString());
|
||||
record.setCurflow(item.get("curFlow").toString());
|
||||
record.setCurele(item.get("curEle").toString());
|
||||
record.setMetersum(item.get("meterSum").toString());
|
||||
record.setMeterins(item.get("meterIns").toString());
|
||||
record.setCardid(item.get("cardId").toString());
|
||||
record.setAreacode(item.get("areaCode").toString());
|
||||
record.setAction(item.get("action").toString());
|
||||
if(StringUtils.isNotEmpty(item.get("create_time").toString())){
|
||||
if(NumberUtil.isNumber(item.get("create_time").toString())) {
|
||||
Date date = new Date(Long.parseLong(item.get("create_time").toString()) * 1000);
|
||||
record.setCreateTime(date);
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(item.get("update_time").toString())){
|
||||
if(NumberUtil.isNumber(item.get("update_time").toString())) {
|
||||
Date date = new Date(Long.parseLong(item.get("update_time").toString()) * 1000);
|
||||
record.setUpdateTime(date);
|
||||
}
|
||||
}
|
||||
list.add(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,4 +198,35 @@ public class MaWatereleRecordServiceImpl implements IMaWatereleRecordService
|
||||
{
|
||||
return maWatereleRecordMapper.deleteMaWatereleRecordById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Object> chartData(MaWatereleRecord maWatereleRecord) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
List<MaWatereleRecord> maWatereleRecords = maWatereleRecordMapper.selectMaWatereleRecordList(maWatereleRecord);
|
||||
List<String> time = new ArrayList<>();
|
||||
List<String> sumFlow = new ArrayList<>();
|
||||
List<String> sumEle = new ArrayList<>();
|
||||
// HashMap<String, Object> sumFlowtMap = new HashMap<>();
|
||||
// sumFlowtMap.put("name", "累计水量");
|
||||
// sumFlowtMap.put("unit", "m³");
|
||||
HashMap<String, Object> sumEletMap = new HashMap<>();
|
||||
sumEletMap.put("name", "累计电量");
|
||||
sumEletMap.put("unit", "度");
|
||||
for (MaWatereleRecord record : maWatereleRecords) {
|
||||
time.add(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, record.getCreateTime()));
|
||||
sumFlow.add(record.getSumflow());
|
||||
sumEle.add(record.getSumele());
|
||||
}
|
||||
// sumFlowtMap.put("time", time);
|
||||
// sumFlowtMap.put("data", sumFlow);
|
||||
sumEletMap.put("time", time);
|
||||
sumEletMap.put("data", sumEle);
|
||||
// list.add(sumFlowtMap);
|
||||
list.add(sumEletMap);
|
||||
// map.put("time", time);
|
||||
// map.put("sumFlow", sumFlow);
|
||||
// map.put("sumEle", sumEle);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="cardtype != null "> and cardType = #{cardtype}</if>
|
||||
<if test="mcusn != null and mcusn != ''"> and mcuSn = #{mcusn}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectMaCardinfoById" parameterType="Long" resultMap="MaCardinfoResult">
|
||||
|
@ -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="curEle != null and curEle != ''"> and cur_ele = #{curEle}</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>
|
||||
</select>
|
||||
|
||||
|
@ -12,12 +12,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="areaCode" column="area_code" />
|
||||
<result property="cardId" column="card_id" />
|
||||
<result property="mcusn" column="mcuSn" />
|
||||
<result property="isRecharge" column="is_recharge" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMaRechargerecordVo">
|
||||
select id, balance, investVal, card_num, area_code, card_id, mcuSn, create_time, update_time from ma_rechargerecord
|
||||
select * from ma_rechargerecord
|
||||
</sql>
|
||||
|
||||
<select id="selectMaRechargerecordList" parameterType="MaRechargerecord" resultMap="MaRechargerecordResult">
|
||||
@ -29,7 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
||||
<if test="cardId != null and cardId != ''"> and card_id = #{cardId}</if>
|
||||
<if test="mcusn != null and mcusn != ''"> and mcuSn = #{mcusn}</if>
|
||||
<if test="isRecharge != null and isRecharge != ''"> and is_recharge = #{isRecharge}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectMaRechargerecordById" parameterType="Long" resultMap="MaRechargerecordResult">
|
||||
@ -46,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="areaCode != null">area_code,</if>
|
||||
<if test="cardId != null">card_id,</if>
|
||||
<if test="mcusn != null">mcuSn,</if>
|
||||
<if test="isRecharge != null">is_recharge,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
@ -56,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="areaCode != null">#{areaCode},</if>
|
||||
<if test="cardId != null">#{cardId},</if>
|
||||
<if test="mcusn != null">#{mcusn},</if>
|
||||
<if test="isRecharge != null">#{isRecharge},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
@ -70,11 +75,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="areaCode != null">area_code = #{areaCode},</if>
|
||||
<if test="cardId != null">card_id = #{cardId},</if>
|
||||
<if test="mcusn != null">mcuSn = #{mcusn},</if>
|
||||
<if test="isRecharge != null">is_recharge = #{isRecharge},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateByCardNumAndAreaCode">
|
||||
update ma_rechargerecord
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="isRecharge != null">is_recharge = #{isRecharge},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where card_num = #{cardNum} and is_recharge = 0 and area_code = #{areaCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMaRechargerecordById" parameterType="Long">
|
||||
delete from ma_rechargerecord where id = #{id}
|
||||
|
@ -51,7 +51,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="cardid != null and cardid != ''"> and cardId = #{cardid}</if>
|
||||
<if test="areacode != null and areacode != ''"> and areaCode = #{areacode}</if>
|
||||
<if test="action != null and action != ''"> and action = #{action}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(create_time ,'%y%m%d%H%i%s') >= date_format(#{params.beginTime},'%y%m%d%H%i%s')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(create_time ,'%y%m%d%H%i%s') <= date_format(#{params.endTime},'%y%m%d%H%i%s')
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectMaWatereleRecordById" parameterType="Long" resultMap="MaWatereleRecordResult">
|
||||
|
@ -63,6 +63,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(end_time ,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="chaxunBeginTime != null and chaxunBeginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(end_time ,'%y%m%d%H%i%s') >= date_format(#{chaxunBeginTime},'%y%m%d%H%i%s')
|
||||
</if>
|
||||
<if test="chaxunEndTime != null and chaxunEndTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(end_time ,'%y%m%d%H%i%s') <= date_format(#{chaxunEndTime},'%y%m%d%H%i%s')
|
||||
</if>
|
||||
</where>
|
||||
order by id desc
|
||||
</select>
|
||||
|
Reference in New Issue
Block a user