package com.gyee.frame.service.recommen;

import com.gyee.frame.common.spring.Constant;
import com.gyee.frame.common.spring.InitialRunner;
import com.gyee.frame.model.auto.*;
import com.gyee.frame.model.custom.*;
import com.gyee.frame.service.*;
import com.gyee.frame.service.report.*;
import com.gyee.frame.util.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * RecommenService
 * @Title: RecommenService.java 
 * @Package com.gyee.frame.service 
 * @author gyee_自动生成
 * @email 1@qq.com
 * @date 2019-12-31 14:58:09  
 **/
@Service
public class RecommenService {

	private final String XQQR = "是";
	@Resource
	private RecommenmainService recommenmainService;
	@Resource
	private RecommenmainMsSqlService recommenmainMsSqlService;
	@Resource
	private WindTurbineTestingPointAiService windTurbineTestingPointAiService;
	@Resource
	private WtReportMainService wtReportMainService;
	@Resource
	private WobugeqService wobugeqService;
	@Resource
	private ShbrUserService shbrUserService;
	@Resource
	private ShbraceletUserService shbraceletUserService;
	@Resource
	private ShbraceletPointkeyService shbraceletPointkeyService;

	@Resource
	private EquipmentSqlService equipmentSqlService;
	@Resource
	private MismapSqlService mismapSqlService;
	@Resource
	private WindturbineSqlService windturbineSqlService;

	@Resource
	private EliminatingeqService eliminatingeqService;

	@Resource
	private Wttragetreport3Service wttragetreport3Service;
	@Resource
	private WtReportFault3Service wtReportFault3Service;

	private final String QS = "0";
	private final String FD = "-1";
	private final String GF = "-2";

	IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();

	private long INTERVAL=600;

	/**
	 * 获得当日健康推荐检修风机
	 * @return
	 */
	public List<Recommenmain> getRecommenmainDay1() {

		List<Recommenmain> list=new ArrayList<>();

		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.HOUR_OF_DAY, 0);
		cal.set(Calendar.MINUTE, 0);
		cal.set(Calendar.SECOND,0);
		cal.set(Calendar.MILLISECOND, 0);

		Date beginDate = cal.getTime();
		cal.add(Calendar.DAY_OF_MONTH, 1);
		Date endDate = cal.getTime();

		list=recommenmainService.getRecommenmainListByStatus("0",beginDate,endDate);

