|
|
@@ -16,25 +16,29 @@
|
|
|
*/
|
|
|
package org.springblade.ldt.bills.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import javax.validation.Valid;
|
|
|
-
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.ldt.bills.entity.GoodsBills;
|
|
|
+import org.springblade.ldt.bills.service.IGoodsBillsService;
|
|
|
import org.springblade.ldt.bills.vo.GoodsBillsVO;
|
|
|
import org.springblade.ldt.bills.wrapper.GoodsBillsWrapper;
|
|
|
-import org.springblade.ldt.bills.service.IGoodsBillsService;
|
|
|
-import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+import org.springblade.ldt.shop.entity.Shop;
|
|
|
+import org.springblade.ldt.shop.service.IShopService;
|
|
|
+import org.springblade.ldt.user.entity.LoginUser;
|
|
|
+import org.springblade.ldt.user.service.ILoginUserService;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
|
/**
|
|
|
* 订单 控制器
|
|
|
@@ -49,6 +53,8 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|
|
public class GoodsBillsController extends BladeController {
|
|
|
|
|
|
private final IGoodsBillsService goodsBillsService;
|
|
|
+ private final ILoginUserService userService;
|
|
|
+ private final IShopService shopService;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -57,8 +63,26 @@ public class GoodsBillsController extends BladeController {
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@ApiOperation(value = "详情", notes = "传入goodsBills")
|
|
|
public R<GoodsBillsVO> detail(GoodsBills goodsBills) {
|
|
|
- GoodsBills detail = goodsBillsService.getOne(Condition.getQueryWrapper(goodsBills));
|
|
|
- return R.data(GoodsBillsWrapper.build().entityVO(detail));
|
|
|
+ //GoodsBills detail = goodsBillsService.getOne(Condition.getQueryWrapper(goodsBills));
|
|
|
+ GoodsBillsVO detail = GoodsBillsWrapper.build().entityVO(goodsBillsService.getOne(Condition.getQueryWrapper(goodsBills)));
|
|
|
+ searchUserInfo(detail);
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 接收人和付款人信息
|
|
|
+ *
|
|
|
+ * @param detail
|
|
|
+ */
|
|
|
+ private void searchUserInfo(GoodsBillsVO detail) {
|
|
|
+ LoginUser user = userService.getById(detail.getPayId());
|
|
|
+ if (ObjectUtil.isNotEmpty(user)) {
|
|
|
+ detail.setPayer(user.getNickName());
|
|
|
+ }
|
|
|
+ Shop shop = shopService.getById(detail.getReceiveId());
|
|
|
+ if (ObjectUtil.isNotEmpty(shop)) {
|
|
|
+ detail.setTaker(shop.getName());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -68,8 +92,10 @@ public class GoodsBillsController extends BladeController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "分页", notes = "传入goodsBills")
|
|
|
public R<IPage<GoodsBillsVO>> list(GoodsBills goodsBills, Query query) {
|
|
|
- IPage<GoodsBills> pages = goodsBillsService.page(Condition.getPage(query), Condition.getQueryWrapper(goodsBills));
|
|
|
- return R.data(GoodsBillsWrapper.build().pageVO(pages));
|
|
|
+ //IPage<GoodsBills> pages = goodsBillsService.page(Condition.getPage(query), Condition.getQueryWrapper(goodsBills));
|
|
|
+ IPage<GoodsBillsVO> pages = GoodsBillsWrapper.build().pageVO(goodsBillsService.page(Condition.getPage(query), Condition.getQueryWrapper(goodsBills)));
|
|
|
+ pages.getRecords().forEach(this::searchUserInfo);
|
|
|
+ return R.data(pages);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -114,7 +140,7 @@ public class GoodsBillsController extends BladeController {
|
|
|
return R.status(goodsBillsService.saveOrUpdate(goodsBills));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 删除 订单
|
|
|
*/
|
|
|
@@ -125,5 +151,5 @@ public class GoodsBillsController extends BladeController {
|
|
|
return R.status(goodsBillsService.deleteLogic(Func.toLongList(ids)));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|