In the era of intelligent applications, Mobile Edge Computing (MEC) is emerging as a promising technology that provides abundant resources for mobile devices. However, establishing a direct connection to the MEC server is not always feasible for certain devices. This paper introduces a novel Device-to-Device (D2D)-assisted system to address this challenge. The system leverages idle helper devices to execute and offload tasks to the MEC server, thereby enhancing resource utilization and reducing offload time. To further minimize offloading time for latency-sensitive tasks, this paper incorporates edge caching. The problem is formulated by jointly optimizing computation, communication and caching, and a novel Joint Multiple Decision Optimization Algorithm (JMDOA) is proposed to solve the minimum-energy-consumption problem. Specifically, the JMDOA algorithm decomposes the integer-mixed non-convex optimization problem into two subproblems based on distinct properties of discrete variables. These subproblems are solved separately and optimized iteratively, ensuring convergence to a suboptimal solution. Simulations demonstrate the effectiveness and superiority of JMDOA, exhibiting lower energy consumption and reduced time compared to other baseline algorithms, approaching the optimum. This work contributes to the field by presenting a novel approach to optimizing resource allocation in MEC systems, with potential implications for the future development of intelligent applications.