Commit d8e04b3f by zhiwj

Merge remote-tracking branch 'origin/developer' into developer

parents 81faa4b6 39b5e318
......@@ -109,7 +109,7 @@ public class StoreDictApiServiceImpl implements StoreDictApiService {
storeDictDTO.setKey(tabStoreField.getStoreFieldName());
storeDictDTO.setValue(tabStoreField.getStoreFieldId()+"");
for(String s : listSelect){
if(tabStoreField.getStoreFieldId() == Integer.valueOf(s)){
if(tabStoreField.getStoreFieldId().intValue() == Integer.valueOf(s).intValue()){
storeDictDTO.setChecked(1);
}
}
......
......@@ -6,11 +6,18 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.redis.data.util.RedisUtil;
import com.gic.store.constant.CreateTypeEnum;
import com.gic.store.dto.*;
import com.gic.store.service.StoreApiService;
import com.gic.store.service.StoreDictApiService;
import com.gic.store.web.qo.PageQO;
import com.gic.store.web.qo.store.StoreQO;
import com.gic.store.web.vo.StoreDictVO;
import com.gic.store.web.vo.StoreListSourceVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -20,6 +27,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -35,6 +43,8 @@ public class StoreController {
@Autowired
private StoreApiService storeApiService;
@Autowired
private StoreDictApiService storeDictApiService;
@RequestMapping("/save-store")
public RestResponse saveOrUpdate(StoreQO storeQO) {
......@@ -83,4 +93,98 @@ public class StoreController {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
}
@RequestMapping("store-list-source")
@ResponseBody
public RestResponse storeListSource(){
Integer enterpriseId = 1111;
List<StoreListSourceVO> list = this.getStoreAllListSource(enterpriseId);
Object obj = RedisUtil.getCache("enterprise:storeListSources:"+enterpriseId);
if(obj == null){
return RestResponse.success(list);
}
String[] sourcesArr = obj.toString().split(",");
for(StoreListSourceVO storeListSourceVO : list){
for(String s : sourcesArr){
if(s.equals(storeListSourceVO.getValue())){
storeListSourceVO.setChecked(1);
}
}
}
return RestResponse.success(list);
}
@RequestMapping("store-list-source-set")
@ResponseBody
public RestResponse storeListSourceSet(String sources){
if(StringUtils.isBlank(sources)){
return EnterpriseRestResponse.failure(ErrorCode.ERR_2);
}
Integer enterpriseId = 1111;
RedisUtil.setCache("enterprise:storeListSources:"+enterpriseId, sources);
System.out.println(JSON.toJSONString(RedisUtil.getCache("enterprise:storeListSources:"+enterpriseId)));
return RestResponse.success();
}
private List<StoreListSourceVO> getStoreAllListSource(Integer enterpriseId){
List<StoreListSourceVO> list = new ArrayList<>();
ServiceResponse<List<StoreDictDTO>> serviceResponse = this.storeDictApiService.listStoreField(enterpriseId);
if(serviceResponse.isSuccess()){
List<StoreDictDTO> storeDictDTOList = serviceResponse.getResult();
if(CollectionUtils.isNotEmpty(storeDictDTOList)){
for(StoreDictDTO storeDictDTO : storeDictDTOList){
if(storeDictDTO.getChecked() == 1){
StoreListSourceVO vo = new StoreListSourceVO();
vo.setChecked(0);
vo.setIsCustom(1);
vo.setKey(storeDictDTO.getKey());
vo.setValue(storeDictDTO.getValue());
list.add(vo);
}
}
}
}
StoreListSourceVO vo1 = new StoreListSourceVO();
vo1.setValue("storeName");
vo1.setKey("门店名称");
list.add(vo1);
StoreListSourceVO vo2 = new StoreListSourceVO();
vo2.setValue("storeGroupName");
vo2.setKey("门店分组名称");
list.add(vo2);
StoreListSourceVO vo3 = new StoreListSourceVO();
vo3.setValue("storeCode");
vo3.setKey("关联门店主键");
list.add(vo3);
StoreListSourceVO vo4 = new StoreListSourceVO();
vo4.setValue("provinces");
vo4.setKey("地区");
list.add(vo4);
StoreListSourceVO vo5 = new StoreListSourceVO();
vo5.setValue("brandNames");
vo5.setKey("门店品牌");
list.add(vo5);
StoreListSourceVO vo6 = new StoreListSourceVO();
vo6.setValue("completeStatus");
vo6.setKey("资料完善状态");
list.add(vo6);
StoreListSourceVO vo7 = new StoreListSourceVO();
vo7.setValue("status");
vo7.setKey("门店启用状态");
list.add(vo7);
StoreListSourceVO vo8 = new StoreListSourceVO();
vo8.setValue("regionName");
vo8.setKey("门店所属域");
list.add(vo8);
StoreListSourceVO vo9 = new StoreListSourceVO();
vo9.setValue("erpStatus");
vo9.setKey("门店状态");
list.add(vo9);
StoreListSourceVO vo10 = new StoreListSourceVO();
vo10.setValue("storeType");
vo10.setKey("门店类型");
list.add(vo10);
return list;
}
}
\ No newline at end of file
package com.gic.store.web.vo;
import java.io.Serializable;
/**
* tab_store_dict
*/
public class StoreListSourceVO implements Serializable {
private String value;
private String key;
private Integer checked=0;
private Integer isCustom = 0;//是否是自定义字段
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getChecked() {
return checked;
}
public void setChecked(Integer checked) {
this.checked = checked;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public Integer getIsCustom() {
return isCustom;
}
public void setIsCustom(Integer isCustom) {
this.isCustom = isCustom;
}
}
\ No newline at end of file
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