Browse Source

商品增加无理由退款等配置

zyj
sj 2 years ago
parent
commit
44110bd059
  1. 2
      yudao-server/src/main/resources/application-local.yaml
  2. 8
      zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java
  3. 3
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/dto/SeckillTimeDto.java
  4. 18
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java
  5. 2
      zsw-bxg/src/main/java/co/yixiang/modules/expert/domain/YxStoreExpert.java
  6. 26
      zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java
  7. 3
      zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java
  8. 18
      zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProductConfig.java
  9. 1
      zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java
  10. 9
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java
  11. 4
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java
  12. 3
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java
  13. 6
      zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java

2
yudao-server/src/main/resources/application-local.yaml

@ -244,7 +244,7 @@ dubbo:
bxg: bxg:
shop: shop:
# API_URL: http://192.168.10.113:48080/bxgApp # API_URL: http://192.168.10.113:48080/bxgApp
API_URL: https://d305-27-19-79-51.jp.ngrok.io API_URL: https://c522-27-19-79-200.jp.ngrok.io
SITE_URL: http://192.168.10.113:48080/bxgApp SITE_URL: http://192.168.10.113:48080/bxgApp
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
ADMIN_API_URL: http://192.168.10.113:48080/bxg ADMIN_API_URL: http://192.168.10.113:48080/bxg

8
zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java

@ -119,6 +119,10 @@ public class AppStoreSeckillController {
JSONObject jsonObject = JSON.parseObject(jsonStr); JSONObject jsonObject = JSON.parseObject(jsonStr);
int time = Integer.valueOf(jsonObject.get("time").toString());//时间 5 int time = Integer.valueOf(jsonObject.get("time").toString());//时间 5
int continued = Integer.valueOf(jsonObject.get("continued").toString());//活动持续事件 3 int continued = Integer.valueOf(jsonObject.get("continued").toString());//活动持续事件 3
String rule="";
if (jsonObject.get("rule")!=null){
rule=jsonObject.get("rule").toString();
}
SimpleDateFormat sdf = new SimpleDateFormat("HH"); SimpleDateFormat sdf = new SimpleDateFormat("HH");
String nowTime = sdf.format(new Date()); String nowTime = sdf.format(new Date());
String index = nowTime.substring(0, 1); String index = nowTime.substring(0, 1);
@ -131,23 +135,27 @@ public class AppStoreSeckillController {
seckillTimeDto.setState("即将开始"); seckillTimeDto.setState("即将开始");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(2); seckillTimeDto.setStatus(2);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(today + activityEndHour * 3600); seckillTimeDto.setStop(today + activityEndHour * 3600);
} else { } else {
if (currentHour >= time && currentHour < activityEndHour) { if (currentHour >= time && currentHour < activityEndHour) {
seckillTimeDto.setState("抢购中"); seckillTimeDto.setState("抢购中");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(1); seckillTimeDto.setStatus(1);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(today + activityEndHour * 3600); seckillTimeDto.setStop(today + activityEndHour * 3600);
seckillTimeIndex.set(yxSystemGroupDataList.indexOf(i)); seckillTimeIndex.set(yxSystemGroupDataList.indexOf(i));
} else if (currentHour < time) { } else if (currentHour < time) {
seckillTimeDto.setState("即将开始"); seckillTimeDto.setState("即将开始");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(2); seckillTimeDto.setStatus(2);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(OrderUtil.dateToTimestamp(new Date()) + activityEndHour * 3600); seckillTimeDto.setStop(OrderUtil.dateToTimestamp(new Date()) + activityEndHour * 3600);
} else if (currentHour >= activityEndHour) { } else if (currentHour >= activityEndHour) {
seckillTimeDto.setState("已结束"); seckillTimeDto.setState("已结束");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00"); seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(0); seckillTimeDto.setStatus(0);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(today + activityEndHour * 3600); seckillTimeDto.setStop(today + activityEndHour * 3600);
} }
} }

3
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/dto/SeckillTimeDto.java

@ -22,6 +22,9 @@ public class SeckillTimeDto {
@ApiModelProperty(value = "秒杀产品状态") @ApiModelProperty(value = "秒杀产品状态")
private Integer status; private Integer status;
@ApiModelProperty(value = "秒杀规则")
private String rule;
@ApiModelProperty(value = "秒杀产品停止时间") @ApiModelProperty(value = "秒杀产品停止时间")
private Integer stop; private Integer stop;
} }

18
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java

