记得上下班打卡 | git大法好,push需谨慎

Commit bf421bac authored by 张国柄's avatar 张国柄

~API:店铺管理:店铺设置;

parent ad63c01b
...@@ -23,6 +23,11 @@ public class GoblinRedisConst { ...@@ -23,6 +23,11 @@ public class GoblinRedisConst {
* {goblin:bsc:self_g_c, JsonUtils.toJson(List<com.liquidnet.service.goblin.dto.vo.GoblinSelfGoodsCategoryVo>)} * {goblin:bsc:self_g_c, JsonUtils.toJson(List<com.liquidnet.service.goblin.dto.vo.GoblinSelfGoodsCategoryVo>)}
*/ */
public static final String BASIC_SELF_GOODS_CATEGORY = PREFIX.concat("bsc:self_g_c"); public static final String BASIC_SELF_GOODS_CATEGORY = PREFIX.concat("bsc:self_g_c");
/**
* 平台服务支持信息
* {goblin:bsc:sev_sup, JsonUtils.toJson(List<com.liquidnet.service.goblin.dto.vo.GoblinServiceSupportVo>)}
*/
public static final String BASIC_SERVICE_SUPPORT = PREFIX.concat("bsc:sev_sup");
/** /**
* 店铺信息 * 店铺信息
* {goblin:bsc:store:${store_id}, com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo} * {goblin:bsc:store:${store_id}, com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo}
......
package com.liquidnet.service.goblin.service.manage; package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import java.util.Map;
public interface IGoblinStoreMgtService { public interface IGoblinStoreMgtService {
/** /**
* 店铺管理:店铺信息:更新 * 店铺管理:店铺信息:更新
...@@ -11,4 +12,14 @@ public interface IGoblinStoreMgtService { ...@@ -11,4 +12,14 @@ public interface IGoblinStoreMgtService {
* @return boolean * @return boolean
*/ */
boolean updateStoreMgtInfo(GoblinStoreInfoVo storeInfoVo); boolean updateStoreMgtInfo(GoblinStoreInfoVo storeInfoVo);
/**
* 店铺管理:店铺设置:编辑
*
* @param uid UID
* @param storeId 店铺ID
* @param confMap 配置集合<key, value>
* @return boolean
*/
boolean updateStoreMgtConfig(String uid, String storeId, Map<String, String> confMap);
} }
...@@ -2,7 +2,7 @@ package com.liquidnet.service.goblin.controller.manage; ...@@ -2,7 +2,7 @@ package com.liquidnet.service.goblin.controller.manage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.constant.LnsEnum; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.CurrentUtil; import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ErrorMapping; import com.liquidnet.service.base.ErrorMapping;
...@@ -18,7 +18,6 @@ import com.liquidnet.service.goblin.dto.vo.GoblinStoreCertInfoVo; ...@@ -18,7 +18,6 @@ import com.liquidnet.service.goblin.dto.vo.GoblinStoreCertInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreConfigVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreConfigVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreNoticeVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreNoticeVo;
import com.liquidnet.service.goblin.enums.GoblinStoreConf;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtService; import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil; import com.liquidnet.service.goblin.util.ObjectUtil;
...@@ -36,9 +35,7 @@ import javax.validation.Valid; ...@@ -36,9 +35,7 @@ import javax.validation.Valid;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ApiSupport(order = 149002) @ApiSupport(order = 149002)
...@@ -74,7 +71,11 @@ public class GoblinStoreMgtController { ...@@ -74,7 +71,11 @@ public class GoblinStoreMgtController {
}) })
@GetMapping(value = {"info"}) @GetMapping(value = {"info"})
public ResponseDto<GoblinStoreMgtInfoVo> info(@NotBlank(message = "店铺ID不能为空") @RequestParam String storeId) { public ResponseDto<GoblinStoreMgtInfoVo> info(@NotBlank(message = "店铺ID不能为空") @RequestParam String storeId) {
// TODO: 2022/1/12 zhanggb 逻辑校验 String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
log.warn("店铺管理:店铺信息:无权查看该店铺[UID={},storeId={}]", currentUid, storeId);
return ResponseDto.failure(ErrorMapping.get("149002"));
}
return ResponseDto.success(GoblinStoreMgtInfoVo.getNew().copy(goblinRedisUtils.getStoreInfoVo(storeId))); return ResponseDto.success(GoblinStoreMgtInfoVo.getNew().copy(goblinRedisUtils.getStoreInfoVo(storeId)));
} }
...@@ -94,7 +95,9 @@ public class GoblinStoreMgtController { ...@@ -94,7 +95,9 @@ public class GoblinStoreMgtController {
@NotBlank(message = "店铺介绍不能为空") @Size(max = 500) @RequestParam String introduce, @NotBlank(message = "店铺介绍不能为空") @Size(max = 500) @RequestParam String introduce,
@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) { @NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
// TODO: 2022/1/12 zhanggb 逻辑校验 if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002"));
}
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId); GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId);
storeInfoVo.setStoreName(storeName); storeInfoVo.setStoreName(storeName);
storeInfoVo.setLogoPic(logoPic); storeInfoVo.setLogoPic(logoPic);
...@@ -113,7 +116,11 @@ public class GoblinStoreMgtController { ...@@ -113,7 +116,11 @@ public class GoblinStoreMgtController {
}) })
@GetMapping(value = {"info/cer"}) @GetMapping(value = {"info/cer"})
public ResponseDto<GoblinStoreCertInfoVo> certInfo(@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) { public ResponseDto<GoblinStoreCertInfoVo> certInfo(@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) {
// TODO: 2022/1/12 zhanggb 逻辑校验 String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
log.warn("店铺管理:认证信息:无权查看该店铺[UID={},storeId={}]", currentUid, storeId);
return ResponseDto.failure(ErrorMapping.get("149002"));
}
return ResponseDto.success(GoblinStoreCertInfoVo.getNew().copy(goblinRedisUtils.getStoreInfoVo(storeId))); return ResponseDto.success(GoblinStoreCertInfoVo.getNew().copy(goblinRedisUtils.getStoreInfoVo(storeId)));
} }
...@@ -124,16 +131,12 @@ public class GoblinStoreMgtController { ...@@ -124,16 +131,12 @@ public class GoblinStoreMgtController {
}) })
@GetMapping(value = {"conf"}) @GetMapping(value = {"conf"})
public ResponseDto<Map<String, String>> conf(@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) { public ResponseDto<Map<String, String>> conf(@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) {
// TODO: 2022/1/12 zhanggb 逻辑校验 String currentUid = CurrentUtil.getCurrentUid();
List<GoblinStoreConfigVo> storeConfigVos = goblinRedisUtils.getStoreConfigVos(storeId); if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
log.warn("店铺管理:店铺设置:无权查看该店铺[UID={},storeId={}]", currentUid, storeId);
if (CollectionUtils.isEmpty(storeConfigVos)) {// TODO: 2022/1/12 zhanggb tmp return ResponseDto.failure(ErrorMapping.get("149002"));
storeConfigVos.add(GoblinStoreConfigVo.getNew().setConfigKey(GoblinStoreConf.BUSINESS_STATUS.name()).setConfigVal("5"));
storeConfigVos.add(GoblinStoreConfigVo.getNew().setConfigKey(GoblinStoreConf.ONOFF_CUSTOMER_SEV.name()).setConfigVal(LnsEnum.ONOFF.ON.name()));
storeConfigVos.add(GoblinStoreConfigVo.getNew().setConfigKey(GoblinStoreConf.ONOFF_SOLD_OUT_SHOW.name()).setConfigVal(LnsEnum.ONOFF.ON.name()));
storeConfigVos.add(GoblinStoreConfigVo.getNew().setConfigKey(GoblinStoreConf.LIMIT_WARNING_STOCK.name()).setConfigVal("5"));
} }
List<GoblinStoreConfigVo> storeConfigVos = goblinRedisUtils.getStoreConfigVos(storeId);
return ResponseDto.success(storeConfigVos.stream().collect(Collectors.toMap(GoblinStoreConfigVo::getConfigKey, GoblinStoreConfigVo::getConfigVal))); return ResponseDto.success(storeConfigVos.stream().collect(Collectors.toMap(GoblinStoreConfigVo::getConfigKey, GoblinStoreConfigVo::getConfigVal)));
} }
...@@ -142,16 +145,44 @@ public class GoblinStoreMgtController { ...@@ -142,16 +145,44 @@ public class GoblinStoreMgtController {
@PostMapping(value = {"conf/edit"}) @PostMapping(value = {"conf/edit"})
public ResponseDto<Object> confEdit(@Valid @RequestBody GoblinStoreMgtConfigEditParam param) { public ResponseDto<Object> confEdit(@Valid @RequestBody GoblinStoreMgtConfigEditParam param) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
// TODO: 2022/1/12 zhanggb 逻辑校验 String storeId = param.getStoreId();
if (CollectionUtils.isEmpty(param.getConfMap())) { if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
log.warn("店铺管理:店铺设置:编辑[UID={},param={}],无效操作:配置为空", currentUid, JsonUtils.toJson(param)); log.warn("店铺管理:店铺设置:无权编辑该店铺[UID={},storeId={}]", currentUid, storeId);
return ResponseDto.failure(ErrorMapping.get("149001")); return ResponseDto.failure(ErrorMapping.get("149002"));
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("店铺管理:店铺设置:编辑[UID={},GoblinStoreMgtConfigEditParam={}]", currentUid, JsonUtils.toJson(param)); log.debug("店铺管理:店铺设置:编辑[UID={},GoblinStoreMgtConfigEditParam={}]", currentUid, JsonUtils.toJson(param));
} }
HashMap<String, String> updateConfMap = CollectionUtil.mapStringString();
return ResponseDto.success(); param.getConfMap().forEach((ck, cv) -> {
switch (ck) {
case "BUSINESS_STATUS":
if (Arrays.asList("4", "5").contains(cv)) {
updateConfMap.put(ck, cv);
}
break;
case "ONOFF_CUSTOMER_SEV":
case "ONOFF_SOLD_OUT_SHOW":
if (Arrays.asList("ON", "OFF").contains(cv)) {
updateConfMap.put(ck, cv);
}
case "LIMIT_WARNING_STOCK":
int limitWarningStock = -1;
try {
limitWarningStock = Integer.parseInt(cv);
} catch (NumberFormatException e) {
}
if (limitWarningStock >= 0) {
updateConfMap.put(ck, cv);
}
break;
}
});
if (CollectionUtils.isEmpty(updateConfMap)) {
log.warn("店铺管理:店铺设置:编辑[UID={},param={}],无效操作:无效配置", currentUid, JsonUtils.toJson(param));
return ResponseDto.failure(ErrorMapping.get("149001"));
}
return ResponseDto.success(goblinStoreMgtService.updateStoreMgtConfig(currentUid, storeId, updateConfMap));
} }
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
......
...@@ -31,7 +31,7 @@ public class GoblinStoreMgtExtraImpl implements IGoblinStoreMgtExtraService { ...@@ -31,7 +31,7 @@ public class GoblinStoreMgtExtraImpl implements IGoblinStoreMgtExtraService {
@Override @Override
public List<GoblinServiceSupportVo> listServiceSupportVo() { public List<GoblinServiceSupportVo> listServiceSupportVo() {
List<GoblinServiceSupportVo> serviceSupportVos = goblinMongoUtils.getMgtServiceSupportVos(); List<GoblinServiceSupportVo> serviceSupportVos = goblinRedisUtils.getServiceSupportVos();
if (CollectionUtils.isEmpty(serviceSupportVos)) { if (CollectionUtils.isEmpty(serviceSupportVos)) {
serviceSupportVos.add(GoblinServiceSupportVo.getNew().setName("正品保证").setDesc("商品为正版行货").setSsid("101")); serviceSupportVos.add(GoblinServiceSupportVo.getNew().setName("正品保证").setDesc("商品为正版行货").setSsid("101"));
serviceSupportVos.add(GoblinServiceSupportVo.getNew().setName("极速发货").setDesc("24小时内发送货物").setSsid("102")); serviceSupportVos.add(GoblinServiceSupportVo.getNew().setName("极速发货").setDesc("24小时内发送货物").setSsid("102"));
......
...@@ -3,16 +3,25 @@ package com.liquidnet.service.goblin.service.impl.manage; ...@@ -3,16 +3,25 @@ package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreConfigVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtService; import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils; import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils; import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil;
import com.liquidnet.service.goblin.util.QueueUtils; import com.liquidnet.service.goblin.util.QueueUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@Slf4j
@Service @Service
public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService { public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService {
@Autowired @Autowired
...@@ -25,7 +34,7 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService { ...@@ -25,7 +34,7 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService {
@Override @Override
public boolean updateStoreMgtInfo(GoblinStoreInfoVo storeInfoVo) { public boolean updateStoreMgtInfo(GoblinStoreInfoVo storeInfoVo) {
if (goblinMongoUtils.updateStoreInfoVo(storeInfoVo)) { if (goblinMongoUtils.updateStoreInfoVo(storeInfoVo)) {
// TODO: 2022/1/12 zhanggb redis // goblinRedisUtils.setStoreInfoVo(storeInfoVo);// TODO: 2022/1/17 zhanggb==
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("goblin_store_info.update_by_edit", SqlMapping.get("goblin_store_info.update_by_edit",
...@@ -36,4 +45,30 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService { ...@@ -36,4 +45,30 @@ public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService {
} }
return false; return false;
} }
@Override
public boolean updateStoreMgtConfig(String uid, String storeId, Map<String, String> confMap) {
LocalDateTime now = LocalDateTime.now();
List<GoblinStoreConfigVo> storeConfigVos = goblinRedisUtils.getStoreConfigVos(storeId);
List<GoblinStoreConfigVo> updateStoreConfigVoList = ObjectUtil.getGoblinStoreConfigVoArrayList();
storeConfigVos.forEach(configVo -> {
String updateConfVal = confMap.get(configVo.getConfigKey());
if (StringUtils.isNotEmpty(updateConfVal)) {
configVo.setConfigVal(updateConfVal);
configVo.setUpdatedBy(uid);
configVo.setUpdatedAt(now);
updateStoreConfigVoList.add(configVo);
}
});
if (!CollectionUtils.isEmpty(updateStoreConfigVoList) && goblinMongoUtils.updateStoreConfigVos(updateStoreConfigVoList)) {
// goblinRedisUtils.setStoreConfigVos(storeId, storeConfigVos);// TODO: 2022/1/17 zhanggb==
LinkedList<Object[]> updateStoreConfigVoObjs = CollectionUtil.linkedListObjectArr();
updateStoreConfigVoList.forEach(uc -> updateStoreConfigVoObjs.add(new Object[]{uc.getConfigVal(), uc.getUpdatedBy(), uc.getUpdatedAt(), uc.getStoreId(), uc.getConfigKey()}));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("goblin_store_config.update", updateStoreConfigVoObjs));
return true;
}
return false;
}
} }
...@@ -9,9 +9,12 @@ import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo; ...@@ -9,9 +9,12 @@ import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo; import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import com.mongodb.client.model.UpdateOneModel;
import com.mongodb.client.model.WriteModel;
import com.mongodb.client.result.DeleteResult; import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult; import com.mongodb.client.result.UpdateResult;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -119,7 +122,27 @@ public class GoblinMongoUtils { ...@@ -119,7 +122,27 @@ public class GoblinMongoUtils {
/* ---------------------------------------- 店铺配置数据源 ---------------------------------------- */ /* ---------------------------------------- 店铺配置数据源 ---------------------------------------- */
public List<GoblinStoreConfigVo> getStoreConfigVo(String storeId) { public List<GoblinStoreConfigVo> getStoreConfigVos(String storeId) {
Query query = Query.query(Criteria.where("storeId").is(storeId));
query.fields().include("storeId").include("configKey").include("configVal");
return mongoTemplate.find(query,
GoblinStoreConfigVo.class, GoblinStoreConfigVo.class.getSimpleName());
}
public boolean updateStoreConfigVos(List<GoblinStoreConfigVo> vos) {
List<WriteModel<Document>> list = ObjectUtil.getWriteModelDocumentArrayList();
vos.forEach(r -> {
if (StringUtils.isNotEmpty(r.getStoreId())) {
list.add(new UpdateOneModel<>(
Query.query(Criteria.where("storeId").is(r.getStoreId()).and("configKey").is(r.getConfigKey())).getQueryObject(),
Update.update("configVal", r.getConfigVal()).set("updatedBy", r.getUpdatedBy()).set("updatedAt", r.getUpdatedAt()).getUpdateObject()
));
}
});
return mongoTemplate.getCollection(GoblinStoreConfigVo.class.getSimpleName()).bulkWrite(list).getModifiedCount() > 0;
}
public List<GoblinStoreConfigVo> delStoreConfigVo(String storeId) {
Query query = Query.query(Criteria.where("storeId").is(storeId)); Query query = Query.query(Criteria.where("storeId").is(storeId));
query.fields().include("configKey").include("configVal"); query.fields().include("configKey").include("configVal");
return mongoTemplate.find(query, return mongoTemplate.find(query,
......
...@@ -7,14 +7,12 @@ import com.liquidnet.commons.lang.util.JsonUtils; ...@@ -7,14 +7,12 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.RandomUtil; import com.liquidnet.commons.lang.util.RandomUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.enums.GoblinStoreConf;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@Component @Component
...@@ -117,6 +115,7 @@ public class GoblinRedisUtils { ...@@ -117,6 +115,7 @@ public class GoblinRedisUtils {
} }
return vos; return vos;
} }
/* ---------------------------------------- 店铺分类数据源 ---------------------------------------- */ /* ---------------------------------------- 店铺分类数据源 ---------------------------------------- */
public List<GoblinStoreGoodsCategoryVo> getStoreGoodsCategoryVos(String storeId) { public List<GoblinStoreGoodsCategoryVo> getStoreGoodsCategoryVos(String storeId) {
...@@ -134,16 +133,38 @@ public class GoblinRedisUtils { ...@@ -134,16 +133,38 @@ public class GoblinRedisUtils {
return vos; return vos;
} }
/* ---------------------------------------- 服务支持数据源 ---------------------------------------- */
public List<GoblinServiceSupportVo> getServiceSupportVos() {
String valStr = (String) redisUtil.get(GoblinRedisConst.BASIC_SERVICE_SUPPORT);
boolean valStrIsEmptyFlg = StringUtils.isEmpty(valStr);
List<GoblinServiceSupportVo> vos;
if (valStrIsEmptyFlg) {
if (!CollectionUtils.isEmpty(vos = goblinMongoUtils.getMgtServiceSupportVos())) {
// redisUtil.set(GoblinRedisConst.BASIC_SERVICE_SUPPORT, JsonUtils.toJson(vos));// TODO: 2022/1/17 zhanggb==
}
} else {
vos = JsonUtils.fromJson(valStr, new TypeReference<List<GoblinServiceSupportVo>>() {
});
}
return vos;
}
/* ---------------------------------------- 店铺配置数据源 ---------------------------------------- */ /* ---------------------------------------- 店铺配置数据源 ---------------------------------------- */
public List<GoblinStoreConfigVo> getStoreConfigVos(String storeId) { public List<GoblinStoreConfigVo> getStoreConfigVos(String storeId) {
String rk = GoblinRedisConst.BASIC_STORE_CONF.concat(storeId); String rk = GoblinRedisConst.BASIC_STORE_CONF.concat(storeId);
List<GoblinStoreConfigVo> vos = (List<GoblinStoreConfigVo>) redisUtil.get(rk); List<GoblinStoreConfigVo> vos = (List<GoblinStoreConfigVo>) redisUtil.get(rk);
if (CollectionUtils.isEmpty(vos) && null != (vos = goblinMongoUtils.getStoreConfigVo(storeId))) { if (CollectionUtils.isEmpty(vos) && null != (vos = goblinMongoUtils.getStoreConfigVos(storeId))) {
// redisUtil.set(rk, vos);// TODO: 2022/1/12 zhanggb== // redisUtil.set(rk, vos);// TODO: 2022/1/12 zhanggb==
} }
return vos; return vos;
} }
public boolean setStoreConfigVos(String storeId, List<GoblinStoreConfigVo> vos) {
return redisUtil.set(GoblinRedisConst.BASIC_STORE_CONF.concat(storeId), vos);
}
public void delStoreConfigVos(String storeId) { public void delStoreConfigVos(String storeId) {
redisUtil.del(GoblinRedisConst.BASIC_STORE_CONF.concat(storeId)); redisUtil.del(GoblinRedisConst.BASIC_STORE_CONF.concat(storeId));
} }
......
...@@ -11,6 +11,8 @@ import com.liquidnet.service.goblin.entity.GoblinOrderSku; ...@@ -11,6 +11,8 @@ import com.liquidnet.service.goblin.entity.GoblinOrderSku;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder; import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
import com.liquidnet.service.goblin.param.GoblinOrderSqlParam; import com.liquidnet.service.goblin.param.GoblinOrderSqlParam;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import com.mongodb.client.model.WriteModel;
import org.bson.Document;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -22,6 +24,7 @@ public class ObjectUtil { ...@@ -22,6 +24,7 @@ public class ObjectUtil {
private static final ArrayList<GoblinFrontBannerVo> goblinFrontBannerVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinFrontBannerVo> goblinFrontBannerVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinSelfMarketingVo> goblinSelfMarketingVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinSelfMarketingVo> goblinSelfMarketingVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinStoreMgtThumbVo> goblinStoreMgtThumbVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinStoreMgtThumbVo> goblinStoreMgtThumbVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinStoreConfigVo> goblinStoreConfigVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSpecVo> goblinGoodsSpecVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSpecVo> goblinGoodsSpecVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSpecValueVo> goblinGoodsSpecValueVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSpecValueVo> goblinGoodsSpecValueVoArrayList = new ArrayList<>();
...@@ -55,6 +58,7 @@ public class ObjectUtil { ...@@ -55,6 +58,7 @@ public class ObjectUtil {
private static final ArrayList<GoblinFrontNavigationVo> goblinFrontNavigationVoArrayList=new ArrayList<>(); private static final ArrayList<GoblinFrontNavigationVo> goblinFrontNavigationVoArrayList=new ArrayList<>();
private static final BasicDBObject basicDBObject = new BasicDBObject(); private static final BasicDBObject basicDBObject = new BasicDBObject();
private static final ArrayList<WriteModel<Document>> writeModelDocumentArrayList = new ArrayList<>();
public static ArrayList<GoblinFrontNavigationVo> getgoblinFrontNavigationVoArrayList() { public static ArrayList<GoblinFrontNavigationVo> getgoblinFrontNavigationVoArrayList() {
...@@ -146,6 +150,10 @@ public class ObjectUtil { ...@@ -146,6 +150,10 @@ public class ObjectUtil {
return (ArrayList<GoblinStoreMgtThumbVo>) goblinStoreMgtThumbVoArrayList.clone(); return (ArrayList<GoblinStoreMgtThumbVo>) goblinStoreMgtThumbVoArrayList.clone();
} }
public static ArrayList<GoblinStoreConfigVo> getGoblinStoreConfigVoArrayList() {
return (ArrayList<GoblinStoreConfigVo>) goblinStoreConfigVoArrayList.clone();
}
public static ArrayList<GoblinGoodsSkuInfoVo> getGoblinGoodsSkuInfoVoArrayList() { public static ArrayList<GoblinGoodsSkuInfoVo> getGoblinGoodsSkuInfoVoArrayList() {
return (ArrayList<GoblinGoodsSkuInfoVo>) goblinGoodsSkuInfoVoArrayList.clone(); return (ArrayList<GoblinGoodsSkuInfoVo>) goblinGoodsSkuInfoVoArrayList.clone();
} }
...@@ -202,4 +210,8 @@ public class ObjectUtil { ...@@ -202,4 +210,8 @@ public class ObjectUtil {
public static BasicDBObject cloneBasicDBObject() { public static BasicDBObject cloneBasicDBObject() {
return (BasicDBObject) basicDBObject.clone(); return (BasicDBObject) basicDBObject.clone();
} }
public static ArrayList<WriteModel<Document>> getWriteModelDocumentArrayList() {
return (ArrayList<WriteModel<Document>>) writeModelDocumentArrayList.clone();
}
} }
...@@ -8,6 +8,8 @@ goblin_store_info.update_by_edit=UPDATE goblin_store_info SET store_name=?,logo_ ...@@ -8,6 +8,8 @@ goblin_store_info.update_by_edit=UPDATE goblin_store_info SET store_name=?,logo_
goblin_store_certification.insert_by_cert=INSERT INTO goblin_store_certification (store_id,person_cert_type,person_name,person_cert_code,person_cert_validity,person_cert_lasting,person_cert_fpic,person_cert_bpic,person_cert_spic,province_id,province_name,city_id,city_name,county_id,county_name,bus_address,bus_name,bus_cert_code,bus_cert_validity,bus_cert_lasting,bus_cert_pic,bus_quality_pic,created_by,created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) goblin_store_certification.insert_by_cert=INSERT INTO goblin_store_certification (store_id,person_cert_type,person_name,person_cert_code,person_cert_validity,person_cert_lasting,person_cert_fpic,person_cert_bpic,person_cert_spic,province_id,province_name,city_id,city_name,county_id,county_name,bus_address,bus_name,bus_cert_code,bus_cert_validity,bus_cert_lasting,bus_cert_pic,bus_quality_pic,created_by,created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_store_certification.update_by_cert=UPDATE goblin_store_certification SET person_cert_type=?,person_name=?,person_cert_code=?,person_cert_validity=?,person_cert_lasting=?,person_cert_fpic=?,person_cert_bpic=?,person_cert_spic=?,province_id=?,province_name=?,city_id=?,city_name=?,county_id=?,county_name=?,bus_address=?,bus_name=?,bus_cert_code=?,bus_cert_validity=?,bus_cert_lasting=?,bus_cert_pic=?,bus_quality_pic=?,updated_by=?,updated_at=? WHERE store_id=? goblin_store_certification.update_by_cert=UPDATE goblin_store_certification SET person_cert_type=?,person_name=?,person_cert_code=?,person_cert_validity=?,person_cert_lasting=?,person_cert_fpic=?,person_cert_bpic=?,person_cert_spic=?,province_id=?,province_name=?,city_id=?,city_name=?,county_id=?,county_name=?,bus_address=?,bus_name=?,bus_cert_code=?,bus_cert_validity=?,bus_cert_lasting=?,bus_cert_pic=?,bus_quality_pic=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_certification.update_by_del=UPDATE goblin_store_certification SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=? goblin_store_certification.update_by_del=UPDATE goblin_store_certification SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=?
#---- 店铺配置信息
goblin_store_config.update=UPDATE goblin_store_config SET config_val=?,updated_by=?,updated_at=? WHERE store_id=? AND config_key=?
#---- 商品信息 #---- 商品信息
goblin_goods.insert=INSERT INTO goblin_goods (spu_id,spu_no,name,subtitle,sell_price, price_ge,price_le,intro,details,cover_pic, video,spec_mode,store_id,cate_fid,cate_sid, cate_tid,store_cate_fid,store_cate_sid,store_cate_tid,brand_id, shelves_handle,shelves_time,spu_validity,virtual_flg,status, shelves_status,spu_appear,shelves_at,created_by,created_at, logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) goblin_goods.insert=INSERT INTO goblin_goods (spu_id,spu_no,name,subtitle,sell_price, price_ge,price_le,intro,details,cover_pic, video,spec_mode,store_id,cate_fid,cate_sid, cate_tid,store_cate_fid,store_cate_sid,store_cate_tid,brand_id, shelves_handle,shelves_time,spu_validity,virtual_flg,status, shelves_status,spu_appear,shelves_at,created_by,created_at, logistics_template)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_goods.update_by_shelves=UPDATE goblin_goods SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND spu_appear='0' goblin_goods.update_by_shelves=UPDATE goblin_goods SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND spu_appear='0'
......
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