订单支持更多状态

This commit is contained in:
1304317391@qq.com
2022-11-29 15:44:17 +08:00
parent c509e75d4c
commit d9a489d99d
8 changed files with 84 additions and 23 deletions
@@ -93,10 +93,26 @@ public class AppStoreBargainController {
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
@ApiOperation(value = "砍价产品列表",notes = "砍价产品列表")
public ApiResult<Map<String,List<YxStoreBargainQueryVo>>> getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page,
public ApiResult<List<YxStoreBargainQueryVo>> getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit){
return ApiResult.ok(storeBargainService.getList(page, limit));
}
/**
* 当前用户参加的砍价活动的列表
*/
@GetMapping("/bargainUser/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
@ApiOperation(value = "当前用户参加的砍价活动的列表",notes = "当前用户参加的砍价活动的列表")
public ApiResult<List<YxStoreBargainQueryVo>> getYxStoreBargainIngList(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit){
return ApiResult.ok(storeBargainService.getUserBargainList(page, limit));
}
/**
* 砍价详情
*/
@@ -35,7 +35,7 @@ public class IndexVo implements Serializable {
private List<HotListDTO> hotListDTOS;
@ApiModelProperty("首页需要的砍价列表")
private Map<String,List<YxStoreBargainQueryVo>> bargainList;
private List<YxStoreBargainQueryVo> bargainList;
@ApiModelProperty("首页秒杀配置")
private SeckillConfigVo seckillConfigVo;
@@ -91,9 +91,17 @@ public interface YxStoreBargainService extends BaseService<YxStoreBargain>{
* @param limit limit
* @return List
*/
Map<String,List<YxStoreBargainQueryVo>> getList(int page, int limit);
List<YxStoreBargainQueryVo>getList(int page, int limit);
/**
* 获取用户参加中的砍价商品列表
* @param page page
* @param limit limit
* @return List
*/
List<YxStoreBargainQueryVo> getUserBargainList(int page, int limit);
// List<YxStoreBargainQueryVo> getUserBargainList(int page, int limit);
/**
* 查询数据分页
* @param criteria 条件
@@ -124,4 +132,5 @@ public interface YxStoreBargainService extends BaseService<YxStoreBargain>{
void deleteBargainImg(String id);
}
@@ -30,6 +30,9 @@ public class YxStoreBargainDto implements Serializable {
/** 砍价活动图片 */
private String image;
/** 砍价活动图片 */
private String linkImage;
/** 单位名称 */
private String unitName;
@@ -349,6 +349,33 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
.build();
}
@Override
public List<YxStoreBargainQueryVo> getUserBargainList(int page, int limit) {
Map<String,List<YxStoreBargainQueryVo>> map=new HashMap<>();
Page<YxStoreBargain> pageModel = new Page<>(page, limit);
LambdaQueryWrapper<YxStoreBargain> wrapper = new LambdaQueryWrapper<>();
Date nowTime = new Date();
wrapper.eq(YxStoreBargain::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
.lt(YxStoreBargain::getStartTime,nowTime)
.gt(YxStoreBargain::getStopTime,nowTime);
List<YxStoreBargainQueryVo> yxStoreBargainQueryVos = generator.convert(
yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(),
YxStoreBargainQueryVo.class);
long uid = LocalUser.getUidByToken();
List<YxStoreBargainQueryVo> isParticipation=new ArrayList<>();
yxStoreBargainQueryVos.forEach(item->{
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(), OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
item.setIsParticipation(storeBargainUserService.getUserIsParticipation(uid, item.getId()));
if (item.getIsParticipation()){
isParticipation.add(item);
}
});
return isParticipation;
}
/**
* 获取砍价商品列表
* @param page page
@@ -356,8 +383,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
* @return List
*/
@Override
public Map<String,List<YxStoreBargainQueryVo>> getList(int page, int limit) {
Map<String,List<YxStoreBargainQueryVo>> map=new HashMap<>();
public List<YxStoreBargainQueryVo> getList(int page, int limit) {
Page<YxStoreBargain> pageModel = new Page<>(page, limit);
LambdaQueryWrapper<YxStoreBargain> wrapper = new LambdaQueryWrapper<>();
Date nowTime = new Date();
@@ -369,21 +395,22 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(),
YxStoreBargainQueryVo.class);
long uid = LocalUser.getUidByToken();
List<YxStoreBargainQueryVo> isParticipation=new ArrayList<>();
List<YxStoreBargainQueryVo> isNotParticipation=new ArrayList<>();
// List<YxStoreBargainQueryVo> isParticipation=new ArrayList<>();
// List<YxStoreBargainQueryVo> isNotParticipation=new ArrayList<>();
yxStoreBargainQueryVos.forEach(item->{
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(), OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
item.setIsParticipation(storeBargainUserService.getUserIsParticipation(uid, item.getId()));
if (item.getIsParticipation()){
isParticipation.add(item);
}else {
isNotParticipation.add(item);
}
// if (item.getIsParticipation()){
// isParticipation.add(item);
// }else {
// isNotParticipation.add(item);
// }
});
map.put("yxStoreBargainQueryVos",yxStoreBargainQueryVos);
map.put("isParticipation",isParticipation);
map.put("isNotParticipation",isNotParticipation);
return map;
// map.put("yxStoreBargainQueryVos",yxStoreBargainQueryVos);
// map.put("isParticipation",isParticipation);
// map.put("isNotParticipation",isNotParticipation);
// return map;
return yxStoreBargainQueryVos;
}
/**
@@ -394,8 +394,12 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
YxStoreSeckillQueryVo.class);
yxStoreSeckillQueryVos.forEach(item->{
Integer sum = item.getSales() + item.getStock();
item.setPercent(NumberUtil.round(NumberUtil.mul(NumberUtil.div(item.getSales(),sum),
100),0).intValue());
if(sum==0){
item.setPercent(100);
}else{
item.setPercent(NumberUtil.round(NumberUtil.mul(NumberUtil.div(item.getSales(),sum),
100),0).intValue());
}
});
return yxStoreSeckillQueryVos;
}
@@ -179,8 +179,10 @@ public class OrderUtil {
if (paid == 0 && status == 0) {
statusName = "未支付";
} else if (paid == 1 && status == 0 && shipping_type == 1 && refund_status == 0) {
statusName = "发货";
} else if (paid == 1 && status == 0 && shipping_type == 2 && refund_status == 0) {
statusName = "审核";
}else if (paid == 1 && status == 5 && shipping_type == 1 && refund_status == 0) {
statusName = "未发货";
} else if (paid == 1 && status == 0 && shipping_type == 2 && refund_status == 0) {
statusName = "未核销";
} else if (paid == 1 && status == 1 && shipping_type == 1 && refund_status == 0) {
statusName = "待收货";
@@ -209,7 +211,7 @@ public class OrderUtil {
* @return
*/
public static int orderStatus(int paid, int status, int refund_status) {
//todo 1-未付款 2-(已付款但未审核)未发货 3-退款中 4-待收货 5-待评价 6-已完成 7-已退款 8-审核通过未发货
//todo 1-未付款 2-(已付款但未审核)待审核 3-退款中 4-待收货 5-待评价 6-已完成 7-已退款 8-审核通过未发货
int _status = 0;
if (paid == 0 && status == 0 && refund_status == 0) {