Commit db9bae72 by tyfanchz

1、删除无用代码

2、增加feign调用异常捕捉
3、车家智能后台接口开发
1 parent 99d857ff
......@@ -51,6 +51,10 @@ public class ProductController {
*/
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartProduct getById(Long id) {
log.info("$$$$ /product/getById param: {}", id);
if (id == null) {
throw new BusinessException(ResultEnum.PARAM_ERROR);
}
return productService.getById(id);
}
......@@ -85,7 +89,7 @@ public class ProductController {
* @param shopProductId 商品 id
*/
@RequestMapping(value = "/checkShopProductId", method = {RequestMethod.GET, RequestMethod.POST})
public boolean checkShopProductId(String shopProductId) {
public Boolean checkShopProductId(String shopProductId) {
log.info("$$$$ /product/checkShopProductId param: {}", shopProductId);
if (StringUtils.isBlank(shopProductId)) {
throw new BusinessException(ResultEnum.PARAM_ERROR);
......
......@@ -4,6 +4,8 @@ import java.util.List;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProductType;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartProductTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -39,8 +41,17 @@ public class ProductTypeController {
return productTypeService.getList(req);
}
/**
* 根据 id 获取产品类型。
*
* @param id 产品类型 id
* @return 结果
*/
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartProductType getById(Long id) {
if (id == null) {
throw new BusinessException(ResultEnum.PARAM_ERROR);
}
return productTypeService.getById(id);
}
......
......@@ -3,7 +3,6 @@ package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartProduct;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>Description:
......@@ -18,15 +17,4 @@ public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<Smar
List<SmartProduct> getList(SmartProduct req);
int countByProductName(String productName);
int insertOrUpdate(SmartProduct record);
int insertOrUpdateSelective(SmartProduct record);
int updateBatch(List<SmartProduct> list);
int updateBatchSelective(List<SmartProduct> list);
int batchInsert(@Param("list") List<SmartProduct> list);
}
......@@ -3,7 +3,6 @@ package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartProductType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>Description:
......@@ -16,15 +15,4 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface SmartProductTypeMapper extends tk.mybatis.mapper.common.Mapper<SmartProductType> {
List<SmartProductType> getList(SmartProductType req);
int insertOrUpdate(SmartProductType record);
int insertOrUpdateSelective(SmartProductType record);
int updateBatch(List<SmartProductType> list);
int updateBatchSelective(List<SmartProductType> list);
int batchInsert(@Param("list") List<SmartProductType> list);
}
......@@ -5,7 +5,6 @@ import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* <p>Description:
......@@ -13,9 +12,11 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
*
* @author wbh
* @date 2021-03-16
* @deprecated 已废弃,需要抛出异常让上游服务感知
*/
@Slf4j
@RestControllerAdvice
//@RestControllerAdvice
@Deprecated
public class GlobalExceptionHandler {
@ExceptionHandler({BusinessException.class})
public String handleBusinessException(BusinessException e) {
......
......@@ -22,7 +22,7 @@ public interface SmartProductService {
List<SmartDeviceOrder> getCommandSetById(String productId);
boolean checkShopProductId(String shopProductId);
Boolean checkShopProductId(String shopProductId);
void putOnOff(Long id);
}
......@@ -109,7 +109,7 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
* @return 商品 id 是否合法
*/
@Override
public boolean checkShopProductId(String shopProductId) {
public Boolean checkShopProductId(String shopProductId) {
return RandomUtil.randomBoolean();
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!