		return list;
	}

	/**
	 * 获得3日健康推荐检修风机
	 * @return
	 */
	public List<Recommenmain> getRecommenmainDay3() {

		List<Recommenmain> list=new ArrayList<>();

		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.HOUR_OF_DAY, 0);
		cal.set(Calendar.MINUTE, 0);
		cal.set(Calendar.SECOND,0);
		cal.set(Calendar.MILLISECOND, 0);
		cal.add(Calendar.DAY_OF_MONTH, 1);
		Date beginDate = cal.getTime();
		cal.add(Calendar.DAY_OF_MONTH, 2);
		Date endDate = cal.getTime();

		list=recommenmainService.getRecommenmainListByStatus("0",beginDate,endDate);

		return list;
	}

	/**
	 * 获得7日健康推荐检修风机
	 * @return
	 */
	public List<Recommenmain> getRecommenmainDay7() {

		List<Recommenmain> list=new ArrayList<>();

		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.HOUR_OF_DAY, 0);
		cal.set(Calendar.MINUTE, 0);
		cal.set(Calendar.SECOND,0);
		cal.set(Calendar.MILLISECOND, 0);

		cal.add(Calendar.DAY_OF_MONTH, 3);
		Date beginDate = cal.getTime();
		cal.add(Calendar.DAY_OF_MONTH, 7);
		Date endDate = cal.getTime();

		list=recommenmainService.getRecommenmainListByStatus("0",beginDate,endDate);

		return list;
	}

	/**
	 * 确认推荐检修风机，并添加记录到生产系统
	 * @param rid
	 */
	public int confirpush(String rid)
	{
		int result=0;
		if(StringUtils.notEmp(rid))
		{
			Recommenmain po=recommenmainService.getRecommenmain(rid);
			if(StringUtils.notEmp(po) && StringUtils.notEmp(po.getCreatedate()))
			{
				RecommenmainExample example=new RecommenmainExample();

				po.setIsmain("1");
				recommenmainService.updateByPrimaryKeySelective(po);

				RecommenmainMsSql repo=new RecommenmainMsSql();

				repo.setWtid(po.getWtid());
				repo.setRecodedate(po.getRecodedate());
				repo.setCreatedate(po.getCreatedate());
				repo.setSpeed(po.getSpeed());
				repo.setReason(po.getReason());
				repo.setIsmain(po.getIsmain());
				repo.setRid(po.getRid());
				repo.setWpid(po.getWpid());
				repo.setWtnum(Double.valueOf(po.getWtnum()));
				repo.setWpnum(Double.valueOf(po.getWpnum()));

				result=recommenmainMsSqlService.insertSelective(repo);

			}
		}
		return result;
	}
	/**
	 * 取消推荐检修风机
	 * @param rid
	 */
	public int ignorepush(String rid)
	{
		int result=0;
		if(StringUtils.notEmp(rid))
		{
			Recommenmain po=recommenmainService.getRecommenmain(rid);
			if(StringUtils.notEmp(po) && StringUtils.notEmp(po.getCreatedate()))
			{
				po.setIsmain("2");
				result=recommenmainService.updateByPrimaryKeySelective(po);
			}
		}
		return result;
	}

	/**
	 * 获得确认检修风机
	 * @return
	 */
	public List<Recommenmain> recommenConfirmedList() {

		List<Recommenmain> list=new ArrayList<>();

		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.HOUR_OF_DAY, 0);
		cal.set(Calendar.MINUTE, 0);
		cal.set(Calendar.SECOND,0);
		cal.set(Calendar.MILLISECOND, 0);

		Date beginDate = cal.getTime();
		cal.add(Calendar.DAY_OF_MONTH, 7);
		Date endDate = cal.getTime();

		list=recommenmainService.getRecommenmainListByStatus("1",beginDate,endDate);

		return list;
	}

	/**
	 * 获得健康状态预测
	 * @param wpId
	 * @param type 1 表示24小时健康趋势，2 表示七天健康趋势 3 表示30天健康趋势，
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object[]> findAllChartjz(String wpId,  String type) throws Exception {

		Map<String, Object[]> map = new HashMap<String, Object[]>();

		if (StringUtils.notEmp(wpId) &&  StringUtils.notEmp(type)) {

			int num=0;
			String format1 = "yyyy-MM-dd HH点";
			String format2 = "yyyy-MM-dd";
			String format3 = "MM-dd";

			SimpleDateFormat df1 = new SimpleDateFormat(format1);
			SimpleDateFormat df2 = new SimpleDateFormat(format2);
			SimpleDateFormat df3 = new SimpleDateFormat(format3);

			Calendar cal = Calendar.getInstance();

			String uniformcode = Constant.YCFJJKZT1DAY;
			switch (type) {
				case "1":
					cal.add(Calendar.HOUR_OF_DAY, 2);
					cal.set(Calendar.MINUTE, 0);
					cal.set(Calendar.SECOND, 0);

					uniformcode = Constant.YCFJJKZT1DAY;

					num=12;
					break;
				case "2":
					cal.add(Calendar.DAY_OF_MONTH, 1);
					cal.set(Calendar.HOUR_OF_DAY, 0);
					cal.set(Calendar.MINUTE, 0);
					cal.set(Calendar.SECOND, 0);
					cal.set(Calendar.MILLISECOND, 0);
					//  uniformcode = Constant.YCFJJKZT7DAY;
					uniformcode = Constant.YCFJJKZT1MONTH;
					num=7;
					break;

				case "3":
					cal.add(Calendar.DAY_OF_MONTH, 1);
					cal.set(Calendar.HOUR_OF_DAY, 0);
					cal.set(Calendar.MINUTE, 0);
					cal.set(Calendar.SECOND, 0);
					cal.set(Calendar.MILLISECOND, 0);
					uniformcode = Constant.YCFJJKZT1MONTH;
					num=30;
					break;
				default:
					break;
			}

			int ysl = 0;// 优数量
			int lsl = 0;// 良数量
			int csl = 0;// 差数量
			double jkd = 0.0;

			Double[] yslchart = new Double[num];
			Double[] lslchart = new Double[num];
			Double[] cslchart = new Double[num];
			Double[] lvchart = new Double[num];

			String[] datechart = new String[num];
			List<Windturbine> wtls = new ArrayList<Windturbine>();

			if (wpId.equals(QS) || wpId.equals(FD) || wpId.equals(GF)) {
				for (Windturbine wt : InitialRunner.wtls) {
					wtls.add(wt);
				}
			}else if (InitialRunner.wpmap.containsKey(wpId)) {
				wtls = InitialRunner.wp_wtmap.get(wpId);
			} else if (InitialRunner.pjmap.containsKey(wpId))  {
				wtls = InitialRunner.pj_wtmap.get(wpId);
			} else if (InitialRunner.lnmap.containsKey(wpId))  {
				wtls = InitialRunner.ln_wtmap.get(wpId);
			} else if (InitialRunner.wtmap.containsKey(wpId))  {
				wtls.add(InitialRunner.wtmap.get(wpId)) ;
			}

			List<String> wtidls = new ArrayList<String>();
			List<String> codejkls = new ArrayList<String>();
			List<String> codeztls = new ArrayList<String>();

			for (Windturbine wt : wtls) {
				wtidls.add(wt.getId());
				codejkls.add(uniformcode);

			}

			String[] jkpoints = new String[wtidls.size()];

			// 获得训练参数对象
			for (int x = 0; x < wtidls.size(); x++) {

				WindTurbineTestingPointAi ai = windTurbineTestingPointAiService.getWindTurbineTestingPointAi2(wtidls.get(x), codejkls.get(x));
				if(StringUtils.notEmp(ai))
				{
					jkpoints[x] = ai.getId();
				}

			}

			for (int i = 0; i < num; i++) {
				ysl = 0;// 优数量
				lsl = 0;// 良数量
				csl = 0;// 差数量
				jkd = 0.0;



				int recodeDate = new BigDecimal(cal.getTime().getTime()).divide(new BigDecimal(1000), 0, RoundingMode.DOWN).intValue();

				// 获得风机健康状态结果数组
				DNAVal[] jkvalues = realApiUtil.getHistMatrix(jkpoints, recodeDate);

				for (int x = 0; x < wtidls.size(); x++) {

					double jk = jkvalues[x].DValue;

					if (jk == 4.0) {

						csl++;
					} else if (jk == 3.0) {

						lsl++;
					} else if (jk == 2.0 || jk == 1.0) {

						ysl++;
					} else {

						ysl++;
					}
				}
				jkd = new BigDecimal(ysl + lsl).divide(new BigDecimal(wtidls.size()), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();

				yslchart[i] = Double.valueOf(ysl);
				lslchart[i] = Double.valueOf(lsl);
				cslchart[i] = Double.valueOf(csl);
				lvchart[i] = Double.valueOf(jkd);

				switch (type) {
					case "1":
						datechart[i] = df1.format(cal.getTime());
						cal.add(Calendar.HOUR_OF_DAY, 2);

						break;
					case "2":
						datechart[i] = df2.format(cal.getTime());
						cal.add(Calendar.DAY_OF_MONTH, 1);
						break;
					case "3":
						datechart[i] = df3.format(cal.getTime());
						cal.add(Calendar.DAY_OF_MONTH, 1);
						break;
					default:
						break;
				}

			}

			map.put("yslchart", yslchart);
			map.put("lslchart", lslchart);
			map.put("cslchart", cslchart);
			map.put("lvchart", lvchart);
			map.put("datechart", datechart);

		}

		return map;

	}


	/**
	 * 通过消缺单获得详细信息
	 * @param rid
	 * @return
	 */
	public MainTrackVo findMainTrack(String rid) {

		MainTrackVo vo = new MainTrackVo();
		RecommenmainMsSql rm = recommenmainMsSqlService.findRecommenmainById(rid);

		if (StringUtils.notEmp(rm)) {

			vo.setWtId(rm.getWtid());
			vo.setWpId(rm.getWpid());
			vo.setWpName(InitialRunner.wpmap.get(rm.getWpid()).getName());
			vo.setTjfs(rm.getSpeed());
			vo.setTjss(rm.getRecodedate());
			vo.setTjyy(rm.getReason());

			WtReportMain wrm = wtReportMainService.findWtReportMainById(rm.getWtid(), rm.getCreatedate());

//			WtReportFault3 wrm =new WtReportFault3();
//			List<Wttragetreport3> wtreportls = wttragetreport3Service.findWttragetreport3(rm.getWtid(),DateUtils.truncate(rm.getRecodedate()));

//			if (!wtreportls.isEmpty()) {
//				//获得健康报告主表信息
//				Wttragetreport3 wtreport = wtreportls.get(0);
//				//获得检修数据
//				List<WtReportFault3> wtfaultls = wtReportFault3Service.findWtReportFault3(wtreport.getId(), rm.getWtid());
//
//				if(!wtfaultls.isEmpty())
//				{
//					wrm =wtfaultls.get(0);
//				}
//			}
			// 如果判定状态为下单，进入该判读
			if (StringUtils.notEmp(rm.getIsmain()) && rm.getIsmain().equals(XQQR)
					&& StringUtils.notEmp(rm.getWobugid())) {

				Wobugeq wobugeq = wobugeqService.findRecommenmainById(rm.getWobugid());

				if (StringUtils.notEmp(wobugeq)) {
					vo.setBugnum(wobugeq.getBugnum());// 缺陷单号
					vo.setWorkgroup1(wobugeq.getWorkgroup1());// 消缺类型
					vo.setFindlabornum(wobugeq.getFindlabornum());// 发现人
					vo.setReportlabornum(wobugeq.getReportlabornum());// 汇报人
					vo.setDescription(wobugeq.getDescription());// 缺陷描述
					vo.setDeparturetime(wobugeq.getDeparturetime());// 出发时间
					vo.setArrivaltime(wobugeq.getArrivaltime());// 到达时间
					vo.setProdtdeptopinion(wobugeq.getProdtdeptopinion());// 故障等级
					vo.setWorkleader(wobugeq.getWorkleader());// 工作负责人
					vo.setRepairedtime(wobugeq.getRepairedtime());// 启动完成时间
					vo.setRepairedcomment(wobugeq.getRepairedcomment());// 消缺工艺
					vo.setUnresolvedbug(wobugeq.getUnresolvedbug());// 遗留问题
					vo.setChecktime(wobugeq.getChecktime());// 验收时间
					vo.setDegradebugtype(wobugeq.getDegradebugtype());// 累计停机小时
					vo.setRepairdeptbugtype1(wobugeq.getRepairdeptbugtype1());// 预计损失电量
					vo.setCheckdeptlabornum(wobugeq.getCheckdeptlabornum());// 验收签字人
					vo.setStatus(wobugeq.getStatus());
					vo.setProdtdepttime(wobugeq.getProdtdepttime());
					vo.setCheckdeptopinion(wobugeq.getCheckdeptopinion());

					vo.setRwfpsc(
							MathUtil.decimal((double) dateDiff(wobugeq.getProdtdepttime(), rm.getOperationdate()), 2));
					vo.setDdxcsc(MathUtil
							.decimal((double) dateDiff(wobugeq.getArrivaltime(), wobugeq.getDeparturetime()), 2));
					vo.setQxclsc(
							MathUtil.decimal((double) dateDiff(wobugeq.getGridtime(), wobugeq.getArrivaltime()), 2));
					vo.setYssc(MathUtil.decimal((double) dateDiff(wobugeq.getChecktime(), wobugeq.getGridtime()), 2));
				}

				if (StringUtils.notEmp(wrm)) {
					vo.setGzpc(wrm.getMainmethod());// 故障排查方法
					vo.setGzjx(wrm.getApproach());// 故障检修方法
				}
				MainTrackVo vos = wobugeqService.findDuration();
				if (vos != null) {
					//vo.setRwfppjsc(MathUtil.decimal(vos.getRwfppjsc(), 2));//任务分配平均时长
					vo.setRwfppjsc(MathUtil.decimal(62.0, 2));//任务分配平均时长
					vo.setDdxcpjsc(MathUtil.decimal(vos.getDdxcpjsc(), 2));//到现场平均时长
					vo.setQxclpjsc(MathUtil.decimal(vos.getQxclpjsc(), 2));//缺陷处理平均时长
					vo.setYspjsc(MathUtil.decimal(vos.getYspjsc(), 2));//验收平均时长
				}
			}
		}


		if ( StringUtils.notEmp(vo.getWorkleader())) {
			long diff = 0l;
			double workHours=0;
			if ( StringUtils.notEmp(vo.getDeparturetime()) && StringUtils.notEmp(vo.getChecktime())) {

				diff = vo.getChecktime().getTime() - vo.getDeparturetime().getTime();
				workHours = (double) (diff / (1000 * 60));
			} else if (vo.getDeparturetime() != null &&  StringUtils.empty(vo.getChecktime())) {
				diff = new Date().getTime() - vo.getDeparturetime().getTime();
				workHours = (double) (diff / (1000 * 60));
			} else {
				workHours = 0.0;
			}

			vo.setWorkHours(workHours);//消缺时长
		}
		return vo;
	}

	private long dateDiff(Date a, Date b) {
		long diff, minuts = 0;
		if (a != null && b != null) {
			diff = a.getTime() - b.getTime();// 这样得到的差值是毫秒级别
			minuts = diff / (1000 * 60);
		}

		return minuts;
	}

	/**
	 * 获得未完成消缺单列表
	 * @return
	 */
	public List<WoBugEqVo> unfinishedList(String wpId, String wtId, Date beginDate, Date endDate) {

		List<WoBugEqVo> list=new ArrayList<>();



		list=recommenmainMsSqlService.unfinishedList(wpId,wtId, beginDate, endDate);

		return list;
	}

	/**
	 * 获得完成消缺单列表
	 * @return
	 */
	public List<WoBugEqVo> finishedList(String wpId, String wtId, Date beginDate, Date endDate) {

		List<WoBugEqVo> list=new ArrayList<>();



		list=recommenmainMsSqlService.finishedList(wpId,wtId, beginDate, endDate);

		return list;
	}

	/**
	 * 通过用户姓名和开始检修时间和结束检修时间获取手环实时和历史数据
	 * @param name
	 * @param beginDate
	 * @param endDate
	 * @return
	 * @throws Exception
	 */
	public Map<String,Map<String,Object>> findShbraceletList(String name,String beginDate,String endDate) throws Exception {

		Map<String,Map<String,Object>> result=new HashMap<>();


		if(StringUtils.notEmp(name) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate))
		{
			ShbrUser user=shbrUserService.findShbrUserByName(name);

			if(StringUtils.notEmp(user) && StringUtils.notEmp(user.getId()))
			{
				ShbraceletUser shbraceletUser=shbraceletUserService.findShbraceletUserById(user.getId());

				if(StringUtils.notEmp(shbraceletUser) && StringUtils.notEmp(shbraceletUser.getDeviceid()))
				{
					List<ShbraceletPointkey> list=shbraceletPointkeyService.findShbraceletPointkeyList(shbraceletUser.getDeviceid());

					if(!list.isEmpty())
					{
						Date begin= DateUtils.parseDate(beginDate);
						Date end= DateUtils.parseDate(endDate);

						Map<String,Object> map1=new HashMap<>();
						Map<String,Object> map2=new HashMap<>();

						result.put("ss",map1);
						result.put("ls",map2);
						for(ShbraceletPointkey po:list)
						{

							String pointkey=po.getPointkey();
							String key=pointkey.substring(pointkey.lastIndexOf("_")+1);
							PointData pd=realApiUtil.getRealData(po.getPointkey());

							map1.put(key,pd.getPointValueInDouble());
							long count = (end.getTime() / 1000 - begin.getTime()/1000) / 600;
							List<PointData> ls = realApiUtil.getHistoryDatasSnap(pointkey, begin.getTime() / 1000, end.getTime() / 1000, count, INTERVAL);
							if(!ls.isEmpty())
							{
								map2.put(key,ls);
							}else
							{
								map2.put(key,new ArrayList<>());
							}

							result.put("ss",map1);
							result.put("ls",map2);
						}
					}
				}
			}
		}

		return result;
	}

