Commit 4371e7ab by 陶光胜

缩略信息返回

parent 456e202a
......@@ -15,6 +15,7 @@ import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.plug.web.strategy.ScreenBackStrategy;
import com.gic.plug.web.strategy.impl.*;
import com.gic.plug.web.strategy.init.StrategyInit;
import com.gic.search.business.api.constant.enums.OperateEnum;
import com.gic.store.constant.StoreESFieldsEnum;
import com.gic.widget.screening.api.dto.*;
......@@ -46,48 +47,8 @@ public class ScreeningController {
@Autowired
private EsScreeningTemplateService esScreeningTemplateService;
@Autowired
private StoreAreaBackImpl storeAreaBack;
@Autowired
private StoreBackImpl storeBack;
@Autowired
private StoreBrandBackImpl storeBrandBack;
@Autowired
private StoreCustomBackImpl storeCustomBack;
@Autowired
private StoreGroupBackImpl storeGroupBack;
@Autowired
private StoreRegionBackImpl storeRegionBack;
@Autowired
private StoreSelectBackImpl storeSelectBack;
@Autowired
private StoreTagBackImpl storeTagBack;
private Map<String, ScreenBackStrategy> strategyMap = new HashMap<>();
private StrategyInit strategyInit;
@PostConstruct
public void init(){
strategyMap.put(StoreESFieldsEnum.AREAIDS.getField(), storeAreaBack);
strategyMap.put(StoreESFieldsEnum.STOREID.getField(), storeBack);
strategyMap.put(StoreESFieldsEnum.STOREBRANDIDLIST.getField(), storeBrandBack);
strategyMap.put(StoreESFieldsEnum.STOREGROUPIDLIST.getField(), storeGroupBack);
strategyMap.put(StoreESFieldsEnum.REGIONID.getField(), storeRegionBack);
strategyMap.put(StoreESFieldsEnum.STATUS.getField(), storeSelectBack);
strategyMap.put(StoreESFieldsEnum.COMPLETESTATUS.getField(), storeSelectBack);
strategyMap.put(StoreESFieldsEnum.CREATETYPE.getField(), storeSelectBack);
strategyMap.put(StoreESFieldsEnum.STORETYPE.getField(), storeSelectBack);
strategyMap.put(StoreESFieldsEnum.ERPSTATUS.getField(), storeSelectBack);
strategyMap.put(StoreESFieldsEnum.STORETAG.getField(), storeTagBack);
strategyMap.put(StoreESFieldsEnum.C1.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C2.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C3.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C4.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C5.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C6.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C7.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C8.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C9.getField(), storeCustomBack);
strategyMap.put(StoreESFieldsEnum.C10.getField(), storeCustomBack);
System.out.println("对象初始化完成");
}
/**
* @return
* @throws
......@@ -153,7 +114,7 @@ public class ScreeningController {
@RequestMapping("screen-back")
@ResponseBody
public String screenBack(String param) throws ClassNotFoundException {
public Object screenBack(String param) throws ClassNotFoundException {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
JSONArray array = JSON.parseArray(param);
StringBuilder backMessage = new StringBuilder();
......@@ -175,7 +136,7 @@ public class ScreeningController {
String key = json.getJSONObject("data").getString("key");
String value = json.getJSONObject("data").getString("value");
String compute = json.getJSONObject("data").getString("compute");
String message = strategyMap.get(key).screenBack(compute, value, key, enterpriseId);
String message = this.strategyInit.getStrategyMap().get(key).screenBack(compute, value, key, enterpriseId);
stringBuilder.append(message);
if(j < list.size()-1){
stringBuilder.append("并且");
......@@ -184,6 +145,6 @@ public class ScreeningController {
stringBuilder.append(")");
backMessage.append(stringBuilder);
}
return backMessage.toString();
return RestResponse.success(backMessage.toString());
}
}
package com.gic.plug.web.strategy.init;
import com.gic.plug.web.strategy.ScreenBackStrategy;
import com.gic.plug.web.strategy.impl.*;
import com.gic.store.constant.StoreESFieldsEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
@Component
public class StrategyInit {
@Autowired
private StoreAreaBackImpl storeAreaBack;
@Autowired
private StoreBackImpl storeBack;
@Autowired
private StoreBrandBackImpl storeBrandBack;
@Autowired
private StoreCustomBackImpl storeCustomBack;
@Autowired
private StoreGroupBackImpl storeGroupBack;
@Autowired
private StoreRegionBackImpl storeRegionBack;
@Autowired
private StoreSelectBackImpl storeSelectBack;
@Autowired
private StoreTagBackImpl storeTagBack;
private Map<String, ScreenBackStrategy> strategyMap = new HashMap<>();
@PostConstruct
public void init(){
strategyMap.put(StoreESFieldsEnum.AREAIDS.getField(), this.getStoreAreaBack());
strategyMap.put(StoreESFieldsEnum.STOREID.getField(), this.getStoreBack());
strategyMap.put(StoreESFieldsEnum.STOREBRANDIDLIST.getField(), this.getStoreBrandBack());
strategyMap.put(StoreESFieldsEnum.STOREGROUPIDLIST.getField(), this.getStoreGroupBack());
strategyMap.put(StoreESFieldsEnum.REGIONID.getField(), this.getStoreRegionBack());
strategyMap.put(StoreESFieldsEnum.STATUS.getField(), this.getStoreSelectBack());
strategyMap.put(StoreESFieldsEnum.COMPLETESTATUS.getField(), this.getStoreSelectBack());
strategyMap.put(StoreESFieldsEnum.CREATETYPE.getField(), this.getStoreSelectBack());
strategyMap.put(StoreESFieldsEnum.STORETYPE.getField(), this.getStoreSelectBack());
strategyMap.put(StoreESFieldsEnum.ERPSTATUS.getField(), this.getStoreSelectBack());
strategyMap.put(StoreESFieldsEnum.STORETAG.getField(), this.getStoreTagBack());
strategyMap.put(StoreESFieldsEnum.C1.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C2.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C3.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C4.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C5.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C6.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C7.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C8.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C9.getField(), this.getStoreCustomBack());
strategyMap.put(StoreESFieldsEnum.C10.getField(), this.getStoreCustomBack());
System.out.println("对象初始化完成");
}
public StoreAreaBackImpl getStoreAreaBack() {
return storeAreaBack;
}
public StoreBackImpl getStoreBack() {
return storeBack;
}
public StoreBrandBackImpl getStoreBrandBack() {
return storeBrandBack;
}
public StoreCustomBackImpl getStoreCustomBack() {
return storeCustomBack;
}
public StoreGroupBackImpl getStoreGroupBack() {
return storeGroupBack;
}
public StoreRegionBackImpl getStoreRegionBack() {
return storeRegionBack;
}
public StoreSelectBackImpl getStoreSelectBack() {
return storeSelectBack;
}
public StoreTagBackImpl getStoreTagBack() {
return storeTagBack;
}
public Map<String, ScreenBackStrategy> getStrategyMap() {
return strategyMap;
}
}
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