@ -82,9 +82,11 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
.eq(YxStoreProduct::getId, yxEvaluation.getProduct()); .eq(YxStoreProduct::getId, yxEvaluation.getProduct());
YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper); YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
if (ObjectUtil.isNull(storeProduct)) { if (ObjectUtil.isNull(storeProduct)) {
throw new ErrorRequestException("商品不存在或已下架"); // throw new ErrorRequestException("商品不存在或已下架");
yxEvaluation.setProduct(JSONUtil.toJsonStr(new YxStoreProduct()));
}else {
yxEvaluation.setProduct(JSONUtil.toJsonStr(storeProduct));
} }
yxEvaluation.setProduct(JSONUtil.toJsonStr(storeProduct));
}); });
return generator.convertPageInfo(page,YxEvaluationDto.class); return generator.convertPageInfo(page,YxEvaluationDto.class);
} }
@ -135,8 +137,16 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
.orderByAsc(YxEvaluation::getSort); .orderByAsc(YxEvaluation::getSort);
List<EvaluationDTO> list = generator.convert(baseMapper.selectList(wrapper),EvaluationDTO.class); List<EvaluationDTO> list = generator.convert(baseMapper.selectList(wrapper),EvaluationDTO.class);
list.forEach(evaluationDTO->{ list.forEach(evaluationDTO->{
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(evaluationDTO.getProduct())); LambdaQueryWrapper<YxStoreProduct> wrapper1 = new LambdaQueryWrapper<>();
evaluationDTO.setProductInfo(yxStoreProduct); wrapper1.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.eq(YxStoreProduct::getId, evaluationDTO.getProduct());
YxStoreProduct yxStoreProduct = storeProductMapper.selectOne(wrapper1);
//这里需要有一个非空判断
if (ObjectUtil.isNotNull(yxStoreProduct)){
evaluationDTO.setProductInfo(yxStoreProduct);
}else{
evaluationDTO.setProductInfo(new YxStoreProduct().setStoreName("该评测商品已删除或已下架"));
}
}); });
return list; return list;
} }

2
zsw-bxg/src/main/java/co/yixiang/modules/expert/domain/YxStoreExpert.java

@ -61,7 +61,7 @@ public class YxStoreExpert implements Serializable {
/** 专家所属单位 */ /** 专家所属单位 */
@NotBlank // @NotBlank
private String expertUnit; private String expertUnit;

26
zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java

@ -8,6 +8,9 @@
*/ */
package co.yixiang.modules.hotList.service.impl; package co.yixiang.modules.hotList.service.impl;
import cn.hutool.core.util.ObjectUtil;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.service.impl.BaseServiceImpl;
@ -54,16 +57,13 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
private final IGenerator generator; private final IGenerator generator;
private final YxStoreProductService yxStoreProductService; private final YxStoreProductService yxStoreProductService;
private final StoreProductMapper storeProductMapper;
@SneakyThrows @SneakyThrows
@Override @Override
//@Cacheable //@Cacheable
public PageResult<YxStoreHotListVo> queryAll(YxStoreHotListQueryCriteria criteria, Pageable pageable) { public PageResult<YxStoreHotListVo> queryAll(YxStoreHotListQueryCriteria criteria, Pageable pageable) {
getPage(pageable); getPage(pageable);
PageInfo<YxStoreHotList> page = new PageInfo<>(queryAll(criteria)); PageInfo<YxStoreHotList> page = new PageInfo<>(queryAll(criteria));
// PageInfo<YxStoreHotListVo> page1 = new PageInfo<>();
// BeanUtils.copyProperties(page,page1);
// BeanUtilsBean.getInstance().copyProperties(page1, page);
page.getList().forEach(hotList->{ page.getList().forEach(hotList->{
List<Integer> productArr = JSONUtil.toList(hotList.getProductList(), Integer.class); List<Integer> productArr = JSONUtil.toList(hotList.getProductList(), Integer.class);
List<YxStoreProduct> list1 =new ArrayList<>(); List<YxStoreProduct> list1 =new ArrayList<>();
@ -72,8 +72,11 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.eq(YxStoreProduct::getId, productId); .eq(YxStoreProduct::getId, productId);
//这里需要有一个非空判断 //这里需要有一个非空判断
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(productId)); YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
list1.add(yxStoreProduct); // YxStoreProduct storeProduct=storeProductMapper.selectById(productId);
if (ObjectUtil.isNotNull(storeProduct)){
list1.add(storeProduct);
}
}); });
hotList.setProductList(JSONUtil.toJsonStr(list1)); hotList.setProductList(JSONUtil.toJsonStr(list1));
// hotList.setProductInfo(list1); // hotList.setProductInfo(list1);
@ -117,9 +120,14 @@ public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMap
List<Integer> productArr = JSONUtil.toList(hotListDto.getProductList(), Integer.class); List<Integer> productArr = JSONUtil.toList(hotListDto.getProductList(), Integer.class);
List<YxStoreProduct> list1 =new ArrayList<>(); List<YxStoreProduct> list1 =new ArrayList<>();
productArr.forEach(productId->{ productArr.forEach(productId->{
//这里需要有一个非空判断 LambdaQueryWrapper<YxStoreProduct> wrapper1 = new LambdaQueryWrapper<>();
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(productId)); wrapper1.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
list1.add(yxStoreProduct); .eq(YxStoreProduct::getId, productId);
YxStoreProduct yxStoreProduct = storeProductMapper.selectOne(wrapper1);
//这里需要有一个非空判断,找不到这个商品就不加
if (ObjectUtil.isNotNull(yxStoreProduct)){
list1.add(yxStoreProduct);
}
}); });
hotListDto.setProductInfo(list1); hotListDto.setProductInfo(list1);
}); });