//	@Resource
//	private EquipmentSqlService equipmentSqlService;
//	@Resource
//	private MismapSqlService mismapSqlService;
//	@Resource
//	private WindturbineSqlService windturbineSqlService;

	/**
	 * 获取部件结构树
	 * @return
	 */
	public List<ElementNode> findLocationTreeByWtId(String wtId) {

		List<ElementNode> vos=new ArrayList<>();
		if (StringUtils.notEmp(wtId) ) {

			MismapSql mis=mismapSqlService.findMismapSqlById(wtId);
			String wtNum=mis.getMiskey();
			WindturbineSql wt = windturbineSqlService.findWindturbineById(wtNum);

			if (StringUtils.notEmp(wt) && StringUtils.notEmp(wt.getLocation())) {

				List<EquipmentSql> eqls = equipmentSqlService.getEquipmentListByLocation(wt.getLocation());
				if(!eqls.isEmpty())
				{
					List<ElementNode> nodes = new ArrayList<ElementNode>();
					for(EquipmentSql eq:eqls)
					{
						ElementNode node=new ElementNode();
						node.setId(eq.getLocation());
						node.setPid(eq.getParent());
						node.setLabel(eq.getDescription());
					//	node.setOpen(true);
						nodes.add(node);
					}

					TreeUtil treeUtil=new TreeUtil(nodes);
					vos=treeUtil.buildJSONTree();
				}
			}
		}

		return vos;
	}


	/**
	 * 通过位置编号获得缺陷单信息
	 * @return
	 */
	public List<WoBugVo> findWobugeqByLocation(Tablepar tablepar,String location, Date beginDate, Date endDate) {

		List<WoBugVo>	vos =new ArrayList<>();
		if (StringUtils.notEmp(tablepar) && StringUtils.notEmp(location) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate) ) {

			List<Wobugeq> list=wobugeqService.findWobugeqByLocation(tablepar,location, beginDate, endDate);

			if (!list.isEmpty()) {

				for (Wobugeq wb : list) {
					if (StringUtils.notEmp(wb.getBugnum())) {
						List<Eliminatingeq> ells = eliminatingeqService.findEliminatingeqById(wb.getBugnum());
						if (!ells.isEmpty()) {
							for (Eliminatingeq el : ells) {
								WoBugVo vo = new WoBugVo();
								vo.setXqbh(wb.getBugnum());
								vo.setXqms(wb.getDescription());
								vo.setXqsj(wb.getFindtime());
								vo.setXqry(wb.getFindlabornum());
								vo.setStatus(1);
								vo.setGhbj(el.getSparename());
								vo.setGhyy(el.getDescription());
								vo.setGhsl(el.getNumber());
								vos.add(vo);
							}
						} else {
							WoBugVo vo = new WoBugVo();
							vo.setXqbh(wb.getBugnum());
							vo.setXqms(wb.getDescription());
							vo.setXqsj(wb.getFindtime());
							vo.setXqry(wb.getFindlabornum());
							vo.setStatus(0);
							vos.add(vo);
						}
					}

				}
			}
		}
		return vos;
	}




	/**
	 * 获得对应风机的1个月健康推荐检修记录
	 * @return
	 */
	public List<Recommenmain> getRecommenmainMonth(String wtId) {

		List<Recommenmain> list=new ArrayList<>();


		if(StringUtils.notEmp(wtId))
		{
			Calendar cal = Calendar.getInstance();
			cal.set(Calendar.HOUR_OF_DAY, 0);
			cal.set(Calendar.MINUTE, 0);
			cal.set(Calendar.SECOND,0);
			cal.set(Calendar.MILLISECOND, 0);

			cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
			Date beginDate = cal.getTime();
			cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
			Date endDate = cal.getTime();

			list=recommenmainService.getRecommenmainList(wtId,beginDate,endDate);
		}


		return list;
	}

}
