Commit 44abce69 authored by shiyu's avatar shiyu

以物换物

parent 02fa1ab7
......@@ -49,6 +49,11 @@ public interface CommConsts {
public static final Long SYSTEM_ACCOUNT = 8888888888L;
/**
* 平台自营店铺账号
*/
public static final Long SELF_SUPPORT_ACCOUNT = 6666666666L;
/**
* 用户未登录的默认账号
*/
......
......@@ -8,6 +8,8 @@ public class DistributionEnum {
public enum DistributionOrderStateEnum {
PRE_PAY(1, "待付款"),
PRE_SALE(5, "众筹中"),
PRE_EXCHANGE(6, "待换货"),
PRE_INSPECTION(8, "待验货"),
PRE_SEND(10, "待发货"),
PRE_SIGNED(20, "待收货"),
AFTER_SALE(30, "售后中"),
......@@ -57,6 +59,7 @@ public class DistributionEnum {
DISCOUNT(4, "折扣品"),
AUCTION_PERFORMANCE(5, "竞拍专场"),
GROUP_PURCHASE(6, "团购"),
EXCHANGE(7, "交换"),
;
private int code;
......@@ -172,6 +175,7 @@ public class DistributionEnum {
SYSTEM_ITEM(3, "平台藏品"),
COLLECTOR_AUCTION_ITEM(4, "藏家拍卖品"),
GROUPPURASE_ITEM(5, "团购商品"),
EXCHANGE_ITEM(6, "可交换商品"),
;
private int code;
......
......@@ -14,6 +14,8 @@ public class SupplierItemVo implements Entity {
private Long itemId;
private Integer itemNum;
/**
* 商品名称
*/
......
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.ExchangeOrderSnapshot;
import java.util.List;
public interface ExchangeOrderSnapshotDao {
boolean insert(ExchangeOrderSnapshot exchangeOrderSnapshot);
boolean update(ExchangeOrderSnapshot exchangeOrderSnapshot);
List<ExchangeOrderSnapshot> findByOrderId(String orderId);
}
......@@ -159,7 +159,7 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
private String rebate;
/**
* 商品类型1一口价2竞拍3用户上传4折扣商品
* 商品类型1一口价2竞拍3用户上传4折扣商品7换藏商品
*/
private Integer type;
......@@ -275,4 +275,9 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/
private Long introducerId;
/**
* 官方估价是否可以为空
*/
private Boolean officialEstimatedPriceNotNull;
}
package com.wwdz.ch.db.impl.distribution;
import com.wwdz.ch.db.dao.distribution.ExchangeOrderSnapshotDao;
import com.wwdz.ch.db.domain.distribution.ExchangeOrderSnapshot;
import com.wwdz.ch.db.domain.distribution.ExchangeOrderSnapshotExample;
import com.wwdz.ch.db.mapper.distribution.ExchangeOrderSnapshotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class ExchangeOrderSnapshotDaoImpl implements ExchangeOrderSnapshotDao {
@Autowired
ExchangeOrderSnapshotMapper exchangeOrderSnapshotMapper;
@Override
public boolean insert(ExchangeOrderSnapshot exchangeOrderSnapshot) {
return exchangeOrderSnapshotMapper.insert(exchangeOrderSnapshot) > 0;
}
@Override
public boolean update(ExchangeOrderSnapshot exchangeOrderSnapshot) {
ExchangeOrderSnapshotExample example = new ExchangeOrderSnapshotExample();
ExchangeOrderSnapshotExample.Criteria criteria = example.createCriteria();
criteria.andDistributionOrderIdEqualTo(exchangeOrderSnapshot.getDistributionOrderId());
return exchangeOrderSnapshotMapper.updateByExampleSelective(exchangeOrderSnapshot, example) > 0;
}
@Override
public List<ExchangeOrderSnapshot> findByOrderId(String orderId) {
ExchangeOrderSnapshotExample example = new ExchangeOrderSnapshotExample();
ExchangeOrderSnapshotExample.Criteria criteria = example.createCriteria();
criteria.andDistributionOrderIdEqualTo(orderId);
return exchangeOrderSnapshotMapper.selectByExampleWithBLOBs(example);
}
}
......@@ -45,6 +45,9 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
JdbcHelper.ifPresent(dto.getIsAbleSale(), criteria::andIsAbleSaleEqualTo);
JdbcHelper.ifPresent(dto.getIsDeleted(), criteria::andIsDeletedEqualTo);
JdbcHelper.ifPresent(dto.getCreatorId(), criteria::andCreatorIdEqualTo);
if (dto.getOfficialEstimatedPriceNotNull() != null && dto.getOfficialEstimatedPriceNotNull()) {
criteria.andOfficialEstimatedPriceIsNotNull();
}
supplierItemExample.setOrderByClause(" create_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return supplierItemMapper.selectByExampleWithBLOBs(supplierItemExample);
......@@ -62,9 +65,11 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
criteria.andNameLike("%" + dto.getName() + "%");
}
JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo);
JdbcHelper.ifPresent(dto.getFilterType(), criteria::andTypeNotIn);
JdbcHelper.ifPresent(dto.getStock(), criteria::andStockGreaterThan);
JdbcHelper.ifPresent(dto.getIsOnSale(), criteria::andIsOnSaleEqualTo);
JdbcHelper.ifPresent(dto.getIsDeleted(), criteria::andIsDeletedEqualTo);
// JdbcHelper.ifPresent(dto.getIsDeleted(), criteria::andIsDeletedEqualTo);
criteria.andIsDeletedEqualTo(false);
supplierItemExample.setOrderByClause(" is_on_sale desc, stock desc, create_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return supplierItemMapper.selectByExampleWithBLOBs(supplierItemExample);
......
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.ExchangeOrderSnapshot;
import com.wwdz.ch.db.domain.distribution.ExchangeOrderSnapshotExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ExchangeOrderSnapshotMapper {
long countByExample(ExchangeOrderSnapshotExample example);
int deleteByExample(ExchangeOrderSnapshotExample example);
int deleteByPrimaryKey(Integer id);
int insert(ExchangeOrderSnapshot record);
int insertSelective(ExchangeOrderSnapshot record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table exchange_order_snapshot
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ExchangeOrderSnapshot selectOneByExample(ExchangeOrderSnapshotExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table exchange_order_snapshot
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ExchangeOrderSnapshot selectOneByExampleSelective(@Param("example") ExchangeOrderSnapshotExample example, @Param("selective") ExchangeOrderSnapshot.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table exchange_order_snapshot
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ExchangeOrderSnapshot selectOneByExampleWithBLOBs(ExchangeOrderSnapshotExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table exchange_order_snapshot
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<ExchangeOrderSnapshot> selectByExampleSelective(@Param("example") ExchangeOrderSnapshotExample example, @Param("selective") ExchangeOrderSnapshot.Column ... selective);
List<ExchangeOrderSnapshot> selectByExampleWithBLOBs(ExchangeOrderSnapshotExample example);
List<ExchangeOrderSnapshot> selectByExample(ExchangeOrderSnapshotExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table exchange_order_snapshot
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
ExchangeOrderSnapshot selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") ExchangeOrderSnapshot.Column ... selective);
ExchangeOrderSnapshot selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") ExchangeOrderSnapshot record, @Param("example") ExchangeOrderSnapshotExample example);
int updateByExampleWithBLOBs(@Param("record") ExchangeOrderSnapshot record, @Param("example") ExchangeOrderSnapshotExample example);
int updateByExample(@Param("record") ExchangeOrderSnapshot record, @Param("example") ExchangeOrderSnapshotExample example);
int updateByPrimaryKeySelective(ExchangeOrderSnapshot record);
int updateByPrimaryKeyWithBLOBs(ExchangeOrderSnapshot record);
int updateByPrimaryKey(ExchangeOrderSnapshot record);
}
\ No newline at end of file
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/>
<table tableName="supplier_item" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="exchange_order_snapshot" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -46,7 +46,11 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
"/wx/distributionOrder/refund", "/wx/collectionBook/findList","/wx/collectionItemsRelation/findInfos","/wx/collectionItemsRelation/findList",
"/wx/supplierItem/findItemsOfCurrentDistributor", "/wx/selfPage/updateSwitch","/wx/selfPage/checkIsMine",
"/wx/specialPerformance/sendMsg", "/wx/specialPerformance/sendMsgTest", "/wx/groupPurchase/systemAddRecord","/wx/officialAccount/**",
"/wx/supplierItem/**","/wx/specialPerformance/**","/wx/groupPurchase/**","/wx/disposableSubscribeRecord/**", "/wx/auctionRecord/findList"
"/wx/supplierItem/**","/wx/specialPerformance/**","/wx/groupPurchase/**","/wx/disposableSubscribeRecord/**", "/wx/auctionRecord/findList",
"/wx/selfPage/countIntroduceAmount",
"/wx/exchange/**"
//下列路径上线注释
/* ,"/wx/specialPerformance/**"
, "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**", "/wx/auctionRecord/**",
......
package com.wwdz.ch.wx.entity.request;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ExchangeRequestDto extends BaseRequestDto implements Entity {
/**
* 商品id
*/
private Long userId;
private String userOpenId;
/**
* 被交换的商品id
*/
private Long exchangeItemId;
/**
* 被交换的商品数量
*/
private Integer exchangeItemNum;
private List<ItemSimpleDto> itemList;
/**
* 用户收货地址
*/
private Long addressId;
/**
* 用户名称
*/
private String receiverName;
/**
* 用户电话
*/
private String receiverPhone;
/**
* 用户收货地址
*/
private String receiverAddress;
/**
* 收藏册id
*/
private Long collectionBookId;
/**
* 用户发出的快递公司编码
*/
private String logisticsCode;
/**
* 运单号
*/
private String waybill;
/**
* 用户发货时间
*/
private Date deliveryTime;
/**
* 平台签收时间
*/
private Date signedTime;
}
package com.wwdz.ch.wx.entity.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class ItemSimpleDto implements Entity {
/**
* 商品id
*/
private Long itemId;
/**
* 商品数量
*/
private Integer itemNum;
}
package com.wwdz.ch.wx.entity.vo.distribution;
import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.wx.entity.GroupPurchaseInfo;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Data
......@@ -278,4 +280,12 @@ public class DistributionOrderDetailVo implements Entity {
private String groupPurchaseStateName;
private GroupPurchaseInfo groupPurchaseInfo;
/**
* 以物换物场景
* 用户用来交换的商品的信息
*/
private UserExchangeInfo userExchangeInfo;
}
package com.wwdz.ch.wx.entity.vo.distribution;
import com.wwdz.ch.core.entity.SupplierItemVo;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.List;
@Data
public class UserExchangeInfo implements Entity {
private List<SupplierItemVo> list;
private String fromLogisticsCode;
private String fromLogisticsName;
private String fromWaybill;
private String content;
}
......@@ -247,18 +247,20 @@ public class CollectionItemsRelationServiceImpl implements CollectionItemsRelati
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
if (dto.getCollectionBookId().longValue() == CollectionBookConstants.DefaultBookEnum.AUCTIONING.getId()){
List<AuctionConfig> auctionConfigList = pageInfo.getList();
Map<Long, AuctionConfig> map = auctionConfigList.stream().collect(Collectors.toMap(AuctionConfig::getItemId, Function.identity() , (k1, k2) ->k2));
supplierItemVo.setRealEndTime(map.get(supplierItem.getId()).getRealEndTime());
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(supplierItem.getId());
if (auctionRecord != null) {
supplierItemVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionRecord.getPrice()));
} else {
supplierItemVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(map.get(supplierItem.getId()).getStartPrice()));
if (dto.getCollectionBookId() != null) {
if (dto.getCollectionBookId().longValue() == CollectionBookConstants.DefaultBookEnum.AUCTIONING.getId()) {
List<AuctionConfig> auctionConfigList = pageInfo.getList();
Map<Long, AuctionConfig> map = auctionConfigList.stream().collect(Collectors.toMap(AuctionConfig::getItemId, Function.identity(), (k1, k2) -> k2));
supplierItemVo.setRealEndTime(map.get(supplierItem.getId()).getRealEndTime());
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(supplierItem.getId());
if (auctionRecord != null) {
supplierItemVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionRecord.getPrice()));
} else {
supplierItemVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(map.get(supplierItem.getId()).getStartPrice()));
}
supplierItemVo.setState(AuctionEnum.StateEnum.AUCTIONING.getCode());
supplierItemVo.setStateName(AuctionEnum.StateEnum.AUCTIONING.getDes());
}
supplierItemVo.setState(AuctionEnum.StateEnum.AUCTIONING.getCode());
supplierItemVo.setStateName(AuctionEnum.StateEnum.AUCTIONING.getDes());
}
list.add(supplierItemVo);
}
......
......@@ -6,6 +6,7 @@ import com.wechat.pay.java.service.refund.model.Refund;
import com.wechat.pay.java.service.refund.model.Status;
import com.wwdz.ch.core.api.wxpay.WxPayServiceApi;
import com.wwdz.ch.core.consts.*;
import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.core.entity.wxPay.DistributionOrderRefundRequestDto;
import com.wwdz.ch.core.notify.AliSmsSender;
import com.wwdz.ch.core.type.PageSearchResult;
......@@ -27,6 +28,7 @@ import com.wwdz.ch.core.entity.SignedNoticeMsg;
import com.wwdz.ch.wx.entity.GroupPurchaseInfo;
import com.wwdz.ch.wx.entity.vo.distribution.DistributionOrderDetailVo;
import com.wwdz.ch.wx.entity.vo.distribution.DistributionOrderVo;
import com.wwdz.ch.wx.entity.vo.distribution.UserExchangeInfo;
import com.wwdz.ch.wx.service.distribution.DistributionOrderService;
import com.wwdz.ch.wx.service.distribution.DistributorProfitService;
import com.wwdz.ch.core.service.SendMsgService;
......@@ -139,6 +141,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired
IntroduceRecordDao introduceRecordDao;
@Autowired
ExchangeOrderSnapshotDao exchangeOrderSnapshotDao;
@Transactional
@Override
public Result createDistributionOrder(DistributionOrderRequestDto dto) {
......@@ -1072,6 +1077,37 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderDetailVo.setIdentifyOrderId(identifyOrder.getIdentifyOrderId());
}
}
//以物换物的订单
if (distributionOrder.getType() == DistributionEnum.DistributionTypeEnum.EXCHANGE.getCode()) {
UserExchangeInfo userExchangeInfo = new UserExchangeInfo();
List<ExchangeOrderSnapshot> exchangeOrderSnapshotList = exchangeOrderSnapshotDao.findByOrderId(dto.getDistributionOrderId());
if (!CollectionUtils.isEmpty(exchangeOrderSnapshotList)) {
userExchangeInfo.setFromWaybill(exchangeOrderSnapshotList.get(0).getWaybill());
userExchangeInfo.setFromLogisticsCode(exchangeOrderSnapshotList.get(0).getLogisticsCode());
userExchangeInfo.setFromLogisticsName(LogisticsEnum.getNameByCode(exchangeOrderSnapshotList.get(0).getLogisticsCode()));
String content;
if (StringUtils.hasLength(exchangeOrderSnapshotList.get(0).getWaybill())) {
content = "商品已寄出,快递信息:" + LogisticsEnum.getNameByCode(exchangeOrderSnapshotList.get(0).getLogisticsCode()) + "," + exchangeOrderSnapshotList.get(0).getWaybill();
} else {
content = "商品未寄出";
}
userExchangeInfo.setContent(content);
}
List<SupplierItemVo> supplierItemVos = new ArrayList<>();
for (ExchangeOrderSnapshot exchangeOrderSnapshot : exchangeOrderSnapshotList) {
SupplierItemVo supplierItemVo = new SupplierItemVo();
supplierItemVo.setItemId(exchangeOrderSnapshot.getItemId());
supplierItemVo.setName(exchangeOrderSnapshot.getItemName());
supplierItemVo.setItemNum(exchangeOrderSnapshot.getItemNum());
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(exchangeOrderSnapshot.getDistributionPrice()));
supplierItemVo.setOfficialEstimatedPrice(PriceUtil.convertPriceFenToYuan(exchangeOrderSnapshot.getOfficialEstimatedPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(exchangeOrderSnapshot.getImages(), exchangeOrderSnapshot.getVideos()));
supplierItemVos.add(supplierItemVo);
}
userExchangeInfo.setList(supplierItemVos);
distributionOrderDetailVo.setUserExchangeInfo(userExchangeInfo);
}
//一口价支付截止时间为下单半小时后,竞拍为24小时
Date date = distributionOrder.getCreateTime();
if (type == DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode() || type == DistributionEnum.DistributionTypeEnum.GROUP_PURCHASE.getCode()) {
......
......@@ -220,6 +220,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
supplierItemVo.setItemId(supplierItem.getId());
supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice()));
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setOfficialEstimatedPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getOfficialEstimatedPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
supplierItemVos.add(supplierItemVo);
}
......
package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.wx.entity.request.ExchangeRequestDto;
public interface ExchangeService {
/**
* 检测用户是否有足够的商品
* @param dto
* @return
*/
Result checkEnoughItem(ExchangeRequestDto dto);
/**
* 查询用户可交换的商品列表
* @param dto
* @return
*/
Result findItemList(ExchangeRequestDto dto);
/**
* 以物换物
* @param dto
* @return
*/
Result exchange(ExchangeRequestDto dto);
/**
* 用户换藏发货
* @param dto
* @return
*/
Result delivery(DistributionOrderRequestDto dto);
}
package com.wwdz.ch.wx.web.distribution;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.wx.entity.request.ExchangeRequestDto;
import com.wwdz.ch.wx.service.distribution.ExchangeService;
import com.xxdxxs.service.FormHandler;
import com.xxdxxs.validation.Validator;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/wx/exchange")
public class ExchangeController {
private static final Logger logger = LoggerFactory.getLogger(ExchangeController.class);
@Autowired
ExchangeService exchangeService;
@ApiOperation(value = "检测用户是否有足够的商品")
@PostMapping("/checkEnoughItem")
public Result checkEnoughItem(@RequestBody ExchangeRequestDto 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 exchangeService.checkEnoughItem(dto);
}
@ApiOperation(value = "查询用户可交换的商品列表")
@PostMapping("/findItemList")
public Result findItemList(@RequestBody ExchangeRequestDto 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 exchangeService.findItemList(dto);
}
@ApiOperation(value = "以物换物")
@PostMapping("/exchange")
public Result exchange(@RequestBody ExchangeRequestDto dto) {
logger.info("以物换物,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("userId", "用户id").must().number()
.set("userOpenId", "用户微信openid").must().string()
.set("exchangeItemId", "被交换的商品id").must().number()
.set("exchangeItemNum", "被交换的商品数量").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return exchangeService.exchange(dto);
}
@ApiOperation(value = "用户换藏发货")
@PostMapping("/delivery")
public Result delivery(@RequestBody DistributionOrderRequestDto dto) {
logger.info("藏家发货,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("distributionOrderId", "订单号").must().string()
.set("logisticsCode", "快递公司编码").must().string()
.set("waybill", "运单号").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return exchangeService.delivery(dto);
}
}
package com.wwdz.ch.wx.web.distribution;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.wx.entity.request.SelfPageRequestDto;
import com.wwdz.ch.wx.service.distribution.SelfPageService;
......@@ -99,11 +100,8 @@ public class SelfPageController {
@PostMapping("/countIntroduceAmount")
public Result countIntroduceAmount(@RequestBody SelfPageRequestDto 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());
if (dto.getUserId() == null) {
dto.setUserId(CommConsts.SYSTEM_ACCOUNT_FOR_UNLOGIN);
}
return userAccountDetailService.countIntroduceAmount(dto.getUserId());
}
......
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