mirror of https://github.com/jeecgboot/jeecg-boot
update : 3.6.3
parent
ce95c69801
commit
84a2043b3e
|
@ -0,0 +1,37 @@
|
||||||
|
CREATE VIEW all_invoices AS
|
||||||
|
WITH shipping AS (
|
||||||
|
SELECT
|
||||||
|
s.id AS id,
|
||||||
|
s.create_by AS create_by,
|
||||||
|
s.create_time AS create_time,
|
||||||
|
s.client_id AS client_id,
|
||||||
|
s.currency_id AS currency_id,
|
||||||
|
s.invoice_number AS invoice_number,
|
||||||
|
IFNULL(s.total_amount + p.total_amount, s.total_amount) AS total_amount,
|
||||||
|
IFNULL(s.discount_amount + p.discount_amount, s.discount_amount) AS discount_amount,
|
||||||
|
IFNULL(s.final_amount + p.final_amount, s.final_amount) AS final_amount,
|
||||||
|
IFNULL(s.paid_amount + p.paid_amount, s.paid_amount) AS paid_amount,
|
||||||
|
IF(SUBSTRING(s.invoice_number,9,1) = '2', 'shipping', 'complete') AS 'type'
|
||||||
|
FROM shipping_invoice s
|
||||||
|
LEFT JOIN purchase_order p ON s.invoice_number = p.invoice_number
|
||||||
|
AND s.client_id = p.client_id
|
||||||
|
),
|
||||||
|
purchase AS (
|
||||||
|
SELECT
|
||||||
|
p.id AS id,
|
||||||
|
p.create_by AS create_by,
|
||||||
|
p.create_time AS create_time,
|
||||||
|
p.client_id AS client_id,
|
||||||
|
p.currency_id AS currency_id,
|
||||||
|
p.invoice_number AS invoice_number,
|
||||||
|
p.total_amount AS total_amount,
|
||||||
|
p.discount_amount AS discount_amount,
|
||||||
|
p.final_amount AS final_amount,
|
||||||
|
p.paid_amount AS paid_amount,
|
||||||
|
IF(SUBSTRING(p.invoice_number,9,1) = '1', 'purchase', 'error') AS 'type'
|
||||||
|
FROM purchase_order p
|
||||||
|
WHERE p.invoice_number NOT IN (SELECT invoice_number FROM shipping_invoice)
|
||||||
|
)
|
||||||
|
SELECT s.* FROM shipping s
|
||||||
|
UNION ALL SELECT p.* FROM purchase p
|
||||||
|
ORDER BY create_time DESC;
|
|
@ -18,3 +18,12 @@ FROM platform_order_content poc
|
||||||
JOIN platform_order po ON poc.platform_order_id = po.id
|
JOIN platform_order po ON poc.platform_order_id = po.id
|
||||||
WHERE po.order_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 28 DAY) AND CURDATE()
|
WHERE po.order_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 28 DAY) AND CURDATE()
|
||||||
GROUP BY poc.sku_id;
|
GROUP BY poc.sku_id;
|
||||||
|
|
||||||
|
create view sales_42 as
|
||||||
|
select `poc`.`sku_id` AS `sku_id`, sum(`poc`.`quantity`) AS `quantity`
|
||||||
|
from (`wia_app`.`platform_order_content` `poc`
|
||||||
|
join `wia_app`.`platform_order` `po`
|
||||||
|
on ((`poc`.`platform_order_id` = `po`.`id`)))
|
||||||
|
where (`po`.`order_time` between (curdate() - interval 42 day) and curdate())
|
||||||
|
and po.erp_status <> 5
|
||||||
|
group by `poc`.`sku_id`;
|
|
@ -586,8 +586,11 @@ public class PurchaseOrderController {
|
||||||
Map<String, Integer> skuQuantityMap = skuQuantities.stream()
|
Map<String, Integer> skuQuantityMap = skuQuantities.stream()
|
||||||
.collect(Collectors.toMap(SkuQuantity::getErpCode, SkuQuantity::getQuantity));
|
.collect(Collectors.toMap(SkuQuantity::getErpCode, SkuQuantity::getQuantity));
|
||||||
skuQuantityMap.forEach((s, integer) -> log.info("SKU: {} Quantity: {}", s, integer));
|
skuQuantityMap.forEach((s, integer) -> log.info("SKU: {} Quantity: {}", s, integer));
|
||||||
|
Map<String, Integer> skuQtyNotEmptyMap = skuQuantityMap.entrySet().stream()
|
||||||
|
.filter(entry -> entry.getValue() > 0)
|
||||||
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
InvoiceMetaData metaData = purchaseOrderService.getMetaDataFromInvoiceNumbers(invoiceNumber);
|
InvoiceMetaData metaData = purchaseOrderService.getMetaDataFromInvoiceNumbers(invoiceNumber);
|
||||||
boolean success = providerMabangService.addPurchaseOrderToMabang(skuQuantityMap, metaData, providersHistory);
|
boolean success = providerMabangService.addPurchaseOrderToMabang(skuQtyNotEmptyMap, metaData, providersHistory);
|
||||||
return success ? invoiceNumber : "failed";
|
return success ? invoiceNumber : "failed";
|
||||||
},throttlingExecutorService))
|
},throttlingExecutorService))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
@ -704,7 +704,6 @@ public class InvoiceController {
|
||||||
public byte[] downloadInventory(@RequestParam("invoiceCode") String invoiceCode, @RequestParam("internalCode") String internalCode, @RequestParam("invoiceEntity") String invoiceEntity) throws IOException {
|
public byte[] downloadInventory(@RequestParam("invoiceCode") String invoiceCode, @RequestParam("internalCode") String internalCode, @RequestParam("invoiceEntity") String invoiceEntity) throws IOException {
|
||||||
InvoiceMetaData metaData = new InvoiceMetaData("", invoiceCode, internalCode, invoiceEntity, "");
|
InvoiceMetaData metaData = new InvoiceMetaData("", invoiceCode, internalCode, invoiceEntity, "");
|
||||||
List<SkuOrderPage> skuOrderPages = skuService.getInventoryByInvoiceNumber(metaData.getInvoiceCode());
|
List<SkuOrderPage> skuOrderPages = skuService.getInventoryByInvoiceNumber(metaData.getInvoiceCode());
|
||||||
System.out.println(skuOrderPages);
|
|
||||||
return shippingInvoiceService.exportPurchaseInventoryToExcel(skuOrderPages, metaData);
|
return shippingInvoiceService.exportPurchaseInventoryToExcel(skuOrderPages, metaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -797,6 +796,7 @@ public class InvoiceController {
|
||||||
* @param completeClientIds list of clients to invoice complete fees
|
* @param completeClientIds list of clients to invoice complete fees
|
||||||
* @return list of invoice infos
|
* @return list of invoice infos
|
||||||
*/
|
*/
|
||||||
|
@Transactional
|
||||||
@GetMapping(value = "/breakdown/makeInvoice")
|
@GetMapping(value = "/breakdown/makeInvoice")
|
||||||
public Result<?> makeBreakdownInvoice(@RequestParam(value = "shipping[]", required = false) List<String> shippingClientIds,
|
public Result<?> makeBreakdownInvoice(@RequestParam(value = "shipping[]", required = false) List<String> shippingClientIds,
|
||||||
@RequestParam(value = "complete[]", required = false) List<String> completeClientIds) throws IOException {
|
@RequestParam(value = "complete[]", required = false) List<String> completeClientIds) throws IOException {
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
<select id="getClientBySku" resultType="org.jeecg.modules.business.entity.Client">
|
<select id="getClientBySku" resultType="org.jeecg.modules.business.entity.Client">
|
||||||
SELECT c.*
|
SELECT c.*
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN client_sku cs ON c.id = cs.client_id
|
JOIN client_sku ON c.id = client_sku.client_id
|
||||||
WHERE cs.sku_id = #{skuId};
|
WHERE client_sku.sku_id = #{skuId};
|
||||||
</select>
|
</select>
|
||||||
<select id="getClientFromInvoice" resultType="org.jeecg.modules.business.entity.Client">
|
<select id="getClientFromInvoice" resultType="org.jeecg.modules.business.entity.Client">
|
||||||
SELECT DISTINCT c.*
|
SELECT DISTINCT c.*
|
||||||
|
|
|
@ -201,14 +201,14 @@
|
||||||
s28.quantity as sales_four_weeks,
|
s28.quantity as sales_four_weeks,
|
||||||
s42.quantity as sales_six_weeks
|
s42.quantity as sales_six_weeks
|
||||||
FROM sku s
|
FROM sku s
|
||||||
JOIN client_sku cs ON s.id = cs.sku_id
|
JOIN client_sku ON s.id = client_sku.sku_id
|
||||||
JOIN product p ON s.product_id = p.id
|
JOIN product p ON s.product_id = p.id
|
||||||
LEFT JOIN sku_current_price sp ON s.id = sp.sku_id
|
LEFT JOIN sku_current_price sp ON s.id = sp.sku_id
|
||||||
LEFT JOIN sales_28 s28 ON s.id = s28.sku_id
|
LEFT JOIN sales_28 s28 ON s.id = s28.sku_id
|
||||||
LEFT JOIN sales_42 s42 ON s.id = s42.sku_id
|
LEFT JOIN sales_42 s42 ON s.id = s42.sku_id
|
||||||
LEFT JOIN sales_7 s7 ON s.id = s7.sku_id
|
LEFT JOIN sales_7 s7 ON s.id = s7.sku_id
|
||||||
LEFT JOIN qtyInOrdersNotShipped ON s.id = qtyInOrdersNotShipped.ID
|
LEFT JOIN qtyInOrdersNotShipped ON s.id = qtyInOrdersNotShipped.ID
|
||||||
WHERE cs.client_id = #{clientId}
|
WHERE client_sku.client_id = #{clientId};
|
||||||
</select>
|
</select>
|
||||||
<select id="getInventoryByInvoiceNumber" resultType="org.jeecg.modules.business.vo.SkuOrderPage">
|
<select id="getInventoryByInvoiceNumber" resultType="org.jeecg.modules.business.vo.SkuOrderPage">
|
||||||
WITH skusFromInvoice AS (
|
WITH skusFromInvoice AS (
|
||||||
|
|
|
@ -74,16 +74,16 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
|
||||||
shippingInvoiceService.delMain(id);
|
shippingInvoiceService.delMain(id);
|
||||||
}
|
}
|
||||||
if(Invoice.getType(invoiceNumber).equalsIgnoreCase(COMPLETE.name())) {
|
if(Invoice.getType(invoiceNumber).equalsIgnoreCase(COMPLETE.name())) {
|
||||||
platformOrderContentService.cancelInvoice(invoiceNumber);
|
|
||||||
platformOrderService.removePurchaseInvoiceNumber(invoiceNumber);
|
|
||||||
platformOrderService.cancelInvoice(invoiceNumber);
|
|
||||||
purchaseOrderService.cancelInvoice(invoiceNumber);
|
|
||||||
shippingInvoiceService.delMain(id);
|
|
||||||
PurchaseOrder purchase = purchaseOrderService.getPurchaseByInvoiceNumberAndClientId(invoiceNumber, clientId);
|
PurchaseOrder purchase = purchaseOrderService.getPurchaseByInvoiceNumberAndClientId(invoiceNumber, clientId);
|
||||||
if(purchase.getInventoryDocumentString() != null && !purchase.getInventoryDocumentString().isEmpty())
|
if(purchase.getInventoryDocumentString() != null && !purchase.getInventoryDocumentString().isEmpty())
|
||||||
shippingInvoiceService.deleteAttachmentFile(purchase.getInventoryDocumentString());
|
shippingInvoiceService.deleteAttachmentFile(purchase.getInventoryDocumentString());
|
||||||
if(purchase.getPaymentDocumentString() != null && !purchase.getPaymentDocumentString().isEmpty())
|
if(purchase.getPaymentDocumentString() != null && !purchase.getPaymentDocumentString().isEmpty())
|
||||||
shippingInvoiceService.deleteAttachmentFile(purchase.getPaymentDocumentString());
|
shippingInvoiceService.deleteAttachmentFile(purchase.getPaymentDocumentString());
|
||||||
|
platformOrderContentService.cancelInvoice(invoiceNumber);
|
||||||
|
platformOrderService.removePurchaseInvoiceNumber(invoiceNumber);
|
||||||
|
platformOrderService.cancelInvoice(invoiceNumber);
|
||||||
|
purchaseOrderService.cancelInvoice(invoiceNumber);
|
||||||
|
shippingInvoiceService.delMain(id);
|
||||||
}
|
}
|
||||||
savRefundService.cancelInvoice(invoiceNumber);
|
savRefundService.cancelInvoice(invoiceNumber);
|
||||||
|
|
||||||
|
@ -151,8 +151,8 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
|
||||||
if(po.getPaymentDocumentString() != null && !po.getPaymentDocumentString().isEmpty())
|
if(po.getPaymentDocumentString() != null && !po.getPaymentDocumentString().isEmpty())
|
||||||
shippingInvoiceService.deleteAttachmentFile(po.getPaymentDocumentString());
|
shippingInvoiceService.deleteAttachmentFile(po.getPaymentDocumentString());
|
||||||
}
|
}
|
||||||
platformOrderService.removePurchaseInvoiceNumbers(purchaseInvoiceNumbers);
|
platformOrderService.removePurchaseInvoiceNumbers(completeInvoiceNumbers);
|
||||||
purchaseOrderService.cancelBatchInvoice(purchaseInvoiceNumbers);
|
purchaseOrderService.cancelBatchInvoice(completeInvoiceNumbers);
|
||||||
purchaseOrderContentMapper.deleteFromPurchaseIds(ids);
|
purchaseOrderContentMapper.deleteFromPurchaseIds(ids);
|
||||||
|
|
||||||
savRefundService.cancelBatchInvoice(completeInvoiceNumbers);
|
savRefundService.cancelBatchInvoice(completeInvoiceNumbers);
|
||||||
|
|
|
@ -160,7 +160,7 @@ spring:
|
||||||
slow-sql-millis: 5000
|
slow-sql-millis: 5000
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://192.168.31.16:3306/wia_app?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Europe/Paris
|
url: jdbc:mysql://192.168.31.16:3306/wia_app?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&connectTimeout=5000&socketTimeout=60000
|
||||||
username: admin
|
username: admin
|
||||||
password: WIASourcing2023+
|
password: WIASourcing2023+
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
Loading…
Reference in New Issue