3
zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java

@ -73,6 +73,9 @@ public class YxStoreProduct extends BaseDomain {
@ApiModelProperty(value = "商品名称") @ApiModelProperty(value = "商品名称")
private String storeName; private String storeName;
/**价保和无理由退款等配置**/
@TableField(typeHandler = JacksonTypeHandler.class)
private YxStoreProductConfig config;
/** 商品简介 */ /** 商品简介 */
@ApiModelProperty(value = "商品简介") @ApiModelProperty(value = "商品简介")

18
zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProductConfig.java

@ -0,0 +1,18 @@
package co.yixiang.modules.product.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class YxStoreProductConfig implements Serializable {
//无理由退款天数
private Integer withoutReason;
//无理由退款图标
private String withoutReasonPic;
//价保天数
private Integer confirmed;
//价保图标
private String confirmedPic;
}

1
zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java

@ -211,6 +211,7 @@ public class StoreProductController {
YxStoreProduct yxStoreProduct = yxStoreProductService.getById(id); YxStoreProduct yxStoreProduct = yxStoreProductService.getById(id);
ProductDto productDto = new ProductDto(); ProductDto productDto = new ProductDto();
productDto.setParameter(yxStoreProduct.getParameter()); productDto.setParameter(yxStoreProduct.getParameter());
productDto.setConfig(yxStoreProduct.getConfig());
BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage"); BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage");
productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(","))); productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(",")));
YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService

9
zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java

@ -1,6 +1,9 @@
package co.yixiang.modules.product.service.dto; package co.yixiang.modules.product.service.dto;
import co.yixiang.modules.product.domain.YxStoreProductConfig;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@ -21,8 +24,7 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
@Setter @Setter
public class ProductDto public class ProductDto {
{
/** 商品id */ /** 商品id */
private Long id; private Long id;
@ -43,6 +45,9 @@ public class ProductDto
@JsonProperty("store_info") @JsonProperty("store_info")
private String storeInfo; private String storeInfo;
/**价保和无理由退款等配置**/
private YxStoreProductConfig config;
/** 关键字 */ /** 关键字 */
private String keyword; private String keyword;

4
zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java

@ -1,5 +1,6 @@
package co.yixiang.modules.product.service.dto; package co.yixiang.modules.product.service.dto;
import co.yixiang.modules.product.domain.YxStoreProductConfig;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@ -52,6 +53,9 @@ public class StoreProductDto
@NotBlank(message = "关键字不能为空") @NotBlank(message = "关键字不能为空")
private String keyword; private String keyword;
/**价保和无理由退款等配置**/
@JsonProperty("config")
private YxStoreProductConfig config;
/** 商品条码(一维码) */ /** 商品条码(一维码) */
@JsonProperty("bar_code") @JsonProperty("bar_code")

3
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java

@ -197,7 +197,6 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
if (ObjectUtil.isNull(storeProduct)) { if (ObjectUtil.isNull(storeProduct)) {
throw new ErrorRequestException("商品不存在或已下架"); throw new ErrorRequestException("商品不存在或已下架");
} }
return storeProduct; return storeProduct;
} }
@ -620,7 +619,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
if (storeProductDto.getSliderImage().isEmpty()) { if (storeProductDto.getSliderImage().isEmpty()) {
throw new YshopException("请上传轮播图"); throw new YshopException("请上传轮播图");
} }
yxStoreProduct.setConfig(storeProductDto.getConfig());
yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice())); yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice())); yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice()));
yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost())); yxStoreProduct.setCost(BigDecimal.valueOf(resultDTO.getMinCost()));

6
zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java

@ -4,8 +4,11 @@ package co.yixiang.modules.product.vo;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue; import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.domain.YxStoreProductConfig;
import co.yixiang.modules.product.service.dto.Parameter; import co.yixiang.modules.product.service.dto.Parameter;
import co.yixiang.serializer.BigDecimalSerializer; import co.yixiang.serializer.BigDecimalSerializer;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -43,6 +46,9 @@ public class YxStoreProductQueryVo implements Serializable {
private String codeBase; private String codeBase;
/**价保和无理由退款等配置**/
private YxStoreProductConfig config;
public String getImage_base() { public String getImage_base() {
return image; return image;
} }

Loading…
Cancel
Save