This paper examines the modelling and solution method of complex multiperiod optimal consumption and investment problems with several kinds of constraints. Our work differs from previous results in several ways: typical market imperfections such as short sale constraints, proportional transaction costs are considered simultaneously; the MGARCH model is adopted to provide a satisfactory description of the time-varying behavior of stock returns; the CVaR constraint is introduced to control the wealth loss risk while maximizing the expected utility; it is assumed that the investor wants to maximize the expected utility of both his intermediate consumptions and his terminal wealth; most importantly, the considered problem is described as a stochastic programming problem, which can easily cope with problems with arbitrary utility functions, multiple risky assets and many periods. The derived model can help the investor to find robust consumption-investment decisions. The procedure to solve the resulting nonlinear stochastic optimization problem is discussed in detail. Numerical results show the suitability and promise of our methodology.