Commit ef48c9b0 by wnb0128

车家智能场景代码规范化--think.wang

1 parent 021061f1
package cn.com.glsx.smart.modules.controller;
import java.util.ArrayList;
import java.util.List;
import cn.com.glsx.smart.modules.entity.SmartUserDevice;
import cn.com.glsx.smart.modules.entity.SmartUserRelation;
import cn.com.glsx.smart.modules.model.request.SmartUserDeviceQueryReq;
import cn.com.glsx.smart.modules.model.request.UserRelationRequest;
import cn.com.glsx.smart.modules.model.response.RemoteDeviceResp;
import cn.com.glsx.smart.modules.service.SmartProductTypeService;
import cn.com.glsx.smart.modules.service.SmartUserDeviceService;
......@@ -14,18 +13,18 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.common.utils.HttpUtils;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 远程产品服务controller
......@@ -56,15 +55,17 @@ public class RemoteProductController {
*/
@ResponseBody
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<RemoteDeviceResp> getList(@RequestBody SmartUserRelation request) {
log.info("用户参数:{}", request);
public R getList(@RequestBody UserRelationRequest relationRequest) {
log.info("用户参数:{}", JSON.toJSONString(relationRequest));
SmartUserRelation request = new SmartUserRelation();
BeanUtils.copyProperties(relationRequest, relationRequest);
SmartUserRelation user = userRelationService.getSingle(request);
if(user == null){
return null;
}
Byte status = request.getStatus() != null ? request.getStatus() : -1;
// return this.getRemoteDevice(user.getThirdId(), status);
return this.getRemoteDeviceV2(user.getId(), status);
return R.ok().data(this.getRemoteDeviceV2(user.getId(), status));
}
private List<RemoteDeviceResp> getRemoteDevice(String thirdId, Byte status) {
......
......@@ -3,16 +3,20 @@ package cn.com.glsx.smart.modules.controller;
import cn.com.glsx.smart.modules.entity.SmartScene;
import cn.com.glsx.smart.modules.entity.SmartUserRelation;
import cn.com.glsx.smart.modules.model.OrderResponse;
import cn.com.glsx.smart.modules.model.ValidateGroups;
import cn.com.glsx.smart.modules.model.request.SceneRequest;
import cn.com.glsx.smart.modules.model.response.SceneResponse;
import cn.com.glsx.smart.modules.service.*;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -45,79 +49,98 @@ public class SceneController {
private SmartUserRelationService userRelationService;
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartScene> getList(@RequestBody SmartScene scene) {
log.info("/scene/getList param: {}", JSON.toJSONString(scene));
return sceneService.getList(scene);
public R getList(@RequestBody SceneRequest sceneRequest) {
log.info("/scene/getList param: {}", JSON.toJSONString(sceneRequest));
SmartScene request = new SmartScene();
BeanUtils.copyProperties(sceneRequest, request);
List<SmartScene> list = sceneService.getList(request);
List<SceneResponse> responseList = new ArrayList<>();
BeanUtils.copyProperties(list, responseList);
return R.ok().data(responseList);
}
@RequestMapping(value = "/getScenList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartScene> getScenList(@RequestBody SmartScene scene) {
log.info("/scene/getScenList param: {}", JSON.toJSONString(scene));
public R getScenList(@RequestBody SceneRequest sceneRequest) {
log.info("/scene/getScenList param: {}", JSON.toJSONString(sceneRequest));
SmartUserRelation smartUserRelation = new SmartUserRelation();
smartUserRelation.setUserId(scene.getUserId());
smartUserRelation.setUserId(sceneRequest.getUserId());
SmartUserRelation user = userRelationService.getSingle(smartUserRelation);
if (user == null) {
return null;
}
scene.setUserId(user.getId());
return sceneService.getList(scene);
SmartScene request = new SmartScene();
BeanUtils.copyProperties(sceneRequest, request);
request.setUserId(user.getId());
List<SmartScene> list = sceneService.getList(request);
List<SceneResponse> responseList = new ArrayList<>();
BeanUtils.copyProperties(list, responseList);
return R.ok().data(responseList);
}
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartScene getById(Long id) {
@RequestMapping(value = "/getById", method = {RequestMethod.GET})
public R getById(@RequestParam("id") Long id) {
log.info("/scene/getById param: {}", id);
SmartScene scene = sceneService.getById(id);
if (scene != null) {
scene.setDataList(sceneDataService.getBySceneId(id));
}
return scene;
SceneResponse response = new SceneResponse();
BeanUtils.copyProperties(scene, response);
return R.ok().data(response);
}
@RequestMapping(value = "/add", method = {RequestMethod.POST})
public boolean save(@RequestBody SmartScene scene) {
scene.setCreateTime(new Date());
log.info("用户新增调用/scene/add param: {}", JSON.toJSONString(scene));
boolean flag = sceneService.insert(scene) > 0;
public R save(@RequestBody @Validated(ValidateGroups.Insert.class) SceneRequest sceneRequest) {
log.info("用户新增调用/scene/add param: {}", JSON.toJSONString(sceneRequest));
SmartScene request = new SmartScene();
BeanUtils.copyProperties(sceneRequest, request);
request.setCreateTime(new Date());
boolean flag = sceneService.insert(request) > 0;
if (flag) {
userKafkaService.addDeviceData(scene); //推送数据至kafka
sceneLogService.insertWrapper(scene.getUserId(),
"新增场景数据:" + scene.getId(), JSON.toJSONString(scene));
userKafkaService.addDeviceData(request); //推送数据至kafka
sceneLogService.insertWrapper(request.getUserId(),
"新增场景数据:" + request.getId(), JSON.toJSONString(request));
}
return flag;
return R.ok().data(flag);
}
@RequestMapping(value = "/update", method = {RequestMethod.POST})
public boolean update(@RequestBody SmartScene scene) {
scene.setUpdateTime(new Date());
log.info("用户更新调用/scene/update param: {}", JSON.toJSONString(scene));
boolean flag = sceneService.update(scene) > 0;
public R update(@RequestBody @Validated(ValidateGroups.Update.class) SceneRequest sceneRequest) {
log.info("用户更新调用/scene/update param: {}", JSON.toJSONString(sceneRequest));
SmartScene request = new SmartScene();
BeanUtils.copyProperties(sceneRequest, request);
request.setUpdateTime(new Date());
boolean flag = sceneService.update(request) > 0;
if (flag) {
userKafkaService.addDeviceData(scene); //推送数据至kafka
sceneLogService.insertWrapper(scene.getUserId(),
"更新场景数据:" + scene.getId(), JSON.toJSONString(scene));
userKafkaService.addDeviceData(request); //推送数据至kafka
sceneLogService.insertWrapper(request.getUserId(),
"更新场景数据:" + request.getId(), JSON.toJSONString(request));
}
return flag;
return R.ok().data(flag);
}
@RequestMapping(value = "/delete", method = {RequestMethod.POST})
public boolean delete(@RequestBody SmartScene scene) {
log.info("用户删除场景调用/scene/delete param: {}", scene.getId());
SmartScene data = sceneService.getById(scene.getId());
int i = sceneService.deleteByPrimaryKey(scene.getId());
public R delete(@RequestBody @Validated(ValidateGroups.Delete.class) SceneRequest sceneRequest) {
log.info("用户删除场景调用/scene/delete param: {}", sceneRequest.getId());
SmartScene data = sceneService.getById(sceneRequest.getId());
int i = sceneService.deleteByPrimaryKey(sceneRequest.getId());
if (i > 0) {
sceneDataService.deleteBySceneId(scene.getId());
sceneDataService.deleteBySceneId(sceneRequest.getId());
sceneLogService.insertWrapper(data.getUserId(),
"删除场景数据:" + data.getId(), JSON.toJSONString(data));
return true;
return R.ok().data(true);
}
return false;
return R.ok().data(false);
}
@RequestMapping(value = "/updateStatus", method = {RequestMethod.POST})
public boolean updateStatus(@RequestBody SmartScene scene) {
scene.setUpdateTime(new Date());
log.info("用户更新调用/scene/updateStatus param: {}", JSON.toJSONString(scene));
return sceneService.updateByPrimaryKeySelective(scene) > 0;
public R updateStatus(@RequestBody @Validated(ValidateGroups.Query.class) SceneRequest sceneRequest) {
log.info("用户更新调用/scene/updateStatus param: {}", JSON.toJSONString(sceneRequest));
SmartScene request = new SmartScene();
BeanUtils.copyProperties(sceneRequest, request);
request.setUpdateTime(new Date());
int i = sceneService.updateByPrimaryKeySelective(request);
return R.ok().data(i > 0);
}
@RequestMapping(value = "/issueOrder", method = {RequestMethod.POST})
......
package cn.com.glsx.smart.modules.controller;
import cn.com.glsx.smart.modules.entity.SmartSceneTemplate;
import cn.com.glsx.smart.modules.model.ValidateGroups;
import cn.com.glsx.smart.modules.model.request.SceneTemplateRequest;
import cn.com.glsx.smart.modules.model.response.SceneTemplateResponse;
import cn.com.glsx.smart.modules.service.SmartSceneTemplateService;
import cn.com.glsx.smart.modules.service.SmartTemplateParamService;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -30,45 +37,63 @@ public class SceneTemplateController {
private SmartTemplateParamService templateParamService;
@RequestMapping(value = "/getPageList", method = {RequestMethod.GET, RequestMethod.POST})
public PageInfo<SmartSceneTemplate> getPageList(@RequestBody SmartSceneTemplate sceneTemplate) {
log.info("/sceneTemplate/getList param: {}", JSON.toJSONString(sceneTemplate));
List<SmartSceneTemplate> sceneList = sceneTemplateService.getList(sceneTemplate);
public R getPageList(@RequestBody SceneTemplateRequest templateRequest) {
log.info("/sceneTemplate/getPageList param: {}", JSON.toJSONString(templateRequest));
SmartSceneTemplate request = new SmartSceneTemplate();
BeanUtils.copyProperties(templateRequest, request);
List<SmartSceneTemplate> sceneList = sceneTemplateService.getList(request);
PageInfo<SmartSceneTemplate> pageInfo = PageInfo.of(sceneList);
return pageInfo;
return R.ok().putPageData(pageInfo);
}
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartSceneTemplate> getList(@RequestBody SmartSceneTemplate sceneTemplate) {
log.info("/sceneTemplate/getList param: {}", JSON.toJSONString(sceneTemplate));
return sceneTemplateService.getList(sceneTemplate);
public R getList(@RequestBody SceneTemplateRequest templateRequest) {
log.info("/sceneTemplate/getList param: {}", JSON.toJSONString(templateRequest));
SmartSceneTemplate request = new SmartSceneTemplate();
BeanUtils.copyProperties(templateRequest, request);
List<SmartSceneTemplate> list = sceneTemplateService.getList(request);
List<SceneTemplateResponse> responseList = new ArrayList<>();
BeanUtils.copyProperties(list, responseList);
return R.ok().data(responseList);
}
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartSceneTemplate getById(@RequestParam("id") Long id) {
@RequestMapping(value = "/getById", method = {RequestMethod.GET})
public R getById(@RequestParam("id") Long id) {
log.info("/sceneTemplate/getById param: {}", id);
SmartSceneTemplate template = sceneTemplateService.getById(id);
if(template != null){
template.setTemplateList(templateParamService.getByTemplateId(id));
}
return template;
SceneTemplateResponse response = new SceneTemplateResponse();
BeanUtils.copyProperties(template, response);
return R.ok().data(response);
}
@RequestMapping(value = "/add", method = {RequestMethod.POST})
public boolean save(@RequestBody SmartSceneTemplate sceneTemplate) {
log.info("新增调用/sceneTemplate/add param: {}", JSON.toJSONString(sceneTemplate));
return sceneTemplateService.insert(sceneTemplate) > 0 ? true : false;
public R save(@RequestBody @Validated(ValidateGroups.Insert.class) SceneTemplateRequest templateRequest) {
log.info("新增调用/sceneTemplate/add param: {}", JSON.toJSONString(templateRequest));
SmartSceneTemplate request = new SmartSceneTemplate();
BeanUtils.copyProperties(templateRequest, request);
int i = sceneTemplateService.insert(request);
return R.ok().data(i > 0);
}
@RequestMapping(value = "/update", method = {RequestMethod.POST})
public boolean update(@RequestBody SmartSceneTemplate sceneTemplate) {
log.info("更新调用/sceneTemplate/update param: {}", JSON.toJSONString(sceneTemplate));
return sceneTemplateService.update(sceneTemplate) > 0 ? true : false;
public R update(@RequestBody @Validated(ValidateGroups.Update.class) SceneTemplateRequest templateRequest) {
log.info("更新调用/sceneTemplate/update param: {}", JSON.toJSONString(templateRequest));
SmartSceneTemplate request = new SmartSceneTemplate();
BeanUtils.copyProperties(templateRequest, request);
int i = sceneTemplateService.update(request);
return R.ok().data(i > 0);
}
@RequestMapping(value = "/updateParam", method = {RequestMethod.POST})
public boolean updateParam(@RequestBody SmartSceneTemplate sceneTemplate) {
log.info("更新主表调用/sceneTemplate/updateParam param: {}", JSON.toJSONString(sceneTemplate));
return sceneTemplateService.updateByPrimaryKeySelective(sceneTemplate) > 0 ? true : false;
public R updateParam(@RequestBody @Validated(ValidateGroups.Query.class) SceneTemplateRequest templateRequest) {
log.info("更新主表调用/sceneTemplate/updateParam param: {}", JSON.toJSONString(templateRequest));
SmartSceneTemplate request = new SmartSceneTemplate();
BeanUtils.copyProperties(templateRequest, request);
int i = sceneTemplateService.updateByPrimaryKeySelective(request);
return R.ok().data(i > 0);
}
}
......@@ -7,6 +7,7 @@ import cn.com.glsx.smart.modules.entity.SmartUserRelation;
import cn.com.glsx.smart.modules.model.pb.InstanceFence.Fence;
import cn.com.glsx.smart.modules.service.*;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -55,12 +56,12 @@ public class UserKafkaController {
*/
@ResponseBody
@RequestMapping(value = "/updateUserAddress", method = {RequestMethod.GET})
public boolean updateUserAddress(@RequestParam("userId") Long userId, @RequestParam("phone") String phone,
@RequestParam("lngAndLat") String lngAndLat){
public R updateUserAddress(@RequestParam("userId") Long userId, @RequestParam("phone") String phone,
@RequestParam("lngAndLat") String lngAndLat){
log.info("更新用户家庭地址:{} {} {}", userId, phone, lngAndLat);
List<SmartScene> sceneList = this.getUserSceneData(userId, phone);
if(CollectionUtils.isEmpty(sceneList)){
return false;
return R.ok().data(false);
}
int len = sceneList.size();
for (int i = 0; i < len; i++) {
......@@ -77,16 +78,16 @@ public class UserKafkaController {
}
}
}
return true;
return R.ok().data(true);
}
@ResponseBody
@RequestMapping(value = "/logoutUserScene", method = {RequestMethod.GET})
public boolean logoutUserScene(@RequestParam("userId") Long userId, @RequestParam("phone") String phone) {
public R logoutUserScene(@RequestParam("userId") Long userId, @RequestParam("phone") String phone) {
log.info("嘀嘀虎用户注销:{} {}", userId, phone);
List<SmartScene> sceneList = this.getUserSceneData(userId, phone);
if(CollectionUtils.isEmpty(sceneList)){
return false;
return R.ok().data(false);
}
for (SmartScene scene : sceneList) {
//用户场景数据获取
......@@ -109,7 +110,7 @@ public class UserKafkaController {
"删除场景数据:" + scene.getId(), JSON.toJSONString(scene));
}
}
return true;
return R.ok().data(true);
}
/**
......
......@@ -4,15 +4,19 @@ package cn.com.glsx.smart.modules.controller;
import cn.com.glsx.smart.common.constant.Constants;
import cn.com.glsx.smart.modules.entity.SmartUserChannel;
import cn.com.glsx.smart.modules.entity.SmartUserRelation;
import cn.com.glsx.smart.modules.model.ValidateGroups;
import cn.com.glsx.smart.modules.model.request.UserRelationRequest;
import cn.com.glsx.smart.modules.model.response.UserRelationResponse;
import cn.com.glsx.smart.modules.service.SmartUserRelationService;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.common.utils.MD5Utils;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.core.web.R;
import com.glsx.plat.redis.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
......@@ -41,40 +45,50 @@ public class UserRelationController {
@ResponseBody
@RequestMapping(value = "/getSingle", method = {RequestMethod.POST})
public SmartUserRelation getSingle(@RequestBody SmartUserRelation userRelation){
return userRelationService.getSingle(userRelation);
public R getSingle(@RequestBody UserRelationRequest relationRequest){
log.info("/user/getSingle获取用户数据参数:{}", JSON.toJSONString(relationRequest));
SmartUserRelation request = new SmartUserRelation();
BeanUtils.copyProperties(relationRequest, request);
SmartUserRelation relation = userRelationService.getSingle(request);
UserRelationResponse response = new UserRelationResponse();
BeanUtils.copyProperties(relation, response);
return R.ok().data(response);
}
@ResponseBody
@RequestMapping(value = "/add", method = {RequestMethod.POST})
public Long add(@RequestBody SmartUserRelation userRelation){
log.info("/user/add保存数据参数:{}", JSON.toJSONString(userRelation));
return userRelationService.insertSelective(userRelation);
public R add(@RequestBody UserRelationRequest relationRequest){
log.info("/user/add保存数据参数:{}", JSON.toJSONString(relationRequest));
SmartUserRelation request = new SmartUserRelation();
BeanUtils.copyProperties(relationRequest, request);
request.setCreateTime(new Date());
Long i = userRelationService.insertSelective(request);
return R.ok().data(i > 0);
}
@ResponseBody
@RequestMapping(value = "/update", method = {RequestMethod.POST})
public Integer update(@RequestBody SmartUserRelation userRelation){
log.info("/user/update保存数据参数:{}", JSON.toJSONString(userRelation));
return userRelationService.updateByPrimaryKeySelective(userRelation);
public R update(@RequestBody UserRelationRequest relationRequest){
log.info("/user/update保存数据参数:{}", JSON.toJSONString(relationRequest));
SmartUserRelation request = new SmartUserRelation();
BeanUtils.copyProperties(relationRequest, request);
Integer i = userRelationService.updateByPrimaryKeySelective(request);
return R.ok().data(i > 0);
}
@ResponseBody
@RequestMapping(value = "/getAqaraToken", method = {RequestMethod.POST})
public String getAqaraToken(@RequestBody SmartUserRelation userRelation){
log.info("/user/getAqaraToken参数:{}", JSON.toJSONString(userRelation));
if(StringUtils.isEmpty(userRelation.getPhone())){
return null;
}
Map<String, String> map = userRelationService.syncAqaraUserCore(userRelation.getPhone());
return map != null ? map.get("accessToken") : null;
public R getAqaraToken(@RequestBody @Validated(ValidateGroups.Query.class) UserRelationRequest relationRequest){
log.info("/user/getAqaraToken参数:{}", JSON.toJSONString(relationRequest));
Map<String, String> map = userRelationService.syncAqaraUserCore(relationRequest.getPhone());
return R.ok().data(map != null ? map.get("accessToken") : null);
}
@ResponseBody
@RequestMapping(value = "/login", method = {RequestMethod.POST})
public R login(@RequestBody SmartUserRelation userRelation){
log.info("/user/login保存数据参数:{}", JSON.toJSONString(userRelation));
String key = userRelation.getPhone();
public R login(@RequestBody @Validated(ValidateGroups.Insert.class) UserRelationRequest relationRequest){
log.info("/user/login保存数据参数:{}", JSON.toJSONString(relationRequest));
String key = relationRequest.getPhone();
if(redisUtils.hasKey(key)){
log.info("用户手机号 {} 重复请求", key);
return R.ok();
......@@ -82,12 +96,12 @@ public class UserRelationController {
redisUtils.setex(key, key, Constants.REDIS_CACHE_TIME);
//获取用户数据
SmartUserRelation request = new SmartUserRelation();
request.setPhone(userRelation.getPhone());
request.setPhone(relationRequest.getPhone());
SmartUserRelation user = userRelationService.getSingle(request);
//用户数据封装
request.setUserId(userRelation.getUserId());
request.setSource(userRelation.getSource());
request.setName(userRelation.getName());
request.setUserId(relationRequest.getUserId());
request.setSource(relationRequest.getSource());
request.setName(relationRequest.getName());
if(user != null){
request.setId(user.getId());
userRelationService.updateByPrimaryKeySelective(request);
......
package cn.com.glsx.smart.modules.model.request;
import lombok.Data;
/**
* 车家智能用户场景数据表
*/
@Data
public class SceneDataRequest {
/**
* 标识ID
*/
private Long id;
/**
* 场景ID 关联smart_scene中id
*/
private Long sceneId;
/**
* 类型 1触发条件 2执行内容
*/
private Byte type;
/**
* 排序
*/
private Byte sort;
/**
* 参数key
*/
private String paramKey;
/**
* 设备id,取自param_value中select
*/
private String deviceId;
/**
* 参数值 数组对象
*/
private String paramValue;
}
package cn.com.glsx.smart.modules.model.request;
import cn.com.glsx.smart.modules.model.ValidateGroups;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* 车家智能用户场景表
*/
@Data
public class SceneRequest implements Serializable {
/**
* 标识ID
*/
@NotNull(message = "id不能为空", groups = {ValidateGroups.Delete.class, ValidateGroups.Update.class, ValidateGroups.Query.class})
private Long id;
/**
* 用户ID 关联smart_user_relation中id
*/
private Long userId;
/**
* 场景名称
*/
@NotBlank(message = "场景名称不能为空", groups = {ValidateGroups.Insert.class, ValidateGroups.Update.class})
private String sceneName;
/**
* 场景类型key 关联smart_sys_code中dict_key
*/
private String typeKey;
/**
* 场景图标ID 关联smart_sys_file中id
*/
private Long icon;
/**
* 场景背景图ID 关联smart_sys_file中id
*/
private Long backPic;
/**
* 列表页面图ID 关联smart_sys_file中id
*/
private Long pagePic;
/**
* 查看次数
*/
private Long viewTimes;
/**
* 场景描述
*/
private String description;
/**
* 条件规则 1任一条件 2全部条件
*/
private Byte conditionRule;
/**
* 执行周期 1每天 2工作日 3法定节假日
*/
private Byte executeCycle;
/**
* 开关说明:-1 无开关 0开关关 1开关开
*/
private Byte status;
/**
* 备注
*/
private String remark;
/**
* 场景关系数据
*/
private List<SceneDataRequest> dataList;
}
package cn.com.glsx.smart.modules.model.request;
import cn.com.glsx.smart.modules.model.BaseDTO;
import cn.com.glsx.smart.modules.model.ValidateGroups;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* 车家智能场景模板表
*/
@Data
public class SceneTemplateRequest extends BaseDTO implements Serializable {
/**
* 标识ID
*/
@NotNull(message = "id不能为空", groups = {ValidateGroups.Query.class, ValidateGroups.Update.class})
private Long id;
/**
* 场景名称
*/
@NotBlank(message = "场景名称不能为空", groups = {ValidateGroups.Insert.class, ValidateGroups.Update.class})
private String sceneName;
/**
* 场景类型key 关联smart_sys_code中dict_key
*/
@NotBlank(message = "场景类型不能为空", groups = {ValidateGroups.Insert.class, ValidateGroups.Update.class})
private String typeKey;
/**
* 场景图标ID 关联smart_sys_file中id
*/
@NotNull(message = "场景图标不能为空", groups = {ValidateGroups.Insert.class, ValidateGroups.Update.class})
private Long icon;
/**
* 场景背景图ID 关联smart_sys_file中id
*/
@NotNull(message = "场景背景不能为空", groups = {ValidateGroups.Insert.class, ValidateGroups.Update.class})
private Long backPic;
/**
* 列表页面图ID 关联smart_sys_file中id
*/
private Long pagePic;
/**
* 常驻首页 0否 1是
*/
private Byte isTop;
/**
* 查看次数
*/
private Long viewTimes;
/**
* 场景描述
*/
@NotBlank(message = "场景描述不能为空", groups = {ValidateGroups.Insert.class, ValidateGroups.Update.class})
private String description;
/**
* 条件规则 1任一条件 2全部条件
*/
private Byte conditionRule;
/**
* 执行周期 1每天 2工作日 3法定节假日
*/
private Byte executeCycle;
/**
* 状态:0下线 1上线
*/
private Byte status;
/**
* 备注
*/
private String remark;
/**
* 场景关系数据
*/
private List<TemplateParamRequest> templateList;
}
package cn.com.glsx.smart.modules.model.request;
import lombok.Data;
import java.io.Serializable;
/**
* 车家智能场景模板参数表
*/
@Data
public class TemplateParamRequest implements Serializable {
/**
* 标识ID
*/
private Long id;
/**
* 模板ID 关联smart_scene_template中id
*/
private Long templateId;
/**
* 类型 1触发条件 2执行内容
*/
private Byte type;
/**
* 排序
*/
private Byte sort;
/**
* 参数key
*/
private String paramKey;
/**
* 模板值 数组对象
*/
private String paramValue;
}
package cn.com.glsx.smart.modules.model.request;
import cn.com.glsx.smart.modules.model.ValidateGroups;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能用户平台注册信息表
*/
@Data
public class UserRelationRequest implements Serializable {
/**
* 标识ID
*/
private Long id;
/**
* 公司用户ID
*/
private Long userId;
/**
* 用户昵称
*/
private String name;
/**
* 手机号 来自嘀加平台用户
*/
@NotBlank(message = "手机号不能为空", groups = {ValidateGroups.Query.class, ValidateGroups.Insert.class})
private String phone;
/**
* 用户密码
*/
private String password;
/**
* 第三方平台标识 1涂鸦
*/
private Byte channel;
/**
* 用户来源 ANDROID iOS
*/
private String source;
/**
* 第三方平台用户id
*/
private String thirdId;
/**
* 状态 0注销 1正常
*/
private Byte status;
}
package cn.com.glsx.smart.modules.model.response;
import lombok.Data;
/**
* 车家智能用户场景数据表
*/
@Data
public class SceneDataResponse {
/**
* 标识ID
*/
private Long id;
/**
* 场景ID 关联smart_scene中id
*/
private Long sceneId;
/**
* 类型 1触发条件 2执行内容
*/
private Byte type;
/**
* 排序
*/
private Byte sort;
/**
* 参数key
*/
private String paramKey;
/**
* 设备id,取自param_value中select
*/
private String deviceId;
/**
* 参数值 数组对象
*/
private String paramValue;
}
package cn.com.glsx.smart.modules.model.response;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 车家智能用户场景表
*/
@Data
public class SceneResponse implements Serializable {
/**
* 标识ID
*/
private Long id;
/**
* 场景名称
*/
private String sceneName;
/**
* 场景类型key 关联smart_sys_code中dict_key
*/
private String typeKey;
/**
* 场景图标ID 关联smart_sys_file中id
*/
private Long icon;
/**
* 场景图标
*/
private String iconUrl;
/**
* 场景背景图ID 关联smart_sys_file中id
*/
private Long backPic;
/**
* 列表页面图ID 关联smart_sys_file中id
*/
private Long pagePic;
/**
* 列表页面图
*/
private String pagePicUrl;
/**
* 场景背景图
*/
private String backPicUrl;
/**
* 查看次数
*/
private Long viewTimes;
/**
* 场景描述
*/
private String description;
/**
* 条件规则 1任一条件 2全部条件
*/
private Byte conditionRule;
/**
* 执行周期 1每天 2工作日 3法定节假日
*/
private Byte executeCycle;
/**
* 开关说明:-1 无开关 0开关关 1开关开
*/
private Byte status;
/**
* 备注
*/
private String remark;
/**
* 创建时间
*/
private Date createTime;
/**
* 场景关系数据
*/
private List<SceneDataResponse> dataList;
}
package cn.com.glsx.smart.modules.model.response;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 车家智能场景模板表
*/
@Data
public class SceneTemplateResponse implements Serializable {
/**
* 标识ID
*/
private Long id;
/**
* 场景名称
*/
private String sceneName;
/**
* 场景类型key 关联smart_sys_code中dict_key
*/
private String typeKey;
/**
* 场景图标ID 关联smart_sys_file中id
*/
private Long icon;
/**
* 场景图标
*/
private String iconUrl;
/**
* 场景背景图ID 关联smart_sys_file中id
*/
private Long backPic;
/**
* 列表页面图ID 关联smart_sys_file中id
*/
private Long pagePic;
/**
* 常驻首页 0否 1是
*/
private Byte isTop;
/**
* 场景背景图
*/
private String backPicUrl;
/**
* 列表页面图
*/
private String pagePicUrl;
/**
* 查看次数
*/
private Long viewTimes;
/**
* 场景描述
*/
private String description;
/**
* 条件规则 1任一条件 2全部条件
*/
private Byte conditionRule;
/**
* 执行周期 1每天 2工作日 3法定节假日
*/
private Byte executeCycle;
/**
* 状态:0下线 1上线
*/
private Byte status;
/**
* 备注
*/
private String remark;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 场景关系数据
*/
private List<TemplateParamResponse> templateList;
}
package cn.com.glsx.smart.modules.model.response;
import lombok.Data;
import java.io.Serializable;
/**
* 车家智能场景模板参数表
*/
@Data
public class TemplateParamResponse implements Serializable {
/**
* 标识ID
*/
private Long id;
/**
* 模板ID 关联smart_scene_template中id
*/
private Long templateId;
/**
* 类型 1触发条件 2执行内容
*/
private Byte type;
/**
* 排序
*/
private Byte sort;
/**
* 参数key
*/
private String paramKey;
/**
* 模板值 数组对象
*/
private String paramValue;
}
package cn.com.glsx.smart.modules.model.response;
import cn.com.glsx.smart.modules.entity.SmartUserChannel;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-15
*/
/**
* 车家智能用户平台注册信息表
*/
@Data
public class UserRelationResponse implements Serializable {
/**
* 标识ID
*/
private Long id;
/**
* 公司用户ID
*/
private Long userId;
/**
* 用户昵称
*/
private String name;
/**
* 手机号 来自嘀加平台用户
*/
private String phone;
/**
* 用户密码
*/
private String password;
/**
* 第三方平台标识 1涂鸦
*/
private Byte channel;
/**
* 用户来源 ANDROID iOS
*/
private String source;
/**
* 第三方平台用户id
*/
private String thirdId;
/**
* 状态 0注销 1正常
*/
private Byte status;
/**
* 备注
*/
private String remark;
/**
* 用户渠道数据
*/
private List<SmartUserChannel> channelList;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!