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

Commit 75077bfe authored by 胡佳晨's avatar 胡佳晨

Merge branch 'dev_draw_change' into pre

parents e7360f01 fa41f436
-- 添加积分券 --
ALTER TABLE stone_score_items ADD simple_type tinyint DEFAULT 0 COMMENT '类别(区别于TYPE字段)';
...@@ -2,17 +2,22 @@ package com.liquidnet.service.stone.constant; ...@@ -2,17 +2,22 @@ package com.liquidnet.service.stone.constant;
public class StoneConstant { public class StoneConstant {
//ctx //ctx
private static final String CTX="stone:"; private static final String CTX = "stone:";
//user //user
public static final String USER=CTX.concat("user:"); public static final String USER = CTX.concat("user:");
//item //item
public static final String ITEM=CTX.concat("item:"); public static final String ITEM = CTX.concat("item:");
//logsList 积分日志列表 //logsList 积分日志列表
public static final String LOGS_LIST=ITEM.concat("logs:list:"); public static final String LOGS_LIST = ITEM.concat("logs:list:");
//orderList 积分订单列表 //orderList 积分订单列表
public static final String ORDER_LIST=ITEM.concat("order:list:"); public static final String ORDER_LIST = ITEM.concat("order:list:");
//orderList 积分订单列表 //orderList 积分订单列表
public static final String ORDER_DETAILS=ITEM.concat("order:details:"); public static final String ORDER_DETAILS = ITEM.concat("order:details:");
//商品列表
public static final String ITEM_LIST = ITEM.concat("list");
//商品列表分类
public static final String ITEM_LIST_SIMPLE = ITEM.concat("list:simpleType:");
//剩余库存 //剩余库存
public static final String SURPLUS_GENERAL = ":surplusGeneral"; public static final String SURPLUS_GENERAL = ":surplusGeneral";
......
...@@ -15,6 +15,8 @@ public class StoneItemBuildParam { ...@@ -15,6 +15,8 @@ public class StoneItemBuildParam {
private String itemId; private String itemId;
@ApiModelProperty(required = true, value = "目标类型[1-券|11-商品维度|21-演出维度]", example = "1") @ApiModelProperty(required = true, value = "目标类型[1-券|11-商品维度|21-演出维度]", example = "1")
private Integer type; private Integer type;
@ApiModelProperty(required = false, value = "前端暂定 0为默认值 无条件")
private Integer simpleType;
@NotBlank(message = "目标物品不能为空") @NotBlank(message = "目标物品不能为空")
@ApiModelProperty(value = "目标物品id", example = "1") @ApiModelProperty(value = "目标物品id", example = "1")
private String targetId; private String targetId;
......
...@@ -20,4 +20,6 @@ public class StoneListParam { ...@@ -20,4 +20,6 @@ public class StoneListParam {
*/ */
@ApiModelProperty(required = false, value = "状态[1-券]", example = "1") @ApiModelProperty(required = false, value = "状态[1-券]", example = "1")
private Integer type; private Integer type;
@ApiModelProperty(required = false, value = "前端定义 0位默认值 无条件", example = "0")
private Integer simpleType;
} }
...@@ -21,6 +21,8 @@ public interface IStoneScoreItemsService { ...@@ -21,6 +21,8 @@ public interface IStoneScoreItemsService {
PageInfo<List<StoneItemListVo>> itemList(Integer page, Integer size); PageInfo<List<StoneItemListVo>> itemList(Integer page, Integer size);
PageInfo<List<StoneItemListVo>> itemListSimpleType(Integer simpleType ,Integer page, Integer size);
ResponseDto<StoneScoreItemVo> itemDetails(String itemId); ResponseDto<StoneScoreItemVo> itemDetails(String itemId);
} }
...@@ -39,7 +39,7 @@ public class StoneItemController extends BaseController { ...@@ -39,7 +39,7 @@ public class StoneItemController extends BaseController {
@GetMapping("integralStoreEdit") @GetMapping("integralStoreEdit")
@ApiOperation(value = "积分商品:详情View") @ApiOperation(value = "积分商品:详情View")
public String integralStoreEdit (ModelMap mmap) { public String integralStoreEdit(ModelMap mmap) {
mmap.put("platformUrl", platformUrl); mmap.put("platformUrl", platformUrl);
return prefix + "/integralStoreEdit"; return prefix + "/integralStoreEdit";
} }
...@@ -49,7 +49,7 @@ public class StoneItemController extends BaseController { ...@@ -49,7 +49,7 @@ public class StoneItemController extends BaseController {
@PostMapping("list") @PostMapping("list")
@ResponseBody @ResponseBody
public TableDataInfo list(StoneListParam listParam) { public TableDataInfo list(StoneListParam listParam) {
PageInfo<StoneScoreItems> result = iItemService.itemList(listParam.getTitle(), listParam.getState(), listParam.getType()); PageInfo<StoneScoreItems> result = iItemService.itemList(listParam.getTitle(), listParam.getState(), listParam.getType(), listParam.getSimpleType());
TableDataInfo rspData = new TableDataInfo(); TableDataInfo rspData = new TableDataInfo();
rspData.setCode(0); rspData.setCode(0);
rspData.setRows(result.getList()); rspData.setRows(result.getList());
......
...@@ -58,6 +58,19 @@ ...@@ -58,6 +58,19 @@
var prefix = ctx + "stone/item"; var prefix = ctx + "stone/item";
var prefix2 = ctx; var prefix2 = ctx;
var couType = [[${couType}]]; var couType = [[${couType}]];
var simpleTypeDataList = [{
id: 1,
simpleName: '5元'
}, {
id: 2,
simpleName: '10元'
}, {
id: 3,
simpleName: '25元'
}, {
id: 4,
simpleName: '35元'
}]
$(function () { $(function () {
var options = { var options = {
url: prefix2 + "stone/item/list", url: prefix2 + "stone/item/list",
...@@ -94,6 +107,21 @@ ...@@ -94,6 +107,21 @@
} }
} }
}, },
{
field: 'simpleType',
title: '优惠券分类',
formatter: function(value, row, index) {
if (value == 0) {
return '无条件';
} else {
for (var i in simpleTypeDataList) {
if (simpleTypeDataList[i].id == value) {
return simpleTypeDataList[i].simpleName;
}
}
}
}
},
{ {
field: 'busiType', field: 'busiType',
title: '类型', title: '类型',
......
...@@ -155,6 +155,16 @@ ...@@ -155,6 +155,16 @@
<input type="radio" value="3" name="typeOne"><span>优先购</span> <input type="radio" value="3" name="typeOne"><span>优先购</span>
</div> </div>
</div> </div>
<div class="labelSelect main_type">
<span class="labelName">优惠券分类:</span>
<select name="labelSelect" id="labelSelectType">
<option value="0">请选择优惠券分类</option>
<option value="1">5元</option>
<option value="2">10元</option>
<option value="3">25元</option>
<option value="4">35元</option>
</select>
</div>
<div id="scoreType" class="main_type"> <div id="scoreType" class="main_type">
<span class="labelName"><i class="required">*</i>类别:</span> <span class="labelName"><i class="required">*</i>类别:</span>
<div class="layui-input-block" style="display: flex"> <div class="layui-input-block" style="display: flex">
...@@ -172,7 +182,6 @@ ...@@ -172,7 +182,6 @@
</div> </div>
<div class="main_type"> <div class="main_type">
<span class="labelName"><i class="required">*</i>展示图:</span> <span class="labelName"><i class="required">*</i>展示图:</span>
<div class="layui-input-block" style="display: flex;flex-direction: column;"> <div class="layui-input-block" style="display: flex;flex-direction: column;">
<img id="viewImg" src="" alt="" style="max-height:242px;"> <img id="viewImg" src="" alt="" style="max-height:242px;">
<div class="ibox-content"> <div class="ibox-content">
...@@ -280,7 +289,8 @@ ...@@ -280,7 +289,8 @@
let itemId = ''; // let itemId = ''; //
let selectType = '1' let selectType = '1'
let type = ''; let type = '';
console.log('检测') let simpleType = '';
$(document).ready(function() { $(document).ready(function() {
var $summernote = $('#summernote').summernote({ var $summernote = $('#summernote').summernote({
height: 300, height: 300,
...@@ -367,6 +377,12 @@ ...@@ -367,6 +377,12 @@
$("#startTime").val(data.startTime); $("#startTime").val(data.startTime);
$("input[name='sex'][value='2']").attr("checked", "checked").siblings().removeAttr('checked'); $("input[name='sex'][value='2']").attr("checked", "checked").siblings().removeAttr('checked');
} }
if (data.simpleType == 0) {
$("#labelSelectType").find("option[value='0']").attr("selected",true);
} else {
var simpleTypeData = data.simpleType.toString();
$("#labelSelectType").find("option[value=" + simpleTypeData + "]").attr("selected",true);
}
} }
}) })
} }
...@@ -527,6 +543,7 @@ ...@@ -527,6 +543,7 @@
endTime = $("#endTime").val(); endTime = $("#endTime").val();
} }
} }
let data = { let data = {
details: $('#summernote').summernote('code'), // 商品详情 details: $('#summernote').summernote('code'), // 商品详情
endTime: $.common.dateFormat(endTime, 'yyyy-MM-dd HH:mm:ss'), // 下架时间(status = 2 必传) endTime: $.common.dateFormat(endTime, 'yyyy-MM-dd HH:mm:ss'), // 下架时间(status = 2 必传)
...@@ -539,7 +556,8 @@ ...@@ -539,7 +556,8 @@
startTime: $.common.dateFormat(startTime, 'yyyy-MM-dd HH:mm:ss'), // 上架时间status = 2 必传) startTime: $.common.dateFormat(startTime, 'yyyy-MM-dd HH:mm:ss'), // 上架时间status = 2 必传)
status: Number(shelves), // 上架状态[1-不限|2-定时|7-下线] status: Number(shelves), // 上架状态[1-不限|2-定时|7-下线]
targetId: showId, // 目标物品id targetId: showId, // 目标物品id
targetTitle: $('#searchIpt').val() || $("#searchIptMall").val() // 目标物品标题 targetTitle: $('#searchIpt').val() || $("#searchIptMall").val(), // 目标物品标题
simpleType: $('#labelSelectType option:selected').val()
} }
let type = 'post'; let type = 'post';
if (!itemId) { if (!itemId) {
...@@ -557,7 +575,8 @@ ...@@ -557,7 +575,8 @@
} else { } else {
data['type'] = 11 data['type'] = 11
} }
promiseMethods(ctx+'stone/item',type,data).then(res=>{ promiseMethods(ctx+'stone/item', type, data).then(res => {
console.log(res);
layer.msg('' + res); layer.msg('' + res);
if (res.code != undefined && res.code != web_status.SUCCESS) { if (res.code != undefined && res.code != web_status.SUCCESS) {
$.modal.alertWarning(res.msg); $.modal.alertWarning(res.msg);
......
...@@ -17,7 +17,7 @@ public interface IItemService { ...@@ -17,7 +17,7 @@ public interface IItemService {
* @param type 类型[1-券] * @param type 类型[1-券]
* @return * @return
*/ */
PageInfo<StoneScoreItems> itemList(String title, Integer status, Integer type); PageInfo<StoneScoreItems> itemList(String title, Integer status, Integer type, Integer simpleType);
/** /**
* 修改 积分物品 状态 * 修改 积分物品 状态
......
...@@ -42,7 +42,7 @@ public class ItemServiceImpl implements IItemService { ...@@ -42,7 +42,7 @@ public class ItemServiceImpl implements IItemService {
* @param type 类型[1-券] * @param type 类型[1-券]
* @return * @return
*/ */
public PageInfo<StoneScoreItems> itemList(String title, Integer status, Integer type) { public PageInfo<StoneScoreItems> itemList(String title, Integer status, Integer type, Integer simpleType) {
PageInfo<StoneScoreItems> pageInfo; PageInfo<StoneScoreItems> pageInfo;
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
List<StoneScoreItems> newList = new ArrayList(); List<StoneScoreItems> newList = new ArrayList();
...@@ -65,6 +65,9 @@ public class ItemServiceImpl implements IItemService { ...@@ -65,6 +65,9 @@ public class ItemServiceImpl implements IItemService {
if (type != -1) { if (type != -1) {
queryWrapper.eq(StoneScoreItems::getType, type); queryWrapper.eq(StoneScoreItems::getType, type);
} }
if (simpleType != 0) {
queryWrapper.eq(StoneScoreItems::getSimpleType, simpleType);
}
} }
List<StoneScoreItems> voList = stoneScoreItemsMapper.selectList(queryWrapper); List<StoneScoreItems> voList = stoneScoreItemsMapper.selectList(queryWrapper);
for (StoneScoreItems item : voList) { for (StoneScoreItems item : voList) {
...@@ -155,6 +158,7 @@ public class ItemServiceImpl implements IItemService { ...@@ -155,6 +158,7 @@ public class ItemServiceImpl implements IItemService {
if (count <= 0) { if (count <= 0) {
return "创建失败"; return "创建失败";
} }
redisUtils.delList(param.getSimpleType().toString());
return "创建成功"; return "创建成功";
} }
...@@ -188,6 +192,7 @@ public class ItemServiceImpl implements IItemService { ...@@ -188,6 +192,7 @@ public class ItemServiceImpl implements IItemService {
if (count <= 0) { if (count <= 0) {
return "修改失败"; return "修改失败";
} }
redisUtils.delList(param.getSimpleType().toString());
return "修改成功"; return "修改成功";
} }
...@@ -202,6 +207,7 @@ public class ItemServiceImpl implements IItemService { ...@@ -202,6 +207,7 @@ public class ItemServiceImpl implements IItemService {
data.setTargetId(param.getTargetId()); data.setTargetId(param.getTargetId());
data.setTargetTitle(param.getTargetTitle()); data.setTargetTitle(param.getTargetTitle());
data.setType(param.getType()); data.setType(param.getType());
data.setSimpleType(param.getSimpleType());
data.setImg(param.getImg()); data.setImg(param.getImg());
data.setScore(param.getScore()); data.setScore(param.getScore());
data.setPrice(BigDecimal.ZERO); data.setPrice(BigDecimal.ZERO);
......
...@@ -102,4 +102,16 @@ public class StoneRedisUtils { ...@@ -102,4 +102,16 @@ public class StoneRedisUtils {
} }
} }
/**
* 删除 积分商品列表缓存
*
* @param simpleType
*/
public void delList(String simpleType) {
String redisKey = StoneConstant.ITEM_LIST;
String redisSimpleKey = StoneConstant.ITEM_LIST_SIMPLE.concat(simpleType);
redisDataSourceUtil.getRedisStoneUtil().del(redisKey);
redisDataSourceUtil.getRedisStoneUtil().del(redisSimpleKey);
}
} }
...@@ -44,11 +44,11 @@ liquidnet: ...@@ -44,11 +44,11 @@ liquidnet:
port: 6379 port: 6379
password: 3Xa%8p password: 3Xa%8p
sweet: sweet:
dbs: 0,16 dbs: 0,256
database: 15 database: 255
host: 39.107.71.112 host: r-2ze7002ckw5u75fgukpd.redis.rds.aliyuncs.com
port: 6379 port: 6380
password: 3Xa%8p password: PO@B!Iud32
adam: adam:
dbs: 0,16 dbs: 0,16
database: 15 database: 15
......
...@@ -16,7 +16,7 @@ liquidnet: ...@@ -16,7 +16,7 @@ liquidnet:
pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level: debug level: debug
mysql: mysql:
database-name: dev_ln_scene database-name: test_ln_scene
mongodb: mongodb:
sslEnabled: false sslEnabled: false
database: dev_ln_scene database: test_ln_scene
...@@ -90,6 +90,11 @@ public class StoneScoreItems implements Serializable { ...@@ -90,6 +90,11 @@ public class StoneScoreItems implements Serializable {
*/ */
private Integer status; private Integer status;
/**
* 类别(区别于TYPE字段)
*/
private Integer simpleType;
/** /**
* 定时上架-时间 * 定时上架-时间
*/ */
......
...@@ -31,6 +31,13 @@ public class StoneItemController { ...@@ -31,6 +31,13 @@ public class StoneItemController {
return ResponseDto.success(stoneScoreItemsService.itemList(page, 40)); return ResponseDto.success(stoneScoreItemsService.itemList(page, 40));
} }
@GetMapping("list/simpleType")
@ApiOperation("积分商品列表(simpleType)")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PageInfo<List<StoneItemListVo>>> itemListSimpleType(@RequestParam("page") @Valid Integer page, @RequestParam("simpleType") @Valid Integer simpleType) {
return ResponseDto.success(stoneScoreItemsService.itemListSimpleType(simpleType, page, 1000));
}
@GetMapping("details") @GetMapping("details")
@ApiOperation("积分商品详情") @ApiOperation("积分商品详情")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
......
...@@ -46,15 +46,57 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService { ...@@ -46,15 +46,57 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService {
page = 1; page = 1;
} }
List<StoneScoreItems> voList; List<StoneScoreItems> voList;
HashMap<String, Object> info = mongoUtils.itemListPage(page, size); long count;
if (page == 1) {
voList = redisUtils.getList();
count = voList.size();
} else {
HashMap<String, Object> info = mongoUtils.itemListPage(page, size, null);
try { try {
voList = (List<StoneScoreItems>) info.get("data"); voList = (List<StoneScoreItems>) info.get("data");
} catch (Exception e) { } catch (Exception e) {
voList = new ArrayList(); voList = new ArrayList();
e.printStackTrace(); e.printStackTrace();
} }
long count = (long) info.get("total"); count = 40 + (long) info.get("total");
}
List<StoneItemListVo> returnVoList = ObjectUtils.getStoneItemListVoArrayList();
for (int i = 0; i < voList.size(); i++) {
StoneScoreItems vo = voList.get(i);
StoneItemListVo returnVo = StoneItemListVo.getNew().copy(vo);
returnVoList.add(returnVo);
}
mPageInfo = new PageInfo(returnVoList);
mPageInfo.setTotal(count);
log.info(UserPathDto.setData("积分商品列表", "", voList));
return mPageInfo;
}
@Override
public PageInfo<List<StoneItemListVo>> itemListSimpleType(Integer simpleType, Integer page, Integer size) {
PageInfo<List<StoneItemListVo>> mPageInfo;
size = 40;
if (page == null || page == 1 || page == 0) {
page = 1;
}
List<StoneScoreItems> voList;
long count;
if (page == 1) {
voList = redisUtils.getListSimple(simpleType);
count = voList.size();
} else {
HashMap<String, Object> info = mongoUtils.itemListPage(page, size, simpleType);
try {
voList = (List<StoneScoreItems>) info.get("data");
} catch (Exception e) {
voList = new ArrayList();
e.printStackTrace();
}
count = 40 + (long) info.get("total");
}
List<StoneItemListVo> returnVoList = ObjectUtils.getStoneItemListVoArrayList(); List<StoneItemListVo> returnVoList = ObjectUtils.getStoneItemListVoArrayList();
for (int i = 0; i < voList.size(); i++) { for (int i = 0; i < voList.size(); i++) {
...@@ -99,7 +141,7 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService { ...@@ -99,7 +141,7 @@ public class StoneScoreItemsServiceImpl implements IStoneScoreItemsService {
} else { } else {
limitStatus = 1; limitStatus = 1;
} }
StoneScoreItemVo vo = StoneScoreItemVo.getNew().copy(data,scoreStatus,limitStatus); StoneScoreItemVo vo = StoneScoreItemVo.getNew().copy(data, scoreStatus, limitStatus);
return ResponseDto.success(vo); return ResponseDto.success(vo);
} }
} }
...@@ -46,13 +46,17 @@ public class StoneMongoUtils { ...@@ -46,13 +46,17 @@ public class StoneMongoUtils {
* *
* @return * @return
*/ */
public HashMap<String, Object> itemListPage(int page, int size) { public HashMap<String, Object> itemListPage(int page, int size, Integer simpleType) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
HashMap<String, Object> info = CollectionUtil.mapStringObject(); HashMap<String, Object> info = CollectionUtil.mapStringObject();
// 排序 分页 // 排序 分页
Pageable pageable = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "createdAt")); Pageable pageable = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "createdAt"));
//条件 //条件
Query query = Query.query(new Criteria().orOperator(Criteria.where("status").is(1),Criteria.where("status").is(2).and("startTime").lte(now).and("endTime").gte(now))); Criteria criteria = new Criteria().orOperator(Criteria.where("status").is(1), Criteria.where("status").is(2).and("startTime").lte(now).and("endTime").gte(now));
if (simpleType != null) {
criteria = criteria.and("simpleType").is(simpleType);
}
Query query = Query.query(criteria);
// 查询总数 // 查询总数
long count = mongoTemplate.count(query, StoneScoreItems.class, StoneScoreItems.class.getSimpleName()); long count = mongoTemplate.count(query, StoneScoreItems.class, StoneScoreItems.class.getSimpleName());
query.with(pageable); query.with(pageable);
...@@ -80,7 +84,7 @@ public class StoneMongoUtils { ...@@ -80,7 +84,7 @@ public class StoneMongoUtils {
*/ */
public StoneUserVo userGet(String uid) { public StoneUserVo userGet(String uid) {
Query query = Query.query(Criteria.where("uid").is(uid)); Query query = Query.query(Criteria.where("uid").is(uid));
StoneUserVo vo = mongoTemplate.findOne(query, StoneUserVo.class,StoneUserVo.class.getSimpleName()); StoneUserVo vo = mongoTemplate.findOne(query, StoneUserVo.class, StoneUserVo.class.getSimpleName());
return vo; return vo;
} }
...@@ -109,12 +113,13 @@ public class StoneMongoUtils { ...@@ -109,12 +113,13 @@ public class StoneMongoUtils {
/** /**
* 获取 用户积分日志 列表 * 获取 用户积分日志 列表
*
* @param uid * @param uid
* @param page * @param page
* @param size * @param size
* @return * @return
*/ */
public HashMap<String, Object> logList(String uid,int page, int size) { public HashMap<String, Object> logList(String uid, int page, int size) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
HashMap<String, Object> info = CollectionUtil.mapStringObject(); HashMap<String, Object> info = CollectionUtil.mapStringObject();
// 排序 分页 // 排序 分页
...@@ -143,12 +148,13 @@ public class StoneMongoUtils { ...@@ -143,12 +148,13 @@ public class StoneMongoUtils {
/** /**
* 获取 用户订单 列表 * 获取 用户订单 列表
*
* @param uid * @param uid
* @param page * @param page
* @param size * @param size
* @return * @return
*/ */
public HashMap<String, Object> orderList(String uid,int page, int size) { public HashMap<String, Object> orderList(String uid, int page, int size) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
HashMap<String, Object> info = CollectionUtil.mapStringObject(); HashMap<String, Object> info = CollectionUtil.mapStringObject();
// 排序 分页 // 排序 分页
......
...@@ -9,6 +9,7 @@ import com.liquidnet.service.stone.vo.StoneUserVo; ...@@ -9,6 +9,7 @@ import com.liquidnet.service.stone.vo.StoneUserVo;
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 java.util.ArrayList;
import java.util.List; import java.util.List;
@Component @Component
...@@ -19,6 +20,39 @@ public class StoneRedisUtils { ...@@ -19,6 +20,39 @@ public class StoneRedisUtils {
@Autowired @Autowired
private StoneMongoUtils mongoUtils; private StoneMongoUtils mongoUtils;
public List<StoneScoreItems> getList() {
try {
String redisKey = StoneConstant.ITEM_LIST;
Object obj = redisUtil.get(redisKey);
if (obj == null) {
List<StoneScoreItems> list = (List<StoneScoreItems>) mongoUtils.itemListPage(1, 40, null).get("data");
redisUtil.set(redisKey, list);
return list;
} else {
return (List<StoneScoreItems>) obj;
}
}catch (Exception e){
return new ArrayList();
}
}
public List<StoneScoreItems> getListSimple(Integer simpleType) {
try {
String redisKey = StoneConstant.ITEM_LIST_SIMPLE.concat(simpleType.toString());
Object obj = redisUtil.get(redisKey);
if (obj == null) {
List<StoneScoreItems> list = (List<StoneScoreItems>) mongoUtils.itemListPage(1, 40, simpleType).get("data");
redisUtil.set(redisKey, list);
return list;
} else {
return (List<StoneScoreItems>) obj;
}
}catch (Exception e){
return new ArrayList();
}
}
/** /**
* 获取 积分物品 剩余库存 * 获取 积分物品 剩余库存
* *
...@@ -202,7 +236,7 @@ public class StoneRedisUtils { ...@@ -202,7 +236,7 @@ public class StoneRedisUtils {
Object obj = redisUtil.get(redisKey); Object obj = redisUtil.get(redisKey);
if (obj == null) { if (obj == null) {
List<StoneScoreLogs> getLogsList = (List<StoneScoreLogs>) mongoUtils.logList(uid, 1, 40).get("data"); List<StoneScoreLogs> getLogsList = (List<StoneScoreLogs>) mongoUtils.logList(uid, 1, 40).get("data");
redisUtil.set(redisKey,getLogsList); redisUtil.set(redisKey, getLogsList);
return getLogsList; return getLogsList;
} else { } else {
return (List<StoneScoreLogs>) obj; return (List<StoneScoreLogs>) obj;
...@@ -314,12 +348,12 @@ public class StoneRedisUtils { ...@@ -314,12 +348,12 @@ public class StoneRedisUtils {
} }
public boolean lockUid(String uid){ public boolean lockUid(String uid) {
String redisKey = StoneConstant.LOCK.concat(uid); String redisKey = StoneConstant.LOCK.concat(uid);
return redisUtil.lock(uid,1,1); return redisUtil.lock(uid, 1, 1);
} }
public void unLockUid(String uid){ public void unLockUid(String uid) {
String redisKey = StoneConstant.LOCK.concat(uid); String redisKey = StoneConstant.LOCK.concat(uid);
redisUtil.uLock(redisKey); redisUtil.uLock(redisKey);
} }
......
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