Commit f36b7de3 authored by shiyu's avatar shiyu

新增字段判断普通商品

parent 61d729a6
......@@ -269,4 +269,40 @@ public class DistributionEnum {
}
/**
* 帖子类型
*/
public enum PostTypeEnum {
COMMON(0, "普通帖子"),
SALE(1, "售卖的帖子"),
;
private int code;
private String des;
PostTypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (DistributionEnum.PostTypeEnum postTypeEnum : DistributionEnum.PostTypeEnum.values()) {
if (code == postTypeEnum.getCode()) {
return postTypeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
}
......@@ -245,4 +245,10 @@ public class SupplierItemVo implements Entity {
* 商家自购价
*/
private String selfBuyPrice;
/**
* 帖子类型
* 0普通帖子,1售卖帖子
*/
private Integer postType;
}
......@@ -296,7 +296,7 @@ public class WxPayCallbackController {
/**
* 更新仓管订单状态
* 更新藏馆订单状态
* @return
*/
@Transactional
......
......@@ -184,7 +184,7 @@ public class DistributionOrderDetailVo implements Entity {
private Date payEndTime;
/**
* 商品类型1一口价2竞拍
* 商品类型1一口价2竞拍3藏品
*/
private Integer type;
......
......@@ -121,7 +121,7 @@ public class CollectionBookServiceImpl implements CollectionBookService {
//没有排序记录,则使用默认排序
if (collectionBookSort == null) {
//查询藏家白名单, 在白名单中说是藏家,需要加上默认标签
if (dto.getIsHasExtraLabel()) {
if (dto.getViewLabelType().intValue() == 1) {
if (collectorWhiteListDao.isExisted(userId)) {
if (dto.getViewLabelType().intValue() == 1) {
for (CollectionBookConstants.DefaultBookEnum defaultBookEnum : CollectionBookConstants.DefaultBookEnum.values()) {
......@@ -132,6 +132,8 @@ public class CollectionBookServiceImpl implements CollectionBookService {
}
}
}
}
if (dto.getIsHasExtraLabel()) {
Map<String, Object> map = new HashMap<>();
map.put("id", 0);
map.put("title", "我收藏的");
......@@ -159,7 +161,7 @@ public class CollectionBookServiceImpl implements CollectionBookService {
continue;
}
} else if (CollectionBookConstants.DefaultBookEnum.getNameByCode(sortNum) != null) {
if (dto.getViewLabelType() == null || (dto.getViewLabelType().intValue() != 1)) {
if (dto.getViewLabelType() == null || dto.getViewLabelType().intValue() != 1) {
continue;
}
map.put("title", CollectionBookConstants.DefaultBookEnum.getNameByCode(sortNum));
......
......@@ -115,6 +115,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired
DistributorProfitService distributorProfitService;
@Autowired
CollectionShareRecordDao collectionShareRecordDao;
@Transactional
@Override
......@@ -389,14 +391,14 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
String shareRecordId = dto.getShareRecordId();
if (StringUtils.hasLength(shareRecordId)) {
//查询分享记录详细信息
DistributorShareRecord distributorShareRecord = distributorShareRecordDao.findById(shareRecordId);
if (distributorShareRecord == null) {
CollectionShareRecord collectionShareRecord = collectionShareRecordDao.findById(shareRecordId);
if (collectionShareRecord == null || collectionShareRecord.getType() == DistributionEnum.CollectionShareTypeEnum.PAGE.getCode()) {
return Result.failed("该分享链接无效");
}
if (!distributorShareRecord.getEnabled()) {
if (!collectionShareRecord.getIsDeleted()) {
return Result.failed("该分享链接已失效");
}
itemId = distributorShareRecord.getItemId();
itemId = collectionShareRecord.getShareTargetId();
}
//查询商品信息,检查商品库存
SupplierItem supplierItem = supplierItemDao.findById(itemId);
......
......@@ -612,6 +612,11 @@ public class SupplierItemServiceImpl implements SupplierItemService {
supplierItem.setDistributionPrice(PriceUtil.convertPriceFromStr(StringUtils.isEmpty(dto.getDistributionPrice())?"0":dto.getDistributionPrice()));
supplierItem.setImages(dto.getImages());
supplierItem.setVideos(dto.getVideos());
if (dto.getIsOnSale()) {
supplierItem.setStock(dto.getStock());
} else {
supplierItem.setStock(1);
}
supplierItemDao.update(supplierItem);
//更新相关的收藏册
......@@ -677,6 +682,14 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
supplierItemVo.setIsCollected(true);
SupplierItem supplierItem = supplierItemDao.findById(itemId);
if (supplierItem.getIsOnSale()) {
supplierItemVo.setPostType(DistributionEnum.PostTypeEnum.SALE.getCode());
} else if (!supplierItem.getIsOnSale() && supplierItem.getStock() == 0) {
supplierItemVo.setPostType(DistributionEnum.PostTypeEnum.SALE.getCode());
} else {
supplierItemVo.setPostType(DistributionEnum.PostTypeEnum.COMMON.getCode());
}
if (supplierItem.getCreatorId().longValue() != targetUserId) {
supplierItemVo.setIsMine(false);
targetUserId = supplierItem.getCreatorId();
......
......@@ -89,12 +89,12 @@ public class WxPayServiceTest {
@Test
public void refund() {
List<String> list = Arrays.asList("DA2403281652031837271");
List<String> list = Arrays.asList("DA2404221520594095031");
list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId);
dto.setAmount("9.8");
dto.setRefundPrice("9.8");
dto.setAmount("1");
dto.setRefundPrice("1");
Result result = wxPayServiceApi.refund(dto);
logger.info("申请微信支付退款:{}", result);
});
......
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