Commit f9add1ca by 周海宝

Merge branch 'dev' into 'master'

Dev

See merge request !1
2 parents baffa533 4021c43c
Showing 46 changed files with 794 additions and 152 deletions
...@@ -71,6 +71,15 @@ ...@@ -71,6 +71,15 @@
<artifactId>rest-admin-mybatis</artifactId> <artifactId>rest-admin-mybatis</artifactId>
<version>1.1.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.glsx</groupId>
<artifactId>rest-admin-redis</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.glsx</groupId>
<artifactId>rest-admin-feign</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
...@@ -4,6 +4,7 @@ import com.glsx.plat.context.EnableRestAdmin; ...@@ -4,6 +4,7 @@ import com.glsx.plat.context.EnableRestAdmin;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.EnableMBeanExport; import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.jmx.support.RegistrationPolicy; import org.springframework.jmx.support.RegistrationPolicy;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
...@@ -15,8 +16,9 @@ import tk.mybatis.spring.annotation.MapperScan; ...@@ -15,8 +16,9 @@ import tk.mybatis.spring.annotation.MapperScan;
*/ */
@EnableRestAdmin @EnableRestAdmin
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients("cn.com.glsx.consumer.modules.client")
@EnableTransactionManagement @EnableTransactionManagement
@MapperScan(basePackages = "cn.com.glsx.consumer.mapper") @MapperScan(basePackages = "cn.com.glsx.consumer.modules.mapper")
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING) @EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
@SpringBootApplication(scanBasePackages = {"cn.com.glsx"}) @SpringBootApplication(scanBasePackages = {"cn.com.glsx"})
public class Application { public class Application {
......
package cn.com.glsx.consumer; package cn.com.glsx.consumer;
import cn.com.glsx.consumer.service.InfoService; import cn.com.glsx.consumer.modules.service.DeviceService;
import com.alibaba.nacos.common.utils.MD5Utils; import cn.com.glsx.consumer.modules.service.InfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/** /**
* @author zhouhaibao * @author zhouhaibao
...@@ -20,12 +23,20 @@ public class TestController { ...@@ -20,12 +23,20 @@ public class TestController {
@Autowired @Autowired
private InfoService infoService; private InfoService infoService;
@RequestMapping("/test") @Autowired
public void test(@RequestBody String data){ private DeviceService deviceService;
infoService.processMessage(data);
}
public static void main(String[] args) { @RequestMapping(value = "/test",method = {RequestMethod.POST})
System.out.println(MD5Utils.md5Hex("13476670746","utf-8")); @ResponseBody
public void test(@RequestBody String json) {
infoService.processMessage(json);
}
@RequestMapping(value = "/test1",method = {RequestMethod.GET})
@ResponseBody
public void test1(@RequestParam String id) {
System.out.println(deviceService.getDeviceName(id));
} }
} }
package cn.com.glsx.consumer.common;
/**
* @author zhouhaibao
* @date 2021/3/15 14:02
*/
public class Contants {
public static final int STATUS_APPEAR=4;
public static final int SCENE_CONDITION_ALL=2;
public static final int SCENE_CONDITION_ANY=1;
public static final String SCENE_STATUS="scene_status";
}
package cn.com.glsx.consumer.common.constant;
/**
* @author zhouhaibao
* @date 2021/3/15 14:02
*/
public class Contants {
/**
* 涂鸦设备属性消息标识
*/
public static final int STATUS_APPEAR = 4;
/**
* 涂鸦设备事件消息标识
*/
public static final int event_APPEAR = 20;
/**
* 场景全部满足条件
*/
public static final int SCENE_CONDITION_ALL = 2;
/**
* aqara设备时间消息标识
*/
public static final String MSG_TYPE_RESOURCE = "resource";
/**
* aqara设备事件消息标识
*/
public static final String MSG_TYPE_DEIVCE = "device";
/**
* 场景状态
*/
public static final String SCENE_STATUS="scene_status";
}
package cn.com.glsx.consumer.common; package cn.com.glsx.consumer.common.enums;
/** /**
* @author fengzhi * 工作日工作类
* @date 2021/3/9 17:05 * @author zhouhaibao
* @description 工作日,节假日类型枚举 *
*/ */
public enum EDay { public enum EDay {
WORKDAY { WORKDAY {
......
package cn.com.glsx.consumer.common; package cn.com.glsx.consumer.common.enums;
/** /**
* @author fengzhi * 枚举,触发条件的逻辑判断
* @date 2021/3/19 17:40 * @author zhouhaibao
* @description 枚举,触发条件的逻辑判断 *
*/ */
public enum ELogic { public enum ELogic {
LESS_THAN { LESS_THAN {
@Override @Override
......
package cn.com.glsx.consumer.redis; package cn.com.glsx.consumer.common.redis;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
......
package cn.com.glsx.consumer.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* @author zhouhaibao
* @date 2021/5/17 13:54
*/
@Configuration
@Data
public class TuyaConfig {
@Value("${pulsar.serviceUrl}")
private String serviceUrl;
@Value("${pulsar.accessId}")
private String accessId;
@Value("${pulsar.accessKey}")
private String accessKey;
@Value("${pulsar.maxRedeliverCount}")
private int maxRedeliverCount;
@Value("${pulsar.topic}")
private String topic;
@Value("${pulsar.subscriptionName}")
private String subscriptionName;
}
package cn.com.glsx.consumer.modules.client;
import cn.com.glsx.consumer.modules.model.request.device.DeviceRequest;
import cn.com.glsx.consumer.modules.model.request.scene.SceneRequest;
import com.glsx.plat.core.web.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author zhouhaibao
* @date 2021/5/6 15:19
*/
@FeignClient(name = "${smart.feign.server.name}",path = "/smartService")
public interface SceneClient {
@ResponseBody
@RequestMapping(value = "/scene/issueOrder", method = {RequestMethod.POST})
R issueOrder(@RequestBody SceneRequest sceneRequest);
@ResponseBody
@RequestMapping(value = "/userDevice/save", method = {RequestMethod.POST})
R devBind(@RequestBody DeviceRequest deviceRequest);
@ResponseBody
@RequestMapping(value = "/userDevice/deleteDevice", method = {RequestMethod.POST})
R devUnBind(@RequestBody DeviceRequest deviceRequest);
}
package cn.com.glsx.consumer.modules.client;
import com.glsx.plat.core.web.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author zhouhaibao
* @date 2021/5/7 14:07
*/
@FeignClient(name = "${smartPlatform.feign.server.name}",path = "/smartDevices-platform-service")
public interface SmartPlatformClient {
@ResponseBody
@RequestMapping(value = "/device/devices/{device_id}", method = {RequestMethod.GET})
R getDeviceName(@PathVariable("device_id")String deviceId);
}
package cn.com.glsx.consumer.comsumers; package cn.com.glsx.consumer.modules.consumers;
import cn.com.glsx.consumer.common.AESBase64Utils; import cn.com.glsx.consumer.config.TuyaConfig;
import cn.com.glsx.consumer.common.Contants; import cn.com.glsx.consumer.modules.consumers.pulsar.MqConsumer;
import cn.com.glsx.consumer.common.MqConsumer; import cn.com.glsx.consumer.modules.utils.AESBase64Utils;
import cn.com.glsx.consumer.entity.MessageVO; import cn.com.glsx.consumer.common.constant.Contants;
import cn.com.glsx.consumer.service.InfoService; import cn.com.glsx.consumer.modules.model.response.device.MessageRep;
import cn.com.glsx.consumer.modules.service.InfoService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component @Component
@Slf4j @Slf4j
public class TuyaComsumer implements CommandLineRunner { public class TuyaComsumer implements CommandLineRunner {
@Value("${pulsar.serviceUrl}") @Resource
private String serviceUrl; private InfoService infoService;
@Value("${pulsar.accessId}")
private String accessId;
@Value("${pulsar.accessKey}")
private String accessKey;
@Value("${pulsar.maxRedeliverCount}")
private int maxRedeliverCount;
@Value("${pulsar.topic}")
private String topic;
@Value("${pulsar.subscriptionName}")
private String subscriptionName;
@Autowired @Autowired
private InfoService infoService; private TuyaConfig tuyaConfig;
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
MqConsumer mqConsumer = MqConsumer.build().serviceUrl(serviceUrl).accessId(accessId).accessKey(accessKey).topic(topic).subscriptionName(subscriptionName) MqConsumer mqConsumer = MqConsumer.build().serviceUrl(tuyaConfig.getServiceUrl()).accessId(tuyaConfig.getAccessId()).accessKey(tuyaConfig.getAccessKey()).topic(tuyaConfig.getTopic()).subscriptionName(tuyaConfig.getSubscriptionName())
.maxRedeliverCount(maxRedeliverCount).messageListener( .maxRedeliverCount(tuyaConfig.getMaxRedeliverCount()).messageListener(
message -> { message -> {
log.info("Message received:" + new String(message.getData()) + ",seq=" log.info("Message received:" + new String(message.getData()) + ",seq="
+ message.getSequenceId() + ",time=" + message.getPublishTime() + ",consumed time=" + message.getSequenceId() + ",time=" + message.getPublishTime() + ",consumed time="
+ System.currentTimeMillis()); + System.currentTimeMillis());
String jsonMessage = new String(message.getData()); String jsonMessage = new String(message.getData());
MessageVO vo = JSON.parseObject(jsonMessage, MessageVO.class); MessageRep vo = JSON.parseObject(jsonMessage, MessageRep.class);
Integer protocol = vo.getProtocol(); Integer protocol = vo.getProtocol();
if(protocol.equals(Contants.STATUS_APPEAR)){ if (protocol.equals(Contants.STATUS_APPEAR)) {
String data = AESBase64Utils.decrypt(vo.getData(), accessKey.substring(8, 24)); String data = AESBase64Utils.decrypt(vo.getData(), tuyaConfig.getAccessKey().substring(8, 24));
log.info("the real message data:" + data); log.info("the real message data:" + data);
infoService.processMessage(data); infoService.processMessage(data);
} else if (protocol.equals(Contants.event_APPEAR)) {
String data = AESBase64Utils.decrypt(vo.getData(), tuyaConfig.getAccessKey().substring(8, 24));
log.info("the real message data:" + data);
infoService.processEeventMessage(data);
} }
} }
); );
......
package cn.com.glsx.consumer.common; package cn.com.glsx.consumer.modules.consumers.pulsar;
import org.apache.pulsar.client.api.Authentication; import org.apache.pulsar.client.api.Authentication;
import org.apache.pulsar.client.api.PulsarClientException; import org.apache.pulsar.client.api.PulsarClientException;
......
package cn.com.glsx.consumer.common; package cn.com.glsx.consumer.modules.consumers.pulsar;
import org.apache.pulsar.client.api.AuthenticationDataProvider; import org.apache.pulsar.client.api.AuthenticationDataProvider;
import org.apache.pulsar.shade.org.apache.commons.codec.digest.DigestUtils; import org.apache.pulsar.shade.org.apache.commons.codec.digest.DigestUtils;
......
package cn.com.glsx.consumer.common; package cn.com.glsx.consumer.modules.consumers.pulsar;
import org.apache.pulsar.client.api.Consumer; import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.DeadLetterPolicy; import org.apache.pulsar.client.api.DeadLetterPolicy;
......
package cn.com.glsx.consumer.modules.controller;
import cn.com.glsx.consumer.common.constant.Contants;
import cn.com.glsx.consumer.modules.model.response.device.AqaraEventRep;
import cn.com.glsx.consumer.modules.service.DeviceEventService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author zhouhaibao
* @date 2021/4/18 10:39
*/
@Controller
@RequestMapping("/notice")
@Slf4j
public class NoticeController {
@Autowired
private DeviceEventService deviceEventService;
@RequestMapping(value = "/deviceInfo",method = RequestMethod.POST)
@ResponseBody
public String deviceInfo(@RequestBody String requestBody){
// 解密请求体信息
try {
log.info("消息内容{}",requestBody);
JSONObject jsonObject1 = JSONObject.parseObject(requestBody);
// 解密传过来的状态值
AqaraEventRep aqaraEventRep = JSONObject.parseObject(requestBody, AqaraEventRep.class);
if(Contants.MSG_TYPE_RESOURCE.equals(aqaraEventRep.getMsgType())){
deviceEventService.processResMessage(aqaraEventRep);
}else if(Contants.MSG_TYPE_DEIVCE.equals(aqaraEventRep.getMsgType())){
deviceEventService.processDevMessage(aqaraEventRep);
}
JSONObject jsonObject=new JSONObject();
jsonObject.put("code",0);
jsonObject.put("result",jsonObject1.getString("echostr"));
return jsonObject.toJSONString();
}catch (Exception e){
e.printStackTrace();
return null;
}
}
}
package cn.com.glsx.consumer.entity; package cn.com.glsx.consumer.modules.entity;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
......
package cn.com.glsx.consumer.entity; package cn.com.glsx.consumer.modules.entity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
......
package cn.com.glsx.consumer.entity; package cn.com.glsx.consumer.modules.entity;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.*; import javax.persistence.*;
......
package cn.com.glsx.consumer.mapper; package cn.com.glsx.consumer.modules.mapper;
import cn.com.glsx.consumer.entity.DayInfo; import cn.com.glsx.consumer.modules.entity.DayInfo;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -9,7 +9,6 @@ import java.util.List; ...@@ -9,7 +9,6 @@ import java.util.List;
@Mapper @Mapper
public interface DayInfoMapper extends CommonBaseMapper<DayInfo> { public interface DayInfoMapper extends CommonBaseMapper<DayInfo> {
int updateDayInsert(@Param("daysYear") List<DayInfo> daysYear);
DayInfo getDayCodeByDate(String date); DayInfo getDayCodeByDate(String date);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.consumer.mapper; package cn.com.glsx.consumer.modules.mapper;
import cn.com.glsx.consumer.entity.SmartDevideStatus; import cn.com.glsx.consumer.modules.entity.SmartDevideStatus;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
......
package cn.com.glsx.consumer.mapper; package cn.com.glsx.consumer.modules.mapper;
import cn.com.glsx.consumer.entity.SmartSceneData; import cn.com.glsx.consumer.modules.entity.SmartSceneData;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
......
package cn.com.glsx.consumer.entity; package cn.com.glsx.consumer.modules.model.param;
import lombok.Data; import lombok.Data;
......
package cn.com.glsx.consumer.entity; package cn.com.glsx.consumer.modules.model.param;
import lombok.Data; import lombok.Data;
......
package cn.com.glsx.consumer.entity; package cn.com.glsx.consumer.modules.model.param;
import lombok.Data; import lombok.Data;
......
package cn.com.glsx.consumer.modules.model.request.device;
import lombok.Data;
/**
* @author zhouhaibao
* @date 2021/4/23 11:43
*/
@Data
public class DeviceRequest {
private String deviceId;
private String platformProductId;
private Integer channel;
private String uid;
private String parentId;
private String deviceName;
private Integer type;// 1.实体设备 2.虚拟设备
}
package cn.com.glsx.consumer.modules.model.request.scene;
import lombok.Data;
/**
* @author zhouhaibao
* @date 2021/5/6 15:36
*/
@Data
public class SceneRequest {
private Long id;
public SceneRequest(Long id) {
this.id = id;
}
}
package cn.com.glsx.consumer.modules.model.response.device;
import lombok.Data;
/**
* @author zhouhaibao
* @date 2021/4/19 15:27
*/
@Data
public class AqaraEventDetailRep {
// 用户openId
private String openId;
// 设备模型
private String model;
// 设备名称
private String name;
// 设备id
private String did;
// 设备父id
private String parentId;
// 属性名
private String attr;
// 属性值
private String value;
private String attach;
// 事件类型
private String event;
private String time;
private String freq;
private String key;
private String ircode;
}
package cn.com.glsx.consumer.modules.model.response.device;
import lombok.Data;
import java.util.List;
/**
* @author zhouhaibao
* @date 2021/4/18 14:37
*/
@Data
public class AqaraEventRep {
/**
* 消息类型
*/
private String msgType;
private List<AqaraEventDetailRep> data;
}
package cn.com.glsx.consumer.modules.model.response.device;
import lombok.Data;
/**
* @author zhouhaibao
* @date 2021/4/23 11:35
*/
@Data
public class DeviceEventDetailRep {
private String devId;
private String uuid;
private String uid;
private String token;
private String name;
private String parentDevId;
}
package cn.com.glsx.consumer.modules.model.response.device;
import lombok.Data;
/**
* @author zhouhaibao
* @date 2021/4/23 11:34
*/
@Data
public class DeviceEventRep {
private String devId;
private String productKey;
private String bizCode;
private DeviceEventDetailRep bizData;
}
package cn.com.glsx.consumer.entity; package cn.com.glsx.consumer.modules.model.response.device;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@Data @Data
public class MessageVO implements Serializable { public class MessageRep implements Serializable {
private String data; private String data;
......
package cn.com.glsx.consumer.modules.model.response.scene;
import lombok.Data;
/**
* @author zhouhaibao
* @date 2021/3/26 17:57
*/
@Data
public class OrderResponseRep {
private String deviceName;
private String message;
private boolean result;
private Integer code;
}
package cn.com.glsx.consumer.service; package cn.com.glsx.consumer.modules.service;
import cn.com.glsx.consumer.entity.SmartSceneData; import cn.com.glsx.consumer.modules.entity.SmartSceneData;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
...@@ -8,7 +8,6 @@ import java.util.function.Predicate; ...@@ -8,7 +8,6 @@ import java.util.function.Predicate;
/** /**
* @author fengzhi * @author fengzhi
* @date 2021/3/9 17:05 * @date 2021/3/9 17:05
* @description 平台统一对外接口
*/ */
public interface ConditionStrategy { public interface ConditionStrategy {
......
package cn.com.glsx.consumer.service; package cn.com.glsx.consumer.modules.service;
import cn.com.glsx.consumer.common.Contants; import cn.com.glsx.consumer.common.constant.Contants;
import cn.com.glsx.consumer.entity.SmartSceneData; import cn.com.glsx.consumer.modules.entity.SmartSceneData;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
......
package cn.com.glsx.consumer.modules.service;
import cn.com.glsx.consumer.modules.model.response.device.AqaraEventRep;
import cn.com.glsx.consumer.modules.model.response.device.AqaraEventDetailRep;
import cn.com.glsx.consumer.modules.model.param.DeviceStatus;
import cn.com.glsx.consumer.modules.model.param.DeviceStatusDetail;
import cn.com.glsx.consumer.modules.model.request.device.DeviceRequest;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhouhaibao
* @date 2021/4/18 14:42
*/
@Slf4j
@Service
public class DeviceEventService {
@Autowired
private InfoService infoService;
@Autowired
private DeviceService deviceService;
/**
* 处理事件消息
*
* @param aqaraEventRep 入参
*/
public void processDevMessage(AqaraEventRep aqaraEventRep) {
List<AqaraEventDetailRep> data = aqaraEventRep.getData();
if (CollectionUtils.isNotEmpty(data)) {
data.forEach(index -> {
String event = index.getEvent();
if(("GW_BIND").equals(event)||("SUB_DEV_BIND").equals(event)){
deviceService.devBind(convertVo(index));
}else if(("GW_UN_BIND").equals(event)||("SUB_DEV_UN_BIND").equals(event)){
deviceService.devUnBind(convertVo(index));
}
});
}
}
private DeviceRequest convertVo(AqaraEventDetailRep index) {
DeviceRequest deviceRequest =new DeviceRequest();
deviceRequest.setDeviceId(index.getDid());
deviceRequest.setParentId(index.getParentId());
deviceRequest.setChannel(2);
deviceRequest.setPlatformProductId(index.getModel());
if(("GW_BIND").equals(index.getEvent())||("SUB_DEV_BIND").equals(index.getEvent())){
deviceRequest.setType(index.getModel().contains("virtual")?2:1);
deviceRequest.setUid(index.getOpenId());
}
deviceRequest.setDeviceName(index.getName());
return deviceRequest;
}
/**
* 处理属性消息
*
* @param aqaraEventRep 请求入参
*/
public void processResMessage(AqaraEventRep aqaraEventRep) {
List<AqaraEventDetailRep> data = aqaraEventRep.getData();
if (CollectionUtils.isNotEmpty(data)) {
data.forEach(index -> {
DeviceStatus deviceStatus = new DeviceStatus();
deviceStatus.setDevId(index.getDid());
deviceStatus.setProductKey(index.getModel());
List<DeviceStatusDetail> list = new ArrayList<>();
DeviceStatusDetail deviceStatusDetail = new DeviceStatusDetail();
deviceStatusDetail.setCode(index.getAttr());
deviceStatusDetail.setValue(index.getValue());
list.add(deviceStatusDetail);
deviceStatus.setStatus(list);
infoService.processMessage(JSONObject.toJSONString(deviceStatus));
});
}
}
}
package cn.com.glsx.consumer.modules.service;
import cn.com.glsx.consumer.modules.client.SceneClient;
import cn.com.glsx.consumer.modules.client.SmartPlatformClient;
import cn.com.glsx.consumer.modules.model.request.device.DeviceRequest;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhouhaibao
* @date 2021/4/23 11:18
*/
@Service
@Slf4j
public class DeviceService {
@Autowired
private SceneClient sceneClient;
@Autowired
private SmartPlatformClient smartPlatformClient;
/**
* 设备绑定
*
* @param deviceRequest 入参
*/
public void devBind(DeviceRequest deviceRequest) {
R response = sceneClient.devBind(deviceRequest);
if(response.isSuccess()){
log.info("设备id{}保存更新成功", deviceRequest.getDeviceId());
}else{
log.info("设备id{}保存更新失败原因{}", deviceRequest.getDeviceId(), response.getMessage());
}
}
/**
* 设备解绑
*
* @param deviceRequest 入参
*/
public void devUnBind(DeviceRequest deviceRequest) {
R response = sceneClient.devUnBind(deviceRequest);
if(response.isSuccess()){
log.info("设备id{}删除成功", deviceRequest.getDeviceId());
}else{
log.info("设备id{}删除失败原因{}", deviceRequest.getDeviceId(), response.getMessage());
}
}
/**
* 获取设备名称
*
* @param devId 设备id
* @return 返回值
*/
public String getDeviceName(String devId) {
R deviceName = smartPlatformClient.getDeviceName(devId);
Object data = deviceName.getData();
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(data));
if(jsonObject==null){
log.info("查询设备{}名称为空",devId);
return null;
}
return jsonObject.getString("name");
}
}
package cn.com.glsx.consumer.service; package cn.com.glsx.consumer.modules.service;
import cn.com.glsx.consumer.common.Contants; import cn.com.glsx.consumer.modules.client.SceneClient;
import cn.com.glsx.consumer.common.EDay; import cn.com.glsx.consumer.common.constant.Contants;
import cn.com.glsx.consumer.common.ELogic; import cn.com.glsx.consumer.common.enums.EDay;
import cn.com.glsx.consumer.entity.DayInfo; import cn.com.glsx.consumer.common.enums.ELogic;
import cn.com.glsx.consumer.entity.DeviceStatus; import cn.com.glsx.consumer.modules.entity.DayInfo;
import cn.com.glsx.consumer.entity.DeviceStatusDetail; import cn.com.glsx.consumer.modules.model.response.device.DeviceEventRep;
import cn.com.glsx.consumer.entity.ScenseParamValue; import cn.com.glsx.consumer.modules.model.response.device.DeviceEventDetailRep;
import cn.com.glsx.consumer.entity.SmartDevideStatus; import cn.com.glsx.consumer.modules.model.param.DeviceStatus;
import cn.com.glsx.consumer.entity.SmartSceneData; import cn.com.glsx.consumer.modules.model.param.DeviceStatusDetail;
import cn.com.glsx.consumer.mapper.DayInfoMapper; import cn.com.glsx.consumer.modules.model.request.device.DeviceRequest;
import cn.com.glsx.consumer.mapper.SmartDevideStatusMapper; import cn.com.glsx.consumer.modules.model.param.ScenseParamValue;
import cn.com.glsx.consumer.mapper.SmartSceneDataMapper; import cn.com.glsx.consumer.modules.entity.SmartDevideStatus;
import cn.com.glsx.consumer.redis.RedisService; import cn.com.glsx.consumer.modules.entity.SmartSceneData;
import cn.com.glsx.consumer.utils.DateUtils; import cn.com.glsx.consumer.modules.mapper.DayInfoMapper;
import cn.com.glsx.consumer.utils.HttpUtil; import cn.com.glsx.consumer.modules.mapper.SmartDevideStatusMapper;
import cn.com.glsx.consumer.modules.mapper.SmartSceneDataMapper;
import cn.com.glsx.consumer.modules.model.request.scene.SceneRequest;
import cn.com.glsx.consumer.common.redis.RedisService;
import cn.com.glsx.consumer.modules.utils.DateUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -51,29 +53,30 @@ public class InfoService { ...@@ -51,29 +53,30 @@ public class InfoService {
@Autowired @Autowired
private ConditionStrategy conditionStrategy; private ConditionStrategy conditionStrategy;
@Value("${issueOrderUrl}") @Autowired
private String issueOrderUrl; private SceneClient sceneClient;
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Autowired
private DeviceService deviceService;
/** /**
* 处理消息 * 处理消息
* *
* @param data * @param data 入参
*/ */
public void processMessage(String data) { public void processMessage(String data) {
DeviceStatus deviceStatus = JSONObject.parseObject(data, DeviceStatus.class); DeviceStatus deviceStatus = JSONObject.parseObject(data, DeviceStatus.class);
List<SmartDevideStatus> list = buildParams(deviceStatus); List<SmartDevideStatus> list = buildParams(deviceStatus);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
list.forEach(index -> { list.forEach(in -> {
if (index.getId() == null) { if (in.getId() == null) {
smartDevideStatusMapper.insert(index); smartDevideStatusMapper.insert(in);
} else { } else {
smartDevideStatusMapper.updateByPrimaryKeySelective(index); smartDevideStatusMapper.updateByPrimaryKeySelective(in);
} }
});
list.forEach(in -> {
// 判断该设备是否在用户场景里面 // 判断该设备是否在用户场景里面
List<SmartSceneData> smartSceneDataList = smartSceneDataMapper.findSceneDataByDeviceId(in.getDeviceId(), in.getDeviceOrderCode()); List<SmartSceneData> smartSceneDataList = smartSceneDataMapper.findSceneDataByDeviceId(in.getDeviceId(), in.getDeviceOrderCode());
if (CollectionUtils.isEmpty(smartSceneDataList)) { if (CollectionUtils.isEmpty(smartSceneDataList)) {
...@@ -82,53 +85,44 @@ public class InfoService { ...@@ -82,53 +85,44 @@ public class InfoService {
} }
smartSceneDataList.forEach(index -> { smartSceneDataList.forEach(index -> {
String key = index.getSceneId() + "_" + Contants.SCENE_STATUS; String key = index.getSceneId() + "_" + Contants.SCENE_STATUS;
List<SmartSceneData> sceneDataList = null; List<SmartSceneData> sceneDataList;
Integer executeCycle = index.getExecuteCycle();
// 判断场景是否触发 // 判断场景是否触发
if (index.getConditionRule().equals("1")) { if (1 == index.getConditionRule()) {
sceneDataList = smartSceneDataMapper.findBySceneId(index.getSceneId(), in.getDeviceOrderCode()); sceneDataList = smartSceneDataMapper.findBySceneId(index.getSceneId(), in.getDeviceOrderCode());
} else { } else {
sceneDataList = smartSceneDataMapper.findBySceneId(index.getSceneId(), null); sceneDataList = smartSceneDataMapper.findBySceneId(index.getSceneId(), null);
} }
// 判断场景条件是否配置了时间并且是全部条件满足执行的 // 判断场景条件是否配置了时间并且是全部条件满足执行的
List<SmartSceneData> scene_condition_time = sceneDataList.stream().filter(inx -> inx.getParamKey().equals("scene_condition_status")).collect(Collectors.toList()); List<SmartSceneData> scene_condition_time = sceneDataList.stream().filter(inx -> ("scene_condition_status").equals(inx.getParamKey())).collect(Collectors.toList());
if (list.size() != scene_condition_time.size() && index.getConditionRule().equals("2")) { if (list.size() != scene_condition_time.size() && index.getConditionRule() == 2) {
log.info("场景id{}不符合必要条件条件", index.getSceneId()); log.info("场景id{}不符合必要条件条件", index.getSceneId());
return; return;
} }
boolean isTrigger = conditionStrategy.isTrigger(scene_condition_time, index.getConditionRule(), boolean isTrigger = conditionStrategy.isTrigger(scene_condition_time, index.getConditionRule(),
(SmartSceneData condition) -> getTriggerResult(condition)); (SmartSceneData condition) -> getTriggerResult(condition));
log.info("场景id{}---{}触发条件", index.getSceneId(), isTrigger ? "符合" : "不符合");
// 温度控制 // 温度控制
Object o = redisService.get(key); Object value = redisService.get(key);
if(!in.getFlag()) { if (!in.getFlag()) {
if (isTrigger) { if (isTrigger) {
if (o == null) { if (value == null) {
redisService.set(key, key); redisService.set(key, key);
} else { } else {
log.info("场景id{}温湿度已经触发过一次", index.getSceneId()); log.info("场景id{}温湿度已经触发过一次", index.getSceneId());
return; return;
} }
}else{ } else {
// 重新触发的话 // 重新触发的话
redisService.delete(key); redisService.delete(key);
} }
} }
log.info("场景id{}---{}触发条件", index.getSceneId(), isTrigger ? "符合" : "不符合"); if(isTrigger) {
if (isTrigger) {
// 下发场景 // 下发场景
Map<String, String> requestMap = new HashMap<>(); R orderResponses = sceneClient.issueOrder(new SceneRequest(index.getSceneId()));
requestMap.put("id", index.getSceneId() + ""); log.info("场景id{}下发结果{}", index.getSceneId(), orderResponses.getData());
try {
String responseBody = HttpUtil.sendPost(issueOrderUrl, JSONObject.toJSONString(requestMap), new HashMap<>());
log.info("场景id{}下发结果{}", index.getSceneId(), responseBody);
} catch (Exception e) {
e.printStackTrace();
log.info("场景id{}下发指令异常,{}", index.getSceneId(), e);
}
} }
}); });
}); });
} }
} }
...@@ -141,7 +135,7 @@ public class InfoService { ...@@ -141,7 +135,7 @@ public class InfoService {
// 温度特殊处理 // 温度特殊处理
if (smartDevideStatus != null) { if (smartDevideStatus != null) {
String code = index.getCode(); String code = index.getCode();
if (code.equals("va_temperature") || code.equals("va_humidity")) { if (("va_temperature").equals(code) || ("va_humidity").equals(code)) {
smartDevideStatus.setFlag(false); smartDevideStatus.setFlag(false);
} }
} }
...@@ -172,7 +166,12 @@ public class InfoService { ...@@ -172,7 +166,12 @@ public class InfoService {
} }
//触发条件判断 /**
* 触发条件判断
*
* @param condition 条件
* @return 返回值
*/
private boolean getTriggerResult(SmartSceneData condition) { private boolean getTriggerResult(SmartSceneData condition) {
if (condition.getExecuteCycle() != 1 && !getExecuteCycle().equals(condition.getExecuteCycle())) { if (condition.getExecuteCycle() != 1 && !getExecuteCycle().equals(condition.getExecuteCycle())) {
log.info("当前时间不是触发周期:" + condition.getId()); log.info("当前时间不是触发周期:" + condition.getId());
...@@ -183,7 +182,7 @@ public class InfoService { ...@@ -183,7 +182,7 @@ public class InfoService {
log.info("触发条件的value不存在===id:" + condition.getId()); log.info("触发条件的value不存在===id:" + condition.getId());
return false; return false;
} }
ScenseParamValue paramValue = null; ScenseParamValue paramValue;
try { try {
paramValue = JSON.parseObject(JSON.parse(value).toString(), ScenseParamValue.class); paramValue = JSON.parseObject(JSON.parse(value).toString(), ScenseParamValue.class);
} catch (Exception e) { } catch (Exception e) {
...@@ -204,7 +203,7 @@ public class InfoService { ...@@ -204,7 +203,7 @@ public class InfoService {
} }
String Value = null; String Value = null;
//触发状态值,如果value没有值,则取ordervalue //触发状态值,如果value没有值,则取ordervalue
if (deviceOrderCode.equals("va_temperature") || deviceOrderCode.equals("va_humidity")) { if (("va_temperature").equals(deviceOrderCode) || ("va_humidity").equals(deviceOrderCode)) {
if (StringUtils.isNotBlank(paramValue.getValue())) { if (StringUtils.isNotBlank(paramValue.getValue())) {
log.info("温湿度值为{}", paramValue.getValue()); log.info("温湿度值为{}", paramValue.getValue());
Value = Integer.parseInt(paramValue.getValue()) * 10 + ""; Value = Integer.parseInt(paramValue.getValue()) * 10 + "";
...@@ -225,4 +224,50 @@ public class InfoService { ...@@ -225,4 +224,50 @@ public class InfoService {
log.info("deviceOrderCode为{}的判断是{}", deviceOrderCode, valueByCode); log.info("deviceOrderCode为{}的判断是{}", deviceOrderCode, valueByCode);
return valueByCode; return valueByCode;
} }
/**
* 事件消息
*
* @param data 入参
*/
public void processEeventMessage(String data) {
DeviceEventRep deviceEventRep = JSONObject.parseObject(data, DeviceEventRep.class);
String bizCode = deviceEventRep.getBizCode();
switch (bizCode) {
case "nameUpdate":
deviceService.devBind(convertVo(deviceEventRep));
break;
case "bindUser":
deviceService.devBind(convertVo(deviceEventRep));
break;
case "delete":
deviceService.devUnBind(convertVo(deviceEventRep));
break;
default:
break;
}
}
private DeviceRequest convertVo(DeviceEventRep deviceEventRep) {
DeviceRequest deviceRequest = new DeviceRequest();
DeviceEventDetailRep bizData = deviceEventRep.getBizData();
if (("bindUser").equals(deviceEventRep.getBizCode())) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
String name = deviceService.getDeviceName(bizData.getDevId());
deviceRequest.setDeviceName(name);
} else {
deviceRequest.setDeviceName(bizData.getName());
}
deviceRequest.setUid(bizData.getUid());
deviceRequest.setPlatformProductId(deviceEventRep.getProductKey());
deviceRequest.setChannel(1);
deviceRequest.setParentId(bizData.getParentDevId());
deviceRequest.setType(bizData.getParentDevId() == null ? 1 : 2);
deviceRequest.setDeviceId(bizData.getDevId());
return deviceRequest;
}
} }
package cn.com.glsx.consumer.common; package cn.com.glsx.consumer.modules.utils;
import org.apache.pulsar.shade.org.apache.commons.codec.binary.Base64; import org.apache.pulsar.shade.org.apache.commons.codec.binary.Base64;
import org.apache.pulsar.shade.org.apache.commons.codec.binary.StringUtils; import org.apache.pulsar.shade.org.apache.commons.codec.binary.StringUtils;
......
package cn.com.glsx.consumer.modules.utils;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Base64;
/**
* AES PKCS5
*/
public class AESUtil {
private static final String ENCRYPT_AES = "AES/CBC/PKCS5Padding";
public static final String CHARSET_UTF_8 = "utf-8";
private static final int SECURE_KEY_LENGTH = 16;
/**
* AES ECB 128加密
* iv偏移量,ECB不用设置
* 加密结果再进行Base64加密
* @param src
* @param key
* @throws Exception
*/
public static String encryptEcb(String src, byte[] key) throws Exception {
SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] content = src.getBytes(CHARSET_UTF_8);
byte[] ret = cipher.doFinal(content);
return Base64.getEncoder().encodeToString(ret);
}
/**
* ECB解密 结果含Base64加密
* @param src
* @param key
* @return
* @throws Exception
*/
public static String decryptEcb(String src,byte[] key) throws Exception{
byte[] srcByte = Base64.getDecoder().decode(src);
SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] ret = cipher.doFinal(srcByte);
return new String(ret,CHARSET_UTF_8);
}
/**
* AES CBC 128加密
* 加密结果再进行Base64编码
* 动态偏移量
* @param src 加密字符串
* @param key 密码 16位
* @throws Exception
*/
public static String encryptCbc(String src, byte[] key) throws Exception {
SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
AlgorithmParameterSpec params = new IvParameterSpec(getIv(key));
Cipher cipher = Cipher.getInstance(ENCRYPT_AES);
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, params);
byte[] content = src.getBytes(CHARSET_UTF_8);
byte[] ret = cipher.doFinal(content);
return Base64.getEncoder().encodeToString(ret);
}
/**
* AES CBC 解密
* 结果含Base64编码
* 动态偏移量
* @param src 加密字符串
* @param key 密码 16位
* @return
* @throws Exception
*/
public static String decryptCbc(String src,byte[] key) throws Exception{
byte[] srcByte = Base64.getDecoder().decode(src);
SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
AlgorithmParameterSpec params = new IvParameterSpec(getIv(key));
Cipher cipher = Cipher.getInstance(ENCRYPT_AES);
cipher.init(Cipher.DECRYPT_MODE, skeySpec, params);
byte[] ret = cipher.doFinal(srcByte);
return new String(ret,CHARSET_UTF_8);
}
/**
* AES 128获取16位密码
* @param key
* @return
* @throws UnsupportedEncodingException
*/
public static byte[] getAESKey(String key) throws UnsupportedEncodingException {
byte[] keyBytes = key.getBytes(CHARSET_UTF_8);
// Use the first 16 bytes (or even less if key is shorter)
byte[] keyBytes128 = new byte[SECURE_KEY_LENGTH];
System.arraycopy(keyBytes, 0, keyBytes128, 0, Math.min(keyBytes.length, SECURE_KEY_LENGTH));
return keyBytes128;
}
/**
* 生成IV偏移量
* @param key
* @return
*/
public static byte[] getIv(byte[] key){
byte[] iv = new byte[SECURE_KEY_LENGTH];
for(int i=0; i< SECURE_KEY_LENGTH && i < key.length; i++){
iv[i] = key[i];
}
if(key.length < SECURE_KEY_LENGTH){
for(int i=key.length; i<SECURE_KEY_LENGTH; i++){
iv[i] = '0';
}
}
return iv;
}
public static void main(String[] args)throws Exception{
String aa="{\"did\":\"lumi.158d0001b12fdb\",\"msgId\":\"AC1F000E676355F9630284AC6BD36AF93\",\"property\":\"system_volume\",\"time\":\"1561544292194\",\"value\":\"40\"}";
System.out.println(encryptEcb(aa,"H1rhtzCNw8HGS5zwCDaLf4XJl0Tsvijg".getBytes()));
}
}
package cn.com.glsx.consumer.utils; package cn.com.glsx.consumer.modules.utils;
import org.apache.commons.lang.time.DateFormatUtils; import org.apache.commons.lang.time.DateFormatUtils;
......
package cn.com.glsx.consumer.utils; package cn.com.glsx.consumer.modules.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</javaTypeResolver> </javaTypeResolver>
<!-- 生成实体类地址 --> <!-- 生成实体类地址 -->
<javaModelGenerator targetPackage="cn.com.glsx.consumer.entity" targetProject="src/main/java"> <javaModelGenerator targetPackage="cn.com.glsx.consumer.modules.entity" targetProject="src/main/java">
<!-- 是否让schema作为包的后缀 --> <!-- 是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<!-- 从数据库返回的值去掉前后空格 --> <!-- 从数据库返回的值去掉前后空格 -->
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</sqlMapGenerator> </sqlMapGenerator>
<!-- 生成接口dao type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 --> <!-- 生成接口dao type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator targetPackage="cn.com.glsx.consumer.mapper" targetProject="src/main/java" type="XMLMAPPER"> <javaClientGenerator targetPackage="cn.com.glsx.consumer.modules.mapper" targetProject="src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="false"/> <property name="enableSubPackages" value="false"/>
</javaClientGenerator> </javaClientGenerator>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.consumer.mapper.DayInfoMapper"> <mapper namespace="cn.com.glsx.consumer.modules.mapper.DayInfoMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.consumer.entity.DayInfo"> <resultMap id="BaseResultMap" type="cn.com.glsx.consumer.modules.entity.DayInfo">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.consumer.mapper.SmartDevideStatusMapper"> <mapper namespace="cn.com.glsx.consumer.modules.mapper.SmartDevideStatusMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.consumer.entity.SmartDevideStatus"> <resultMap id="BaseResultMap" type="cn.com.glsx.consumer.modules.entity.SmartDevideStatus">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.consumer.mapper.SmartSceneDataMapper"> <mapper namespace="cn.com.glsx.consumer.modules.mapper.SmartSceneDataMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.consumer.entity.SmartSceneData"> <resultMap id="BaseResultMap" type="cn.com.glsx.consumer.modules.entity.SmartSceneData">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!