The way is as follows:
1. If the evidence can prove that the product (whether the product of Company A or the product of Company B) has been publicly sold before the patent application date, then the design belongs to the existing design, and Company B may request the Patent Reexamination Board to declare the patent invalid.
2. If the evidence can't prove that the product was sold publicly before the patent application date, it can only prove that Company B produced it before the patent application date, so you can claim the right of first use in the lawsuit.
If there is enough evidence, the lawsuit will be won.
In addition, even if the evidence of Company B is insufficient, Company B may request the court to let Company A issue a patent evaluation report, and perhaps the other party will withdraw the lawsuit on its own after receiving the evaluation report issued by China National Intellectual Property Administration.