对接打印机
This commit is contained in:
parent
81e5429ee9
commit
5e76aa6305
@ -238,9 +238,19 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
|
|
||||||
|
<!--二维码生成-->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>javase</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -66,6 +66,10 @@ public interface FastBeeConstant {
|
|||||||
* 设备其他消息处理
|
* 设备其他消息处理
|
||||||
*/
|
*/
|
||||||
String DEVICE_OTHER_TASK = "deviceOtherMsgTask";
|
String DEVICE_OTHER_TASK = "deviceOtherMsgTask";
|
||||||
|
/**
|
||||||
|
* 水电设备数据上报处理
|
||||||
|
*/
|
||||||
|
String DEVICE_WATER_ELECTRIC_TASK = "deviceWaterElectricMsgTask";
|
||||||
/**
|
/**
|
||||||
* 数据调试任务
|
* 数据调试任务
|
||||||
*/
|
*/
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
package com.fastbee.mq.redischannel.consumer;
|
package com.fastbee.mq.redischannel.consumer;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.fastbee.common.constant.FastBeeConstant;
|
import com.fastbee.common.constant.FastBeeConstant;
|
||||||
import com.fastbee.common.core.mq.DeviceReportBo;
|
import com.fastbee.common.core.mq.DeviceReportBo;
|
||||||
import com.fastbee.mq.service.impl.DeviceOtherMsgHandler;
|
import com.fastbee.mq.service.impl.DeviceOtherMsgHandler;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author gsb
|
* @author gsb
|
||||||
@ -31,48 +26,57 @@ public class DeviceOtherMsgConsumer {
|
|||||||
String serialNumber;//设备序列号
|
String serialNumber;//设备序列号
|
||||||
Long packetId;//包号
|
Long packetId;//包号
|
||||||
byte[] data = bo.getData();//数据
|
byte[] data = bo.getData();//数据
|
||||||
String topic;//主题
|
String topic=bo.getTopicName();//主题
|
||||||
System.err.println("接收到数据:"+ new String(data));
|
//设备上报数据消息
|
||||||
//解析
|
if(topic.endsWith("/info/up")){
|
||||||
String jsonString = "{\"type\": \"waterEleData\", \"pakSn\": 123, \"data\": {\"workState\": 1, \"action\": \"startPump\", \"mcuSn\": \"MCU123456\", \"sumEle\": 5000, \"sumFlow\": 3000, \"insFlow\": 2.5, \"userSumFlow\": 1500, \"areaCode\": \"010\", \"cardId\": \"CARD12345678\", \"userBalance\": 100.0, \"userSumEle\": 3000, \"curEle\": 50, \"curFlow\": 200, \"insPower\": 2300}}";
|
System.err.println("mqtt接收到设备上报数据:"+ new String(data));
|
||||||
JSONObject entries = JSONUtil.parseObj(jsonString);
|
} else if ( topic.endsWith("/info/reply")) {
|
||||||
System.err.println("解析后:"+entries);
|
System.err.println("mqtt回应收到设备上报数据:"+ new String(data));
|
||||||
//获取帧标识
|
} else if (topic.endsWith("cmd/down")) {
|
||||||
String type = entries.getStr("type");
|
System.err.println("mqtt收到设备下发命令:"+ new String(data));
|
||||||
//获取帧号
|
|
||||||
Long pakSn = entries.getLong("pakSn");
|
|
||||||
//获取数据
|
|
||||||
JSONObject dataObj = entries.getJSONObject("data");
|
|
||||||
//获取水泵状态0=关泵,1=开泵
|
|
||||||
Integer workState = dataObj.getInt("workState");
|
|
||||||
//获取动作
|
|
||||||
String action = dataObj.getStr("action");
|
|
||||||
//获取单片机编码
|
|
||||||
String mcuSn = dataObj.getStr("mcuSn");
|
|
||||||
//获取累计用电量
|
|
||||||
Integer sumEle = dataObj.getInt("sumEle");
|
|
||||||
//获取累计用水量
|
|
||||||
Integer sumFlow = dataObj.getInt("sumFlow");
|
|
||||||
//获取瞬时流量
|
|
||||||
Double insFlow = dataObj.getDouble("insFlow");
|
|
||||||
//当前用户累计用水量
|
|
||||||
Integer userSumFlow = dataObj.getInt("userSumFlow");
|
|
||||||
//获取区域号
|
|
||||||
String areaCode = dataObj.getStr("areaCode");
|
|
||||||
//获取卡号
|
|
||||||
String cardId = dataObj.getStr("cardId");
|
|
||||||
//获取用户余额
|
|
||||||
Double userBalance = dataObj.getDouble("userBalance");
|
|
||||||
//获取用户累计用电量
|
|
||||||
Integer userSumEle = dataObj.getInt("userSumEle");
|
|
||||||
//获取本次用电量
|
|
||||||
Integer curEle = dataObj.getInt("curEle");
|
|
||||||
//获取本次用水量
|
|
||||||
Integer curFlow = dataObj.getInt("curFlow");
|
|
||||||
//获取瞬时功率
|
|
||||||
Integer insPower = dataObj.getInt("insPower");
|
|
||||||
|
|
||||||
|
} else if (topic.endsWith("cmd/reply")) {
|
||||||
|
System.err.println("mqtt回应收到设备下发命令:"+ new String(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
// //解析
|
||||||
|
// String jsonString = "{\"type\": \"waterEleData\", \"pakSn\": 123, \"data\": {\"workState\": 1, \"action\": \"startPump\", \"mcuSn\": \"MCU123456\", \"sumEle\": 5000, \"sumFlow\": 3000, \"insFlow\": 2.5, \"userSumFlow\": 1500, \"areaCode\": \"010\", \"cardId\": \"CARD12345678\", \"userBalance\": 100.0, \"userSumEle\": 3000, \"curEle\": 50, \"curFlow\": 200, \"insPower\": 2300}}";
|
||||||
|
// JSONObject entries = JSONUtil.parseObj(jsonString);
|
||||||
|
// System.err.println("解析后:"+entries);
|
||||||
|
// //获取帧标识
|
||||||
|
// String type = entries.getStr("type");
|
||||||
|
// //获取帧号
|
||||||
|
// Long pakSn = entries.getLong("pakSn");
|
||||||
|
// //获取数据
|
||||||
|
// JSONObject dataObj = entries.getJSONObject("data");
|
||||||
|
// //获取水泵状态0=关泵,1=开泵
|
||||||
|
// Integer workState = dataObj.getInt("workState");
|
||||||
|
// //获取动作
|
||||||
|
// String action = dataObj.getStr("action");
|
||||||
|
// //获取单片机编码
|
||||||
|
// String mcuSn = dataObj.getStr("mcuSn");
|
||||||
|
// //获取累计用电量
|
||||||
|
// Integer sumEle = dataObj.getInt("sumEle");
|
||||||
|
// //获取累计用水量
|
||||||
|
// Integer sumFlow = dataObj.getInt("sumFlow");
|
||||||
|
// //获取瞬时流量
|
||||||
|
// Double insFlow = dataObj.getDouble("insFlow");
|
||||||
|
// //当前用户累计用水量
|
||||||
|
// Integer userSumFlow = dataObj.getInt("userSumFlow");
|
||||||
|
// //获取区域号
|
||||||
|
// String areaCode = dataObj.getStr("areaCode");
|
||||||
|
// //获取卡号
|
||||||
|
// String cardId = dataObj.getStr("cardId");
|
||||||
|
// //获取用户余额
|
||||||
|
// Double userBalance = dataObj.getDouble("userBalance");
|
||||||
|
// //获取用户累计用电量
|
||||||
|
// Integer userSumEle = dataObj.getInt("userSumEle");
|
||||||
|
// //获取本次用电量
|
||||||
|
// Integer curEle = dataObj.getInt("curEle");
|
||||||
|
// //获取本次用水量
|
||||||
|
// Integer curFlow = dataObj.getInt("curFlow");
|
||||||
|
// //获取瞬时功率
|
||||||
|
// Integer insPower = dataObj.getInt("insPower");
|
||||||
|
|
||||||
// otherMsgHandler.messageHandler(bo);
|
// otherMsgHandler.messageHandler(bo);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.fastbee.mq.redischannel.consumer;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.fastbee.common.constant.FastBeeConstant;
|
||||||
|
import com.fastbee.common.core.mq.DeviceReportBo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class HydropowerDeviceReportMsgConsumer {
|
||||||
|
|
||||||
|
@Async(FastBeeConstant.TASK.DEVICE_WATER_ELECTRIC_TASK)
|
||||||
|
public void consume(DeviceReportBo bo){
|
||||||
|
try {
|
||||||
|
//处理emq订阅的非 property/post 属性上报的消息 ,因为其他消息量小,放在一起处理
|
||||||
|
String serialNumber;//设备序列号
|
||||||
|
Long packetId;//包号
|
||||||
|
byte[] data = bo.getData();//数据
|
||||||
|
String topic;//主题
|
||||||
|
System.err.println("mqtt接收到数据:"+ new String(data));
|
||||||
|
//解析
|
||||||
|
String jsonString = "{\"type\": \"waterEleData\", \"pakSn\": 123, \"data\": {\"workState\": 1, \"action\": \"startPump\", \"mcuSn\": \"MCU123456\", \"sumEle\": 5000, \"sumFlow\": 3000, \"insFlow\": 2.5, \"userSumFlow\": 1500, \"areaCode\": \"010\", \"cardId\": \"CARD12345678\", \"userBalance\": 100.0, \"userSumEle\": 3000, \"curEle\": 50, \"curFlow\": 200, \"insPower\": 2300}}";
|
||||||
|
JSONObject entries = JSONUtil.parseObj(jsonString);
|
||||||
|
System.err.println("解析后:"+entries);
|
||||||
|
//获取帧标识
|
||||||
|
String type = entries.getStr("type");
|
||||||
|
//获取帧号
|
||||||
|
Long pakSn = entries.getLong("pakSn");
|
||||||
|
//获取数据
|
||||||
|
JSONObject dataObj = entries.getJSONObject("data");
|
||||||
|
//获取水泵状态0=关泵,1=开泵
|
||||||
|
Integer workState = dataObj.getInt("workState");
|
||||||
|
//获取动作
|
||||||
|
String action = dataObj.getStr("action");
|
||||||
|
//获取单片机编码
|
||||||
|
String mcuSn = dataObj.getStr("mcuSn");
|
||||||
|
//获取累计用电量
|
||||||
|
Integer sumEle = dataObj.getInt("sumEle");
|
||||||
|
//获取累计用水量
|
||||||
|
Integer sumFlow = dataObj.getInt("sumFlow");
|
||||||
|
//获取瞬时流量
|
||||||
|
Double insFlow = dataObj.getDouble("insFlow");
|
||||||
|
//当前用户累计用水量
|
||||||
|
Integer userSumFlow = dataObj.getInt("userSumFlow");
|
||||||
|
//获取区域号
|
||||||
|
String areaCode = dataObj.getStr("areaCode");
|
||||||
|
//获取卡号
|
||||||
|
String cardId = dataObj.getStr("cardId");
|
||||||
|
//获取用户余额
|
||||||
|
Double userBalance = dataObj.getDouble("userBalance");
|
||||||
|
//获取用户累计用电量
|
||||||
|
Integer userSumEle = dataObj.getInt("userSumEle");
|
||||||
|
//获取本次用电量
|
||||||
|
Integer curEle = dataObj.getInt("curEle");
|
||||||
|
//获取本次用水量
|
||||||
|
Integer curFlow = dataObj.getInt("curFlow");
|
||||||
|
//获取瞬时功率
|
||||||
|
Integer insPower = dataObj.getInt("insPower");
|
||||||
|
|
||||||
|
// otherMsgHandler.messageHandler(bo);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("=>设备其他消息处理出错",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -22,9 +22,10 @@ public class MqttTest {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/publish")
|
@GetMapping("/publish")
|
||||||
public String test(){
|
public String test(){
|
||||||
pubMqttClient.publish(1,true,"/topic/test","mqtt测试主题发布消息!");
|
pubMqttClient.publish(1,true,"/10086/155/cmd/down","mqtt测试主题发布消息!");
|
||||||
return "test";
|
return "test";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试创建mqtt客户端
|
* 测试创建mqtt客户端
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.fastbee.data.controller.printer;
|
||||||
|
|
||||||
|
import com.fastbee.common.core.domain.AjaxResultPro;
|
||||||
|
import com.fastbee.data.controller.printer.yilianyun.YiLianYunPrintService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/printer")
|
||||||
|
public class PrinterController {
|
||||||
|
@Autowired
|
||||||
|
private YiLianYunPrintService printerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文本内容打印
|
||||||
|
*/
|
||||||
|
@PostMapping("/text/do")
|
||||||
|
public AjaxResultPro textPrint(@RequestBody String content){
|
||||||
|
printerService.textPrint(content);
|
||||||
|
return AjaxResultPro.success();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 图片打印
|
||||||
|
*/
|
||||||
|
@PostMapping("/image/do")
|
||||||
|
public AjaxResultPro imagePrint(@RequestBody String imageUrl){
|
||||||
|
printerService.imagePrint(imageUrl);
|
||||||
|
return AjaxResultPro.success();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.fastbee.data.controller.printer.yilianyun;
|
||||||
|
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class YiLianYunAuthorizationService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
private String clientId = "1044721086";
|
||||||
|
private String clientSecret = "dfb761fb75768df0066f9614dc507531";
|
||||||
|
|
||||||
|
private String grantType = "client_credentials";
|
||||||
|
|
||||||
|
private String sign;
|
||||||
|
|
||||||
|
private String scope = "all";
|
||||||
|
private Long timestamp;
|
||||||
|
private String id = "550e8400-e29b-41d4-a716-446655440000";
|
||||||
|
private String endpoint = "https://open-api.10ss.net/v2/oauth/oauth";
|
||||||
|
|
||||||
|
|
||||||
|
public String getAccessToken() {
|
||||||
|
String cacheToken = stringRedisTemplate.opsForValue().get("yilianyun:user:token");
|
||||||
|
if (!Objects.isNull(cacheToken)){
|
||||||
|
System.err.println("缓存中获取token:"+cacheToken);
|
||||||
|
return cacheToken;
|
||||||
|
}
|
||||||
|
String token = getAuth();
|
||||||
|
// System.err.println("从服务器获取token:"+token);
|
||||||
|
// return token;
|
||||||
|
stringRedisTemplate.opsForValue().set("yilianyun:user:token",token,3600*24*20, TimeUnit.MILLISECONDS);
|
||||||
|
return stringRedisTemplate.opsForValue().get("yilianyun:access_token");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuth() {
|
||||||
|
timestamp = System.currentTimeMillis();
|
||||||
|
sign=YiLianYunUtil.getSign(timestamp);
|
||||||
|
//构建请求体
|
||||||
|
Map<String,Object> param= new HashMap<>();
|
||||||
|
param.put("client_id",clientId);
|
||||||
|
param.put("grant_type",grantType);
|
||||||
|
param.put("sign",sign);
|
||||||
|
param.put("scope",scope);
|
||||||
|
param.put("timestamp",timestamp);
|
||||||
|
param.put("id",id);
|
||||||
|
YiLianYunBaseService yiLianYunBaseService = new YiLianYunBaseService();
|
||||||
|
JSONObject resp = yiLianYunBaseService.baseRequest(endpoint, param);
|
||||||
|
System.err.println(resp);
|
||||||
|
return resp.getStr("access_token");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
YiLianYunPrintService yiLianYunPrintService = new YiLianYunPrintService();
|
||||||
|
// yiLianYunPrintService.print("<FS2>您好</FS2>");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.fastbee.data.controller.printer.yilianyun;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.fastbee.common.exception.ServiceException;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class YiLianYunBaseService {
|
||||||
|
/**
|
||||||
|
* 基本请求
|
||||||
|
* @param body 请求负载
|
||||||
|
* @return 请求结果 data
|
||||||
|
*/
|
||||||
|
public JSONObject baseRequest(String url, Map<String,Object> body){
|
||||||
|
String jsonStr = JSONUtil.toJsonStr(body);
|
||||||
|
String respStr = HttpUtil.post(url, jsonStr);
|
||||||
|
JSONObject resp = JSONUtil.parseObj(respStr);
|
||||||
|
System.err.println(resp);
|
||||||
|
if(!resp.get("error").toString().equals("0")){
|
||||||
|
throw new ServiceException(resp.get("error_description").toString());
|
||||||
|
}
|
||||||
|
return resp.getJSONObject("body");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.fastbee.data.controller.printer.yilianyun;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class YiLianYunPrintService {
|
||||||
|
@Autowired
|
||||||
|
private YiLianYunAuthorizationService authorizationService;
|
||||||
|
private String endpoint = "https://open-api.10ss.net/v2/print/index";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文本打印
|
||||||
|
* @param content 打印内容
|
||||||
|
*/
|
||||||
|
public void textPrint(String content){
|
||||||
|
YiLianYunBaseService yiLianYunBaseService = new YiLianYunBaseService();
|
||||||
|
//构建请求参数
|
||||||
|
// 创建一个 HashMap 来存储属性
|
||||||
|
Map<String, Object> attributes = new HashMap<>();
|
||||||
|
// 添加属性到 HashMap
|
||||||
|
Long timestamp = System.currentTimeMillis();
|
||||||
|
attributes.put("client_id", YiLianYunUtil.clientId);
|
||||||
|
attributes.put("sign", YiLianYunUtil.getSign(timestamp));
|
||||||
|
attributes.put("timestamp", timestamp);
|
||||||
|
attributes.put("id", "550e8400-e29b-41d4-a716-446655440000");
|
||||||
|
attributes.put("access_token", authorizationService.getAccessToken());
|
||||||
|
attributes.put("machine_code", "4004899747");
|
||||||
|
attributes.put("origin_id", "123");
|
||||||
|
attributes.put("content", content);
|
||||||
|
JSONObject resp = yiLianYunBaseService.baseRequest(endpoint, attributes);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 图片打印
|
||||||
|
*/
|
||||||
|
public void imagePrint(String pictureUrl){
|
||||||
|
YiLianYunBaseService yiLianYunBaseService = new YiLianYunBaseService();
|
||||||
|
//构建请求参数
|
||||||
|
// 创建一个 HashMap 来存储属性
|
||||||
|
Map<String, Object> attributes = new HashMap<>();
|
||||||
|
// 添加属性到 HashMap
|
||||||
|
Long timestamp = System.currentTimeMillis();
|
||||||
|
attributes.put("client_id", YiLianYunUtil.clientId);
|
||||||
|
attributes.put("sign", YiLianYunUtil.getSign(timestamp));
|
||||||
|
attributes.put("timestamp", timestamp);
|
||||||
|
attributes.put("id", "550e8400-e29b-41d4-a716-446655440000");
|
||||||
|
attributes.put("access_token", authorizationService.getAccessToken());
|
||||||
|
attributes.put("machine_code", "4004899747");
|
||||||
|
attributes.put("origin_id", "123");
|
||||||
|
attributes.put("picture_url", pictureUrl);
|
||||||
|
JSONObject resp = yiLianYunBaseService.baseRequest(endpoint, attributes);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.fastbee.data.controller.printer.yilianyun;
|
||||||
|
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
|
|
||||||
|
public class YiLianYunUtil {
|
||||||
|
public static String clientId = "1044721086";
|
||||||
|
public static String clientSecret = "dfb761fb75768df0066f9614dc507531";
|
||||||
|
public static String getSign(Long timestamp) {
|
||||||
|
String param = clientId + timestamp + clientSecret;
|
||||||
|
return DigestUtil.md5Hex(param).toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ import com.fastbee.common.core.domain.BaseEntity;
|
|||||||
* 设备上电审核前上报的基础信息对象 iot_device_report_info
|
* 设备上电审核前上报的基础信息对象 iot_device_report_info
|
||||||
*
|
*
|
||||||
* @author kerwincui
|
* @author kerwincui
|
||||||
* @date 2024-12-09
|
* @date 2024-12-10
|
||||||
*/
|
*/
|
||||||
@ApiModel(value = "DeviceReportInfo",description = "设备上电审核前上报的基础信息 iot_device_report_info")
|
@ApiModel(value = "DeviceReportInfo",description = "设备上电审核前上报的基础信息 iot_device_report_info")
|
||||||
@Data
|
@Data
|
||||||
@ -105,4 +105,9 @@ public class DeviceReportInfo extends BaseEntity
|
|||||||
@ApiModelProperty("二维码")
|
@ApiModelProperty("二维码")
|
||||||
private String qrCode;
|
private String qrCode;
|
||||||
|
|
||||||
|
/** 设备名称 */
|
||||||
|
@Excel(name = "设备名称")
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
<result property="batchNumber" column="batch_number" />
|
<result property="batchNumber" column="batch_number" />
|
||||||
<result property="serialNumber" column="serial_number" />
|
<result property="serialNumber" column="serial_number" />
|
||||||
<result property="qrCode" column="qr_code" />
|
<result property="qrCode" column="qr_code" />
|
||||||
|
<result property="name" column="name" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeviceReportInfoVo">
|
<sql id="selectDeviceReportInfoVo">
|
||||||
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code from iot_device_report_info
|
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name from iot_device_report_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult">
|
<select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult">
|
||||||
@ -47,6 +48,7 @@
|
|||||||
<if test="batchNumber != null "> and batch_number = #{batchNumber}</if>
|
<if test="batchNumber != null "> and batch_number = #{batchNumber}</if>
|
||||||
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
|
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
|
||||||
<if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
|
<if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -74,6 +76,7 @@
|
|||||||
<if test="batchNumber != null">batch_number,</if>
|
<if test="batchNumber != null">batch_number,</if>
|
||||||
<if test="serialNumber != null">serial_number,</if>
|
<if test="serialNumber != null">serial_number,</if>
|
||||||
<if test="qrCode != null">qr_code,</if>
|
<if test="qrCode != null">qr_code,</if>
|
||||||
|
<if test="name != null">name,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="imei != null and imei != ''">#{imei},</if>
|
<if test="imei != null and imei != ''">#{imei},</if>
|
||||||
@ -92,6 +95,7 @@
|
|||||||
<if test="batchNumber != null">#{batchNumber},</if>
|
<if test="batchNumber != null">#{batchNumber},</if>
|
||||||
<if test="serialNumber != null">#{serialNumber},</if>
|
<if test="serialNumber != null">#{serialNumber},</if>
|
||||||
<if test="qrCode != null">#{qrCode},</if>
|
<if test="qrCode != null">#{qrCode},</if>
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -114,6 +118,7 @@
|
|||||||
<if test="batchNumber != null">batch_number = #{batchNumber},</if>
|
<if test="batchNumber != null">batch_number = #{batchNumber},</if>
|
||||||
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
|
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
|
||||||
<if test="qrCode != null">qr_code = #{qrCode},</if>
|
<if test="qrCode != null">qr_code = #{qrCode},</if>
|
||||||
|
<if test="name != null">name = #{name},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user