Commit 39682821 authored by shiyu's avatar shiyu

查询用户发布商品的权限,售卖按钮是否可用

parent 9a0a7c54
......@@ -85,13 +85,13 @@ public class DistributorProfitServiceImpl implements DistributorProfitService {
try {
Map<String, String> map = new HashMap<>();
map.put("introduceRebate", "2%");
double channelServiceRebate = 0.03;
double channelServiceRebate = 0.01;
CollectorWhiteList collectorWhiteList = collectorWhiteListDao.findById(supplierItemRequestDto.getUserId());
if (collectorWhiteList != null) {
channelServiceRebate = PriceUtil.convertToDivide(collectorWhiteList.getChannelCostRebate()).doubleValue();
map.put("channelServiceRebate", collectorWhiteList.getChannelCostRebate().intValue() + "%");
} else {
map.put("channelServiceRebate", "3%");
map.put("channelServiceRebate", "1%");
}
Long itemPrice = PriceUtil.convertPriceFromStr(supplierItemRequestDto.getDistributionPrice());
long channelServiceCost = PriceUtil.convertPriceFromStr(PriceUtil.convertDoubleToString(itemPrice.doubleValue() * channelServiceRebate));
......
package com.wwdz.ch.wx.impl.openShop;
import com.drew.metadata.adobe.AdobeJpegDescriptor;
import com.wwdz.ch.core.api.wxpay.WxPayServiceApi;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.CommonEnum;
......@@ -270,4 +271,40 @@ public class OpenShopServiceImpl implements OpenShopService {
}
return Result.failed();
}
@Override
public Result checkUploadItemPermission(OpenShopApplyOrderRequestDto dto) {
try {
long userId = dto.getUserId();
Date now = new Date();
Map<String, Boolean> map = new HashMap<>();
CollectorWhiteList collectorWhiteList = collectorWhiteListDao.findById(userId);
if (collectorWhiteList != null && collectorWhiteList.getEndValidTime().after(now)) {
map.put("isCollector", true);
map.put("openShop", true);
map.put("guaranteeMoney", true);
return Result.success(map);
} else {
map.put("isCollector", false);
}
//不是藏家时,判断是否开店审核通过
OpenShopApplyOrder openShopApplyOrder = openShopApplyOrderDao.findByUserId(userId);
if (openShopApplyOrder != null) {
if (openShopApplyOrder.getState() == OpenShopApplyOrderEnum.StateEnum.PASSED.getCode()) {
map.put("openShop", true);
} else {
map.put("openShop", false);
}
map.put("guaranteeMoney", false);
} else {
map.put("openShop", false);
map.put("guaranteeMoney", false);
}
return Result.success(map);
} catch (Exception e) {
logger.error("查询用户发布商品的权限 error : {}", e);
}
return Result.failed();
}
}
......@@ -44,4 +44,13 @@ public interface OpenShopService {
* @return
*/
Result findOpenShopApplyOrder(OpenShopApplyOrderRequestDto dto);
/**
* 查询用户发布商品的权限
* 发布商品页面,可售卖按钮是否可用
* @param dto
* @return
*/
Result checkUploadItemPermission(OpenShopApplyOrderRequestDto dto);
}
......@@ -109,4 +109,18 @@ public class OpenShopController {
}
@ApiOperation(value = "查询用户发布商品的权限")
@PostMapping("/checkUploadItemPermission")
public Result checkUploadItemPermission(@RequestBody OpenShopApplyOrderRequestDto dto) {
logger.info("查询用户发布商品的权限,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("userId", "用户id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return openShopService.checkUploadItemPermission(dto);
}
}
......@@ -89,12 +89,12 @@ public class WxPayServiceTest {
@Test
public void refund() {
List<String> list = Arrays.asList("OSC2410301513339847057", "OSC2410301635131217582");
List<String> list = Arrays.asList("GM2410311556591498832");
list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId);
dto.setAmount("100");
dto.setRefundPrice("100");
dto.setAmount("0.01");
dto.setRefundPrice("0.01");
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