Commit 2c526ac4 authored by shiyu's avatar shiyu

退款接口3

parent 3f0bf5c6
......@@ -289,15 +289,13 @@ public class WxPayServiceApi {
amountReq.setTotal(dto.getAmount());
//货币类型(默认人民币)
amountReq.setCurrency("CNY");
//退款回调地址
//退款通知回调地址
request.setNotifyUrl(wxPayProperties.getRefundNotifyUrl());
//商户系统单号
request.setOutTradeNo(dto.getDistributionOrderId());
request.setAmount(amountReq);
//商户退款单号
request.setOutRefundNo(dto.getRefundId());
//退款通知回调地址
request.setNotifyUrl(null);
Refund refundResponse = service.create(request);
logger.info("微信申请退款接口返回:{}", JsonUtils.from(refundResponse));
return Result.success(refundResponse);
......
......@@ -32,4 +32,11 @@ public interface DistributorShareRecordDao {
*/
List<DistributorShareRecord> findMaxPriceRecord(DistributorShareRecordRequestDto dto);
/**
* 根据商品id,把关联的分享链接都改为无效
* @param itemId
* @return
*/
int updateDisEnabled(long itemId);
}
......@@ -39,6 +39,11 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/
private String name;
/**
* 分销价格,要除以100
*/
private Long distributionPrice;
/**
* 创建开始时间
* 用于查询
......
......@@ -34,4 +34,14 @@ public class DistributorShareRecordDaoImpl implements DistributorShareRecordDao
List<DistributorShareRecord> distributorShareRecords = distributorShareRecordMapper.findMaxPriceRecord(dto.getDistributorId());
return distributorShareRecords;
}
@Override
public int updateDisEnabled(long itemId) {
DistributorShareRecordExample distributorShareRecordExample = new DistributorShareRecordExample();
DistributorShareRecordExample.Criteria criteria = distributorShareRecordExample.createCriteria();
criteria.andItemIdEqualTo(itemId);
DistributorShareRecord distributorShareRecord = new DistributorShareRecord();
distributorShareRecord.setEnabled(false);
return distributorShareRecordMapper.updateByExampleSelective(distributorShareRecord, distributorShareRecordExample);
}
}
......@@ -33,6 +33,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
JdbcHelper.ifPresent(dto.getStock(), criteria::andStockGreaterThan);
JdbcHelper.ifPresent(dto.getIsOnSale(), criteria::andIsOnSaleEqualTo);
JdbcHelper.ifPresent(dto.getIsDeleted(), criteria::andIsDeletedEqualTo);
supplierItemExample.setOrderByClause(" id desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return supplierItemMapper.selectByExampleWithBLOBs(supplierItemExample);
}
......@@ -49,10 +50,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
@Override
public int update(SupplierItem supplierItem) {
supplierItem.setUpdateTime(new Date());
SupplierItemExample supplierItemExample = new SupplierItemExample();
SupplierItemExample.Criteria criteria = supplierItemExample.createCriteria();
criteria.andIdEqualTo(supplierItem.getId());
return supplierItemMapper.updateByExampleSelective(supplierItem, supplierItemExample);
return supplierItemMapper.updateByPrimaryKeySelective(supplierItem);
}
@Override
......
......@@ -514,7 +514,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return Result.failed("调用微信支付退款接口错误");
}
Refund refundResponse = (Refund) result.getData();
if (refundResponse.getStatus().equals(Status.SUCCESS)) {
if (refundResponse.getStatus().equals(Status.SUCCESS) || refundResponse.getStatus().equals(Status.PROCESSING)) {
Date now = new Date();
//创建退款单
RefundOrder refundOrder = new RefundOrder();
......
......@@ -227,4 +227,17 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
return Result.failed();
}
@Override
public Result updateDistributionPrice(SupplierItemRequestDto dto) {
SupplierItem supplierItem = new SupplierItem();
supplierItem.setId(dto.getId());
supplierItem.setDistributionPrice(dto.getDistributionPrice());
supplierItemDao.update(supplierItem);
//把该商品所关联的所有分享链接都改为无效
// distributorShareRecordDao.
return null;
}
}
......@@ -36,5 +36,12 @@ public interface SupplierItemService {
*/
Result reduceStock(long itemId, int stock);
/**
* 修改商品供货价
* @param dto
* @return
*/
Result updateDistributionPrice(SupplierItemRequestDto dto);
}
......@@ -51,4 +51,11 @@ public class SupplierItemController {
return supplierItemService.findItemsOfCurrentDistributor(dto);
}
@ApiOperation(value = "修改商品供货价")
@PostMapping("/updateDistributionPrice")
public Result updateDistributionPrice(@RequestBody SupplierItemRequestDto dto) {
logger.info("updateDistributionPrice,请求参数:{}", JSON.toJSONString(dto));
return supplierItemService.updateDistributionPrice(dto);
}
}
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