|
|
@@ -18,51 +18,44 @@ package org.springblade.purchase.sales.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import com.trade.purchase.order.enums.OrderTypeEnum;
|
|
|
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.check.dto.AuditProecessDTO;
|
|
|
-import org.springblade.check.entity.AuditPathsActs;
|
|
|
-import org.springblade.check.entity.AuditPathsLevels;
|
|
|
-import org.springblade.check.feign.ICheckClient;
|
|
|
import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.client.entity.FeesDesc;
|
|
|
import org.springblade.client.feign.ICorpsDescClient;
|
|
|
import org.springblade.client.feign.IFeesDescClient;
|
|
|
+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.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.deliver.goods.entity.Delivery;
|
|
|
import org.springblade.deliver.goods.feign.IDeliveryClient;
|
|
|
-import org.springblade.finance.vojo.Acc;
|
|
|
import org.springblade.finance.feign.IFinanceClient;
|
|
|
-import org.springblade.finance.vojo.Settlement;
|
|
|
+import org.springblade.finance.vojo.Acc;
|
|
|
+import org.springblade.purchase.sales.entity.Order;
|
|
|
import org.springblade.purchase.sales.entity.OrderFees;
|
|
|
import org.springblade.purchase.sales.entity.OrderItems;
|
|
|
import org.springblade.purchase.sales.service.*;
|
|
|
import org.springblade.purchase.sales.vo.OrderItemsVO;
|
|
|
import org.springblade.purchase.sales.vo.OrderStatisticAnalysisVO;
|
|
|
+import org.springblade.purchase.sales.vo.OrderVO;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import org.springblade.purchase.sales.entity.Order;
|
|
|
-import org.springblade.purchase.sales.vo.OrderVO;
|
|
|
-import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -119,6 +112,7 @@ public class OrderController extends BladeController {
|
|
|
IPage<Order> pages = orderService.page(Condition.getPage(query), Condition.getQueryWrapper(order));
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 自定义分页 销售或采购订单表
|
|
|
*/
|
|
|
@@ -127,70 +121,70 @@ public class OrderController extends BladeController {
|
|
|
@ApiOperation(value = "分页", notes = "传入order")
|
|
|
public R<IPage<Order>> page(OrderVO order, Query query) {
|
|
|
LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(Order::getTenantId,SecureUtil.getTenantId());//租户id
|
|
|
- lambdaQueryWrapper.eq(Order::getIsDeleted,0);//订单是否有效
|
|
|
- lambdaQueryWrapper.eq(Order::getBillType,OrderTypeEnum.SALES.getType());//订单类型
|
|
|
- lambdaQueryWrapper.eq(Order::getTradeType,OrderTypeEnum.DOMESTIC.getType());//贸易类型
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderNo()),Order::getOrderNo,order.getOrderNo());//订单号
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getCorpId()),Order::getCorpId,order.getCorpId());//客户id
|
|
|
- lambdaQueryWrapper.ge(Func.isNotEmpty(order.getContractStartDate()),Order::getBusinesDate,order.getContractStartDate());//合同日期开始
|
|
|
- lambdaQueryWrapper.le(Func.isNotEmpty(order.getContractEndDate()),Order::getBusinesDate,order.getContractEndDate());//合同日期结束
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getSrcOrderNo()),Order::getSrcOrderNo,order.getSrcOrderNo());//订单来源
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getShippingAddress()),Order::getShippingAddress,order.getShippingAddress());//发货地址
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getArrivalAddress()),Order::getArrivalAddress,order.getArrivalAddress());//到货地址
|
|
|
- lambdaQueryWrapper.ge(Func.isNotEmpty(order.getActualDeliveryDateStart()),Order::getActualDeliveryDate,order.getActualDeliveryDateStart());//发货日期开始
|
|
|
- lambdaQueryWrapper.le(Func.isNotEmpty(order.getActualDeliveryDateEnd()),Order::getActualDeliveryDate,order.getActualDeliveryDateEnd());//发货日期结束
|
|
|
- lambdaQueryWrapper.ge(Func.isNotEmpty(order.getDeliveryStartDate()),Order::getRequiredDeliveryDate,order.getDeliveryStartDate());//要求发货日期开始
|
|
|
- lambdaQueryWrapper.le(Func.isNotEmpty(order.getDeliveryEndDate()),Order::getRequiredDeliveryDate,order.getDeliveryEndDate());//要求发货日期结束
|
|
|
- lambdaQueryWrapper.ge(Func.isNotEmpty(order.getArrivalDateStart()),Order::getRequiredArrivalDate,order.getArrivalDateStart());//要求到货日期开始
|
|
|
- lambdaQueryWrapper.le(Func.isNotEmpty(order.getArrivalDateEnd()),Order::getRequiredArrivalDate,order.getArrivalDateEnd());//要求到货日期结束
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderStatus()),Order::getOrderStatus,order.getOrderStatus());//单据状态
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getSysNo()),Order::getSysNo,order.getSysNo());//系统编号
|
|
|
- lambdaQueryWrapper.eq(Func.isNotEmpty(order.getCreateUser()),Order::getCreateUser,order.getCreateUser());//制单人
|
|
|
- lambdaQueryWrapper.ge(Func.isNotEmpty(order.getCreateTimeStart()),Order::getCreateTime,order.getCreateTimeStart());//制单日期开始
|
|
|
- lambdaQueryWrapper.le(Func.isNotEmpty(order.getCreateTimeEnd()),Order::getCreateTime,order.getCreateTimeEnd());//制单日期结束
|
|
|
- lambdaQueryWrapper.ge(Func.isNotEmpty(order.getDateValidityStart()),Order::getDateValidity,order.getDateValidityStart());//有效日期开始
|
|
|
- lambdaQueryWrapper.le(Func.isNotEmpty(order.getDateValidityEnd()),Order::getDateValidity,order.getDateValidityEnd());//有效日期结束
|
|
|
- lambdaQueryWrapper.ge(Func.isNotEmpty(order.getOrderStartDate()),Order::getBusinesDate,order.getOrderStartDate());//订单日期开始
|
|
|
- lambdaQueryWrapper.le(Func.isNotEmpty(order.getOrderEndDate()),Order::getBusinesDate,order.getOrderEndDate());//订单日期结束
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getPortOfLoad()),Order::getPortOfLoad,order.getPortOfLoad());//装货港
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getPortOfDestination()),Order::getPortOfDestination,order.getPortOfDestination());//目的港
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getPlannedDeliveryStart()), Order::getPlannedDeliveryDate,order.getPlannedDeliveryStart());//计划交货开始
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getPlannedDeliveryEnd()), Order::getPlannedDeliveryDate,order.getPlannedDeliveryEnd());//计划交货结束
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderRemark()),Order::getOrderRemark,order.getOrderRemark());//备注
|
|
|
+ lambdaQueryWrapper.eq(Order::getTenantId, SecureUtil.getTenantId());//租户id
|
|
|
+ lambdaQueryWrapper.eq(Order::getIsDeleted, 0);//订单是否有效
|
|
|
+ lambdaQueryWrapper.eq(Order::getBillType, OrderTypeEnum.SALES.getType());//订单类型
|
|
|
+ lambdaQueryWrapper.eq(Order::getTradeType, OrderTypeEnum.DOMESTIC.getType());//贸易类型
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderNo()), Order::getOrderNo, order.getOrderNo());//订单号
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getCorpId()), Order::getCorpId, order.getCorpId());//客户id
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getContractStartDate()), Order::getBusinesDate, order.getContractStartDate());//合同日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getContractEndDate()), Order::getBusinesDate, order.getContractEndDate());//合同日期结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getSrcOrderNo()), Order::getSrcOrderNo, order.getSrcOrderNo());//订单来源
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getShippingAddress()), Order::getShippingAddress, order.getShippingAddress());//发货地址
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getArrivalAddress()), Order::getArrivalAddress, order.getArrivalAddress());//到货地址
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getActualDeliveryDateStart()), Order::getActualDeliveryDate, order.getActualDeliveryDateStart());//发货日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getActualDeliveryDateEnd()), Order::getActualDeliveryDate, order.getActualDeliveryDateEnd());//发货日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getDeliveryStartDate()), Order::getRequiredDeliveryDate, order.getDeliveryStartDate());//要求发货日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getDeliveryEndDate()), Order::getRequiredDeliveryDate, order.getDeliveryEndDate());//要求发货日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getArrivalDateStart()), Order::getRequiredArrivalDate, order.getArrivalDateStart());//要求到货日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getArrivalDateEnd()), Order::getRequiredArrivalDate, order.getArrivalDateEnd());//要求到货日期结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderStatus()), Order::getOrderStatus, order.getOrderStatus());//单据状态
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getSysNo()), Order::getSysNo, order.getSysNo());//系统编号
|
|
|
+ lambdaQueryWrapper.eq(Func.isNotEmpty(order.getCreateUser()), Order::getCreateUser, order.getCreateUser());//制单人
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getCreateTimeStart()), Order::getCreateTime, order.getCreateTimeStart());//制单日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getCreateTimeEnd()), Order::getCreateTime, order.getCreateTimeEnd());//制单日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getDateValidityStart()), Order::getDateValidity, order.getDateValidityStart());//有效日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getDateValidityEnd()), Order::getDateValidity, order.getDateValidityEnd());//有效日期结束
|
|
|
+ lambdaQueryWrapper.ge(Func.isNotEmpty(order.getOrderStartDate()), Order::getBusinesDate, order.getOrderStartDate());//订单日期开始
|
|
|
+ lambdaQueryWrapper.le(Func.isNotEmpty(order.getOrderEndDate()), Order::getBusinesDate, order.getOrderEndDate());//订单日期结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPortOfLoad()), Order::getPortOfLoad, order.getPortOfLoad());//装货港
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPortOfDestination()), Order::getPortOfDestination, order.getPortOfDestination());//目的港
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPlannedDeliveryStart()), Order::getPlannedDeliveryDate, order.getPlannedDeliveryStart());//计划交货开始
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getPlannedDeliveryEnd()), Order::getPlannedDeliveryDate, order.getPlannedDeliveryEnd());//计划交货结束
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(order.getOrderRemark()), Order::getOrderRemark, order.getOrderRemark());//备注
|
|
|
lambdaQueryWrapper.orderByDesc(Order::getId);
|
|
|
IPage<Order> page = orderService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
- if (CollectionUtils.isNotEmpty(page.getRecords())){
|
|
|
- page.getRecords().stream().forEach(item ->{
|
|
|
- if (item.getCorpId() != null){
|
|
|
+ if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|
|
+ page.getRecords().stream().forEach(item -> {
|
|
|
+ if (item.getCorpId() != null) {
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());//客户
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
item.setCorpsName(corpMessage.getData().getCname());
|
|
|
}
|
|
|
}
|
|
|
- if (item.getBelongToCorpId() != null){
|
|
|
+ if (item.getBelongToCorpId() != null) {
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getBelongToCorpId());//销售公司
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
item.setBelongToCorpName(corpMessage.getData().getCname());
|
|
|
}
|
|
|
}
|
|
|
- if (item.getProductionPlant() != null){
|
|
|
+ if (item.getProductionPlant() != null) {
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getProductionPlant());//销售公司
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
item.setProductionPlantName(corpMessage.getData().getCname());
|
|
|
}
|
|
|
}
|
|
|
R<User> user = userClient.userInfoById(item.getCreateUser());//制单人
|
|
|
- if (user.isSuccess() && user.getData() != null){
|
|
|
+ if (user.isSuccess() && user.getData() != null) {
|
|
|
item.setCreateUserName(user.getData().getName());
|
|
|
}
|
|
|
//获取订单明细
|
|
|
List<OrderItems> list = orderItemsService.list(new QueryWrapper<OrderItems>().eq("pid", item.getId()).eq("is_deleted", 0));
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
- item.setOrderQuantity(list.stream().map(OrderItems::getOrderQuantity).reduce(BigDecimal.ZERO,BigDecimal::add));//数量合计
|
|
|
- item.setAmount(list.stream().map(OrderItems::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add));//销售金额
|
|
|
- item.setPurchaseAmount(list.stream().map(OrderItems::getPurchaseAmount).reduce(BigDecimal.ZERO,BigDecimal::add));//采购金额
|
|
|
- item.setActualQuantity(list.stream().map(OrderItems::getActualQuantity).reduce(BigDecimal.ZERO,BigDecimal::add));//发货数量
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ item.setOrderQuantity(list.stream().map(OrderItems::getOrderQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));//数量合计
|
|
|
+ item.setAmount(list.stream().map(OrderItems::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));//销售金额
|
|
|
+ item.setPurchaseAmount(list.stream().map(OrderItems::getPurchaseAmount).reduce(BigDecimal.ZERO, BigDecimal::add));//采购金额
|
|
|
+ item.setActualQuantity(list.stream().map(OrderItems::getActualQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));//发货数量
|
|
|
item.setActualWeight(list.stream().map(OrderItems::getActualWeight).reduce(BigDecimal.ZERO, BigDecimal::add));//已发重量(吨)
|
|
|
}
|
|
|
});
|
|
|
@@ -215,30 +209,30 @@ public class OrderController extends BladeController {
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
@ApiOperation(value = "修改", notes = "传入order")
|
|
|
public R update(@Valid @RequestBody Order order) {
|
|
|
- if (order.getId() == null){
|
|
|
- throw new SecurityException("请选择要删除的数据");
|
|
|
+ if (order.getId() == null) {
|
|
|
+ throw new SecurityException("请选择要删除的数据");
|
|
|
}
|
|
|
//先查订单信息
|
|
|
Order orderMessage = orderService.getById(order.getId());
|
|
|
//是否生成采购单
|
|
|
LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(Order::getSrcOrderNo,orderMessage.getSysNo());
|
|
|
- lambdaQueryWrapper.eq(Order::getTradeType,OrderTypeEnum.DOMESTIC.getType());
|
|
|
- lambdaQueryWrapper.eq(Order::getIsDeleted,0);
|
|
|
- lambdaQueryWrapper.eq(Order::getBillType,OrderTypeEnum.PURCHASE.getType());
|
|
|
+ lambdaQueryWrapper.eq(Order::getSrcOrderNo, orderMessage.getSysNo());
|
|
|
+ lambdaQueryWrapper.eq(Order::getTradeType, OrderTypeEnum.DOMESTIC.getType());
|
|
|
+ lambdaQueryWrapper.eq(Order::getIsDeleted, 0);
|
|
|
+ lambdaQueryWrapper.eq(Order::getBillType, OrderTypeEnum.PURCHASE.getType());
|
|
|
List<Order> orderList = orderService.list(lambdaQueryWrapper);
|
|
|
- if (CollectionUtils.isNotEmpty(orderList)){
|
|
|
- throw new SecurityException("销售单已生成采购单不能删除");
|
|
|
+ if (CollectionUtils.isNotEmpty(orderList)) {
|
|
|
+ throw new SecurityException("销售单已生成采购单不能删除");
|
|
|
}
|
|
|
//是否生成发货单
|
|
|
- List<Delivery> list = deliveryClient.getOrderMessage(orderMessage.getSysNo(),OrderTypeEnum.DOMESTIC.getType());
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
- throw new SecurityException("销售单已生成发货单不能删除");
|
|
|
+ List<Delivery> list = deliveryClient.getOrderMessage(orderMessage.getSysNo(), OrderTypeEnum.DOMESTIC.getType());
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ throw new SecurityException("销售单已生成发货单不能删除");
|
|
|
}
|
|
|
//是否生成账单单
|
|
|
List<Acc> financeAcc = iFinanceClient.getFinanceAccList(orderMessage.getOrderNo(), OrderTypeEnum.DOMESTIC.getType());
|
|
|
- if (CollectionUtils.isNotEmpty(financeAcc)){
|
|
|
- throw new SecurityException("销售单已生成账单不能删除");
|
|
|
+ if (CollectionUtils.isNotEmpty(financeAcc)) {
|
|
|
+ throw new SecurityException("销售单已生成账单不能删除");
|
|
|
}
|
|
|
order.setIsDeleted(1);
|
|
|
orderService.updateById(order);
|
|
|
@@ -250,6 +244,7 @@ public class OrderController extends BladeController {
|
|
|
orderPartsService.updateByPid(order.getId());
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 新增或修改 国内销售或采购订单表
|
|
|
*/
|
|
|
@@ -275,6 +270,7 @@ public class OrderController extends BladeController {
|
|
|
|
|
|
/**
|
|
|
* 国内销售单生成发货单
|
|
|
+ *
|
|
|
* @param order
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -282,42 +278,46 @@ public class OrderController extends BladeController {
|
|
|
@ApiOperationSupport(order = 6)
|
|
|
@ApiOperation(value = "国内销售单生成发货单", notes = "传入主订单id,明细ids")
|
|
|
public R deliverGoods(@Valid @RequestBody Order order) {
|
|
|
- if (order.getId() == null){
|
|
|
- return R.fail(500,"参数缺失");
|
|
|
+ if (order.getId() == null) {
|
|
|
+ return R.fail(500, "参数缺失");
|
|
|
}
|
|
|
- if (CollectionUtils.isEmpty(order.getOrderItemIds())){
|
|
|
- return R.fail(500,"请选择要发货的商品明细");
|
|
|
+ if (CollectionUtils.isEmpty(order.getOrderItemIds())) {
|
|
|
+ return R.fail(500, "请选择要发货的商品明细");
|
|
|
}
|
|
|
order.setBillType(OrderTypeEnum.SALES.getType());
|
|
|
order.setTradeType(OrderTypeEnum.DOMESTIC.getType());
|
|
|
return R.data(orderService.deliverGoods(order));
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 发货单获取订单明细
|
|
|
- * @param query 分页参数
|
|
|
- * @param orderNo 订单号或合同号
|
|
|
- * @param corpId 客户id
|
|
|
+ *
|
|
|
+ * @param query 分页参数
|
|
|
+ * @param orderNo 订单号或合同号
|
|
|
+ * @param corpId 客户id
|
|
|
* @param orderStartDate 时间开始时间
|
|
|
- * @param orderEndDate 时间结束时间
|
|
|
+ * @param orderEndDate 时间结束时间
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/orderItemsList")
|
|
|
@ApiOperationSupport(order = 10)
|
|
|
@ApiOperation(value = "发货单获取订单明细", notes = "传入orderItems")
|
|
|
public R<IPage<OrderItemsVO>> orderItemsList(Query query,
|
|
|
- @RequestParam(value = "orderNo",required = false) String orderNo,
|
|
|
- @RequestParam(value = "corpId",required = false)Long corpId,
|
|
|
- @RequestParam(value = "orderStartDate",required = false)String orderStartDate,
|
|
|
- @RequestParam(value = "orderEndDate",required = false)String orderEndDate) {
|
|
|
+ @RequestParam(value = "orderNo", required = false) String orderNo,
|
|
|
+ @RequestParam(value = "corpId", required = false) Long corpId,
|
|
|
+ @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
|
|
|
+ @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
|
|
|
String tradeType = OrderTypeEnum.DOMESTIC.getType();
|
|
|
String billType = OrderTypeEnum.SALES.getType();
|
|
|
String tenantId = SecureUtil.getTenantId();
|
|
|
- IPage<OrderItemsVO> pages = orderItemsService.orderItemsList(Condition.getPage(query),orderNo,corpId,orderStartDate,orderEndDate,
|
|
|
- tradeType,billType,tenantId);
|
|
|
+ IPage<OrderItemsVO> pages = orderItemsService.orderItemsList(Condition.getPage(query), orderNo, corpId, orderStartDate, orderEndDate,
|
|
|
+ tradeType, billType, tenantId);
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 国内销售单生成采购单
|
|
|
+ *
|
|
|
* @param order
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -325,8 +325,8 @@ public class OrderController extends BladeController {
|
|
|
@ApiOperationSupport(order = 9)
|
|
|
@ApiOperation(value = "国内销售单生成采购单")
|
|
|
public R createMarket(@Valid @RequestBody Order order) {
|
|
|
- if (order.getId() == null){
|
|
|
- return R.fail(500,"参数缺失");
|
|
|
+ if (order.getId() == null) {
|
|
|
+ return R.fail(500, "参数缺失");
|
|
|
}
|
|
|
order.setBillType(OrderTypeEnum.PURCHASE.getType());
|
|
|
order.setTradeType(OrderTypeEnum.DOMESTIC.getType());
|
|
|
@@ -335,81 +335,72 @@ public class OrderController extends BladeController {
|
|
|
|
|
|
/**
|
|
|
* 统计分析
|
|
|
- * */
|
|
|
+ */
|
|
|
@GetMapping("/listOrderStatisticAnalysis")
|
|
|
@ApiOperationSupport(order = 9)
|
|
|
@ApiOperation(value = "统计分析")
|
|
|
- public R listOrderStatisticAnalysis(Order order, Query query)
|
|
|
- {
|
|
|
+ public R listOrderStatisticAnalysis(Order order, Query query) {
|
|
|
|
|
|
/* LambdaQueryWrapper<Order> orderLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
orderLambdaQueryWrapper.eq(StringUtils.isNotBlank(order.getOrderNo()),Order::getOrderNo,order.getOrderNo());
|
|
|
orderLambdaQueryWrapper.between(StringUtils.isNotBlank(order.getStartTime())&&StringUtils.isNotBlank(order.getEndTime()),Order::getCreateTime,order.getStartTime(),order.getEndTime());
|
|
|
IPage<Order> iPage = orderService.page(Condition.getPage(query), orderLambdaQueryWrapper);
|
|
|
List<Order> records = iPage.getRecords();*/
|
|
|
- Page<OrderStatisticAnalysisVO> iPage = new Page(query.getCurrent(),query.getSize());
|
|
|
- IPage<OrderStatisticAnalysisVO> orderStatisticAnalysisVOIPage = orderService.listOrderStatisticAnalysis(iPage, AuthUtil.getTenantId(), order.getOrderNo(),order.getStartTime(),order.getEndTime());
|
|
|
+ Page<OrderStatisticAnalysisVO> iPage = new Page(query.getCurrent(), query.getSize());
|
|
|
+ IPage<OrderStatisticAnalysisVO> orderStatisticAnalysisVOIPage = orderService.listOrderStatisticAnalysis(iPage, AuthUtil.getTenantId(), order.getOrderNo(), order.getStartTime(), order.getEndTime());
|
|
|
List<OrderStatisticAnalysisVO> records = orderStatisticAnalysisVOIPage.getRecords();
|
|
|
- if(CollectionUtils.isNotEmpty(records))
|
|
|
- {
|
|
|
- records.forEach(e->{
|
|
|
+ if (CollectionUtils.isNotEmpty(records)) {
|
|
|
+ records.forEach(e -> {
|
|
|
Long orderId = e.getOrderId();
|
|
|
//采购主表信息
|
|
|
- LambdaQueryWrapper<Order> orderLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<Order> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
orderLambdaQueryWrapper
|
|
|
- .eq(Order::getId,orderId)
|
|
|
- .eq(Order::getTenantId,AuthUtil.getTenantId())
|
|
|
- .eq(Order::getIsDeleted,0);
|
|
|
+ .eq(Order::getId, orderId)
|
|
|
+ .eq(Order::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Order::getIsDeleted, 0);
|
|
|
Order service = orderService.getOne(orderLambdaQueryWrapper);
|
|
|
//供应商名称
|
|
|
- if(e.getCorpId()!=null)
|
|
|
- {
|
|
|
+ if (e.getCorpId() != null) {
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(e.getCorpId());
|
|
|
- if(corpMessage.isSuccess())
|
|
|
- {
|
|
|
+ if (corpMessage.isSuccess()) {
|
|
|
e.setCorpName(corpMessage.getData().getCname());
|
|
|
}
|
|
|
}
|
|
|
//调用-费用微服务-获取关税设置详情
|
|
|
R<FeesDesc> customDuty = feesDescClient.getFeesByName("关税");
|
|
|
- Long customDutyId=null;
|
|
|
- if(customDuty.isSuccess()&&customDuty.getData()!=null)
|
|
|
- {
|
|
|
- customDutyId=customDuty.getData().getId();
|
|
|
+ Long customDutyId = null;
|
|
|
+ if (customDuty.isSuccess() && customDuty.getData() != null) {
|
|
|
+ customDutyId = customDuty.getData().getId();
|
|
|
}
|
|
|
|
|
|
//关税
|
|
|
- BigDecimal customDutyMoney=BigDecimal.ZERO;
|
|
|
+ BigDecimal customDutyMoney = BigDecimal.ZERO;
|
|
|
//查询采购订单关税的费用明细
|
|
|
- if(customDutyId!=null)
|
|
|
- {
|
|
|
- LambdaQueryWrapper<OrderFees> orderFeesLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ if (customDutyId != null) {
|
|
|
+ LambdaQueryWrapper<OrderFees> orderFeesLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
orderFeesLambdaQueryWrapper
|
|
|
- .eq(OrderFees::getPid,orderId)
|
|
|
- .eq(OrderFees::getItemId,customDutyId);
|
|
|
+ .eq(OrderFees::getPid, orderId)
|
|
|
+ .eq(OrderFees::getItemId, customDutyId);
|
|
|
List<Long> customDutyIds = orderFeesService.list(orderFeesLambdaQueryWrapper).stream().map(OrderFees::getId).collect(Collectors.toList());
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(customDutyIds))
|
|
|
- {
|
|
|
- Acc customDutyAcc=new Acc();
|
|
|
+ if (CollectionUtils.isNotEmpty(customDutyIds)) {
|
|
|
+ Acc customDutyAcc = new Acc();
|
|
|
customDutyAcc.setSrcType(2);
|
|
|
customDutyAcc.setSrcFeesIds(customDutyIds);
|
|
|
//只有 itemType=采购 && billType=申请 才是付钱
|
|
|
customDutyAcc.setItemType("采购");
|
|
|
customDutyAcc.setBillType("申请");
|
|
|
R<List<Acc>> accListByCondition = iFinanceClient.getAccListByCondition(customDutyAcc);
|
|
|
- if(accListByCondition.isSuccess())
|
|
|
- {
|
|
|
+ if (accListByCondition.isSuccess()) {
|
|
|
List<Acc> customDutyList = accListByCondition.getData();
|
|
|
//关税
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(customDutyList))
|
|
|
- {
|
|
|
- customDutyMoney=customDutyList.stream().reduce(BigDecimal.ZERO,(x,y) ->{ return x.add(y.getAmount().multiply(y.getExchangeRate())); },BigDecimal::add);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- customDutyMoney=BigDecimal.ZERO;
|
|
|
+ if (CollectionUtils.isNotEmpty(customDutyList)) {
|
|
|
+ customDutyMoney = customDutyList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
|
|
|
+ return x.add(y.getAmount().multiply(y.getExchangeRate()));
|
|
|
+ }, BigDecimal::add);
|
|
|
+ } else {
|
|
|
+ customDutyMoney = BigDecimal.ZERO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -419,42 +410,37 @@ public class OrderController extends BladeController {
|
|
|
|
|
|
|
|
|
//调用-费用微服务-获取物流费设置详情
|
|
|
- Long deliverId=null;
|
|
|
+ Long deliverId = null;
|
|
|
R<FeesDesc> deliver = feesDescClient.getFeesByName("物流费");
|
|
|
- if(deliver.isSuccess()&&deliver.getData()!=null)
|
|
|
- {
|
|
|
- deliverId=deliver.getData().getId();
|
|
|
+ if (deliver.isSuccess() && deliver.getData() != null) {
|
|
|
+ deliverId = deliver.getData().getId();
|
|
|
}
|
|
|
- BigDecimal deliverMoney=BigDecimal.ZERO;
|
|
|
- if(deliverId!=null)
|
|
|
- {
|
|
|
- LambdaQueryWrapper<OrderFees> quotaLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ BigDecimal deliverMoney = BigDecimal.ZERO;
|
|
|
+ if (deliverId != null) {
|
|
|
+ LambdaQueryWrapper<OrderFees> quotaLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
quotaLambdaQueryWrapper
|
|
|
- .eq(OrderFees::getPid,orderId)
|
|
|
- .eq(OrderFees::getItemId,deliverId);
|
|
|
+ .eq(OrderFees::getPid, orderId)
|
|
|
+ .eq(OrderFees::getItemId, deliverId);
|
|
|
List<Long> deliverIds = orderFeesService.list(quotaLambdaQueryWrapper).stream().map(OrderFees::getId).collect(Collectors.toList());
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(deliverIds))
|
|
|
- {
|
|
|
- Acc customDutyAcc=new Acc();
|
|
|
+ if (CollectionUtils.isNotEmpty(deliverIds)) {
|
|
|
+ Acc customDutyAcc = new Acc();
|
|
|
customDutyAcc.setSrcType(2);
|
|
|
customDutyAcc.setSrcFeesIds(deliverIds);
|
|
|
//只有 itemType=采购 && billType=申请 才是付钱
|
|
|
customDutyAcc.setItemType("采购");
|
|
|
customDutyAcc.setBillType("申请");
|
|
|
R<List<Acc>> accListByCondition = iFinanceClient.getAccListByCondition(customDutyAcc);
|
|
|
- if(accListByCondition.isSuccess())
|
|
|
- {
|
|
|
+ if (accListByCondition.isSuccess()) {
|
|
|
List<Acc> deliverList = accListByCondition.getData();
|
|
|
//物流费
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(deliverList))
|
|
|
- {
|
|
|
- deliverMoney=deliverList.stream().reduce(BigDecimal.ZERO,(x,y) ->{ return x.add(y.getAmount().multiply(y.getExchangeRate())); },BigDecimal::add);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- deliverMoney=BigDecimal.ZERO;
|
|
|
+ if (CollectionUtils.isNotEmpty(deliverList)) {
|
|
|
+ deliverMoney = deliverList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
|
|
|
+ return x.add(y.getAmount().multiply(y.getExchangeRate()));
|
|
|
+ }, BigDecimal::add);
|
|
|
+ } else {
|
|
|
+ deliverMoney = BigDecimal.ZERO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -465,44 +451,39 @@ public class OrderController extends BladeController {
|
|
|
|
|
|
|
|
|
//调用-费用微服务-获取配额设置详情
|
|
|
- Long quotaId=null;
|
|
|
+ Long quotaId = null;
|
|
|
R<FeesDesc> quota = feesDescClient.getFeesByName("配额");
|
|
|
- if(quota.isSuccess()&"a.getData()!=null)
|
|
|
- {
|
|
|
- quotaId=quota.getData().getId();
|
|
|
+ if (quota.isSuccess() && quota.getData() != null) {
|
|
|
+ quotaId = quota.getData().getId();
|
|
|
}
|
|
|
//配额
|
|
|
- BigDecimal quotaMoney=BigDecimal.ZERO;
|
|
|
+ BigDecimal quotaMoney = BigDecimal.ZERO;
|
|
|
//查询采购订单配额的费用明细
|
|
|
- if(quotaId!=null)
|
|
|
- {
|
|
|
- LambdaQueryWrapper<OrderFees> quotaLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ if (quotaId != null) {
|
|
|
+ LambdaQueryWrapper<OrderFees> quotaLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
quotaLambdaQueryWrapper
|
|
|
- .eq(OrderFees::getPid,orderId)
|
|
|
- .eq(OrderFees::getItemId,quotaId);
|
|
|
+ .eq(OrderFees::getPid, orderId)
|
|
|
+ .eq(OrderFees::getItemId, quotaId);
|
|
|
List<Long> quotaIdIds = orderFeesService.list(quotaLambdaQueryWrapper).stream().map(OrderFees::getId).collect(Collectors.toList());
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(quotaIdIds))
|
|
|
- {
|
|
|
- Acc customDutyAcc=new Acc();
|
|
|
+ if (CollectionUtils.isNotEmpty(quotaIdIds)) {
|
|
|
+ Acc customDutyAcc = new Acc();
|
|
|
customDutyAcc.setSrcType(2);
|
|
|
customDutyAcc.setSrcFeesIds(quotaIdIds);
|
|
|
//只有 itemType=采购 && billType=申请 才是付钱
|
|
|
customDutyAcc.setItemType("采购");
|
|
|
customDutyAcc.setBillType("申请");
|
|
|
R<List<Acc>> accListByCondition = iFinanceClient.getAccListByCondition(customDutyAcc);
|
|
|
- if(accListByCondition.isSuccess())
|
|
|
- {
|
|
|
+ if (accListByCondition.isSuccess()) {
|
|
|
List<Acc> quotaList = accListByCondition.getData();
|
|
|
//关税
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(quotaList))
|
|
|
- {
|
|
|
- quotaMoney=quotaList.stream().reduce(BigDecimal.ZERO,(x,y) ->{ return x.add(y.getAmount().multiply(y.getExchangeRate())); },BigDecimal::add);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- quotaMoney=BigDecimal.ZERO;
|
|
|
+ if (CollectionUtils.isNotEmpty(quotaList)) {
|
|
|
+ quotaMoney = quotaList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
|
|
|
+ return x.add(y.getAmount().multiply(y.getExchangeRate()));
|
|
|
+ }, BigDecimal::add);
|
|
|
+ } else {
|
|
|
+ quotaMoney = BigDecimal.ZERO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -513,43 +494,38 @@ public class OrderController extends BladeController {
|
|
|
|
|
|
|
|
|
//调用-费用微服务-获取增值税设置详情
|
|
|
- Long gstId=null;
|
|
|
+ Long gstId = null;
|
|
|
R<FeesDesc> GST = feesDescClient.getFeesByName("增值税");
|
|
|
- if(GST.isSuccess()&&GST.getData()!=null)
|
|
|
- {
|
|
|
- gstId=GST.getData().getId();
|
|
|
+ if (GST.isSuccess() && GST.getData() != null) {
|
|
|
+ gstId = GST.getData().getId();
|
|
|
}
|
|
|
//增值税
|
|
|
- BigDecimal gstMoney=BigDecimal.ZERO;
|
|
|
- if(gstId!=null)
|
|
|
- {
|
|
|
- LambdaQueryWrapper<OrderFees> quotaLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ BigDecimal gstMoney = BigDecimal.ZERO;
|
|
|
+ if (gstId != null) {
|
|
|
+ LambdaQueryWrapper<OrderFees> quotaLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
quotaLambdaQueryWrapper
|
|
|
- .eq(OrderFees::getPid,orderId)
|
|
|
- .eq(OrderFees::getItemId,gstId);
|
|
|
+ .eq(OrderFees::getPid, orderId)
|
|
|
+ .eq(OrderFees::getItemId, gstId);
|
|
|
List<Long> gstIds = orderFeesService.list(quotaLambdaQueryWrapper).stream().map(OrderFees::getId).collect(Collectors.toList());
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(gstIds))
|
|
|
- {
|
|
|
- Acc customDutyAcc=new Acc();
|
|
|
+ if (CollectionUtils.isNotEmpty(gstIds)) {
|
|
|
+ Acc customDutyAcc = new Acc();
|
|
|
customDutyAcc.setSrcType(2);
|
|
|
customDutyAcc.setSrcFeesIds(gstIds);
|
|
|
//只有 itemType=采购 && billType=申请 才是付钱
|
|
|
customDutyAcc.setItemType("采购");
|
|
|
customDutyAcc.setBillType("申请");
|
|
|
R<List<Acc>> accListByCondition = iFinanceClient.getAccListByCondition(customDutyAcc);
|
|
|
- if(accListByCondition.isSuccess())
|
|
|
- {
|
|
|
+ if (accListByCondition.isSuccess()) {
|
|
|
List<Acc> gstList = accListByCondition.getData();
|
|
|
//关税
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(gstList))
|
|
|
- {
|
|
|
- gstMoney=gstList.stream().reduce(BigDecimal.ZERO,(x,y) ->{ return x.add(y.getAmount().multiply(y.getExchangeRate())); },BigDecimal::add);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- gstMoney=BigDecimal.ZERO;
|
|
|
+ if (CollectionUtils.isNotEmpty(gstList)) {
|
|
|
+ gstMoney = gstList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
|
|
|
+ return x.add(y.getAmount().multiply(y.getExchangeRate()));
|
|
|
+ }, BigDecimal::add);
|
|
|
+ } else {
|
|
|
+ gstMoney = BigDecimal.ZERO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -560,7 +536,7 @@ public class OrderController extends BladeController {
|
|
|
|
|
|
|
|
|
//获取货款账单明细
|
|
|
- Acc itemAcc=new Acc();
|
|
|
+ Acc itemAcc = new Acc();
|
|
|
itemAcc.setSrcType(1);
|
|
|
itemAcc.setSrcFeesId(null);
|
|
|
itemAcc.setSrcParentId(orderId);
|
|
|
@@ -569,95 +545,69 @@ public class OrderController extends BladeController {
|
|
|
itemAcc.setBillType("申请");
|
|
|
R<List<Acc>> accListByCondition4 = iFinanceClient.getAccListByCondition(itemAcc);
|
|
|
//货款
|
|
|
- BigDecimal itemMoney=BigDecimal.ZERO;
|
|
|
- if(accListByCondition4.isSuccess())
|
|
|
- {
|
|
|
+ BigDecimal itemMoney = BigDecimal.ZERO;
|
|
|
+ if (accListByCondition4.isSuccess()) {
|
|
|
List<Acc> itemList = accListByCondition4.getData();
|
|
|
- if(CollectionUtils.isNotEmpty(itemList))
|
|
|
- {
|
|
|
+ if (CollectionUtils.isNotEmpty(itemList)) {
|
|
|
//货款
|
|
|
- itemMoney=itemList.stream().reduce(BigDecimal.ZERO,(x,y) ->{ return x.add(y.getAmount().multiply(y.getExchangeRate())); },BigDecimal::add);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- itemMoney=BigDecimal.ZERO;
|
|
|
+ itemMoney = itemList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
|
|
|
+ return x.add(y.getAmount().multiply(y.getExchangeRate()));
|
|
|
+ }, BigDecimal::add);
|
|
|
+ } else {
|
|
|
+ itemMoney = BigDecimal.ZERO;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- e.setItemMoney(itemMoney.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
+ e.setItemMoney(itemMoney.setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
|
|
|
//成本单价=(货款+关税+配额)/发票重量---精确小数点2位
|
|
|
- BigDecimal unitPrice=null;
|
|
|
- if(service.getInvoiceWeight()==null || service.getInvoiceWeight().compareTo(BigDecimal.ZERO)==0)
|
|
|
- {
|
|
|
- unitPrice=BigDecimal.ZERO;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- unitPrice=((itemMoney.add(quotaMoney)).add(customDutyMoney)).divide(service.getInvoiceWeight(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal unitPrice = null;
|
|
|
+ if (service.getInvoiceWeight() == null || service.getInvoiceWeight().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ unitPrice = BigDecimal.ZERO;
|
|
|
+ } else {
|
|
|
+ unitPrice = ((itemMoney.add(quotaMoney)).add(customDutyMoney)).divide(service.getInvoiceWeight(), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
e.setUnitPrice(unitPrice);
|
|
|
|
|
|
//销售主表信息
|
|
|
- LambdaQueryWrapper<Order> saleOrderWrapper=new LambdaQueryWrapper<>();
|
|
|
- saleOrderWrapper.eq(Order::getId,e.getOrderSaleId()).eq(Order::getTenantId,AuthUtil.getTenantId());
|
|
|
+ LambdaQueryWrapper<Order> saleOrderWrapper = new LambdaQueryWrapper<>();
|
|
|
+ saleOrderWrapper.eq(Order::getId, e.getOrderSaleId()).eq(Order::getTenantId, AuthUtil.getTenantId());
|
|
|
Order serviceOne = orderService.getOne(saleOrderWrapper);
|
|
|
- if(serviceOne==null)
|
|
|
- {
|
|
|
- return;
|
|
|
+ if (serviceOne == null) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
//客户名称
|
|
|
- if(e.getSaleCorpId()!=null)
|
|
|
- {
|
|
|
+ if (e.getSaleCorpId() != null) {
|
|
|
R<CorpsDesc> corpsDescClientCorpMessage = corpsDescClient.getCorpMessage(e.getSaleCorpId());
|
|
|
- if(corpsDescClientCorpMessage.isSuccess())
|
|
|
- {
|
|
|
+ if (corpsDescClientCorpMessage.isSuccess()) {
|
|
|
e.setSaleCorpName(corpsDescClientCorpMessage.getData().getCname());
|
|
|
}
|
|
|
}
|
|
|
//业务员名称
|
|
|
- if(e.getCreateUser()!=null)
|
|
|
- {
|
|
|
+ if (e.getCreateUser() != null) {
|
|
|
R<User> info = userClient.userInfoById(e.getCreateUser());
|
|
|
- if(info.isSuccess())
|
|
|
- {
|
|
|
+ if (info.isSuccess()) {
|
|
|
e.setCreateUserName(info.getData().getRealName());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(serviceOne.getExchangeRate()==null)
|
|
|
- {
|
|
|
- throw new SecurityException("销售订单:"+serviceOne.getOrderNo()+",汇率未填,无法完成统计");
|
|
|
+ if (serviceOne.getExchangeRate() == null) {
|
|
|
+ throw new SecurityException("销售订单:" + serviceOne.getOrderNo() + ",汇率未填,无法完成统计");
|
|
|
}
|
|
|
//开票金额= 销售订单明细总价*销售订单主表的汇率
|
|
|
- BigDecimal InvoiceAmount=e.getAmount().multiply(serviceOne.getExchangeRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal InvoiceAmount = e.getAmount().multiply(serviceOne.getExchangeRate()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
e.setInvoiceAmount(InvoiceAmount);
|
|
|
e.setExchangeRate(serviceOne.getExchangeRate());
|
|
|
//成本金额=提货数量*成本价格
|
|
|
- BigDecimal costAmount=e.getSaleBillWeight().multiply(unitPrice).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal costAmount = e.getSaleBillWeight().multiply(unitPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
e.setCostAmount(costAmount);
|
|
|
|
|
|
- //利润=开票金额-成本金额-物流费用
|
|
|
- BigDecimal profit=(InvoiceAmount.subtract(costAmount)).subtract(deliverMoney).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
- e.setProfit(profit);
|
|
|
+ //利润=开票金额-成本金额-物流费用
|
|
|
+ BigDecimal profit = (InvoiceAmount.subtract(costAmount)).subtract(deliverMoney).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ e.setProfit(profit);
|
|
|
});
|
|
|
}
|
|
|
orderStatisticAnalysisVOIPage.setRecords(records);
|
|
|
@@ -665,8 +615,7 @@ public class OrderController extends BladeController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("checkOrder")
|
|
|
- public R checkOrder(@RequestBody Order order)
|
|
|
- {
|
|
|
+ public R checkOrder(@RequestBody Order order) {
|
|
|
|
|
|
orderService.checkOrder(order);
|
|
|
return R.data("操作成功");
|
|
|
@@ -674,41 +623,54 @@ public class OrderController extends BladeController {
|
|
|
|
|
|
/**
|
|
|
* 审核通过
|
|
|
- * */
|
|
|
+ */
|
|
|
@PostMapping("/passCheck")
|
|
|
@ApiOperationSupport(order = 8)
|
|
|
@ApiOperation(value = "Feign-审核通过", notes = "传入财务id")
|
|
|
- public R passCheck (@ApiParam(value = "财务主表id", required = true) @RequestParam Long id)
|
|
|
- {
|
|
|
+ public R passCheck(@ApiParam(value = "财务主表id", required = true) @RequestParam Long id) {
|
|
|
orderService.passCheck(id);
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 审核不通过
|
|
|
- * */
|
|
|
+ */
|
|
|
@PostMapping("/passCancel")
|
|
|
@ApiOperationSupport(order = 8)
|
|
|
@ApiOperation(value = "Feign-审核不通过", notes = "传入财务id")
|
|
|
- public R passCancel (@ApiParam(value = "财务主表id", required = true) @RequestParam Long id)
|
|
|
- {
|
|
|
+ public R passCancel(@ApiParam(value = "财务主表id", required = true) @RequestParam Long id) {
|
|
|
orderService.passCancel(id);
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 更换审批人
|
|
|
+ */
|
|
|
+ @GetMapping("/changeAuditUser")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "Feign-更换审批人", notes = "传入财务id")
|
|
|
+ public R changeAuditUser(@ApiParam(value = "审批id", required = true) @RequestParam Long auditId,
|
|
|
+ @ApiParam(value = "更改的审批人id", required = true) @RequestParam String auditUserId) {
|
|
|
+ if (auditId == null || StringUtil.isBlank(auditUserId)) {
|
|
|
+ throw new SecurityException("参数异常,更改审批人失败");
|
|
|
+ }
|
|
|
+ orderService.changeAuditUser(auditId, auditUserId);
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 库存账查询锁定库存订单信息
|
|
|
*/
|
|
|
@GetMapping("/ListMessage")
|
|
|
@ApiOperationSupport(order = 9)
|
|
|
@ApiOperation(value = "库存账查询锁定库存订单信息", notes = "传入order")
|
|
|
- public R<IPage<OrderVO>> ListMessage(Query query,@RequestParam("itemId") Long itemId,
|
|
|
- @RequestParam("corpId") Long corpId) {
|
|
|
- IPage<OrderVO> pages = orderService.orderInventory(Condition.getPage(query),SecureUtil.getTenantId(),OrderTypeEnum.DOMESTIC.getType(),OrderTypeEnum.SALES.getType(),itemId,corpId);
|
|
|
- if (CollectionUtils.isNotEmpty(pages.getRecords())){
|
|
|
- pages.getRecords().stream().forEach(item ->{
|
|
|
+ public R<IPage<OrderVO>> ListMessage(Query query, @RequestParam("itemId") Long itemId,
|
|
|
+ @RequestParam("corpId") Long corpId) {
|
|
|
+ IPage<OrderVO> pages = orderService.orderInventory(Condition.getPage(query), SecureUtil.getTenantId(), OrderTypeEnum.DOMESTIC.getType(), OrderTypeEnum.SALES.getType(), itemId, corpId);
|
|
|
+ if (CollectionUtils.isNotEmpty(pages.getRecords())) {
|
|
|
+ pages.getRecords().stream().forEach(item -> {
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
+ if (corpMessage.isSuccess() && corpMessage.getData() != null) {
|
|
|
item.setCorpsName(corpMessage.getData().getCname());
|
|
|
}
|
|
|
});
|