Commit ff517497 by 111-PC\111

[+]代码规范

1 parent bfbec986
......@@ -30,14 +30,10 @@ public class BussinessFactory implements ApplicationContextAware {
* @param <T>
* @return
*/
public static <T> T getInstance(Integer bustype,Class<T> requiredType){
public static <T> T getInstance(Integer bustype, Class<T> requiredType) {
String handerType = BussinessType.getHanderType(bustype);
if(handerType==null){
return null;
}else {
T bean = applicationContext.getBean(handerType, requiredType);
return bean;
}
T bean = applicationContext.getBean(handerType, requiredType);
return bean;
}
}
package cn.com.glsx.common.bussinessFactory;
/**
* @author zhouhaibao
* @date 2021/3/8 11:32
......@@ -40,7 +41,7 @@ public enum BussinessType {
return m.getHanderImp();
}
}
return null;
return tuya_hander.getHanderImp();
}
}
......@@ -6,9 +6,12 @@ package cn.com.glsx.common.constant;
*/
public class Constants {
// 涂鸦立牌rediskey
/**
* 涂鸦令牌rediskey
*/
public static final String ACCESSTOKEN_REDISKEY="accessToken_redisKey";
/**
* aqara返回正确标识
*/
public static final int AQARA_RETURN_SUCCESS_CODE=0;
public static final int AQARA_RETURN_FAIL_CODE=500;
}
package cn.com.glsx.common.enums;
/**
* @author zhouhaibao
* @date 2021/3/20 13:48
*/
public enum DeviceErrorEnum {
NOT_LOGIN_ERROR("1000", "数据不存在"),
SECRET_INVALID_ERROR("1001", "非法密钥"),
PERMISSION_DENY_ERROR("1106", "权限受限"),
FUNCTION_NOT_SUPPORT_ERROR("2003", "不支持的指令"),
COMMAND_SUPPORT_ERROR("2008", "不支持的指令或值"),
DEVICE_NOT_EXIST_ERROR("2010", "设备不存在"),
COMMANDS_ISSUE_ERROR("1103", "指令下发失败"),
TYPE_IS_ERROR("1104", "类型错误"),
DEVICE_IS_FFLINE_ERROR("2001", "设备已经离线");
private String value;
private String displayName;
DeviceErrorEnum(String value, String displayName) {
this.value = value;
this.displayName = displayName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public static DeviceErrorEnum searchValue(String key) {
for (DeviceErrorEnum m : DeviceErrorEnum.values()) {
if (m.getValue().equals(key)) {
return m;
}
}
return null;
}
}
package cn.com.glsx.common.enums;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public enum ResultEnum {
SUCCESS(200, "成功"),
ERROR(500, "系统异常"),
PARAM_ERROR(1001, "参数错误"),
ID_NOT_FOUND(1002, "ID不存在");
private final Integer code;
private final String message;
ResultEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}
......@@ -27,12 +27,6 @@ public class AdminExceptionHandler extends GlobalExceptionHandler {
return R.error(e.getCode(), e.getMessage());
}
/**
* Mybatis BindingException
*
* @param e
* @return
*/
@ExceptionHandler(BindingException.class)
public R handleBindingException(BindingException e) {
saveException(e, ExceptionLevel.fatal);
......
package cn.com.glsx.common.exception;
/**
* <p>Description: 业务码
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
* 智能车家服务编码
* @author zhouhaibao
*/
public enum ResultEnum {
NOT_LOGIN_ERROR(1000, "数据不存在", 1101),
......
package cn.com.glsx.common.exception;
import com.glsx.plat.exception.BusinessException;
import lombok.Data;
/**
* <p>Description: 车家智能异常类
* <p>Project: chejia-smart
* Description: 智能云平台异常类
*
* @author wbh
* @Date 2021-03-16
* @author zhouhaibao
*/
@Data
public class SmaPlatBusinessException extends RuntimeException{
......
......@@ -13,11 +13,8 @@ import org.springframework.validation.annotation.Validated;
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 javax.validation.constraints.NotBlank;
/**
* @author zhouhaibao
* @date 2021/4/20 16:25
......
......@@ -4,8 +4,6 @@ import cn.com.glsx.modules.model.request.AccessTokRequest;
import cn.com.glsx.modules.model.request.AuthRequest;
import cn.com.glsx.modules.service.OauthService;
import com.glsx.plat.core.web.R;
import com.lumi.opencloud.model.v1.request.AccessTokenRequest;
import com.lumi.opencloud.model.v1.request.AuthorizeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -5,7 +5,6 @@ import cn.com.glsx.modules.model.request.UserRequest;
import cn.com.glsx.modules.model.response.tuya.UserInfoResponse;
import cn.com.glsx.modules.service.UserService;
import com.glsx.plat.core.web.R;
import com.lumi.opencloud.model.v1.request.AuthorizeRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......
package cn.com.glsx.modules.service;
import cn.com.glsx.common.enums.ResultEnum;
import cn.com.glsx.common.exception.SmaPlatBusinessException;
import cn.com.glsx.config.AqaraConfig;
import cn.com.glsx.modules.model.request.OrderRequest;
......@@ -15,7 +14,6 @@ import cn.com.glsx.modules.model.response.aqara.SubscriberResponse;
import cn.com.glsx.modules.service.abs.BaseDeviceService;
import cn.com.glsx.modules.utils.ResultUtils;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.core.web.R;
import com.lumi.opencloud.common.AiotConfig;
import com.lumi.opencloud.common.ResponseMsg;
import com.lumi.opencloud.manager.v1.DeviceManager;
......@@ -34,7 +32,6 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author zhouhaibao
......
package cn.com.glsx.modules.service;
import cn.com.glsx.config.AqaraConfig;
import cn.com.glsx.modules.model.request.AqaraBaseRequest;
import cn.com.glsx.modules.model.response.aqara.HomeResponse;
import cn.com.glsx.modules.utils.ResultUtils;
import com.glsx.plat.core.web.R;
import com.lumi.opencloud.common.AiotConfig;
import com.lumi.opencloud.common.ResponseMsg;
import com.lumi.opencloud.manager.v1.PositionManager;
......
......@@ -6,7 +6,6 @@ import cn.com.glsx.modules.model.request.AuthRequest;
import cn.com.glsx.modules.model.response.aqara.AccessTokenResponse;
import cn.com.glsx.modules.model.response.aqara.AuthorizeResponse;
import cn.com.glsx.modules.utils.ResultUtils;
import com.glsx.plat.core.web.R;
import com.lumi.opencloud.common.ResponseMsg;
import com.lumi.opencloud.manager.v1.OauthManager;
import com.lumi.opencloud.model.v1.request.AccessTokenRequest;
......
......@@ -2,14 +2,12 @@ package cn.com.glsx.modules.service;
import cn.com.glsx.config.AqaraConfig;
import cn.com.glsx.modules.utils.ResultUtils;
import com.glsx.plat.core.web.R;
import com.lumi.opencloud.common.AiotConfig;
import com.lumi.opencloud.common.ResponseMsg;
import com.lumi.opencloud.manager.v1.InfraredManager;
import com.lumi.opencloud.model.ir.request.IrKeyClickRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
......
......@@ -2,7 +2,6 @@ package cn.com.glsx.modules.service.abs;
import cn.com.glsx.modules.model.request.OrderRequest;
import cn.com.glsx.modules.model.request.RemoteRequest;
import com.glsx.plat.core.web.R;
/**
* @author zhouhaibao
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!