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

Commit f67a61a8 authored by 胡佳晨's avatar 胡佳晨

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

parents c96987a2 ae3f37bc
......@@ -5,29 +5,34 @@ public class GoblinRedisConst {
/* ----------------------------------------------------------------- */
/**
* 认证中店铺UID关系缓存
* {goblin:basic:ustore:${uid}, List<store_id>}
* {goblin:bsc:ustore:${uid}, List<store_id>}
*/
public static final String BASIC_USTORE = PREFIX.concat("basic:ustore:");
public static final String BASIC_USTORE = PREFIX.concat("bsc:ustore:");
/**
* 店铺信息
* {goblin:basic:store:${store_id}, com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo}
* {goblin:bsc:store:${store_id}, com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo}
*/
public static final String BASIC_STORE = PREFIX.concat("basic:store:");
public static final String BASIC_STORE = PREFIX.concat("bsc:store:");
/**
* 店铺配置信息
* {goblin:bsc:store_cf:${store_id}, com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo}
*/
public static final String BASIC_STORE_CONF = PREFIX.concat("bsc:store_cf:");
/**
* 店铺商品分类信息
* {goblin:basic:store:${store_id}, com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo}
* {goblin:bsc:store_g_c:${store_id}, JsonUtils.toJson(List<com.liquidnet.service.goblin.dto.vo.GoblinStoreGoodsCategoryVo>)}
*/
public static final String BASIC_STORE_GOODS_CATEGORY = PREFIX.concat("basic:store_g_c:");
public static final String BASIC_STORE_GOODS_CATEGORY = PREFIX.concat("bsc:store_g_c:");
/**
* SPU信息
* {goblin:basic:goods:${spu_id}, com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo}
* {goblin:bsc:goods:${spu_id}, com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo}
*/
public static final String BASIC_GOODS = PREFIX.concat("basic:goods:");
public static final String BASIC_GOODS = PREFIX.concat("bsc:goods:");
/**
* SKU信息
* {goblin:basic:goods_sku:${sku_id}, com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo}
* {goblin:bsc:goods_sku:${sku_id}, com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo}
*/
public static final String BASIC_GOODS_SKU = PREFIX.concat("basic:goods_sku:");
public static final String BASIC_GOODS_SKU = PREFIX.concat("bsc:goods_sku:");
......
package com.liquidnet.service.goblin.dto.manage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Map;
@ApiModel(value = "GoblinStoreMgtConfigEditParam", description = "店铺配置编辑入参")
@Data
public class GoblinStoreMgtConfigEditParam implements Serializable {
private static final long serialVersionUID = -815274264545867695L;
@ApiModelProperty(position = 10, value = "店铺ID[64]")
@NotBlank(message = "店铺ID不能为空") @Size(max = 64)
private String storeId;
@ApiModelProperty(position = 11, value = "店铺配置集合[Map]", example = "{\"BUSINESS_STATUS\":\"5\",\"ONOFF_CUSTOMER_SEV\":\"ON\",\"ONOFF_SOLD_OUT_SHOW\":\"ON\",\"LIMIT_WARNING_STOCK\":\"5\"}")
@NotNull(message = "店铺配置不能为空")
private Map<String, String> confMap;
}
package com.liquidnet.service.goblin.dto.manage.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -29,4 +30,14 @@ public class GoblinStoreMgtInfoVo implements java.io.Serializable, Cloneable {
return new GoblinStoreMgtInfoVo();
}
}
public GoblinStoreMgtInfoVo copy(GoblinStoreInfoVo source) {
if (null == source) return this;
this.setStoreId(source.getStoreId());
this.setStoreName(source.getStoreName());
this.setLogoPic(source.getLogoPic());
this.setBackgroundPic(source.getBackgroundPic());
this.setIntroduce(source.getIntroduce());
return this;
}
}
......@@ -25,6 +25,8 @@ public class GoblinShoppingCartVoo implements Serializable {
//mongodb userid
private String userId;
private int shoopingCount;
private static final GoblinShoppingCartVoo obj = new GoblinShoppingCartVoo();
......
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@ApiModel(value = "GoblinStoreConfigVo", description = "店铺配置信息")
@Data
public class GoblinStoreConfigVo implements Serializable, Cloneable {
private static final long serialVersionUID = 6234859594302504118L;
/**
* 店铺id
*/
private String storeId;
/**
* 参数名称
*/
private String configName;
@ApiModelProperty(position = 12, value = "参数键名")
private String configKey;
@ApiModelProperty(position = 13, value = "参数键值")
private String configVal;
/**
* 参数描述
*/
private String configDesc;
/**
* 保留字段
*/
private String configType;
private String createdBy;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt;
private String updatedBy;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt;
public GoblinStoreConfigVo setConfigKey(String configKey) {
this.configKey = configKey;
return this;
}
public GoblinStoreConfigVo setConfigVal(String configVal) {
this.configVal = configVal;
return this;
}
private static final GoblinStoreConfigVo obj = new GoblinStoreConfigVo();
public static GoblinStoreConfigVo getNew() {
try {
return (GoblinStoreConfigVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinStoreConfigVo();
}
}
}
package com.liquidnet.service.goblin.enums;
/**
* 店铺配置信息
*
* @author zhanggb
* Created by IntelliJ IDEA at 2022/1/12
*/
public enum GoblinStoreConf {
/**
* 状态:营业状态
* 同步`GoblinStoreInfoVo.status`
*/
BUSINESS_STATUS,
/**
* 开关:联系客服
*/
ONOFF_CUSTOMER_SEV,
/**
* 开关:售罄展示
*/
ONOFF_SOLD_OUT_SHOW,
/**
* 指标:库存不足
*/
LIMIT_WARNING_STOCK,
}
package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
public interface IGoblinStoreMgtService {
/**
* 店铺管理:店铺信息:更新
*
* @param storeInfoVo GoblinStoreInfoVo
* @return boolean
*/
boolean updateStoreMgtInfo(GoblinStoreInfoVo storeInfoVo);
}
......@@ -38,7 +38,7 @@ public class GoblinStoreAdminController extends BaseController {
}
@RequiresPermissions("goblin:store:list")
@PostMapping("/list")
@RequestMapping("/list")
@ResponseBody
public TableDataInfo list(GoblinStoreInfo storeInfo) {
LambdaQueryWrapper<GoblinStoreInfo> lambdaQueryWrapper = Wrappers.lambdaQuery(GoblinStoreInfo.class);
......
......@@ -4,7 +4,12 @@ public final class LnsEnum {
public enum ENV {
dev,
test,
prod;
prod,
}
public enum ONOFF {
ON,
OFF,
}
public static void main(String[] args) {
......
......@@ -32,6 +32,8 @@ public class CorsConfig {
corsConfiguration.addAllowedOrigin("https://m.zhengzai.tv");
corsConfiguration.addAllowedOrigin("http://testm.zhengzai.tv");
corsConfiguration.addAllowedOrigin("https://testm.zhengzai.tv");
corsConfiguration.addAllowedOrigin("http://ttestm.zhengzai.tv");
corsConfiguration.addAllowedOrigin("https://ttestm.zhengzai.tv");
corsConfiguration.addAllowedOrigin("http://devm.zhengzai.tv");
corsConfiguration.addAllowedOrigin("https://devm.zhengzai.tv");
......
......@@ -178,9 +178,9 @@ create table goblin_store_config
create index idx_gsc_store_id on goblin_store_config (store_id);
# insert into goblin_store_config (store_id, config_name, config_key, config_val, created_by, created_at)
# values (0, '联系客服', 'switch_show_customer_service', 'Y', 'admin', sysdate()),
# (0, '售罄展示', 'switch_show_sold_out', 'Y', 'admin', sysdate()),
# (0, '库存不足', 'boundary_warning_stock', '5', 'admin', sysdate());
# values (0, '联系客服', 'ONOFF_CUSTOMER_SERVICE', 'ON', 'admin', sysdate()),
# (0, '售罄展示', 'ONOFF_SOLD_OUT_SHOW', 'ON', 'admin', sysdate()),
# (0, '库存不足', 'LIMIT_WARNING_STOCK', '5', 'admin', sysdate());
# -- >>------------------------------------------------------------------------------------
drop table if exists goblin_store_goods_category;
create table goblin_store_goods_category
......
......@@ -3,17 +3,13 @@ package com.liquidnet.service.goblin.controller;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.GoblinShoppingCartVoo;
import com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author zhangfuxin
......@@ -44,11 +40,25 @@ public class GoblinFrontLoginController {
return ResponseDto.success( goblinFrontService.updateShopCart(spuId,storeId,skuId,number,userId));
}
@GetMapping("getShopCartCount")
@ApiOperation("获取商品数量")
public ResponseDto getShopCartCount() {
String userId=CurrentUtil.getCurrentUid();
return ResponseDto.success(goblinFrontService.getShopCartCount(userId));
}
@PostMapping("deleteShopCart")
@ApiOperation("删除商品")
public ResponseDto deleteShopCart(String skuIds) {
String userId=CurrentUtil.getCurrentUid();
return ResponseDto.success(goblinFrontService.delteShoppingCart(skuIds.split(","),userId));
}
@GetMapping("getShopCart")
@ApiOperation("获得购物车列表")
public ResponseDto<GoblinShoppingCartVoo> getShopCart() {
String userId=CurrentUtil.getCurrentUid();
return ResponseDto.success((GoblinShoppingCartVoo)redisUtil.get(GoblinRedisConst.FRONT_SHOPCART.concat(userId)));
return ResponseDto.success(goblinFrontService.getShoppCart(userId));
}
......@@ -59,4 +69,5 @@ public class GoblinFrontLoginController {
}
......@@ -2,12 +2,19 @@ package com.liquidnet.service.goblin.controller.manage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.constant.LnsEnum;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtConfigEditParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtThumbVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCertificationVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreConfigVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import com.liquidnet.service.goblin.enums.GoblinStoreConf;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil;
import io.swagger.annotations.Api;
......@@ -16,16 +23,18 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ApiSupport(order = 149002)
@Api(tags = "店铺管理")
......@@ -36,6 +45,8 @@ import java.util.List;
public class GoblinStoreMgtController {
@Autowired
GoblinRedisUtils goblinRedisUtils;
@Autowired
IGoblinStoreMgtService goblinStoreMgtService;
@ApiOperationSupport(order = 1)
@ApiOperation(value = "店铺管理:店铺列表")
......@@ -58,8 +69,8 @@ public class GoblinStoreMgtController {
})
@GetMapping(value = {"info"})
public ResponseDto<GoblinStoreMgtInfoVo> info(@NotBlank(message = "店铺ID不能为空") @RequestParam String storeId) {
return ResponseDto.success(null);
// TODO: 2022/1/12 zhanggb 逻辑校验
return ResponseDto.success(GoblinStoreMgtInfoVo.getNew().copy(goblinRedisUtils.getStoreInfoVo(storeId)));
}
@ApiOperationSupport(order = 3)
......@@ -72,13 +83,22 @@ public class GoblinStoreMgtController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "introduce", value = "店铺介绍[500]"),
})
@GetMapping(value = {"info/edit"})
public ResponseDto<GoblinStoreMgtInfoVo> infoEdit(@NotBlank(message = "店铺名称不能为空") @Size(max = 128) @RequestParam String storeName,
public ResponseDto<Object> infoEdit(@NotBlank(message = "店铺名称不能为空") @Size(max = 128) @RequestParam String storeName,
@NotBlank(message = "店铺LOGO不能为空") @Size(max = 256) @RequestParam String logoPic,
@NotBlank(message = "店铺背景图不能为空") @Size(max = 256) @RequestParam String backgroundPic,
@NotBlank(message = "店铺介绍不能为空") @Size(max = 500) @RequestParam String introduce,
@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) {
String currentUid = CurrentUtil.getCurrentUid();
// TODO: 2022/1/12 zhanggb 逻辑校验
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId);
storeInfoVo.setStoreName(storeName);
storeInfoVo.setLogoPic(logoPic);
storeInfoVo.setBackgroundPic(backgroundPic);
storeInfoVo.setIntroduce(introduce);
storeInfoVo.setUpdatedBy(currentUid);
storeInfoVo.setUpdatedAt(LocalDateTime.now());
return ResponseDto.success(null);
return goblinStoreMgtService.updateStoreMgtInfo(storeInfoVo) ? ResponseDto.success() : ResponseDto.failure(ErrorMapping.get("149003"));
}
@ApiOperationSupport(order = 4)
......@@ -88,6 +108,44 @@ public class GoblinStoreMgtController {
})
@GetMapping(value = {"info/cer"})
public ResponseDto<GoblinStoreCertificationVo> certInfo(@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) {
// TODO: 2022/1/12 zhanggb 逻辑校验
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(storeId);
return ResponseDto.success(null == storeInfoVo ? null : storeInfoVo.getCertificationVo());
}
@ApiOperationSupport(order = 5)
@ApiOperation(value = "店铺管理:店铺设置:详情", notes = "BUSINESS_STATUS(状态:营业状态[4-停业|5-营业])、ONOFF_CUSTOMER_SEV(开关:联系客服)、ONOFF_SOLD_OUT_SHOW(开关:售罄展示)、LIMIT_WARNING_STOCK(指标:库存不足)")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺ID[64]"),
})
@GetMapping(value = {"info/conf"})
public ResponseDto<Map<String, String>> configInfo(@NotBlank(message = "店铺ID不能为空") @Size(max = 64) @RequestParam String storeId) {
// TODO: 2022/1/12 zhanggb 逻辑校验
List<GoblinStoreConfigVo> storeConfigVos = goblinRedisUtils.getStoreConfigVos(storeId);
if (CollectionUtils.isEmpty(storeConfigVos)) {// TODO: 2022/1/12 zhanggb tmp
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"));
}
return ResponseDto.success(storeConfigVos.stream().collect(Collectors.toMap(GoblinStoreConfigVo::getConfigKey, GoblinStoreConfigVo::getConfigVal)));
}
@ApiOperationSupport(order = 6)
@ApiOperation(value = "店铺管理:店铺设置:编辑")
@PostMapping(value = {"info/conf/edit"})
public ResponseDto<Object> configInfoEdit(@Valid @RequestBody GoblinStoreMgtConfigEditParam param) {
String currentUid = CurrentUtil.getCurrentUid();
// TODO: 2022/1/12 zhanggb 逻辑校验
if (CollectionUtils.isEmpty(param.getConfMap())) {
log.warn("店铺管理:店铺设置:编辑[UID={},param={}],无效操作:配置为空", currentUid, JsonUtils.toJson(param));
return ResponseDto.failure(ErrorMapping.get("149001"));
}
if (log.isDebugEnabled()) {
log.debug("店铺管理:店铺设置:编辑[UID={},GoblinStoreMgtConfigEditParam={}]", currentUid, JsonUtils.toJson(param));
}
return ResponseDto.success();
}
......
......@@ -25,10 +25,7 @@ import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
@Service
public class GoblinFrontServiceImpl implements GoblinFrontService {
......@@ -419,10 +416,88 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
return true;
}
public int getShopCartCount(String userId){
int count=0;
GoblinShoppingCartVoo goblinShoppingCartVoo= (GoblinShoppingCartVoo) redisUtil.get(GoblinRedisConst.FRONT_SHOPCART.concat(userId));
if(null!=goblinShoppingCartVoo){
List<GoblinShoppingCartVo> shopList=goblinShoppingCartVoo.getShopList();
for(GoblinShoppingCartVo goblinShoppingCartVo:shopList){
List<GoblinShoppingCartVoDetail> skuList=goblinShoppingCartVo.getSkuList();
for(GoblinShoppingCartVoDetail goblinShoppingCartVoDetail:skuList){
count=goblinShoppingCartVoDetail.getNumber()+count;
}
}
}
return count;
}
/**
* 删除购物车里面的商品
*/
public boolean delteShoppingCart(String[] skuIds,String userId) {
boolean isDeleteAll = false;
GoblinShoppingCartVoo goblinShoppingCartVoo = (GoblinShoppingCartVoo) redisUtil.get(GoblinRedisConst.FRONT_SHOPCART.concat(userId));
if (null != goblinShoppingCartVoo) {
List<GoblinShoppingCartVo> shopList = goblinShoppingCartVoo.getShopList();
for (GoblinShoppingCartVo goblinShoppingCartVo : shopList) {
List<GoblinShoppingCartVoDetail> skuList = goblinShoppingCartVo.getSkuList();
Iterator<GoblinShoppingCartVoDetail> iterator = skuList.iterator();
while(iterator.hasNext()){
GoblinShoppingCartVoDetail goblinShoppingCartVoDetail=iterator.next();
for (String skuId : skuIds) {
if (goblinShoppingCartVoDetail.getSkuId().equals(skuId)) {
//skuList.remove(goblinShoppingCartVoDetail);
iterator.remove();
}
}
}
/* for (GoblinShoppingCartVoDetail goblinShoppingCartVoDetail : skuList) {
}*/
}
}
/* //创建 voo
GoblinShoppingCartVoo goblinShoppingCartVoo1=GoblinShoppingCartVoo.getNew();
// 根据shop分类
ArrayList<GoblinShoppingCartVo> list=ObjectUtil.goblinShoppingCartVoArrayList();
GoblinShoppingCartVo goblinShoppingCartVo=GoblinShoppingCartVo.getNew();
goblinShoppingCartVo.setStoreId(storeId);
//该商铺下的所有商品
ArrayList<GoblinShoppingCartVoDetail> list1=ObjectUtil.goblinShoppingCartVoDetailArrayList();
//创建 购物车vo
GoblinShoppingCartVoDetail goblinShoppingCartVoDetail=this.setValue(userId,storeId,spuId,skuId,1);
list1.add(goblinShoppingCartVoDetail);
goblinShoppingCartVo.setSkuList(list1);
list.add(goblinShoppingCartVo);
goblinShoppingCartVoo1.setShopList(list);
goblinShoppingCartVoo1.setGoblinShoppingCartId(IDGenerator.nextSnowId());
saveRedisMongodbMysqlShop(goblinShoppingCartVoo1,userId);
*/
/*for(Map<String,String> map:listMap){
//找到位置, 删除
//获取
GoblinShoppingCartVoo goblinShoppingCartVoo= (GoblinShoppingCartVoo) redisUtil.get(GoblinRedisConst.FRONT_SHOPCART.concat(userId));
if(null!=goblinShoppingCartVoo){
List<GoblinShoppingCartVo> shopList=goblinShoppingCartVoo.getShopList();
for(GoblinShoppingCartVo goblinShoppingCartVo:shopList){
List<GoblinShoppingCartVoDetail> skuList= goblinShoppingCartVo.getSkuList();
String skuId=map.get("skuId");
for(GoblinShoppingCartVoDetail goblinShoppingCartVoDetail:skuList){
if(skuId.equals(goblinShoppingCartVoDetail.getSkuId())){
skuList.remove(goblinShoppingCartVoDetail);
}
}
}
}
}*/
saveRedisMongodbMysqlShop(goblinShoppingCartVoo,userId);
return true;
}
/**
* @author zhangfuxin
* @Description: 获得购物车列表
* @date 2022/1/12 下午2:36
*/
public GoblinShoppingCartVoo getShoppCart(String userId){
//判断该用户 redis里是否有购物车
GoblinShoppingCartVoo goblinShoppingCartVoo= (GoblinShoppingCartVoo) redisUtil.get(GoblinRedisConst.FRONT_SHOPCART.concat(userId));
......@@ -432,7 +507,8 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
//找到对应的 spu 和 sku
GoblinGoodsInfoVo goblinGoodsInfoVo=goblinRedisUtils.getGoodsInfoVo(goblinShoppingCartVoDetail.getSpuId());
GoblinGoodsSkuInfoVo goblinGoodsSkuInfoVo=goblinRedisUtils.getGoodsSkuInfoVo(goblinShoppingCartVoDetail.getSkuId());
goblinShoppingCartVoDetail.setGoblinGoodsInfoVo(goblinGoodsInfoVo);
goblinShoppingCartVoDetail.setGoblinGoodsSkuInfoVo(goblinGoodsSkuInfoVo);
}
}
......
package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreInfoVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.QueueUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
@Service
public class GoblinStoreMgtServiceImpl implements IGoblinStoreMgtService {
@Autowired
private QueueUtils queueUtils;
@Autowired
private GoblinRedisUtils goblinRedisUtils;
@Autowired
private GoblinMongoUtils goblinMongoUtils;
@Override
public boolean updateStoreMgtInfo(GoblinStoreInfoVo storeInfoVo) {
if (goblinMongoUtils.updateStoreInfoVo(storeInfoVo)) {
// TODO: 2022/1/12 zhanggb redis
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("goblin_store_info.update_by_edit",
storeInfoVo.getStoreName(), storeInfoVo.getLogoPic(), storeInfoVo.getBackgroundPic(), storeInfoVo.getIntroduce(),
storeInfoVo.getUpdatedBy(), storeInfoVo.getUpdatedAt(), storeInfoVo.getStoreId()
));
return true;
}
return false;
}
}
......@@ -101,6 +101,15 @@ public class GoblinMongoUtils {
return (List<GoblinServiceSupportVo>) mongoTemplate.insert(vos, GoblinServiceSupportVo.class.getSimpleName());
}
/* ---------------------------------------- 店铺配置数据源 ---------------------------------------- */
public List<GoblinStoreConfigVo> getStoreConfigVo(String storeId) {
Query query = Query.query(Criteria.where("storeId").is(storeId));
query.fields().include("config_name").include("config_key").include("config_val");
return mongoTemplate.find(query,
GoblinStoreConfigVo.class, GoblinStoreConfigVo.class.getSimpleName());
}
/* ---------------------------------------- 店铺数据源 ---------------------------------------- */
public GoblinStoreInfoVo setStoreInfoVo(GoblinStoreInfoVo vo) {
......
......@@ -97,6 +97,17 @@ public class GoblinRedisUtils {
return vos;
}
/* ---------------------------------------- 店铺配置数据源 ---------------------------------------- */
public List<GoblinStoreConfigVo> getStoreConfigVos(String storeId) {
String rk = GoblinRedisConst.BASIC_STORE_CONF.concat(storeId);
List<GoblinStoreConfigVo> vos = (List<GoblinStoreConfigVo>) redisUtil.get(rk);
if (CollectionUtils.isEmpty(vos) && null != (vos = goblinMongoUtils.getStoreConfigVo(storeId))) {
// redisUtil.set(rk, vos);// TODO: 2022/1/12 zhanggb 暂不设置
}
return vos;
}
/* ---------------------------------------- 店铺数据源 ---------------------------------------- */
private boolean setStoreIds(String uid, List<String> storeIds) {
......
......@@ -17,7 +17,7 @@
149000=操作过于频繁,请稍后再试
149001=无效操作
149002=无权操作该店铺,请核实
149003=
149003=处理失败,请联系客服
149004=
149005=
149006=添加商品失败,规格信息无效
......
......@@ -3,6 +3,7 @@ goblin_store_info.insert_by_cert=INSERT INTO goblin_store_info (store_id,uid,sta
goblin_store_info.update_by_cert1=UPDATE goblin_store_info SET store_type=?,cert_type=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_cert2=UPDATE goblin_store_info SET store_name=?,logo_pic=?,background_pic=?,introduce=?,status=?,store_type=?,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_del=UPDATE goblin_store_info SET del_flg=1,updated_by=?,updated_at=? WHERE store_id=?
goblin_store_info.update_by_edit=UPDATE goblin_store_info SET store_name=?,logo_pic=?,background_pic=?,introduce=?,updated_by=?,updated_at=? WHERE store_id=?
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=?
......
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