When the lights in the control panel flash, it's because the computer chip inside it is damaged by water. Unless you can see that the connectors in the cables are completely damaged by corrosion, you can probably repair your bike by only replacing the control panel. Before you buy anything, you can test it by joining the red and the blue wires inside the control panel's harness. That should switch on the controller and give you basic pedal assist function at the lowest level. If that works, you can nearly any similar control panel, which are very cheap to buy.