pull/8040/head
Gauthier LO 2024-06-28 17:03:56 +02:00
parent 3b9d03eda3
commit af3540274c
4 changed files with 19 additions and 19 deletions

View File

@ -57,6 +57,7 @@ import static org.jeecg.common.util.SqlInjectionUtil.specialFilterContentForDict
import static org.jeecg.modules.business.entity.Invoice.InvoiceType.*; import static org.jeecg.modules.business.entity.Invoice.InvoiceType.*;
import static org.jeecg.modules.business.entity.Task.TaskCode.SI_G; import static org.jeecg.modules.business.entity.Task.TaskCode.SI_G;
import static org.jeecg.modules.business.entity.TaskHistory.TaskStatus.*; import static org.jeecg.modules.business.entity.TaskHistory.TaskStatus.*;
import static org.jeecg.modules.business.vo.PlatformOrderFront.invoiceStatus.*;
/** /**
* Controller for request related to shipping invoice * Controller for request related to shipping invoice
@ -530,9 +531,9 @@ public class InvoiceController {
// checking shipping data availability // checking shipping data availability
List<String> shopIdList = Arrays.asList(shopIds.split(",")); List<String> shopIdList = Arrays.asList(shopIds.split(","));
// fetch order that can be invoiced either by shipping or purchase or both // fetch order that can be invoiced either by shipping or purchase or both
LinkedList<PlatformOrder> allOrders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIdList, Collections.singletonList(1), parsedColumn, parsedOrder, 1, -1); List<PlatformOrder> allOrders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIdList, Collections.singletonList(1), parsedColumn, parsedOrder, 1, -1);
int total = allOrders.size(); int total = allOrders.size();
LinkedList<PlatformOrder> orders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIdList, Collections.singletonList(1), parsedColumn, parsedOrder, pageNo, pageSize); List<PlatformOrder> orders = platformOrderService.findUninvoicedOrdersByShopForClient(shopIdList, Collections.singletonList(1), parsedColumn, parsedOrder, pageNo, pageSize);
// LinkedList<PlatformOrder> sortedOrders = orders.stream().sorted(Comparator.comparing(PlatformOrder::getOrderTime)).collect(Collectors.toCollection(LinkedList::new)); // LinkedList<PlatformOrder> sortedOrders = orders.stream().sorted(Comparator.comparing(PlatformOrder::getOrderTime)).collect(Collectors.toCollection(LinkedList::new));
if(orders.isEmpty()) if(orders.isEmpty())
return Result.OK("No order to invoice."); return Result.OK("No order to invoice.");
@ -554,7 +555,6 @@ public class InvoiceController {
Map<String, String> errorMapToOrderId = new HashMap<>(); Map<String, String> errorMapToOrderId = new HashMap<>();
List<PlatformOrderFront> orderFronts = new ArrayList<>(); List<PlatformOrderFront> orderFronts = new ArrayList<>();
int tmpCpt = 0;
for(Map.Entry<PlatformOrder, List<PlatformOrderContent>> entry : orderContentMap.entrySet()) { for(Map.Entry<PlatformOrder, List<PlatformOrderContent>> entry : orderContentMap.entrySet()) {
PlatformOrderFront orderFront = new PlatformOrderFront(); PlatformOrderFront orderFront = new PlatformOrderFront();
BeanUtils.copyProperties(entry.getKey(), orderFront); BeanUtils.copyProperties(entry.getKey(), orderFront);
@ -562,16 +562,16 @@ public class InvoiceController {
//rename shop id by shop name to prevent it to leak in front //rename shop id by shop name to prevent it to leak in front
orderFront.setShopId(shops.get(orderFront.getShopId())); orderFront.setShopId(shops.get(orderFront.getShopId()));
// set default value of shipping and purchase availability // set default value of shipping and purchase availability
orderFront.setShippingAvailable(PlatformOrderFront.invoiceStatus.Available.code); orderFront.setShippingAvailable(Available.code);
orderFront.setPurchaseAvailable(PlatformOrderFront.invoiceStatus.Available.code); orderFront.setPurchaseAvailable(Available.code);
if(entry.getValue().isEmpty()) { if(entry.getValue().isEmpty()) {
if(!errorMapToOrderId.containsKey(entry.getKey().getPlatformOrderId())) if(!errorMapToOrderId.containsKey(entry.getKey().getPlatformOrderId()))
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : order has no content : " + entry.getKey().getPlatformOrderId()); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : order has no content : " + entry.getKey().getPlatformOrderId());
else else
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and has no content"); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and has no content");
orderFront.setShippingAvailable(PlatformOrderFront.invoiceStatus.Unavailable.code); orderFront.setShippingAvailable(Unavailable.code);
orderFront.setPurchaseAvailable(PlatformOrderFront.invoiceStatus.Unavailable.code); orderFront.setPurchaseAvailable(Unavailable.code);
orderFronts.add(orderFront); orderFronts.add(orderFront);
continue; continue;
} }
@ -585,8 +585,8 @@ public class InvoiceController {
else else
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing one or more sku in db"); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing one or more sku in db");
orderFront.setShippingAvailable(PlatformOrderFront.invoiceStatus.Unavailable.code); orderFront.setShippingAvailable(Unavailable.code);
orderFront.setPurchaseAvailable(PlatformOrderFront.invoiceStatus.Unavailable.code); orderFront.setPurchaseAvailable(Unavailable.code);
continue; continue;
} }
@ -597,7 +597,7 @@ public class InvoiceController {
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : Missing logistic channel for order : " + entry.getKey().getPlatformOrderId()); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : Missing logistic channel for order : " + entry.getKey().getPlatformOrderId());
else else
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing logistic channel"); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing logistic channel");
orderFront.setShippingAvailable(PlatformOrderFront.invoiceStatus.Unavailable.code); orderFront.setShippingAvailable(Unavailable.code);
} }
// finds the first product with missing weight // finds the first product with missing weight
String missingWeightProductId = productService.searchFirstEmptyWeightProduct(skuIds); String missingWeightProductId = productService.searchFirstEmptyWeightProduct(skuIds);
@ -606,7 +606,7 @@ public class InvoiceController {
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : Missing one or more weight for order : " + entry.getKey().getPlatformOrderId()); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : Missing one or more weight for order : " + entry.getKey().getPlatformOrderId());
else else
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing weight"); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing weight");
orderFront.setShippingAvailable(PlatformOrderFront.invoiceStatus.Unavailable.code); orderFront.setShippingAvailable(Unavailable.code);
} }
} }
if(entry.getKey().getPurchaseInvoiceNumber() == null) { if(entry.getKey().getPurchaseInvoiceNumber() == null) {
@ -617,7 +617,7 @@ public class InvoiceController {
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : Missing one or more sku price for order : " + entry.getKey().getPlatformOrderId()); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), "Error : Missing one or more sku price for order : " + entry.getKey().getPlatformOrderId());
else else
errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing one or more sku price"); errorMapToOrderId.put(entry.getKey().getPlatformOrderId(), errorMapToOrderId.get(entry.getKey().getPlatformOrderId()) + " and missing one or more sku price");
orderFront.setPurchaseAvailable(PlatformOrderFront.invoiceStatus.Unavailable.code); orderFront.setPurchaseAvailable(Unavailable.code);
} }
} }
@ -634,18 +634,18 @@ public class InvoiceController {
if(entry.getKey().getPurchaseInvoiceNumber() != null) { if(entry.getKey().getPurchaseInvoiceNumber() != null) {
PurchaseOrder purchase = purchaseOrderService.getPurchaseByInvoiceNumber(entry.getKey().getPurchaseInvoiceNumber()); PurchaseOrder purchase = purchaseOrderService.getPurchaseByInvoiceNumber(entry.getKey().getPurchaseInvoiceNumber());
if(purchase.getPaidAmount().compareTo(BigDecimal.ZERO) == 0) if(purchase.getPaidAmount().compareTo(BigDecimal.ZERO) == 0)
orderFront.setPurchaseAvailable(PlatformOrderFront.invoiceStatus.Invoiced.code);// invoiced orderFront.setPurchaseAvailable(Invoiced.code);// invoiced
else else
orderFront.setPurchaseAvailable(PlatformOrderFront.invoiceStatus.Paid.code);// paid orderFront.setPurchaseAvailable(Paid.code);// paid
} }
// set shipping order status (-1 = unavailable, 0 = available, 1 = invoiced, 2 = paid) // set shipping order status (-1 = unavailable, 0 = available, 1 = invoiced, 2 = paid)
if(entry.getKey().getShippingInvoiceNumber() != null) { if(entry.getKey().getShippingInvoiceNumber() != null) {
ShippingInvoice shippingInvoice = iShippingInvoiceService.getShippingInvoice(entry.getKey().getShippingInvoiceNumber()); ShippingInvoice shippingInvoice = iShippingInvoiceService.getShippingInvoice(entry.getKey().getShippingInvoiceNumber());
if(shippingInvoice.getPaidAmount().compareTo(BigDecimal.ZERO) == 0) { if(shippingInvoice.getPaidAmount().compareTo(BigDecimal.ZERO) == 0) {
orderFront.setShippingAvailable(PlatformOrderFront.invoiceStatus.Invoiced.code); // invoiced orderFront.setShippingAvailable(Invoiced.code); // invoiced
} }
else { else {
orderFront.setShippingAvailable(PlatformOrderFront.invoiceStatus.Paid.code); // paid orderFront.setShippingAvailable(Paid.code); // paid
} }
} }
orderFronts.add(orderFront); orderFronts.add(orderFront);

View File

@ -190,7 +190,7 @@ public interface PlatformOrderMapper extends BaseMapper<PlatformOrder> {
List<PlatformOrder> findUninvoicedShippingOrdersByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses); List<PlatformOrder> findUninvoicedShippingOrdersByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses);
List<PlatformOrder> fetchUninvoicedPurchaseOrdersByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses); List<PlatformOrder> fetchUninvoicedPurchaseOrdersByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses);
LinkedList<PlatformOrder> findUninvoicedOrdersByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses, List<PlatformOrder> findUninvoicedOrdersByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses,
@Param("column") String column, @Param("order") String order, @Param("offset") Integer offset, @Param("size") Integer pageSize); @Param("column") String column, @Param("order") String order, @Param("offset") Integer offset, @Param("size") Integer pageSize);
List<String> findUninvoicedOrderIdsByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses); List<String> findUninvoicedOrderIdsByShopForClient(@Param("shopIds") List<String> shopIds, @Param("erpStatuses") List<Integer> erpStatuses);

View File

@ -208,7 +208,7 @@ public interface IPlatformOrderService extends IService<PlatformOrder> {
* @param pageSize * @param pageSize
* @return * @return
*/ */
LinkedList<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds, List<Integer> erpStatuses, String column, String order, Integer pageNo, Integer pageSize); List<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds, List<Integer> erpStatuses, String column, String order, Integer pageNo, Integer pageSize);
/** /**
* Get ids of all order that can be invoiced by small clients (type 2) themselves. * Get ids of all order that can be invoiced by small clients (type 2) themselves.
* @param shopIds list of shop id * @param shopIds list of shop id

View File

@ -429,7 +429,7 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
} }
@Override @Override
public LinkedList<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds, List<Integer> erpStatuses, String column, String order, Integer pageNo, Integer pageSize) { public List<PlatformOrder> findUninvoicedOrdersByShopForClient(List<String> shopIds, List<Integer> erpStatuses, String column, String order, Integer pageNo, Integer pageSize) {
int offset = (pageNo - 1) * pageSize; int offset = (pageNo - 1) * pageSize;
return platformOrderMap.findUninvoicedOrdersByShopForClient(shopIds, erpStatuses, column, order, offset, pageSize); return platformOrderMap.findUninvoicedOrdersByShopForClient(shopIds, erpStatuses, column, order, offset, pageSize);
} }