|
@@ -4,6 +4,7 @@ import java.io.OutputStream;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.math.RoundingMode;
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
@@ -34,8 +35,11 @@ import org.jeecg.modules.cuspCode.service.ICuspCustomerProfileManService;
|
|
import org.jeecg.modules.cuspCode.service.ICuspCustomerProfileService;
|
|
import org.jeecg.modules.cuspCode.service.ICuspCustomerProfileService;
|
|
import org.jeecg.modules.purCode.entity.PurCommissionRequest;
|
|
import org.jeecg.modules.purCode.entity.PurCommissionRequest;
|
|
import org.jeecg.modules.purCode.entity.PurOrder;
|
|
import org.jeecg.modules.purCode.entity.PurOrder;
|
|
|
|
+import org.jeecg.modules.purCode.entity.PurOrderProduct;
|
|
|
|
+import org.jeecg.modules.purCode.entity.PurQuotationSelectionProduct;
|
|
import org.jeecg.modules.purCode.service.IPurCommissionRequestService;
|
|
import org.jeecg.modules.purCode.service.IPurCommissionRequestService;
|
|
import org.jeecg.modules.purCode.service.IPurOrderService;
|
|
import org.jeecg.modules.purCode.service.IPurOrderService;
|
|
|
|
+import org.jeecg.modules.purCode.service.IPurQuotationSelectionProductService;
|
|
import org.jeecg.modules.saleCode.entity.*;
|
|
import org.jeecg.modules.saleCode.entity.*;
|
|
import org.jeecg.modules.saleCode.service.*;
|
|
import org.jeecg.modules.saleCode.service.*;
|
|
import org.jeecg.modules.saleCode.vo.SaleOrderAlert;
|
|
import org.jeecg.modules.saleCode.vo.SaleOrderAlert;
|
|
@@ -127,6 +131,8 @@ public class SaleOrderController {
|
|
private ISaleQuotationService saleQuotationService;
|
|
private ISaleQuotationService saleQuotationService;
|
|
@Autowired
|
|
@Autowired
|
|
private ISaleQuotationProductService saleQuotationProductService;
|
|
private ISaleQuotationProductService saleQuotationProductService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IPurQuotationSelectionProductService purQuotationSelectionProductService;
|
|
|
|
|
|
@Value(value = "${jeecg.path.upload}")
|
|
@Value(value = "${jeecg.path.upload}")
|
|
private String uploadpath;
|
|
private String uploadpath;
|
|
@@ -156,6 +162,7 @@ public class SaleOrderController {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 销售订单弹框明细-佣金付款使用
|
|
* 销售订单弹框明细-佣金付款使用
|
|
|
|
+ *
|
|
* @param saleOrder
|
|
* @param saleOrder
|
|
* @param pageNo
|
|
* @param pageNo
|
|
* @param pageSize
|
|
* @param pageSize
|
|
@@ -196,6 +203,7 @@ public class SaleOrderController {
|
|
QueryWrapper<SaleOrderAlert> queryWrapper = QueryGenerator.initQueryWrapper(saleInquiryForm, req.getParameterMap());
|
|
QueryWrapper<SaleOrderAlert> queryWrapper = QueryGenerator.initQueryWrapper(saleInquiryForm, req.getParameterMap());
|
|
Page<SaleOrderAlert> page = new Page<SaleOrderAlert>(pageNo, pageSize);
|
|
Page<SaleOrderAlert> page = new Page<SaleOrderAlert>(pageNo, pageSize);
|
|
IPage<SaleOrderAlert> pageList = saleOrderProductService.selectSaleOrderDetailAlert(page, queryWrapper);
|
|
IPage<SaleOrderAlert> pageList = saleOrderProductService.selectSaleOrderDetailAlert(page, queryWrapper);
|
|
|
|
+
|
|
return Result.OK(pageList);
|
|
return Result.OK(pageList);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -221,6 +229,43 @@ public class SaleOrderController {
|
|
queryWrapper.isNotNull("supplier_id");
|
|
queryWrapper.isNotNull("supplier_id");
|
|
queryWrapper.apply("quantity > IFNULL(purchase_quantity, 0)");
|
|
queryWrapper.apply("quantity > IFNULL(purchase_quantity, 0)");
|
|
IPage<SaleOrderAlert> pageList = saleOrderProductService.selectSaleOrderDetailAlert(page, queryWrapper);
|
|
IPage<SaleOrderAlert> pageList = saleOrderProductService.selectSaleOrderDetailAlert(page, queryWrapper);
|
|
|
|
+
|
|
|
|
+ List<SaleOrderAlert> saleOrderProductList = pageList.getRecords();
|
|
|
|
+
|
|
|
|
+ // 获取报价单行
|
|
|
|
+ List<SaleQuotationProduct> saleQuotationProductList = new ArrayList<>();
|
|
|
|
+ if (oConvertUtils.listIsNotEmpty(saleOrderProductList)) {
|
|
|
|
+ LambdaQueryWrapper<SaleQuotationProduct> productWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ productWrapper.in(SaleQuotationProduct::getId, saleOrderProductList.stream().map(SaleOrderAlert::getSourceId).collect(Collectors.toList()));
|
|
|
|
+ saleQuotationProductList = saleQuotationProductService.list(productWrapper);
|
|
|
|
+ }
|
|
|
|
+ // 获取报价选定单行
|
|
|
|
+ List<PurQuotationSelectionProduct> purQuotationSelectionProductList = new ArrayList<>();
|
|
|
|
+ if (oConvertUtils.listIsNotEmpty(saleQuotationProductList)) {
|
|
|
|
+ LambdaQueryWrapper<PurQuotationSelectionProduct> productWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ productWrapper.in(PurQuotationSelectionProduct::getId, saleQuotationProductList.stream().map(SaleQuotationProduct::getSourceId).collect(Collectors.toList()));
|
|
|
|
+ purQuotationSelectionProductList = purQuotationSelectionProductService.list(productWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (SaleOrderAlert product : pageList.getRecords()) {
|
|
|
|
+
|
|
|
|
+ SaleQuotationProduct saleQuotationProduct = saleQuotationProductList.stream().filter(e -> e.getId().equals(product.getSourceId())).findFirst().orElse(null);
|
|
|
|
+ if (saleQuotationProduct != null) {
|
|
|
|
+ PurQuotationSelectionProduct quotationSelectionProduct = purQuotationSelectionProductList.stream().filter(e -> e.getId().equals(saleQuotationProduct.getSourceId())).findFirst().orElse(null);
|
|
|
|
+ if (oConvertUtils.isNotEmpty(quotationSelectionProduct.getDiscount())) {
|
|
|
|
+ product.setDiscount(quotationSelectionProduct.getDiscount());
|
|
|
|
+ }else{
|
|
|
|
+ product.setDiscount(new BigDecimal("0"));
|
|
|
|
+ product.setTaxPriceOriginal(product.getTaxPriceGys());
|
|
|
|
+ }
|
|
|
|
+ if (oConvertUtils.isNotEmpty(quotationSelectionProduct.getTaxPriceOriginal())) {
|
|
|
|
+ product.setTaxPriceOriginal(quotationSelectionProduct.getTaxPriceOriginal());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
return Result.OK(pageList);
|
|
return Result.OK(pageList);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -361,7 +406,7 @@ public class SaleOrderController {
|
|
|
|
|
|
List<SaleOrderShip> saleOrderShipListOld = saleOrderShipService.selectByMainId(saleOrder.getId());
|
|
List<SaleOrderShip> saleOrderShipListOld = saleOrderShipService.selectByMainId(saleOrder.getId());
|
|
List<SaleOrderShipHis> saleOrderShipHisList = new ArrayList<>();
|
|
List<SaleOrderShipHis> saleOrderShipHisList = new ArrayList<>();
|
|
- if (saleOrderShipListOld !=null && saleOrderShipListOld.size() > 0) {
|
|
|
|
|
|
+ if (saleOrderShipListOld != null && saleOrderShipListOld.size() > 0) {
|
|
for (SaleOrderShip o : saleOrderShipListOld) {
|
|
for (SaleOrderShip o : saleOrderShipListOld) {
|
|
SaleOrderShipHis his = new SaleOrderShipHis();
|
|
SaleOrderShipHis his = new SaleOrderShipHis();
|
|
BeanUtils.copyProperties(o, his);
|
|
BeanUtils.copyProperties(o, his);
|
|
@@ -374,7 +419,7 @@ public class SaleOrderController {
|
|
|
|
|
|
List<SaleOrderProduct> saleOrderProductListOld = saleOrderProductService.selectByMainId(saleOrder.getId());
|
|
List<SaleOrderProduct> saleOrderProductListOld = saleOrderProductService.selectByMainId(saleOrder.getId());
|
|
List<SaleOrderProductHis> saleOrderProductList = new ArrayList<>();
|
|
List<SaleOrderProductHis> saleOrderProductList = new ArrayList<>();
|
|
- if (saleOrderProductListOld !=null && saleOrderProductListOld.size() > 0) {
|
|
|
|
|
|
+ if (saleOrderProductListOld != null && saleOrderProductListOld.size() > 0) {
|
|
|
|
|
|
for (SaleOrderProduct o : saleOrderProductListOld) {
|
|
for (SaleOrderProduct o : saleOrderProductListOld) {
|
|
SaleOrderProductHis his = new SaleOrderProductHis();
|
|
SaleOrderProductHis his = new SaleOrderProductHis();
|
|
@@ -751,7 +796,7 @@ public class SaleOrderController {
|
|
@AutoLog(value = "销售订单-批量关闭")
|
|
@AutoLog(value = "销售订单-批量关闭")
|
|
@ApiOperation(value = "销售订单-批量关闭", notes = "销售订单-批量关闭")
|
|
@ApiOperation(value = "销售订单-批量关闭", notes = "销售订单-批量关闭")
|
|
@GetMapping(value = "/submitClose")
|
|
@GetMapping(value = "/submitClose")
|
|
- public Result<String> submitClose(@RequestParam(name = "ids", required = true) String ids,String closeReason) {
|
|
|
|
|
|
+ public Result<String> submitClose(@RequestParam(name = "ids", required = true) String ids, String closeReason) {
|
|
|
|
|
|
QueryWrapper<SaleOrder> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SaleOrder> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
@@ -983,10 +1028,10 @@ public class SaleOrderController {
|
|
List<SaleOrderProduct> productList = saleOrderProductService.selectByMainId(saleOrder.getId());
|
|
List<SaleOrderProduct> productList = saleOrderProductService.selectByMainId(saleOrder.getId());
|
|
List<SaleOrderShip> saleOrderShipList = saleOrderShipService.selectByMainId(saleOrder.getId());
|
|
List<SaleOrderShip> saleOrderShipList = saleOrderShipService.selectByMainId(saleOrder.getId());
|
|
QueryWrapper<SaleQuotation> saleQuotationWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SaleQuotation> saleQuotationWrapper = new QueryWrapper<>();
|
|
- saleQuotationWrapper.eq("bill_code",sourceCode);
|
|
|
|
|
|
+ saleQuotationWrapper.eq("bill_code", sourceCode);
|
|
List<SaleQuotation> listSaleQuotation = saleQuotationService.list(saleQuotationWrapper);
|
|
List<SaleQuotation> listSaleQuotation = saleQuotationService.list(saleQuotationWrapper);
|
|
List<SaleQuotationProduct> saleQuotationProduct = new ArrayList<>();
|
|
List<SaleQuotationProduct> saleQuotationProduct = new ArrayList<>();
|
|
- if(listSaleQuotation.size() > 0){
|
|
|
|
|
|
+ if (listSaleQuotation.size() > 0) {
|
|
saleQuotationProduct = saleQuotationProductService.selectByMainId(listSaleQuotation.get(0).getId());
|
|
saleQuotationProduct = saleQuotationProductService.selectByMainId(listSaleQuotation.get(0).getId());
|
|
}
|
|
}
|
|
BaseTemplates templates = null;
|
|
BaseTemplates templates = null;
|
|
@@ -1032,7 +1077,7 @@ public class SaleOrderController {
|
|
String agreementTerms = saleOrder.getAgreementTerms();
|
|
String agreementTerms = saleOrder.getAgreementTerms();
|
|
if (StringUtils.isNotBlank(agreementTerms)) {
|
|
if (StringUtils.isNotBlank(agreementTerms)) {
|
|
String info = sysDictService.queryAgreementTermsByName(agreementTerms);
|
|
String info = sysDictService.queryAgreementTermsByName(agreementTerms);
|
|
- if(StringUtils.isNotBlank(info)){
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(info)) {
|
|
saleOrder.setAgreementTerms(info);
|
|
saleOrder.setAgreementTerms(info);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1073,13 +1118,25 @@ public class SaleOrderController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(saleQuotationProduct.size() > 0){
|
|
|
|
|
|
+ if (saleQuotationProduct.size() > 0) {
|
|
|
|
|
|
- for(SaleQuotationProduct a:saleQuotationProduct){
|
|
|
|
|
|
+ for (SaleQuotationProduct a : saleQuotationProduct) {
|
|
String saleId = a.getId();
|
|
String saleId = a.getId();
|
|
- if(StringUtils.isNotBlank(o.getSourceId()) && o.getSourceId().equals(saleId)){
|
|
|
|
- o.setDiscountText(a.getDiscount().setScale(2).toString());
|
|
|
|
- o.setTaxPrice(a.getPurchasePrice().setScale(2));
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(o.getSourceId()) && o.getSourceId().equals(saleId)) {
|
|
|
|
+ if (a.getDiscount() != null) {
|
|
|
|
+ o.setDiscountText(a.getDiscount().setScale(2).toString());
|
|
|
|
+ }
|
|
|
|
+ if (a.getSalePrice() != null) {
|
|
|
|
+
|
|
|
|
+ BigDecimal dic = a.getDiscount() == null ? BigDecimal.ZERO : a.getDiscount();
|
|
|
|
+ BigDecimal dis = (new BigDecimal("100").subtract(dic)).divide(new BigDecimal("100"));
|
|
|
|
+
|
|
|
|
+ BigDecimal getSalePrice = a.getSalePrice() == null ? BigDecimal.ZERO : a.getSalePrice();
|
|
|
|
+ BigDecimal setTaxPrice = getSalePrice.divide(dis, 4, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+
|
|
|
|
+ o.setTaxPrice(setTaxPrice);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1169,4 +1226,13 @@ public class SaleOrderController {
|
|
return response.getOutputStream();
|
|
return response.getOutputStream();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+
|
|
|
|
+ BigDecimal getSalePrice = new BigDecimal("90");
|
|
|
|
+ BigDecimal dis = new BigDecimal("10");
|
|
|
|
+
|
|
|
|
+ System.out.println((new BigDecimal("100").subtract(dis)).divide(new BigDecimal("100")));
|
|
|
|
+ System.out.println(getSalePrice.divide(new BigDecimal("0.9")).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
+ }
|
|
}
|
|
}
|