package org.cs.web.order;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.cs.core.ctl.BaseCtl;
import org.cs.mgr.order.dao.IMgmOrderCommissionDao;
import org.cs.mgr.order.model.MgmOrderCommission;
import org.cs.mgr.order.service.IMgmOrderCommissionService;
import org.cs.mgr.user.model.MgmMessage;
import org.cs.mgr.user.service.IMgmCustomerService;
import org.cs.mgr.user.service.IMgmMessageService;
import org.cs.util.Pager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;


/** 
 * 
 * @ClassName:  
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:28:55
 */
@Controller
@RequestMapping("web/mgmOrderCommissionWebCtl")
public class MgmOrderCommissionWebCtl extends BaseCtl {

	private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private IMgmOrderCommissionService mgmOrderCommissionService;
	
	@Autowired
	private IMgmCustomerService mgmCustomerService;
	
	@Autowired
	private IMgmOrderCommissionDao mgmOrderCommissionDao;
	/**
	 * 
	 * <p>佣金记录</p>
	 * @return
	 * @throws Exception 
	 */
	@RequestMapping("me_money")
	public String me_money(@RequestParam(required=false)String userId,ModelMap mm){
		List<Map<String, Object>> lists;
		BigDecimal sum;
		try {
			lists = mgmOrderCommissionService.getMgmOrderCommissionList(userId);
			
			sum = this.mgmOrderCommissionDao.getMgmOrderCommissionNum(Integer.parseInt(userId));
			mm.put("lists", lists);
			mm.put("SUM", sum);
			mm.put("USER_ID", userId); 
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "app/me/me_money";	
	}
}

