package com.hotent.portal.job;

import javax.annotation.Resource;

import org.quartz.JobExecutionContext;

import com.hotent.base.manager.CommonManager;
import com.hotent.job.model.BaseJob;

/**
 * 更新PM系统中的人天工时登记日对应的星期几
 * @author heyifan
 *
 */
public class SysPMUpdateXMRTJL extends BaseJob{
	@Resource
	CommonManager commonManager;

	@Override
	public void executeJob(JobExecutionContext context) throws Exception {
		String sql = "UPDATE w_xmrtjl a" + 
				"LEFT JOIN work_day b ON a.f_tbsj = b.date_ " + 
				"SET a.f_xq = concat((" + 
				"		CASE" + 
				"				b.is_work_ " + 
				"				WHEN 0 THEN" + 
				"				'节假日-' " + 
				"				WHEN 1 THEN" + 
				"				'工作日-' " + 
				"			END " + 
				"				),(" + 
				"			CASE" + 
				"					WEEKDAY( f_tbsj ) " + 
				"					WHEN 0 THEN" + 
				"					'星期一' " + 
				"					WHEN 1 THEN" + 
				"					'星期二' " + 
				"					WHEN 2 THEN" + 
				"					'星期三' " + 
				"					WHEN 3 THEN" + 
				"					'星期四' " + 
				"					WHEN 4 THEN" + 
				"					'星期五' " + 
				"					WHEN 5 THEN" + 
				"					'星期六' " + 
				"					WHEN 6 THEN" + 
				"					'星期天' " + 
				"			END " + 
				"	))";
		commonManager.execute(sql);
	}
}
