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

Commit 815e55c7 authored by 张国柄's avatar 张国柄

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

parents b784110d fdad5006
......@@ -28,7 +28,8 @@ public class GoblinRedisConst {
/* ----------------------------------------------------------------- */
public static final String FRONT_BANNER = PREFIX.concat("front_banner"); //前端banner
public static final String FRONT_TOP_BANNER = PREFIX.concat("front_top_banner"); //前端顶部banner
public static final String FRONT_MIDDLE_BANNER = PREFIX.concat("front_top_banner"); //前端中部banner
public static final String FRONT_NAVIGATION = PREFIX.concat("front_navigation"); //前端banner
public static final String FRONT_HOTWORD = PREFIX.concat("front_hot_word"); //前端banner
public static final String FRONT_HOTWORD_INDEX = PREFIX.concat("front_hot_word_index"); //前端banner index
......@@ -37,6 +38,7 @@ public class GoblinRedisConst {
public static final String SELECT_GOODS = PREFIX.concat("select_goods"); //精选商品
public static final String MOUDLE_INDEX = PREFIX.concat("moudle_index"); //moudle_index 组件排序
public static final String COMPLIATIONS = PREFIX.concat("goblinFrontCompilations"); // 合集
public static final String FRONT_GOBLINFRONTCUBE = PREFIX.concat("goblinFrontCube"); // 合集
/* ----------------------------------------------------------------- */
......
package com.liquidnet.service.goblin.dto.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.entity.GoblinGoods;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author liquidnet
* @since 2022-01-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinFrontCubeVo implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 魔方id
*/
@ApiModelProperty(value = "魔方id")
private String cubeId;
/**
* 1、一行一个2一行二个3一行三个4上一下三
*/
@ApiModelProperty(value = "1、一行一个2一行二个3一行三个4上一下三")
private Integer rowType;
/**
* 1、单商品2、合集
*/
@ApiModelProperty(value = "1、单商品2、合集")
private Integer pageType;
/**
* 商品名称
*/
@ApiModelProperty(value = "商品名称")
private String spuName;
/**
* 商品id
*/
@ApiModelProperty(value = "商品id,用逗号拼接")
private String spuId;
/**
* 推荐文案
*/
@ApiModelProperty(value = "推荐文案1")
private String informationA;
@ApiModelProperty(value = "推荐文案2")
private String informationB;
@ApiModelProperty(value = "推荐文案3")
private String informationC;
@ApiModelProperty(value = "推荐文案4")
private String informationD;
/**
* 合集id
*/
@ApiModelProperty(value = "合集ids")
private String compilationsId;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime createTime;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime updateTime;
/**
* spu
*/
@ApiModelProperty(value = "spu信息")
private GoblinGoods goblinGoods;
private static final GoblinFrontCubeVo obj = new GoblinFrontCubeVo();
public static GoblinFrontCubeVo getNew() {
try {
return (GoblinFrontCubeVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinFrontCubeVo();
}
}
}
......@@ -71,7 +71,11 @@ public class GoblinFrontCubeParam implements Serializable {
@ApiModelProperty(value = "推荐文案4")
private String informationD;
/**
* 0未删除1已删除
*/
@ApiModelProperty(value = "0未删除1已删除")
private Integer delTag;
/**
* 合集id
*/
......
......@@ -43,6 +43,8 @@ public class GoblinFrontBannerController extends BaseController {
GoblinFrontMoudleIndexServiceImpl goblinFrontMoudleIndexService;
@Autowired
GoblinFrontCompilationsServiceImpl goblinFrontCompilationsService;
@Autowired
GoblinFrontCubeServiceImpl goblinFrontCubeService;
/**
* @author zhangfuxin
......@@ -130,17 +132,20 @@ public class GoblinFrontBannerController extends BaseController {
boolean bannerResult=goblinFrontBannerService.online();
logger.info("bannerResult,{}",bannerResult);
boolean hotWordResult=goblinFrontHotWordService.online();
logger.info("hotWordResult,{}",hotWordResult);
logger.info("热词,{}",hotWordResult);
boolean navigationResult=goblinFrontNavigationService.online();
logger.info("navigationResult,{}",navigationResult);
logger.info("导航栏,{}",navigationResult);
boolean secillResult=goblinFrontSeckillService.online();
logger.info("secillResult,{}",secillResult);
logger.info("限时秒杀,{}",secillResult);
boolean selectGoods=goblinFrontSelectGoodsService.online();
logger.info("精选商品{}",selectGoods);
boolean moudleIndexResult=goblinFrontMoudleIndexService.online();
logger.info("组件排序{}",moudleIndexResult);
boolean hejiReult=goblinFrontCompilationsService.online();
logger.info("合集{}",hejiReult);
//魔方
boolean cubeResult=goblinFrontCubeService.online();
logger.info("魔方{}",cubeResult);
/* boolean hejiReult=goblinFrontCompilationsService.online();
logger.info("合集{}",hejiReult);*/
if (bannerResult&&hotWordResult&&navigationResult ) {
return success("操作成功");
} else {
......
......@@ -143,9 +143,12 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
return list1;
}
public boolean online(){
//首页顶部
//banner
LambdaQueryWrapper<GoblinFrontBanner> queryWrapper = Wrappers.lambdaQuery(GoblinFrontBanner.class);
queryWrapper.ne(GoblinFrontBanner::getDelTag,1);
//bannerType
queryWrapper.eq(GoblinFrontBanner::getBannerType,1);
queryWrapper.orderByDesc(GoblinFrontBanner::getIndexs);
List<GoblinFrontBanner> list=goblinFrontBannerMapper.selectList(queryWrapper);
//mongodb
......@@ -162,10 +165,35 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
}
}
//redis
redisDataSourceUtil.getRedisGoblinUtil().del(GoblinRedisConst.FRONT_BANNER);
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_BANNER,list);
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_TOP_BANNER,list);
//中部
return true;
}
public void middle(){
LambdaQueryWrapper<GoblinFrontBanner> queryWrapper = Wrappers.lambdaQuery(GoblinFrontBanner.class);
queryWrapper.ne(GoblinFrontBanner::getDelTag,1);
//bannerType
queryWrapper.eq(GoblinFrontBanner::getBannerType,2);
queryWrapper.orderByDesc(GoblinFrontBanner::getIndexs);
List<GoblinFrontBanner> list=goblinFrontBannerMapper.selectList(queryWrapper);
//mongodb
for(GoblinFrontBanner goblinFrontBanner: list){
GoblinFrontBanner goblinFrontBanner1=mongoTemplate.findOne(Query.query(Criteria.where("bannerId").is(goblinFrontBanner.getBannerId())), GoblinFrontBanner.class, GoblinFrontBanner.class.getSimpleName());
if(null==goblinFrontBanner1){
mongoTemplate.save(goblinFrontBanner,GoblinFrontBanner.class.getSimpleName());
}else{
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontBanner)));
mongoTemplate.getCollection(GoblinFrontBanner.class.getSimpleName()).updateOne(
Query.query(Criteria.where("bannerId").is(goblinFrontBanner.getBannerId())).getQueryObject(),
orderObject
);
}
}
//redis
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_MIDDLE_BANNER,list);
}
......
package com.liquidnet.client.admin.zhengzai.goblin.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontCubeService;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.entity.GoblinFrontCube;
import com.liquidnet.service.goblin.entity.GoblinGoods;
import com.liquidnet.service.goblin.mapper.GoblinFrontCubeMapper;
import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper;
import com.liquidnet.service.goblin.param.GoblinFrontCubeParam;
import com.mongodb.BasicDBObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
......@@ -86,13 +92,30 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
goblinFrontCubeParam.setGoblinGoods(goodsList.get(0));
list1.add(goblinFrontCubeParam);
}
}
return list1;
}
public boolean online(){
LambdaQueryWrapper<GoblinFrontCube> queryWrapper = Wrappers.lambdaQuery(GoblinFrontCube.class);
queryWrapper.ne(GoblinFrontCube::getDelTag,1);
List<GoblinFrontCube> list=goblinFrontCubeMapper.selectList(queryWrapper);
//mongodb
for(GoblinFrontCube goblinFrontCube: list){
GoblinFrontCube goblinFrontCube1=mongoTemplate.findOne(Query.query(Criteria.where("cubeId").is(goblinFrontCube.getCubeId())), GoblinFrontCube.class, GoblinFrontCube.class.getSimpleName());
if(null==goblinFrontCube1){
mongoTemplate.save(goblinFrontCube,GoblinFrontCube.class.getSimpleName());
}else{
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontCube)));
mongoTemplate.getCollection(GoblinFrontCube.class.getSimpleName()).updateOne(
Query.query(Criteria.where("cubeId").is(goblinFrontCube.getCubeId())).getQueryObject(),
orderObject
);
}
}
//redis
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_GOBLINFRONTCUBE,list);
return true;
}
}
......@@ -160,18 +160,6 @@ public class GoblinFrontHotWordServiceImpl extends ServiceImpl<GoblinFrontHotWor
}
}
/* GoblinFrontHotWord goblinFrontHotWord=list.get(0);
if(null!=goblinFrontHotWord){
//redis
if(null!=goblinFrontHotWord.getChangeTime()&&goblinFrontHotWord.getChangeTime()>0){
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD,list,goblinFrontHotWord.getChangeTime());
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD_INDEX,0);
}else{
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD,list);
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD_INDEX,0);
}
}*/
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_HOTWORD,list);
return true;
}
......
......@@ -124,7 +124,7 @@ public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSe
GoblinFrontSelectGoods goblinFrontSelectGoods= list.get(0);
GoblinFrontSelectGoods goblinFrontSelectGoods1= mongoTemplate.findOne(Query.query(Criteria.where("selectGoodsId").is(goblinFrontSelectGoods.getSelectGoodsId())), GoblinFrontSelectGoods.class, GoblinFrontSelectGoods.class.getSimpleName());
if(null==goblinFrontSelectGoods1){
mongoTemplate.save(goblinFrontSelectGoods1,GoblinFrontSelectGoods.class.getSimpleName());
mongoTemplate.save(goblinFrontSelectGoods,GoblinFrontSelectGoods.class.getSimpleName());
}else{
BasicDBObject orderObject = new BasicDBObject("$set", JSON.parse(JsonUtils.toJson(goblinFrontSelectGoods)));
mongoTemplate.getCollection(GoblinFrontSelectGoods.class.getSimpleName()).updateOne(
......
......@@ -2,7 +2,12 @@ package com.liquidnet.service.goblin.controller;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontBannerVo;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontGoodDetailVo;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontSeckillVo;
import com.liquidnet.service.goblin.dto.vo.GoblinFrontSelectGoodVo;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
import com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
......@@ -14,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangfuxin
......@@ -31,31 +38,37 @@ public class GoblinFrontController {
@Autowired
private GoblinFrontServiceImpl goblinFrontService;
@GetMapping("getBanner")
@ApiOperation("获取banner")
public ResponseDto getBanner() {
@GetMapping("getTopBanner")
@ApiOperation("获取顶部banner")
public ResponseDto<ArrayList<GoblinFrontBannerVo>> getBanner() {
return ResponseDto.success( goblinFrontService.getListBanner());
}
@GetMapping("getMiddleBanner")
@ApiOperation("获取中部banner")
public ResponseDto<ArrayList<GoblinFrontBannerVo>> getMiddleBanner() {
return ResponseDto.success( goblinFrontService.getMiddleBanner());
}
@GetMapping("getHotWord")
@ApiOperation("获得热词")
public ResponseDto getHotWord() {
public ResponseDto<List<GoblinFrontHotWord>> getHotWord() {
return ResponseDto.success( goblinFrontService.getHotWord() );
}
@GetMapping("getNavigation")
@ApiOperation("获得金刚栏")
public ResponseDto getNavigation() {
public ResponseDto<List<GoblinFrontNavigation>> getNavigation() {
return ResponseDto.success( goblinFrontService.getNavigation() );
}
@GetMapping("getSeckilll")
@ApiOperation("获得秒杀首页要用的")
public ResponseDto getSeckilll() throws ParseException {
public ResponseDto<GoblinFrontSeckillVo> getSeckilll() throws ParseException {
return ResponseDto.success( goblinFrontService.getSeckilll());
}
@GetMapping("getSelectGoods")
@ApiOperation("获得精选商品列表")
public ResponseDto getSelectGoods(@RequestParam(name = "pageSize", required = true) int pageSize, @RequestParam(name = "pageNumber", required = true)int pageNumber) throws ParseException {
@ApiOperation("获得精选商品列表(pageNumber从0开始)")
public ResponseDto<GoblinFrontSelectGoodVo> getSelectGoods(@RequestParam(name = "pageSize", required = true) int pageSize, @RequestParam(name = "pageNumber", required = true)int pageNumber) throws ParseException {
return ResponseDto.success( goblinFrontService.getSelectGoods(pageNumber,pageSize));
}
@GetMapping("getGoodsDetail")
......@@ -68,6 +81,11 @@ public class GoblinFrontController {
public ResponseDto getMoudleIndex() throws ParseException {
return ResponseDto.success( goblinFrontService.getMoudleIndex());
}
@GetMapping("getCube")
@ApiOperation("获取魔方")
public ResponseDto getCube() throws ParseException {
return ResponseDto.success( goblinFrontService.getCube());
}
......
......@@ -32,7 +32,28 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
@Override
public ArrayList<GoblinFrontBannerVo> getListBanner() {
List<GoblinFrontBanner> list= (List<GoblinFrontBanner>) redisUtil.get(GoblinRedisConst.FRONT_BANNER);
List<GoblinFrontBanner> list= (List<GoblinFrontBanner>) redisUtil.get(GoblinRedisConst.FRONT_TOP_BANNER);
LocalDateTime nowTime= LocalDateTime.now();
ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList= ObjectUtil.getGoblinFrontBannerArrayList();
//查看是否有失效的时间
for(GoblinFrontBanner goblinFrontBanner:list){
if(null!=goblinFrontBanner.getEndTime()){
if( nowTime.isAfter(goblinFrontBanner.getEndTime())){
}else{
goblinFrontBannerArrayList.add(goblinFrontBanner);
}
}
}
ArrayList<GoblinFrontBannerVo> list1= ObjectUtil.goblinFrontBannerVoArrayList();
for(GoblinFrontBanner goblinFrontBanner:goblinFrontBannerArrayList){
GoblinFrontBannerVo goblinFrontBannerVo=GoblinFrontBannerVo.getNew();
BeanUtils.copyProperties(goblinFrontBanner,goblinFrontBannerVo);
list1.add(goblinFrontBannerVo);
}
return list1;
}
public ArrayList<GoblinFrontBannerVo> getMiddleBanner() {
List<GoblinFrontBanner> list= (List<GoblinFrontBanner>) redisUtil.get(GoblinRedisConst.FRONT_MIDDLE_BANNER);
LocalDateTime nowTime= LocalDateTime.now();
ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList= ObjectUtil.getGoblinFrontBannerArrayList();
//查看是否有失效的时间
......@@ -205,6 +226,20 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
List<GoblinFrontMoudleIndex> list= (List<GoblinFrontMoudleIndex>) redisUtil.get(GoblinRedisConst.MOUDLE_INDEX);
return list;
}
/***
* @author zhangfuxin
* @Description:获取魔方
* @date 2022/1/10 下午4:49
*/
public GoblinFrontCubeVo getCube(){
GoblinFrontCubeVo goblinFrontCubeVo=GoblinFrontCubeVo.getNew();
List<GoblinFrontCube> list= (List<GoblinFrontCube>) redisUtil.get(GoblinRedisConst.FRONT_GOBLINFRONTCUBE);
if(list.size()>0){
BeanUtils.copyProperties(list.get(0),goblinFrontCubeVo);
}
return goblinFrontCubeVo;
}
/**
* @author zhangfuxin
......@@ -229,14 +264,14 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
goblinFrontSelectGoodVo.setCount(ids.length);
//
ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVoArrayList= ObjectUtil.getGoblinGoodsInfoVos();
for(int i=0;i<end;i++){
for(int i=0;i<=end;i++){
if (i>=start){
GoblinGoodsInfoVo goblinGoodsInfoVo= goblinRedisUtils.getGoodsInfoVo(ids[i]);
goblinGoodsInfoVoArrayList.add(goblinGoodsInfoVo);
}
}
goblinFrontSelectGoodVo.setGoblinGoodsInfoVoList(goblinGoodsInfoVoArrayList);
return goblinFrontSelectGoodVo;
}
return null;
}
......
......@@ -473,7 +473,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
httpData.add("name", redisUtils.getStoreInfoVo(storeOrderVo.getStoreId()).getStoreName());
httpData.add("detail", "查找最初订单");
httpData.add("orderCode", storeOrderVo.getOrderCode());
httpData.add("orderId", storeOrderVo.getOrderId());
// httpData.add("orderId", storeOrderVo.getOrderId());
httpData.add("clientIp", storeOrderVo.getIpAddress());
httpData.add("notifyUrl", synUrl);
httpData.add("createDate", storeOrderVo.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
......@@ -520,7 +520,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
log.debug("SYNC PARAM = " + syncOrderParam.toString());
//支付时间
LocalDateTime now = LocalDateTime.now();
String[] array = syncOrderParam.getOrderCodeId().split(",");
String[] array = redisUtils.getMasterCode(syncOrderParam.getOrderCode());
String uid = "0";
BigDecimal priceActual = BigDecimal.ZERO;
for (String orderId : array) {
......
......@@ -18,8 +18,8 @@ liquidnet:
username: admin
password: admin
config:
# location: /Users/hujiachen/IdeaProjects/liquidnet-bus-v1/liquidnet-bus-config/liquidnet-config
location: /app/support-config
location: /Users/hujiachen/JavaProject/liquidnet-bus-v1/liquidnet-bus-config/liquidnet-config
# location: /app/support-config
# end-dev-这里是配置信息基本值
spring:
......
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