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

Commit 7d7e257a authored by 胡佳晨's avatar 胡佳晨

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

parents cdee87ec 3b100546
...@@ -6,7 +6,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport; ...@@ -6,7 +6,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.common.exception.constant.ErrorCode; import com.liquidnet.common.exception.constant.ErrorCode;
import com.liquidnet.commons.lang.util.CollectionUtil; 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.DateUtil;
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;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
...@@ -78,11 +77,11 @@ public class GoblinStoreMgtGoodsController { ...@@ -78,11 +77,11 @@ public class GoblinStoreMgtGoodsController {
} }
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation(value = "SPU导出") @ApiOperation(value = "SPU导出", notes = "#以POST模拟FORM表单请求该接口")
@PostMapping("export") @PostMapping("export")
public void export(@Valid @RequestBody GoblinStoreMgtGoodsFilterParam storeMgtGoodsFilterParam, public void export(@Valid GoblinStoreMgtGoodsFilterParam storeMgtGoodsFilterParam, HttpServletResponse response) {
HttpServletResponse response) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
try {
List<String> storeIds = goblinRedisUtils.getStoreIds(currentUid); List<String> storeIds = goblinRedisUtils.getStoreIds(currentUid);
String storeId = storeMgtGoodsFilterParam.getStoreId(); String storeId = storeMgtGoodsFilterParam.getStoreId();
boolean storeIdIsBlank = StringUtils.isBlank(storeId); boolean storeIdIsBlank = StringUtils.isBlank(storeId);
...@@ -102,18 +101,17 @@ public class GoblinStoreMgtGoodsController { ...@@ -102,18 +101,17 @@ public class GoblinStoreMgtGoodsController {
storeMgtGoodsFilterParam.setPageSize(2000); storeMgtGoodsFilterParam.setPageSize(2000);
PagedResult<GoblinStoreMgtGoodsListVo> pagedResult = goblinstoreMgtGoodsService.goodsList(storeMgtGoodsFilterParam); PagedResult<GoblinStoreMgtGoodsListVo> pagedResult = goblinstoreMgtGoodsService.goodsList(storeMgtGoodsFilterParam);
List<GoblinStoreMgtGoodsListVo> rows = pagedResult.getList(); List<GoblinStoreMgtGoodsListVo> rows = pagedResult.getList();
ArrayList<GoblinStoreMgtGoodsListVoExcel> rowsToExcels = ObjectUtil.getGoblinStoreMgtGoodsListVoExcelArrayList(); List<GoblinStoreMgtGoodsListVoExcel> rowsToExcels = ObjectUtil.getGoblinStoreMgtGoodsListVoExcelArrayList();
rows.forEach(row -> rowsToExcels.add(GoblinStoreMgtGoodsListVoExcel.getNew().copy(row))); rows.forEach(row -> rowsToExcels.add(GoblinStoreMgtGoodsListVoExcel.getNew().copy(row)));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
String fileName = "商品数据" + DateUtil.Formatter.yyyyMMddHHmmssTrim.format(LocalDateTime.now()); String fileName = URLEncoder.encode("商品数据", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
try { EasyExcel.write(response.getOutputStream(), GoblinStoreMgtGoodsListVoExcel.class).sheet("SPU").doWrite(rowsToExcels);
EasyExcel.write(response.getOutputStream()).sheet("SPU").doWrite(rows);
} catch (IOException e) { } catch (IOException e) {
log.error("商品管理:SPU导出:异常[UID={},storeId={},ex.msg={}]", currentUid, storeId, e.getLocalizedMessage()); log.error("商品管理:SPU导出:异常[UID={},ex.msg={}]", currentUid, e.getLocalizedMessage());
} }
} }
......
...@@ -61,7 +61,9 @@ public class GoblinStoreMgtGoodsListVoExcel implements Serializable, Cloneable { ...@@ -61,7 +61,9 @@ public class GoblinStoreMgtGoodsListVoExcel implements Serializable, Cloneable {
this.setSpuNo(source.getSpuNo()); this.setSpuNo(source.getSpuNo());
this.setCoverPic(source.getCoverPic()); this.setCoverPic(source.getCoverPic());
this.setName(source.getName()); this.setName(source.getName());
this.setCateMerge(source.getCateFid() + "/" + source.getCateSid() + "/" + source.getCateTid()); this.setCateMerge(StringUtils.defaultString(source.getCateFid(), "") + "/"
+ StringUtils.defaultString(source.getCateSid(), "") + "/"
+ StringUtils.defaultString(source.getCateTid(), ""));
this.setPriceRange("¥" + source.getPriceGe().toString() + " - ¥" + source.getPriceLe().toString()); this.setPriceRange("¥" + source.getPriceGe().toString() + " - ¥" + source.getPriceLe().toString());
switch (source.getShelvesStatus()) { switch (source.getShelvesStatus()) {
case "0": case "0":
......
...@@ -109,12 +109,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -109,12 +109,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
@Override @Override
public GoblinFrontHotWord getHotWord() { public GoblinFrontHotWord getHotWord() {
if(!redisUtil.hasKey(GoblinRedisConst.FRONT_HOTWORD)){ List<GoblinFrontHotWord> list=goblinRedisUtils.getHotWord();
return null;
}
// int index= (int) redisUtil.get(GoblinRedisConst.FRONT_HOTWORD_INDEX); // int index= (int) redisUtil.get(GoblinRedisConst.FRONT_HOTWORD_INDEX);
//获得value //获得value
List<GoblinFrontHotWord> list= (List<GoblinFrontHotWord>) redisUtil.get(GoblinRedisConst.FRONT_HOTWORD);
/* index++; /* index++;
String hotWord=""; String hotWord="";
redisUtil.set(GoblinRedisConst.FRONT_HOTWORD_INDEX,index); redisUtil.set(GoblinRedisConst.FRONT_HOTWORD_INDEX,index);
......
...@@ -10,6 +10,7 @@ import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo; ...@@ -10,6 +10,7 @@ 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.liquidnet.service.goblin.entity.GoblinFrontBanner; import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import com.mongodb.client.model.UpdateOneModel; import com.mongodb.client.model.UpdateOneModel;
import com.mongodb.client.model.WriteModel; import com.mongodb.client.model.WriteModel;
...@@ -896,4 +897,9 @@ public class GoblinMongoUtils { ...@@ -896,4 +897,9 @@ public class GoblinMongoUtils {
GoblinFrontBanner.class, GoblinFrontBanner.class.getSimpleName()); GoblinFrontBanner.class, GoblinFrontBanner.class.getSimpleName());
} }
public List<GoblinFrontHotWord> getHotWord() {
Query query = Query.query(Criteria.where("delTag").is(0));
return mongoTemplate.find(query,
GoblinFrontHotWord.class, GoblinFrontHotWord.class.getSimpleName());
}
} }
...@@ -9,6 +9,7 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst; ...@@ -9,6 +9,7 @@ import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo; import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner; import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
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;
...@@ -884,6 +885,15 @@ public class GoblinRedisUtils { ...@@ -884,6 +885,15 @@ public class GoblinRedisUtils {
} }
return vo; return vo;
} }
// 热词降级
public List<GoblinFrontHotWord> getHotWord() {
List<GoblinFrontHotWord> vo= (List<GoblinFrontHotWord>) redisUtil.get(GoblinRedisConst.FRONT_HOTWORD);
if (null == vo ) {
//降级
return goblinMongoUtils.getHotWord();
}
return vo;
}
} }
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