First thing I think is to take the JDBC client out of the loop. What is innodb_buffer_pool_size? How much RAM is available to MySQL?
Are you running the MySQL query cache? If so, it's muddying your waters, turn it off.
If an upgrade to 8.0 isn't soon possible, unless I misunderstand this query I think you need to rework it such that you run its code logic ...
SELECT
item_t0.p_productcode as productcode, item_t0.p_currency as currency,
SUM( item_t0.p_totalorders ) totalorders,
SUM( item_t0.p_totalvisits ) totalvisits,
SUM( item_t0.p_totalproductviews ) totalproductviews,
SUM( item_t0.p_totalcartadds ) totalcartadds,
SUM( item_t0.p_totalunits ) totalunits,
SUM( item_t0.p_customscore1 ) customscore1, SUM( item_t0.p_customscore2 ) customscore2,
SUM( item_t0.p_customscore3 ) customscore3
FROM productanalytics item_t0
WHERE ( item_t0.p_datetime >= '2021-01-01 00:00:00' AND item_t0.p_datetime <= '2021-07-28 23:59:59')
AND (item_t0.TypePkString=8796126871634 )
GROUP BY item_t0.p_productcode, item_t0.p_currency
in.. just once, save that result to a temp table, then move the subsetting logic of your non-performing Left Joins to a pivot query on the above result.