Number 1 mistake I see Jayce players make in laning is sitting back in cannon mode all the time and saving hammer stance for trades. Ideally you should do that the other way around and here's why: Hammer stance W gives you mana on hit, and Jayce is mana gated. So if you do your CSing in hammer stance, you just recovered a good spell worth of mana per wave for free on top of regular mana regen. Moreover, the trading pattern starting from Hammer stance is safer: You jump on them w/ Q (AA at least once) and maybe use W for added dmg, then punt them back w/ E and then switch to cannon stance and add more damage to your trade, and from range now, so you are free to decide when to end the trade, and there's much less your opponent can do to try and re-engage it+they just took a ton of damage aren't likely to want to resume fighting anyways.
The suggestions of MrFawknSunshine below are well worth taking advantage of to deal w/ the threat of jungle ganks. Moreover, if the enemy top laner is chunked out hard, you can sometimes turn the jungle gank into a free kill or even a double. (Also, it's not a bad thing if the enemy jungle is camping you, if you're drawing that much attention to your lane, then your teammates have the opportunity to make winning plays elsewhere on the map, like in bot lane). You might wanna try jungling for a few dozen games to get a sense for what the role is like, to help you understand what to expect from the enemy jungler.