Commit f76e213f by 陶光胜

查询门店选择器配置

parent 0e441cc1
......@@ -22,6 +22,7 @@
<!-- api依赖,正式版会在 gic-pom-base 里生成 -->
<gic-store-api>4.0-SNAPSHOT</gic-store-api>
<gic-thirdparty-sdk>4.0-SNAPSHOT</gic-thirdparty-sdk>
<gic-redis-data>4.0-SNAPSHOT</gic-redis-data>
</properties>
<dependencies>
......@@ -117,6 +118,11 @@
<artifactId>gic-enterprise-base-api</artifactId>
<version>${gic-enterprise-base-api}</version>
</dependency>
<dependency>
<groupId>com.gic </groupId>
<artifactId>gic-redis-data </artifactId>
<version>${gic-redis-data} </version>
</dependency>
</dependencies>
<build>
......
......@@ -3,6 +3,9 @@ package com.gic.plug.web;
import com.gic.dubbo.util.DubboContextUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ImportResource;
......@@ -11,12 +14,20 @@ import org.springframework.context.annotation.ImportResource;
*
* @author zhurz
*/
@SpringBootApplication
@SpringBootApplication(
scanBasePackages = "com.gic",
exclude = {
RedisAutoConfiguration.class,
RedisRepositoriesAutoConfiguration.class,
QuartzAutoConfiguration.class
}
)
@ImportResource(value = {
"classpath*:applicationContext-init.xml",
"classpath*:dubbo-setting.xml",
"classpath*:dubbo-gic-webapp-plug.xml",
"classpath*:spring-interceptor.xml"
"classpath*:spring-interceptor.xml",
"classpath*:redis-init.xml"
})
public class Main {
......
......@@ -4,8 +4,10 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.plug.web.vo.StoreFieldRegionVO;
import com.gic.plug.web.vo.StoreFieldSelectVO;
import com.gic.redis.data.util.RedisUtil;
import com.gic.store.constant.StoreFieldDateEnum;
import com.gic.store.constant.StoreFieldTextEnum;
import com.gic.store.constant.StoreFieldTypeEnum;
......@@ -72,12 +74,13 @@ public class StoreFieldController {
@RequestMapping("/list-store-field-by-region-id")
public RestResponse listStoreFieldByRegionId(Integer regionId) {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
if (regionId == null) {
RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "域ID不能为空");
}
ServiceResponse<List<StoreFieldDTO>> result = storeFieldApiService.listStoreFieldByRegionId(regionId);
if (result.isSuccess()) {
return RestResponse.success(transferDtoToVo(result.getResult()));
return RestResponse.success(transferDtoToVo(result.getResult(), enterpriseId));
} else {
return RestResponse.failure(result.getCode(), result.getMessage());
}
......@@ -85,9 +88,11 @@ public class StoreFieldController {
@RequestMapping("/list-store-field")
public RestResponse listStoreField(String search) {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<List<StoreFieldDTO>> result = storeFieldApiService.listStoreField(StoreGroupConstant.TEST_ENTERPRISE_ID, search);
if (result.isSuccess()) {
return RestResponse.success(transferDtoToVo(result.getResult()));
return RestResponse.success(transferDtoToVo(result.getResult(), enterpriseId));
} else {
return RestResponse.failure(result.getCode(), result.getMessage());
}
......@@ -103,12 +108,19 @@ public class StoreFieldController {
}
}
private List<StoreFieldRegionVO> transferDtoToVo(List<StoreFieldDTO> dtoList) {
private List<StoreFieldRegionVO> transferDtoToVo(List<StoreFieldDTO> dtoList, Integer enterpriseId) {
String key = "enterprise:store:storeField:"+enterpriseId+":";
List<StoreFieldRegionVO> voList = new ArrayList<>(dtoList.size());
for (StoreFieldDTO dto : dtoList) {
//不需要文本类型字段
if (dto.getStoreFieldType().intValue() != StoreFieldTypeEnum.TEXT.getCode()) {
voList.add(EntityUtil.changeEntityNew(StoreFieldRegionVO.class, dto));
Object obj = RedisUtil.getCache(key+dto.getStoreFieldId());
if(obj != null){
StoreFieldRegionVO vo = EntityUtil.changeEntityNew(StoreFieldRegionVO.class, dto);
vo.setStoreFieldKey(obj.toString());
voList.add(vo);
}
}
}
return voList;
......
......@@ -22,6 +22,8 @@ public class StoreFieldRegionVO implements Serializable{
*/
private Integer storeFieldType;
private String storeFieldKey;
/**
* 排序
*/
......@@ -66,4 +68,12 @@ public class StoreFieldRegionVO implements Serializable{
public void setSort(Double sort) {
this.sort = sort;
}
public String getStoreFieldKey() {
return storeFieldKey;
}
public void setStoreFieldKey(String storeFieldKey) {
this.storeFieldKey = storeFieldKey;
}
}
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