Commit 9e5e1fba by tyfanchz

Merge remote-tracking branch 'origin/dev' into dev

2 parents 970793e6 bf119d7f
......@@ -56,8 +56,11 @@ public class RemoteProductController {
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public JSONArray getList(@RequestBody SmartUserRelation request) {
log.info("用户参数:{}", request);
request.setUserId(91712228L);
// request.setUserId(91712228L);
SmartUserRelation user = userRelationService.getSingle(request);
if(user == null){
return null;
}
return this.getRemoteDevice(user.getThirdId());
}
......@@ -72,6 +75,9 @@ public class RemoteProductController {
JSONObject json = JSON.parseObject(result);
if (json.getInteger("code").equals(200)) {
JSONArray array = json.getJSONArray("message");
if(array == null || array.size() <= 0){
return array;
}
return this.remoteDataHandle(array);
}
}
......@@ -102,7 +108,7 @@ public class RemoteProductController {
JSONObject val = new JSONObject();
String productId = object.getString("product_id");
val.put("productId", productId);
val.put("uuid", object.getString("uuid"));
val.put("uuid", object.getString("id"));
val.put("productName", object.getString("product_name"));
SmartProduct product = this.compareProductId(productList, productId);
if(product != null){
......
......@@ -68,6 +68,7 @@ public class UserRelationController {
request.setPhone(userRelation.getPhone());
request.setChannel(userRelation.getChannel()); //涂鸦
SmartUserRelation user = userRelationService.getSingle(request);
request.setUserId(userRelation.getUserId());
if(user != null){
String tuYaId = user.getThirdId();
if(StringUtils.isEmpty(tuYaId)){
......@@ -75,9 +76,9 @@ public class UserRelationController {
tuYaId = this.syncUser(user.getPhone(), user.getPassword());
request.setThirdId(tuYaId);
request.setId(user.getId());
userRelationService.updateByPrimaryKeySelective(request);
}
}
userRelationService.updateByPrimaryKeySelective(request);
return R.ok().data(tuYaId);
}
String password = MD5.create().digestHex(Constants.DEFAULT_PASSWORD);
......
......@@ -9,11 +9,12 @@ package com.glsx.smart.dao.entity;
*/
import lombok.Data;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
/**
* 车家智能用户场景数据表
......@@ -49,6 +50,11 @@ public class SmartSceneData {
private String paramKey;
/**
* 设备id,取自param_value中select
*/
private String deviceId;
/**
* 参数值 数组对象
*/
private String paramValue;
......
......@@ -57,6 +57,11 @@ public class SmartUserRelation implements Serializable {
private Byte channel;
/**
* 用户来源 ANDROID iOS
*/
private String source;
/**
* 第三方平台用户id
*/
private String thirdId;
......
......@@ -11,10 +11,11 @@
<result column="sort" jdbcType="TINYINT" property="sort"/>
<result column="param_key" jdbcType="VARCHAR" property="paramKey"/>
<result column="param_value" jdbcType="VARCHAR" property="paramValue"/>
<result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, scene_id, `type`, sort, param_key, param_value
id, scene_id, `type`, sort, param_key, device_id, param_value
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
......@@ -101,12 +102,12 @@
useGeneratedKeys="true">
<!--@mbg.generated-->
insert into smart_scene_data
(scene_id, `type`, sort, param_key, param_value)
(scene_id, `type`, sort, param_key, device_id, param_value)
values
<foreach collection="list" item="item" separator=",">
(#{item.sceneId,jdbcType=BIGINT}, #{item.type,jdbcType=TINYINT},
#{item.sort,jdbcType=TINYINT},
#{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR})
#{item.sort,jdbcType=TINYINT}, #{item.paramKey,jdbcType=VARCHAR},
#{item.deviceId,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR})
</foreach>
</insert>
<delete id="deleteBySceneId" parameterType="java.lang.Long">
......
......@@ -12,13 +12,14 @@
<result column="password" jdbcType="VARCHAR" property="password"/>
<result column="channel" jdbcType="TINYINT" property="channel"/>
<result column="third_id" jdbcType="VARCHAR" property="thirdId"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, `name`, user_id, phone, `password`, channel, third_id, `status`, remark, create_time
id, `name`, user_id, phone, `password`, channel, third_id, `source`, `status`, remark, create_time
</sql>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!