Commit fcf7d0ea by 朱瑞泽

update doc

parent e86bc210
package com.gic.demo.project.api.utils;
/**
* demo api 常量
*
* @author zhurz
*/
public class DemoStoreApiConstant {
/**
* 服务异常
*/
public static final String ERROR = "9999";
}
......@@ -3,6 +3,8 @@ package com.gic.demo.project.service.inner.service;
import com.gic.demo.project.service.entity.TabGicDemoStore;
/**
* 门店内部服务
*
* @author zhurz
*/
public interface DemoStoreInnerService {
......
......@@ -9,6 +9,8 @@ import org.springframework.stereotype.Service;
/**
* 门店内部服务
*
* @author zhurz
*/
@Service
......
......@@ -4,6 +4,7 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.demo.project.api.dto.DemoStoreDTO;
import com.gic.demo.project.api.service.DemoStoreApiService;
import com.gic.demo.project.api.utils.DemoStoreApiConstant;
import com.gic.demo.project.service.entity.TabGicDemoStore;
import com.gic.demo.project.service.inner.service.DemoStoreInnerService;
import org.apache.commons.lang3.RandomUtils;
......@@ -28,7 +29,7 @@ public class DemoStoreApiServiceImpl implements DemoStoreApiService {
@Override
public ServiceResponse<DemoStoreDTO> findDemoStoreById(String storeId) {
if (RandomUtils.nextInt(0, 10) > 5) {
return ServiceResponse.failure("0001", "服务异常");
return ServiceResponse.failure(DemoStoreApiConstant.ERROR, "服务异常");
}
TabGicDemoStore store = localService.findDemoStoreById(storeId);
return ServiceResponse.success(EntityUtil.changeEntityByOrika(DemoStoreDTO.class, store));
......
package com.gic.demo.project.web.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.demo.project.api.dto.DemoStoreDTO;
import com.gic.demo.project.api.service.DemoStoreApiService;
import com.gic.demo.project.web.exception.GicDemoErrCode;
import com.gic.demo.project.web.vo.DemoStoreVO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -39,7 +41,9 @@ public class DemoProjectController {
}
ServiceResponse<DemoStoreDTO> response = demoStoreApiService.findDemoStoreById(storeId);
if (response.isSuccess()) {
return RestResponse.success(response.getResult());
// 转换为VO
DemoStoreVO vo = EntityUtil.changeEntityByOrika(DemoStoreVO.class, response.getResult());
return RestResponse.success(vo);
}
logger.warn("获取门店信息异常 -> {} -> {}", storeId, response.getMessage());
return GicDemoErrCode.ERR_1.buildFailureResponse();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment