text:
/**
 *
 */
package com.cardpay.pccredit.manager.service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cardpay.pccredit.customer.dao.comdao.CustomerInforCommDao;
import com.cardpay.pccredit.customer.model.CustomerInfor;
import com.cardpay.pccredit.customer.model.CustomerManagerTarget;
import com.cardpay.pccredit.customer.service.CustomerInforService;
import com.cardpay.pccredit.intopieces.constant.Constant;
import com.cardpay.pccredit.manager.constant.ManagerAdjustAdviceEnum;
import com.cardpay.pccredit.manager.constant.ManagerLevelAdjustmentConstant;
import com.cardpay.pccredit.manager.constant.ManagerLevelConstant;
import com.cardpay.pccredit.manager.constant.ManagerLevelEnum;
import com.cardpay.pccredit.manager.constant.ManagerTargetType;
import com.cardpay.pccredit.manager.dao.ManagerAssessmentScoreDao;
import com.cardpay.pccredit.manager.dao.comdao.ManagerAssessmentScoreCommDao;
import com.cardpay.pccredit.manager.dao.comdao.ManagerDownRuleComdao;
import com.cardpay.pccredit.manager.dao.comdao.ManagerPromotionRuleComdao;
import com.cardpay.pccredit.manager.filter.AccountManagerParameterFilter;
import com.cardpay.pccredit.manager.model.DownGradeRule;
import com.cardpay.pccredit.manager.model.ManagerAssessmentScore;
import com.cardpay.pccredit.manager.model.ManagerLevelAdjustment;
import com.cardpay.pccredit.manager.model.ManagerMonthTargetData;
import com.cardpay.pccredit.manager.model.ManagerPromotionDownRule;
import com.cardpay.pccredit.manager.model.ManagerPromotionRule;
import com.cardpay.pccredit.manager.model.MangerMonthAssessment;
import com.cardpay.pccredit.manager.model.PromotionRules;
import com.cardpay.pccredit.manager.model.TyManagerAssessment;
import com.cardpay.pccredit.manager.web.AccountManagerParameterForm;
import com.wicresoft.jrad.base.database.dao.common.CommonDao;
import com.wicresoft.jrad.base.database.id.IDGenerator;
import com.wicresoft.jrad.base.database.model.QueryResult;
import com.wicresoft.jrad.modules.privilege.filter.UserFilter;
import com.wicresoft.jrad.modules.privilege.model.User;

/**
 * 描述 :客户经理评估标准 定时执行service
 * @author 张石树
 *
 * 2014-11-12 下午3:37:19
 */
@Service
public class ManagerAssessmentScoreScheduleService {

	private Logger logger = Logger.getLogger(ManagerAssessmentScoreScheduleService.class);

	@Autowired
	private AccountManagerParameterService accountManagerParameterService;

	@Autowired
	private CustomerInforCommDao customerInforCommDao;

	@Autowired
	private ManagerAssessmentScoreCommDao managerAssessmentScoreCommDao;

	@Autowired
	private CommonDao commonDao;

	@Autowired
	private ManagerAssessmentScoreDao managerAssessmentScoreDao;

	@Autowired
	private ManagerBelongMapService managerBelongMapService;

	@Autowired
	private ManagerDownRuleComdao managerDownRuleComdao;

	@Autowired
	private ManagerPromotionRuleComdao managerPromotionRuleComdao;

	@Autowired
	private CustomerInforService customerInforService;
//	/**
//	 * 增加上一个月的客户经理评估信息
//	 */
//	public void addManagerAssessmentScore(){
//		Calendar calendar = Calendar.getInstance();
//		calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1, 0, 0, 0);
//		calendar.add(Calendar.MONTH, -1);
//		int year = calendar.get(Calendar.YEAR);
//		int month = calendar.get(Calendar.MONTH) + 1;
//		//每月客户经理评估
//		this.addManagerMonthAssessmentScore(year, month);
//
//		//根据规则 生成 晋级
//		List<PromotionRules> promotionRules = managerAssessmentScoreCommDao.findAllPromotionRules();
//		Map<String, List<PromotionRules>> proRulesMap = new HashMap<String, List<PromotionRules>>();
//		for(PromotionRules proRule : promotionRules){
//			if(proRulesMap.containsKey(proRule.getInitialLevel())){
//				List<PromotionRules> rules = proRulesMap.get(proRule.getInitialLevel());
//				rules.add(proRule);
//			} else {
//				List<PromotionRules> rules = new ArrayList<PromotionRules>();
//				rules.add(proRule);
//				proRulesMap.put(proRule.getInitialLevel(), rules);
//			}
//		}
//		//客户经理级别月度考核指标
//		Map<String, MangerMonthAssessment> managerTargetAssessmentMap = new HashMap<String, MangerMonthAssessment>();
//		List<MangerMonthAssessment> mangerMonthAssessments = managerAssessmentScoreCommDao.findManagerMonthAssessmentAll();
//		for(MangerMonthAssessment monthAssessment : mangerMonthAssessments){
//			managerTargetAssessmentMap.put(monthAssessment.getCustomerManagerLevel(), monthAssessment);
//		}
//		//晋级 降级生成
//		try{
//			AccountManagerParameterFilter filter = new AccountManagerParameterFilter();
//			// 设置每次最大查询记录数
//			filter.setLimit(50);
//			// 查询页码
//			filter.setPage(0);
//			QueryResult<AccountManagerParameterForm> qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
//			while(qs.getItems().size() != 0){
//				for(AccountManagerParameterForm accountManager : qs.getItems()){
//					//判断这个月的指标是否生成
//					ManagerMonthTargetData monthTargetData = managerAssessmentScoreCommDao.findManangerMonthTargetDataBy(year, month, accountManager.getUserId(), accountManager.getLevelInformation());
//					if(monthTargetData != null){
//						continue;
//					}
//					//客户经理目标
//					CustomerManagerTarget customerManagerTarget = accountManagerParameterService.getcustomerManagerTargetBymanagerIdDate(accountManager.getUserId(), ManagerTargetType.month.name());
//
//					List<CustomerInfor> customerInfors = customerInforCommDao.findCustomerByManagerId(accountManager.getUserId());
//					if(customerInfors != null && customerInfors.size() > 0){
//						//下属的经理级别统计Map
//					    Map<String, Integer> subLevelCountMap = new HashMap<String, Integer>();
//						List<String> customerIds = new ArrayList<String>();
//						for(CustomerInfor infor : customerInfors){
//							customerIds.add(infor.getId());
//						}
//						ManagerMonthTargetData managerMonthTargetData = new ManagerMonthTargetData();
//						//管户数(户)
//						managerMonthTargetData.setTubeNumber(customerInfors.size());
//						//激活率
//						Integer activateCardCounts = managerAssessmentScoreCommDao.countActivateCard(year, month, customerIds);
//						if(customerManagerTarget.getActivationNumber() != null && customerManagerTarget.getActivationNumber() > 0){
//							double activateCardCountsD = activateCardCounts;
//							double activationNumberD = customerManagerTarget.getActivationNumber();
//							BigDecimal bg = new BigDecimal(activateCardCountsD/activationNumberD * 100);
//							Double activateCardRate = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
//							managerMonthTargetData.setActivationRate(activateCardRate+"");
//						} else {
//							managerMonthTargetData.setActivationRate(100.0 + "");
//						}
//						//活跃率
//						Integer activeCardCounts = managerAssessmentScoreCommDao.countActiveCard(year, month, customerIds);
//						if(customerManagerTarget.getActiveNumber() != null && customerManagerTarget.getActiveNumber() > 0){
//							double activeCardCountsD = activeCardCounts;
//							double ActiveNumberD = customerManagerTarget.getActiveNumber();
//							BigDecimal bg = new BigDecimal(activeCardCountsD/ActiveNumberD * 100);
//							Double activeCardRate = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
//							managerMonthTargetData.setActiveRate(activeCardRate + "");
//						} else {
//							managerMonthTargetData.setActiveRate(100.0 + "");
//						}
//						//月度 日均透支余额(万)
//						List<String> managerIds = new ArrayList<String>();
//						managerIds.add(accountManager.getUserId());
//						Double perDayAverageCreditlineAccount = managerAssessmentScoreCommDao.perDayAverageCreditlineAccount(managerIds, year, month);
//						managerMonthTargetData.setMonthPerdayCreditline(perDayAverageCreditlineAccount + "");
//						//团队月度日均透支余额 (万)
//					    List<AccountManagerParameterForm> subManagerParams = managerBelongMapService.findSubListManagerByManagerId(accountManager.getUserId());
//					    if(subManagerParams.size() > 0){
//							managerIds.clear();
//							for(AccountManagerParameterForm parameterForm : subManagerParams){
//								managerIds.add(parameterForm.getUserId());
//								if(subLevelCountMap.containsKey(parameterForm.getLevelInformation())){
//									subLevelCountMap.put(parameterForm.getLevelInformation(),
//											subLevelCountMap.get(parameterForm.getLevelInformation()) + 1);
//								} else {
//									subLevelCountMap.put(parameterForm.getLevelInformation(), 1);
//								}
//							}
//							Double teamPerDayAverageCreditlineAccount = managerAssessmentScoreCommDao.perDayAverageCreditlineAccount(managerIds, year, month);
//							managerMonthTargetData.setMonthPerdayTeamCreditline(teamPerDayAverageCreditlineAccount + "");
//							managerMonthTargetData.setSubManangerCount(subManagerParams.size());
//						} else {
//							managerMonthTargetData.setMonthPerdayTeamCreditline(0 + "");
//							managerMonthTargetData.setSubManangerCount(0);
//						}
//					    //月度考核是否达标
//					    MangerMonthAssessment monthAssessment = managerTargetAssessmentMap.get(accountManager.getLevelInformation());
//					    if(monthAssessment != null){
//					    	//管理高级 需要判断团队
//					    	if(ManagerLevelEnum.MANA005.name().equals(accountManager.getLevelInformation())){
//								if (Double.parseDouble(managerMonthTargetData.getMonthPerdayCreditline()) >
//										Double.parseDouble(monthAssessment.getMonthdayAvgCreditline())
//										&& Double.parseDouble(managerMonthTargetData.getMonthPerdayTeamCreditline()) >
//										Double.parseDouble(monthAssessment.getMonthdayTeamAvgCreditline())
//										&& managerMonthTargetData.getTubeNumber() > monthAssessment.getTubeNumber()
//										&& Double.parseDouble(managerMonthTargetData.getActiveRate()) >
//										Double.parseDouble(monthAssessment.getActiveRate())
//										&& Double.parseDouble(managerMonthTargetData.getActivationRate()) >
//										Double.parseDouble(monthAssessment.getActivationRate())) {
//									managerMonthTargetData.setIfPassStandard(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_1);
//					    		} else {
//					    			managerMonthTargetData.setIfPassStandard(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_0);
//					    		}
//								//见习
//					    	} else if(ManagerLevelEnum.MANA001.name().equals(accountManager.getLevelInformation())){
//					    		if (Double.parseDouble(managerMonthTargetData.getMonthPerdayCreditline()) >
//								Double.parseDouble(monthAssessment.getMonthdayAvgCreditline())
//								&& managerMonthTargetData.getTubeNumber() > monthAssessment.getTubeNumber()) {
//									managerMonthTargetData.setIfPassStandard(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_1);
//					    		} else {
//					    			managerMonthTargetData.setIfPassStandard(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_0);
//					    		}
//					    	} else {
//					    		if (Double.parseDouble(managerMonthTargetData.getMonthPerdayCreditline()) >
//										Double.parseDouble(monthAssessment.getMonthdayAvgCreditline())
//										&& managerMonthTargetData.getTubeNumber() > monthAssessment.getTubeNumber()
//										&& Double.parseDouble(managerMonthTargetData.getActiveRate()) >
//										Double.parseDouble(monthAssessment.getActiveRate())
//										&& Double.parseDouble(managerMonthTargetData.getActivationRate()) >
//										Double.parseDouble(monthAssessment.getActivationRate())) {
//									managerMonthTargetData.setIfPassStandard(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_1);
//					    		} else {
//					    			managerMonthTargetData.setIfPassStandard(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_0);
//					    		}
//					    	}
//					    } else {
//					    	managerMonthTargetData.setIfPassStandard(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_0);
//					    }
//
//						//客户每月指标统计数据
//						managerMonthTargetData.setCustomerManagerId(accountManager.getUserId());
//						managerMonthTargetData.setDataYear(year);
//						managerMonthTargetData.setDataMonth(month);
//						managerMonthTargetData.setCustomerManagerLevel(accountManager.getLevelInformation());
//						managerMonthTargetData.setCreatedBy(Constant.SCHEDULES_SYSTEM_USER);
//						managerMonthTargetData.setCreatedTime(new Date());
//						managerMonthTargetData.setModifiedBy(Constant.SCHEDULES_SYSTEM_USER);
//						managerMonthTargetData.setModifiedTime(new Date());
//						commonDao.insertObject(managerMonthTargetData);
//
//						//晋级规则判断
//						if(proRulesMap.get(accountManager.getLevelInformation()) != null){
//							//季度日均透支余额(万)
//							Double quarterAverageCreditLineAccount = 0.0;
//							List<ManagerMonthTargetData> monthTargetDatas = managerAssessmentScoreCommDao
//									.findQuarterPerCreditlineAccount(accountManager.getUserId(), accountManager.getLevelInformation(), 3);
//							if(monthTargetDatas.size() < 3){
//								continue;
//							}
//							for(ManagerMonthTargetData targetData : monthTargetDatas){
//								quarterAverageCreditLineAccount += Double.parseDouble(targetData.getMonthPerdayCreditline());
//							}
//							quarterAverageCreditLineAccount = quarterAverageCreditLineAccount / 3;
//
//							List<PromotionRules> proRules = proRulesMap.get(accountManager.getLevelInformation());
//							//见习	初级	200	-	-	-	40	80%	60%
//							//业务中级	业务高级	1300	-	-	-	160	80%	70%
//							if(ManagerLevelEnum.MANA001.name().equals(accountManager.getLevelInformation())
//									|| ManagerLevelEnum.MANA004.name().equals(accountManager.getLevelInformation())){
//								PromotionRules rule = proRules.get(0);
//								if (quarterAverageCreditLineAccount > Double.parseDouble(rule.getQuarterAverageOverBalance())
//										&& managerMonthTargetData.getTubeNumber() > rule.getTubeNumber()
//										&& Double.parseDouble(managerMonthTargetData.getActivationRate()) > Double
//												.parseDouble(rule.getActivationRate())
//										&& Double.parseDouble(managerMonthTargetData.getActiveRate()) > Double
//												.parseDouble(rule.getActiveRate())) {
//									this.insertManagerLevelAdjustment(accountManager, rule, year, month);
//								}
//							}
//							if(ManagerLevelEnum.MANA002.name().equals(accountManager.getLevelInformation())){
//								for(PromotionRules rule : proRules){
//									boolean promotionFlag = false;
//									//管理中级 初级	管理中级	500	-	初级	2	100	80%	70%
//									//              业务中级	650	-	-	-	100	80%	70%
//									if(rule.getPromotionLevel().equals(ManagerLevelEnum.MANA003.name())){
//										Integer subLevelCount = subLevelCountMap.get(ManagerLevelEnum.MANA002.name()) != null ?
//												subLevelCountMap.get(ManagerLevelEnum.MANA002.name()) : 0;
//										if (quarterAverageCreditLineAccount > Double.parseDouble(rule.getQuarterAverageOverBalance())
//												&& subLevelCount >rule.getSubMangerNumber()
//												&& managerMonthTargetData.getTubeNumber() > rule.getTubeNumber()
//												&& Double.parseDouble(managerMonthTargetData.getActivationRate()) > Double
//														.parseDouble(rule.getActivationRate())
//												&& Double.parseDouble(managerMonthTargetData.getActiveRate()) > Double
//														.parseDouble(rule.getActiveRate())) {
//											promotionFlag = true;
//										}
//									} else {
//										if (quarterAverageCreditLineAccount > Double.parseDouble(rule.getQuarterAverageOverBalance())
//												&& managerMonthTargetData.getTubeNumber() > rule.getTubeNumber()
//												&& Double.parseDouble(managerMonthTargetData.getActivationRate()) > Double
//														.parseDouble(rule.getActivationRate())
//												&& Double.parseDouble(managerMonthTargetData.getActiveRate()) > Double
//														.parseDouble(rule.getActiveRate())) {
//											promotionFlag = true;
//										}
//									}
//									if(promotionFlag){
//										this.insertManagerLevelAdjustment(accountManager, rule, year, month);
//										break;
//									}
//								}
//							}
//							//管理中级	管理高级	1000	-	初级	4	160	80%	70%
//							//管理中级	管理高级	1000	-	中级	2	160	80%	70%
//							if(ManagerLevelEnum.MANA003.name().equals(accountManager.getLevelInformation())){
//								PromotionRules rule = proRules.get(0);
//								Integer subLevelCount = subLevelCountMap.get(rule.getLevelTeamMember()) != null ?
//										subLevelCountMap.get(rule.getLevelTeamMember()) : 0;
//								if (quarterAverageCreditLineAccount > Double.parseDouble(rule.getQuarterAverageOverBalance())
//										&& subLevelCount >rule.getSubMangerNumber()
//										&& managerMonthTargetData.getTubeNumber() > rule.getTubeNumber()
//										&& Double.parseDouble(managerMonthTargetData.getActivationRate()) > Double
//											.parseDouble(rule.getActivationRate())
//										&& Double.parseDouble(managerMonthTargetData.getActiveRate()) > Double
//											.parseDouble(rule.getActiveRate())) {
//									this.insertManagerLevelAdjustment(accountManager, rule, year, month);
//								}
//							}
//						}
//					}
//				}
//				// 设置查询的页码
//				filter.setPage(filter.getPage() + 1);
//				qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
//			}
//		}catch(Exception e){
//			logger.error("客户经理评估信息定时生成错误");
//			logger.error(e.getMessage(), e);
//			throw new RuntimeException(e.getMessage());
//		}
//	}

	/**
	 * 插入客户经理级别调整
	 * @param accountManager
	 * @param rule
	 */
	private void insertManagerLevelAdjustment(
			AccountManagerParameterForm accountManager, PromotionRules rule, int year, int month) {
		int count = managerAssessmentScoreCommDao.findManagerLevelAdjustment(accountManager.getUserId(), year, month);
		if(count == 0){
			ManagerLevelAdjustment managerLevelAdjustment = new ManagerLevelAdjustment();
			managerLevelAdjustment.setIfHandled(ManagerLevelAdjustmentConstant.IFHANDLE_0);
			managerLevelAdjustment.setSystemAdvice(ManagerAdjustAdviceEnum.up.name());
			managerLevelAdjustment.setOriginalLevel(rule.getInitialLevel());
			managerLevelAdjustment.setAdjustAfterLevel(rule.getPromotionLevel());
			managerLevelAdjustment.setCustomerManagerId(accountManager.getUserId());
			managerLevelAdjustment.setCreatedBy(Constant.SCHEDULES_SYSTEM_USER);
			managerLevelAdjustment.setCreatedTime(new Date());
			managerLevelAdjustment.setModifiedBy(Constant.SCHEDULES_SYSTEM_USER);
			managerLevelAdjustment.setModifiedTime(new Date());
			managerLevelAdjustment.setDataYear(year);
			managerLevelAdjustment.setDataMonth(month);
			commonDao.insertObject(managerLevelAdjustment);
		}
	}

	/**
	 * 客户经理降级每日执行
	 */
	public void downLevelSchedulesDay(){
		Calendar calendar = Calendar.getInstance();
		calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1, 0, 0, 0);
		calendar.add(Calendar.MONTH, -1);
		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH) + 1;

		//降级规则
		List<DownGradeRule> downGradeRules =  managerDownRuleComdao.getDownGradeRule();
		Map<String, DownGradeRule> downGradeRulesMap = new HashMap<String, DownGradeRule>();
		for(DownGradeRule downGradeRule : downGradeRules){
			downGradeRulesMap.put(downGradeRule.getCurrentLevel(), downGradeRule);
		}

		//根据规则  晋级规则
		List<PromotionRules> promotionRules = managerAssessmentScoreCommDao.findAllPromotionRules();
		Map<String, PromotionRules> proRulesMap = new HashMap<String, PromotionRules>();
		for(PromotionRules proRule : promotionRules){
			proRulesMap.put(proRule.getPromotionLevel(), proRule);
		}
		//客户经理级别月度考核指标
		Map<String, MangerMonthAssessment> managerTargetAssessmentMap = new HashMap<String, MangerMonthAssessment>();
		List<MangerMonthAssessment> mangerMonthAssessments = managerAssessmentScoreCommDao.findManagerMonthAssessmentAll();
		for(MangerMonthAssessment monthAssessment : mangerMonthAssessments){
			managerTargetAssessmentMap.put(monthAssessment.getCustomerManagerLevel(), monthAssessment);
		}
		try {
			AccountManagerParameterFilter filter = new AccountManagerParameterFilter();
			// 设置每次最大查询记录数
			filter.setLimit(50);
			// 查询页码
			filter.setPage(0);
			QueryResult<AccountManagerParameterForm> qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
			while(qs.getItems().size() != 0){
				for(AccountManagerParameterForm accountManager : qs.getItems()){
					//客户经理月度指标
					ManagerMonthTargetData managerMonthTargetData =
							managerAssessmentScoreCommDao.findManangerMonthTargetDataBy(year, month, accountManager.getUserId(), accountManager.getLevelInformation());
					if(managerMonthTargetData != null){
						//降级规则判断
						DownGradeRule downGradeRule = downGradeRulesMap.get(accountManager.getLevelInformation());
						if(downGradeRule == null){
							continue;
						}
						//a.初级微贷经理的降级:考核期末业绩指标未达标或综合评估得分连续两期低于60分。
						if(ManagerLevelEnum.MANA002.name().equals(accountManager.getLevelInformation())){
							//指标未达标 或 综合评估得分连续两期低于60分
							List<ManagerAssessmentScore> assessmentScores = managerAssessmentScoreCommDao.
									findManagerAssessmentScoreByYearAndMonth(accountManager.getUserId(), accountManager.getLevelInformation(), 2);
							if(managerMonthTargetData.getIfPassStandard().equals(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_0) ||
									(assessmentScores.size() == 2 && assessmentScores.get(0).getTotalScore() != null &&
									assessmentScores.get(0).getTotalScore() !=null &&
									assessmentScores.get(0).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()) &&
									assessmentScores.get(1).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()))){
								//生成降级信息
								this.addInsertDownLevelAdjustment(accountManager, ManagerLevelEnum.MANA001.name(), year, month);
							}
						}
						//b.	管理中级微贷经理的降级:考核期末业绩指标未达标;考核期末业绩达标但团队规模连续两期未达标;
						//综合评估得分连续两期低于70分。
						if(ManagerLevelEnum.MANA003.name().equals(accountManager.getLevelInformation())){
							//指标未达标 或 综合评估得分连续两期低于70分
							List<ManagerAssessmentScore> assessmentScores = managerAssessmentScoreCommDao.
									findManagerAssessmentScoreByYearAndMonth(accountManager.getUserId(), accountManager.getLevelInformation(), 2);
							List<ManagerMonthTargetData> targetDatas =
									managerAssessmentScoreCommDao.findManangerMonthTargetData(accountManager.getUserId(), accountManager.getLevelInformation(), 2);
							PromotionRules rule = proRulesMap.get(accountManager.getLevelInformation());
							if(managerMonthTargetData.getIfPassStandard().equals(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_0) ||
									(managerMonthTargetData.getIfPassStandard().equals(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_1)
											&& targetDatas.size() == 2 && targetDatas.get(0).getSubManangerCount() < rule.getSubMangerNumber()
											&& targetDatas.get(1).getSubManangerCount() < rule.getSubMangerNumber()) ||
											(assessmentScores.size() == 2 && assessmentScores.get(0).getTotalScore() != null &&
											assessmentScores.get(0).getTotalScore() !=null && assessmentScores.get(0).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()) &&
											assessmentScores.get(1).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()))){
								//生成降级信息
								this.addInsertDownLevelAdjustment(accountManager, ManagerLevelEnum.MANA002.name(), year, month);
							}
						}
						//c.	业务中级微贷经理的降级:考核期末业绩指标未达标或综合评估得分连续两期低于70分。
						if(ManagerLevelEnum.MANA004.name().equals(accountManager.getLevelInformation())){
							List<ManagerAssessmentScore> assessmentScores = managerAssessmentScoreCommDao.
									findManagerAssessmentScoreByYearAndMonth(accountManager.getUserId(), accountManager.getLevelInformation(), 2);
							if(managerMonthTargetData.getIfPassStandard().equals(ManagerLevelAdjustmentConstant.IF_PASS_STANDARD_0) ||
									(assessmentScores.size() == 2 && assessmentScores.get(0).getTotalScore() != null &&
									assessmentScores.get(0).getTotalScore() !=null &&
									assessmentScores.get(0).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()) &&
									assessmentScores.get(1).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()))){
								//生成降级信息
								this.addInsertDownLevelAdjustment(accountManager, ManagerLevelEnum.MANA002.name(), year, month);
							}
						}
						//d.	管理高级微贷经理的降级:考核期末团队业绩指标完成率低于80%;考核期末团队业绩完成80%以上,
						//但连续两期未达100%;考核期末团队业绩达标但团队规模连续两期未达标;综合评估得分连续两期低于80分。
						if(ManagerLevelEnum.MANA005.name().equals(accountManager.getLevelInformation())){
							//综合评估得分连续
							List<ManagerAssessmentScore> assessmentScores = managerAssessmentScoreCommDao.
									findManagerAssessmentScoreByYearAndMonth(accountManager.getUserId(), accountManager.getLevelInformation(), 2);
							List<ManagerMonthTargetData> targetDatas =
									managerAssessmentScoreCommDao.findManangerMonthTargetData(accountManager.getUserId(), accountManager.getLevelInformation(), 2);
							//月度考核指标
							MangerMonthAssessment assessment = managerTargetAssessmentMap.get(accountManager.getLevelInformation());
							double kaoHeYeJiZhiBiao = Double.parseDouble(managerMonthTargetData.getMonthPerdayTeamCreditline())/
									Double.parseDouble(assessment.getMonthdayTeamAvgCreditline()) * 100;
							PromotionRules rule = proRulesMap.get(accountManager.getLevelInformation());
							if(kaoHeYeJiZhiBiao < 80 ||
									(Double.parseDouble(managerMonthTargetData.getMonthPerdayTeamCreditline())
											>= Double.parseDouble(assessment.getMonthdayTeamAvgCreditline())
									 && targetDatas.size() == 2
									 && targetDatas.get(0).getSubManangerCount() < rule.getSubMangerNumber()
									 && targetDatas.get(1).getSubManangerCount() < rule.getSubMangerNumber()) ||
									 (assessmentScores.size() == 2 && assessmentScores.get(0).getTotalScore() != null &&
										assessmentScores.get(0).getTotalScore() !=null &&
										assessmentScores.get(0).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()) &&
										assessmentScores.get(1).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore()))){
								//生成降级信息
								this.addInsertDownLevelAdjustment(accountManager, ManagerLevelEnum.MANA003.name(), year, month);
							}
						}

						//e.	业务高级微贷经理的降级:自然年内季度业绩指标未达标满二次;自然年内综合评估得分低于80分满二次。
						if(ManagerLevelEnum.MANA006.name().equals(accountManager.getLevelInformation())){
							//自然年内指标数据
							List<ManagerMonthTargetData> targetDatas =
									managerAssessmentScoreCommDao.findManangerMonthTargetDataByYear(accountManager.getUserId(), accountManager.getLevelInformation(), year);
							//自然年内综合评估得分低于80分满二次
							List<ManagerAssessmentScore> assessmentScores = managerAssessmentScoreCommDao.
									findManagerAssessmentScoreByYear(accountManager.getUserId(), accountManager.getLevelInformation(), year);
							MangerMonthAssessment assessment = managerTargetAssessmentMap.get(accountManager.getLevelInformation());
							int lowEightyCount = 0;
							for(int i = 0; i < assessmentScores.size(); i++){
								if(assessmentScores.get(i).getTotalScore() != null &&
										assessmentScores.get(i).getTotalScore() < Double.parseDouble(downGradeRule.getEvaluationScore())){
									lowEightyCount ++;
								}
							}
							int quarterYeJiZhiBiao = 0;
							if(targetDatas.size() >= 6){
								int quarterSize = targetDatas.size()/3;
								for(int i = 0; i < quarterSize; i++){
									Double quarterCreditAccount = 0.0;
									for(int j = 1; j <= 3; j++){
										quarterCreditAccount += Double.parseDouble(targetDatas.get(i * 3 + j).getMonthPerdayCreditline());
									}
									if(quarterCreditAccount/3 < Double.parseDouble(assessment.getMonthdayAvgCreditline())){
										quarterYeJiZhiBiao ++;
									}
								}
							}
							if(lowEightyCount >= 2 || quarterYeJiZhiBiao >= 2){
								//生成降级信息
								this.addInsertDownLevelAdjustment(accountManager, ManagerLevelEnum.MANA004.name(), year, month);
							}
						}
					}
				}
				// 设置查询的页码
				filter.setPage(filter.getPage() + 1);
				qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
			}
		} catch (Exception e) {
			logger.error("客户经理降级定时生成错误");
			logger.error(e.getMessage(), e);
			throw new RuntimeException(e.getMessage());
		}
	}

	/**
	 * 生成降级信息
	 * @param accountManager
	 * @param afterLevel
	 */
	private void addInsertDownLevelAdjustment(AccountManagerParameterForm accountManager, String afterLevel, int year, int month) {

		int count = managerAssessmentScoreCommDao.findManagerLevelAdjustment(accountManager.getUserId(), year, month);
		if(count == 0){
			ManagerLevelAdjustment managerLevelAdjustment = new ManagerLevelAdjustment();
			managerLevelAdjustment.setIfHandled(ManagerLevelAdjustmentConstant.IFHANDLE_0);
			managerLevelAdjustment.setSystemAdvice(ManagerAdjustAdviceEnum.down.name());
			managerLevelAdjustment.setOriginalLevel(accountManager.getLevelInformation());
			managerLevelAdjustment.setAdjustAfterLevel(afterLevel);
			managerLevelAdjustment.setCustomerManagerId(accountManager.getUserId());
			managerLevelAdjustment.setCreatedBy(Constant.SCHEDULES_SYSTEM_USER);
			managerLevelAdjustment.setCreatedTime(new Date());
			managerLevelAdjustment.setModifiedBy(Constant.SCHEDULES_SYSTEM_USER);
			managerLevelAdjustment.setModifiedTime(new Date());
			managerLevelAdjustment.setDataYear(year);
			managerLevelAdjustment.setDataMonth(month);
			commonDao.insertObject(managerLevelAdjustment);
		}
	}

	/**
	 * 客户经理每月评估
	 * @param year
	 * @param month
	 */
	private void addManagerMonthAssessmentScore(int year, int month) {
		try{
			AccountManagerParameterFilter filter = new AccountManagerParameterFilter();
			// 设置每次最大查询记录数
			filter.setLimit(50);
			// 查询页码
			filter.setPage(0);
			QueryResult<AccountManagerParameterForm> qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
			while(qs.getItems().size() != 0){
				for(AccountManagerParameterForm accountManager : qs.getItems()){
					//如果已经存在则不需要重新计算评估信息
					ManagerAssessmentScore score = managerAssessmentScoreCommDao.findManagerAssessmentScoreByYearAndMonth(
							year, month, accountManager.getUserId(),accountManager.getLevelInformation());
					if(score != null){
						continue;
					}
					List<CustomerInfor> customerInfors = customerInforCommDao.findCustomerByManagerId(accountManager.getUserId());
					if(customerInfors != null && customerInfors.size() > 0){
						List<String> customerIds = new ArrayList<String>();
						for(CustomerInfor infor : customerInfors){
							customerIds.add(infor.getId());
						}
						this.addManagerAssessmentScore(year, month, accountManager, customerIds);
					}
				}
				// 设置查询的页码
				filter.setPage(filter.getPage() + 1);
				qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
			}
		}catch(Exception e){
			logger.error("客户经理评估信息定时生成错误");
			logger.error(e.getMessage(), e);
			throw new RuntimeException(e.getMessage());
		}
	}

	/**
	 * 生成客户经理评估信息
	 * @param year
	 * @param month
	 * @param accountManager
	 * @param customerIds
	 */
	private void addManagerAssessmentScore(int year, int month,
			AccountManagerParameterForm accountManager, List<String> customerIds) {
		//合同金额 (申请表 实际额度)
		Double heTongJE = managerAssessmentScoreCommDao.sumAppApplyQuota(customerIds);
		//账单统计信息
		List<HashMap<String, Object>> billList = managerAssessmentScoreCommDao.sumAccountBill(customerIds, year, month);
		HashMap<String, Object> acBilMap = billList.get(0);
		// 贷款余额  透支余额
		BigDecimal touZhiYEBig = (BigDecimal) acBilMap.get("OVERDRAFT_ACCOUNT");
		Double touZhiYE = touZhiYEBig.doubleValue();
		//实收利息
		BigDecimal shiShouLSBig = (BigDecimal) acBilMap.get("PAID_INTEREST_ACCOUNT");
		Double shiShouLS = shiShouLSBig.doubleValue();
		//实收利息
		BigDecimal yingShouLSBig = (BigDecimal) acBilMap.get("CURRENT_MONTH_INTEREST_ACCOUNT");
		Double yingShouLS = yingShouLSBig.doubleValue();
		//逾期金额
		BigDecimal yuQiJEBig = (BigDecimal) acBilMap.get("OVERDUE_AMOUNT");
		Double yuQiJE = yuQiJEBig.doubleValue();
		//还款金额
		BigDecimal huanKuanJEBig = (BigDecimal) acBilMap.get("PAYBACK_ACCOUNT");
		Double huanKuanJE = huanKuanJEBig.doubleValue();
		//逾期后还款总额
		Double yuQiHouHuanZE = managerAssessmentScoreCommDao.sumOverduePaybackAll(customerIds);
		//存款
		BigDecimal cunKuangBig = (BigDecimal) acBilMap.get("PAYBACK_ACCOUNT");
		Double cunKuang = cunKuangBig.doubleValue();

		//贷款使用率
		double dksyl = 0;
		if(heTongJE != 0){
			dksyl = (touZhiYE/heTongJE) * 100;
			BigDecimal bg = new BigDecimal(dksyl);
			dksyl = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
		}
		//利息收回率
		double lshsl = 0;
		if(yingShouLS != 0){
			lshsl = (shiShouLS/yingShouLS) * 100;
			BigDecimal bg = new BigDecimal(lshsl);
			lshsl = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
		}
		//逾期率
		double yql = 0;
		if(touZhiYE != 0){
			yql = (yuQiJE/touZhiYE) * 100;
			BigDecimal bg = new BigDecimal(yql);
			yql = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
		}
		//逾期回收率
		double yqhsl = 0;
		if(touZhiYE != 0){
			yqhsl = (huanKuanJE/touZhiYE) * 100;
			BigDecimal bg = new BigDecimal(yqhsl);
			yqhsl = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
		}
		//瑕疵贷款率
		double xcdkl = 0;
		if(touZhiYE != 0){
			xcdkl = (yuQiHouHuanZE/touZhiYE) * 100;
			BigDecimal bg = new BigDecimal(xcdkl);
			xcdkl = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
		}
		//逾期余额
		double yqye = touZhiYE/10000;
		BigDecimal bg = new BigDecimal(yqye);
		yqye = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();

		List<ManagerAssessmentScore> assessmentScores =
				managerAssessmentScoreCommDao.findManagerAssessmentScoreByYearAndMonth(accountManager.getUserId(), accountManager.getLevelInformation(), 1);

		//TODO 存款 电子银行产品

		ManagerAssessmentScore managerAssessmentScore = new ManagerAssessmentScore();
		managerAssessmentScore.setCreditUtilizationRate(dksyl);
		managerAssessmentScore.setNumbererestRecoveryRate(lshsl);
		managerAssessmentScore.setOverdueRate(yql);
		managerAssessmentScore.setLateRecoveryRate(yqhsl);
		managerAssessmentScore.setOverdueBalanceRate(yqye);
		managerAssessmentScore.setDefectiveLoansRate(xcdkl);
		managerAssessmentScore.setAssessed(accountManager.getUserId());
		managerAssessmentScore.setAssessedConfirmDate(new Date());
		managerAssessmentScore.setCreatedBy(Constant.SCHEDULES_SYSTEM_USER);
		managerAssessmentScore.setCreatedTime(new Date());
		managerAssessmentScore.setModifiedBy(Constant.SCHEDULES_SYSTEM_USER);
		managerAssessmentScore.setModifiedTime(new Date());
		managerAssessmentScore.setDataYear(year);
		managerAssessmentScore.setDataMonth(month);
		managerAssessmentScore.setCustomerManagerLevel(accountManager.getLevelInformation());
		//存款余额每增加10万元加1分,总分10分
		if(assessmentScores.size() > 0 && assessmentScores.get(0).getLastDeposit() != null){
			BigDecimal depositScore = new BigDecimal((cunKuang - assessmentScores.get(0).getLastDeposit()) / (10 * 10000 * 100)); //已分单位
			int depositScoreInt = depositScore.intValue();
			if(depositScoreInt > 10){
				depositScoreInt = 10;
			}
			managerAssessmentScore.setDeposit((double) depositScoreInt);
		} else {
			managerAssessmentScore.setDeposit(0.0);
		}

		managerAssessmentScore.setLastDeposit(cunKuang);

		commonDao.insertObject(managerAssessmentScore);
	}

	/**
	 * 每月初定时生成当月评估表
	 */
	public void addAssessment(){
		Calendar calendar = Calendar.getInstance();
		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH) +1;
		//获取所有客户经理
		UserFilter filter = new UserFilter();
		filter.setUserType(1);
		String sql = "select * from sys_user where id in (select user_id from account_manager_parameter)";
		List<User> users = commonDao.queryBySql(User.class, sql, null);
		for(int i=0;i<users.size();i++){
			TyManagerAssessment assessment = new TyManagerAssessment();
			assessment.setId(IDGenerator.generateID());
			assessment.setYear(year+"");
			assessment.setMonth(month+"");
			assessment.setCustomerId(users.get(i).getId());
			assessment.setCustomerName(users.get(i).getDisplayName());
			commonDao.insertObject(assessment);
		}
	}

	/**
	 * 太原
	 * 客户经理晋降级
	 * 每年 3,6,9,12月生成客户经理升降级记录
	 * 插入客户经理级别调整信息
	 * @param 升降级规则(考核指标)
	 * @param 客户经理实际指数
	 */
	public void generateManagerAdjustment(){
		try{
			Calendar calendar = Calendar.getInstance();
			calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1, 0, 0, 0);
			calendar.add(Calendar.MONTH, -1);
			int year = calendar.get(Calendar.YEAR);
			int month = calendar.get(Calendar.MONTH) + 1;

			//查询升降级规则
			List<ManagerPromotionDownRule> managerPromotionRulelist = managerPromotionRuleComdao.getManagerPromotionDownRule();
			Map<String, ManagerPromotionDownRule> GradeRulesMap = new HashMap<String, ManagerPromotionDownRule>();
			for(ManagerPromotionDownRule Rule : managerPromotionRulelist){
				GradeRulesMap.put(Rule.getInitialLevel(), Rule);
			}

			AccountManagerParameterFilter filter = new AccountManagerParameterFilter();
			// 设置每次最大查询记录数
			filter.setLimit(50);
			// 查询页码
			filter.setPage(0);
			// 查询客户经理
			QueryResult<AccountManagerParameterForm> qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
			while(qs.getItems().size() != 0){
				for(AccountManagerParameterForm accountManager : qs.getItems()){
					//TODO
					//统计客户经理实际指标情况,以下数据仅供测试时使用

					//季度日均用信余额
					String	quarterAverageCreditBalance ="1500";
					//统计该客户经理下的客户数目
					List<CustomerInfor> customerList=customerInforService.findCustomerByManagerId(accountManager.getUserId());
					//Integer	tubeNumber = customerList.size();
					//管户数(户)
					Integer	tubeNumber =180;
					//逾期贷款率
					String	overLoanRatio = "0.1";
					//月均KPI得分
					String	kpiScore = "90";

					ManagerPromotionDownRule  GradeRule = GradeRulesMap.get(accountManager.getLevelInformation());
					if(GradeRule == null){
						continue;
					}
					// a.见习个人微贷经理  季度日均用信余额:100	 管户数:10	  	逾期贷款率:0   月均KPI得分:80
					if(ManagerLevelConstant.MANAGER_LEVEL_1.equals(accountManager.getLevelInformation())){
						if(Double.parseDouble(quarterAverageCreditBalance)>=Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getQuarterAverageCreditBalance())
								&& tubeNumber >= GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getTubeNumber()
								&& Double.parseDouble(overLoanRatio) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getOverLoanRatio())
								&& Double.parseDouble(kpiScore) >= Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getKpiScore())){
							//生成升级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_2,ManagerAdjustAdviceEnum.up.name(),year, month);
						}
					}
					// b.初级个人微贷经理 季度日均用信余额:500	 管户数:70	            逾期贷款率:1  月均KPI得分:80
					if(ManagerLevelConstant.MANAGER_LEVEL_2.equals(accountManager.getLevelInformation())){
						if(Double.parseDouble(quarterAverageCreditBalance)>=Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getQuarterAverageCreditBalance())
								&& tubeNumber >= GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getTubeNumber()
								&& Double.parseDouble(overLoanRatio) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getOverLoanRatio())
								&& Double.parseDouble(kpiScore) >= Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getKpiScore())){
							//生成升级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_3,ManagerAdjustAdviceEnum.up.name(),year, month);
						}

						if(Double.parseDouble(quarterAverageCreditBalance)<Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getQuarterAverageCreditBalance())
								|| tubeNumber <GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getTubeNumber()
								|| Double.parseDouble(overLoanRatio) >= Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getOverLoanRatio())
								|| Double.parseDouble(kpiScore) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_2).getKpiScore())){
							//生成降级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_1,ManagerAdjustAdviceEnum.down.name(),year, month);
						}
					}
					// c.中级个人微贷经理 季度日均用信余额:800	 管户数:110	 逾期贷款率:1   月均KPI得分:85
					if(ManagerLevelConstant.MANAGER_LEVEL_3.equals(accountManager.getLevelInformation())){
						if(Double.parseDouble(quarterAverageCreditBalance)>=Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getQuarterAverageCreditBalance())
								&& tubeNumber >= GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getTubeNumber()
								&& Double.parseDouble(overLoanRatio) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getOverLoanRatio())
								&& Double.parseDouble(kpiScore) >= Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getKpiScore())){
							//生成升级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_4,ManagerAdjustAdviceEnum.up.name(),year, month);
						}

						if(Double.parseDouble(quarterAverageCreditBalance) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getQuarterAverageCreditBalance())
								|| tubeNumber <  GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getTubeNumber()
								|| Double.parseDouble(overLoanRatio) >= Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getOverLoanRatio())
								|| Double.parseDouble(kpiScore) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_3).getKpiScore())){
							//生成降级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_2,ManagerAdjustAdviceEnum.down.name(),year, month);
						}

					}
					// d.高级个人微贷经理 季度日均用信余额:1100	 管户数:140	 逾期贷款率:1   月均KPI得分:90
					if(ManagerLevelConstant.MANAGER_LEVEL_4.equals(accountManager.getLevelInformation())){
						if(Double.parseDouble(quarterAverageCreditBalance)>=Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getQuarterAverageCreditBalance())
								&& tubeNumber >=  GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getTubeNumber()
								&& Double.parseDouble(overLoanRatio) <Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getOverLoanRatio())
								&& Double.parseDouble(kpiScore) >= Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getKpiScore())){
							//生成升级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_5,ManagerAdjustAdviceEnum.up.name(), year, month);
						}

						if(Double.parseDouble(quarterAverageCreditBalance) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getQuarterAverageCreditBalance())
								|| tubeNumber < GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getTubeNumber()
								|| Double.parseDouble(overLoanRatio) >= Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getOverLoanRatio())
								|| Double.parseDouble(kpiScore) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_4).getKpiScore())){
							//生成降级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_3, ManagerAdjustAdviceEnum.down.name(),year, month);
						}
					}
					// e.资深个人微贷经理 季度日均用信余额:1500	 管户数:170	 逾期贷款率:1   月均KPI得分:90
					if(ManagerLevelConstant.MANAGER_LEVEL_5.equals(accountManager.getLevelInformation())){
						if(Double.parseDouble(quarterAverageCreditBalance) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getQuarterAverageCreditBalance())
								|| tubeNumber < GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getTubeNumber()
								|| Double.parseDouble(overLoanRatio) >=  Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getOverLoanRatio())
								|| Double.parseDouble(kpiScore) < Double.parseDouble(GradeRulesMap.get(ManagerLevelConstant.MANAGER_LEVEL_5).getKpiScore())){
							//生成降级信息
							this.addInsertLevelAdjustment(accountManager,ManagerLevelConstant.MANAGER_LEVEL_4, ManagerAdjustAdviceEnum.down.name(),year, month);
						}
					}
				}
				// 设置查询的页码
				filter.setPage(filter.getPage() + 1);
				qs = accountManagerParameterService.findAccountManagerParametersByFilter(filter);
			}
		}catch(Exception e){
			logger.error("客户经理升降级定时生成错误");
			logger.error(e.getMessage(), e);
			throw new RuntimeException(e.getMessage());
		}
	}

	/**
	 *
	 * ty
	 * 生成降级信息
	 * @param accountManager
	 * @param afterLevel
	 */
	private void addInsertLevelAdjustment(AccountManagerParameterForm accountManager, String afterLevel,String systemadvice,int year, int month) {

		int count = managerAssessmentScoreCommDao.findManagerLevelAdjustment(accountManager.getUserId(), year, month);
		if(count == 0){
			ManagerLevelAdjustment managerLevelAdjustment = new ManagerLevelAdjustment();
			managerLevelAdjustment.setIfHandled(ManagerLevelAdjustmentConstant.IFHANDLE_0);
			managerLevelAdjustment.setSystemAdvice(systemadvice);
			managerLevelAdjustment.setOriginalLevel(accountManager.getLevelInformation());
			managerLevelAdjustment.setAdjustAfterLevel(afterLevel);
			managerLevelAdjustment.setCustomerManagerId(accountManager.getUserId());
			managerLevelAdjustment.setCreatedBy(Constant.SCHEDULES_SYSTEM_USER);
			managerLevelAdjustment.setCreatedTime(new Date());
			managerLevelAdjustment.setModifiedBy(Constant.SCHEDULES_SYSTEM_USER);
			managerLevelAdjustment.setModifiedTime(new Date());
			managerLevelAdjustment.setDataYear(year);
			managerLevelAdjustment.setDataMonth(month);
			commonDao.insertObject(managerLevelAdjustment);
		}
	}

}

redpajama_set_name: RedPajamaGithub


Sweeten your morning coffee with a cinnamon sugar spoon; ready to drop into your coffee and enjoy!
Included in the pack are cinnamon vanilla flavoured sugar spoons. Simply place the spoon in your coffee mug, wait for it to melt, and then give it a little stir to make sure it's all mixed together. Then sit back, relax and enjoy!


Pole Position Raceway features some of the fastest indoor go kart racing in America! The 60,000 square foot facility is fully climate controlled and features a huge ¼-mile race track, arcade games, meeting space and more. These are not the lawn-mower powered go karts you remember as a kid; these are some of the fastest, most state-of-the-art all electric karts you'll find in the USA.


Eyeing a sales growth of 35%, fashion brand Max is lining up Rs 100 crore to open 50 stores across the country this fiscal.
The Dubai-based Landmark Group promoted company operates 145 stores in the country.
The firm is bullish on the under penetrated kids wear segment which is growing at over 40% year-on-year for the company, he said.
"At present, kids wear is the fastest growing category for us followed by womenswear and men's wear. Kids wear segment has been dominated by unorganised players. As kids wear is price sensitive segment, we entered with reasonable priced, high quality products," Vasanth Kumar, executive director at Max Fashion said.
Kids wear contributes 25% to Max Fashions' turnover while womenswear and menswear 40% and 28%, respectively.
In order to cater to the demand of tier-III and tier-IV cities, Max has opened outlets under the Easybuy brand, Kumar said.


text:
Q: Need help finding the right vocabulary so I can go research more Looking for some vocabulary to help me refine my research so I can tackle this problem.
Here's an overview of the problem statement I'm working on.
At my company we manufacture various products, each product can have a number of different configurations, let's call each unique configuration of a product a PIN (this set up pretty much allows for unlimited customization).
Each product belongs to one of n discrete product classes.
We don't actually know the weights of any particular PIN, however we have years of shipping data and when things get shipped we have a weight associated with the entire shipment.
A shipment can contain several cartons and each carton can contain many different PINs (coming from any one of the n discrete product classes).
I have a nice, clean dataset which contains Shipment ID, Carton number, Product Class, PIN, Number of PINs in Carton, Number of items in Carton, and Total Weight of Carton.
Using this data my job is to estimate the weight of any given PIN.
I don't have a robust enough vocabulary to start my search, and I am hoping someone can help me with either some keywords, or relevant articles that I can look into that might help me make progress against this.
Warning: everything below is literally me thinking out loud
So each PIN is a '/' delimited string (all of them have 11 total '/') which denote the various combinations/configurations a product can take on.
So the easiest version of the problem looks like this - one shipment, with one carton, containing one PIN.
Then its pretty easy to get the weight of one PIN directly.
What I am currently thinking of doing is very similar to that easiest case, identify all shipments with one carton and one PIN.
Aggregate up to the product class level, calculate the mean weight, use that as a starting point.
It's looking like its going to be a situation where I may need to develop 13 separate models for the 13 different product classes
Cheers

A: Consolidating the comments into an answer, this is a linear system. Each shipment has some number cartons which contain some number of PINs. We don't seem to be interested in the cartons themselves, so we can ignore that detail and represent the source data as an $n \times p$ matrix $A$ where there are $p$ products (PINs) and $n$ shipments. Likewise, there are $n$ measurements of the total weight, which we collect in a vector $b$. We know this system is linear because measuring total weight is linear in the number of items: the total weight of 2 items weighing 3 lbs is 6 lbs, etc.
So we need to solve the linear system $Ax=b$ for $x$, where $x$ is a vector collecting the weight of each PIN. This system can only be solved uniquely if $A$ is full-rank (and is not inconsistent). If it's not full rank, you'll add more information to the problem to make it solvable, either by collecting more data (e.g. by getting the weights of the PINs without pivots in $A$ and then appending this data), or using additional knowledge about the problem to sufficiently constrain the solution.
So far, all of this assumes that the weight of a shipment only includes the weight of the PINs, and not extraneous things like packaging, shipment boxes, etc. If this material is included in the total weight $b$, you'll have to account for that in some way, perhaps by adding additional columns for each element of packaging that's included in the weights in $b$.

redpajama_set_name: RedPajamaStackExchange


text:
Lister, John Hardman (c. 1828–1890)
Last week we recorded the death of Mr. John Lister, one of the party who claimed credit for the discovery of gold at Ophir with Mr. Hargraves. Mr. Lister's death took place on Friday, and on the following day his second eldest son died. This morning a telegram was received in town that his sister, the wife, of Mr. William Tom, of Byng, had died. All three fell victims to pleurisy. A strange coincidence occurred in the case of Mr. Lister. Very recently efforts have been made to secure from Government some recognition of his and Mr. W. Tom's claim to reward as first discoverers of gold in New South Wales. A commission was appointed to make enquiries and to take evidence, &c, and on the very day the commission was to commence its work, Mr. Lister died.
Bathurst Free Press (NSW) , 24 September 1890 , p 2 (view original)
death notice, Newcastle Morning Herald (NSW), 19 September 1890, p 5
Tom, Susannah Sarah (sister)
Tom, William (brother-in-law)
Hargraves, Edward Hammond (acquaintance)
'Lister, John Hardman (c. 1828–1890)', Obituaries Australia, National Centre of Biography, Australian National University, https://oa.anu.edu.au/obituary/lister-john-hardman-32032/text39585, accessed 17 January 2022.
Herefordshire, England
Blayney, New South Wales, Australia
gold discoverer

redpajama_set_name: RedPajamaCommonCrawl


Intel's Optane products so far fall into one of two categories. At the high end is the flagship P4800X enterprise SSD and its derivatives for the enthusiast market. At the low end are the small M.2 modules intended primarily for caching use. It's this latter category that is being upgraded from PCIe 3×2 to a PCIe 3×4 host interface, moving the cache drives and small Optane SSDs more toward the mainstream NVMe SSD market.
Based on leaked roadmaps, we know that the original Optane Memory and its refresh Optane Memory M10 are being replaced by the new Optane Memory M15, codenamed Carson Beach. The Optane SSD 800P is being replaced by the new Optane SSD 815P, codenamed Bombay Beach. Capacity options are changing slightly for the M15 cache modules, which offer 16GB to 128GB in M.2 2280 form factor and 16GB to 64GB in M.2 2242 size. The Optane SSD 815P will be available in the same 58GB and 118GB capacities as the 800P.
It appears that Intel is continuing with the rather confusing mismatch of advertised capacities between the Optane Memory and Optane SSD products. In reality, the Optane Memory 64GB and Optane SSD 58GB products have the exact same usable capacity, and the same will hold true for the 128GB vs 118GB. The smaller advertised capacities are more in line with how SSD vendors traditionally relate claimed GB to actual usable capacity, while the Optane Memory parts are advertising the nominal raw capacity of their 3D XPoint memory without reflecting space used for error correction or spare area for defect and wear management.
The system requirements for the above Optane products are unchanged from their predecessors. Optane Memory caching requires a Kaby Lake or newer platform and the use of Intel's Optane Memory storage drivers for Windows. Otherwise, both the M15 and 815P are standard NVMe SSDs that can be used as regular data or boot drives in any system that supports flash-based NVMe SSDs.
The third new Optane product is by far the most interesting: the Optane Memory H10 with Solid State Storage, codenamed Teton Glacier. Where previous Optane Memory products have been intended to serve as a cache in front of a mechanical hard drive, the H10 is Optane caching for QLC NAND, with both 3D XPoint and flash memory on the same M.2 module. The H10 bundles 16GB of Optane cache with 256GB of QLC NAND, or 32GB cache with 512GB or 1TB of QLC.
So far, Intel has only shared a mock-up rendering that looks like an Intel 660p and Optane Memory module squeezed onto one M.2 2280 card, but with enough changes to the layout that it doesn't appear to be just a photoshop of images of the two existing products. The first half of the board appears to contain the same Silicon Motion SM2263 controller used on the 660p, and one package each of DRAM and QLC NAND. The second half of the board looks like an existing Optane Memory module, with its own controller and 3D XPoint memory packages. We're not sure if this photo is an accurate representation of the real product, but it indicates that two PCIe lanes are routed to the SM2263 controller and two to the Optane controller. This suggests the Optane Memory H10 will appear to the host system as two different NVMe SSDs, and will likely require PCIe port bifurcation support to operate a PCIe x4 M.2 slot as two PCIe x2 links. This could potentially limit compatibility to M.2 slots that use PCIe lanes provided by the PCH. Officially, the Optane Memory H10 will require a Whiskey Lake or Coffee Lake platform. Unofficially, this may be the first Optane product that doesn't work out of the box as a plain NVMe SSD on any platform that supports NVMe. The dual-controller nature of the H10 means that the SSD caching functionality still depends on driver software, and is not managed transparently by the SSD itself. Intel will have to develop a unified 3D XPoint+3D NAND controller to pull that off.
Intel has not formally announced any of these three new Optane products, but we expect to get more official information from them soon and will update this article with any new details. The Optane Memory H10 is planned for release in spring 2019 and we expect the M15 and 815P to arrive at the same time or sooner.


The Offshore Gaming Association conducted interesting interviews with online gambling experts and businessmen this week in an article on legalisation written by Hartley Henderson.
In rsearching his article, Henderson spoke to Caesars Interactive Entertainment chief executive Mitch Garber, a widely experienced business leader who is due to debate the desirability of a federal online gambling ban soon with Las Vegas Sands executive Andrew Abboud (see previous InfoPowa reports).
Henderson asked Garber whether it is not too late to introduce federal law legalising interstate online poker, and Garber's thoughtful response was that whilst it's not yet too late for a federal solution, US online gambling regulation has thus far evolved in a state-by-state environment similar to that which controls the land gambling side of the industry.
Garber noted that the online gambling industry has embraced this solution in Nevada, Delaware and New Jersey, where operators are succeeding at growing a meaningful business and "…see momentum toward a rollout of future state by state legalization, and compacting between states which will address the issue of scalability.
"So, we are very happy with the rollout of the first states and we are actively working to get the same result in a number of additional states. That is our focus."
"We believe that Sheldon Adelson has taken a polarizing and hypocritical position on legalized online gaming. His arguments against legalization have no basis in fact, and we believe that we will successfully counter those arguments in whatever forum is appropriate, and ensure that we continue along the path of legalized, taxed, and fully regulated online gaming in the United States, and greater enforcement against illegal sites."
Garber elaborated, saying that Adelson's arguments are centred around the availability of online gaming 24 hours a day at home.
"This argument ignores a number of important facts, including the sophistication of the prevailing technology; the generally low stakes nature of online gaming; and most importantly, the fact that we are living in a new paradigm, where you can shop or trade stocks from your sofa 24 hours a day on the internet.
"Online gaming, properly licensed, with the appropriate focus on responsible gaming, is simply another good and service available online."
Henderson additionally interviewed legal expert Larry Walters on the problems associated with re-writing the Wire Act to impose a ban on internet gambling, and Walters' comments were informative.
He said that whilst Congress had wide powers of enactment within the framework of the constitution, and that politicians could in theory impose a ban by amending the 'carve outs' allowed in the Unlawful Internet Gaming Enforcement Act (UIGEA) or expanding the Wire Act to encompass more than sports betting, such a course faced a number of complexities.
The legal expert surmised that a statutory move would have to be very broad in order to include exemptions for state lotteries, possibly Indian tribes, and other interested parties, .
"There are other carve outs in the UIGEA besides intra-state gambling, such as the one for fantasy sports, so that type of gaming may have to be addressed too, in order to enact a broad prohibition," Walters said.
"Then the lawmakers would need to think about what to do with things like skill games, online sweepstakes, and penny auctions – which are not traditional gambling, but which might provide a similar recreational feel.
"The hurdles and political resistance would be substantial from the stakeholders affected by these sweeping changes. Americans have become accepting of the concept of 'gaming,' in a way that we've never seen in this country.
"People 'wager' with virtual, in-game currency on a regular basis, without a second thought," Walters said, adding that an entire generation of children have been raised on games where you can win or lose 'credits' through elements of chance, and openly laugh at adults who think that 'gambling' is a vice activity on par with drugs or prostitution.
"Anything is possible in Congress, but the likelihood of a broad, controversial, online gambling prohibition bill making its way through a divided Congress during an election year is remote."
Walters also considered the issue of states' rights in terms of any federal ban, and particularly in view of the state-by-state legalisation that has been a feature of the US industry in recent times.
He noted that "grandfathering" such states into a new regime was a far more complex process than may appear, with constitutional and comparative issues that have the potential to be complicated and difficult.
"There are constitutional issues created by both grandfathering and not grandfathering, which could get complicated," he said.
"If grandfathered, New Jersey would be placed in the unenviable position of arguing that grandfathering under the Professional and Amateur Sports Protection Act (PASPA) is unconstitutional, while grandfathering under some new statute is just fine. If it was not grandfathered, it would have the mirror image problem."
Walters suggested that possibly the best solution is for the federal courts once and for all to clarify the issue of online gambling at the federal level.
"I have no doubt that when the facts are put on the table and when the courts look at the benefits of a uniform set of laws they'll agree that there is no reason to criminalize an activity that both states and citizens want and that is perfectly legal nationwide at land-based establishments," Walters said.
"The lack of problems with the sites that are currently operating will alleviate many fears and in the end the government will almost certainly amend the Wire Act and UIGEA to specifically include interstate wagering. When that happens Americans will once again enjoy the benefits of full online poker tables and poker rooms and in the end it will benefit all tax paying Americans."


The highly regarded Rowton Hall Hotel & Spa, set in the heart of the spectacular Cheshire countryside, has been sold through specialist business property adviser, Christie & Co. Situated in the desirable and affluent area of Chester, the sale of the hotel was conducted entirely off-market through a bespoke and confidential marketing campaign.
The property comprises 40 en-suite letting bedrooms, function and conference facilities which accommodate a large number of weddings year-on-year, a luxury spa, and award-winning restaurant. The site also features well-kept landscaped gardens and substantial customer car parking for up to 200 vehicles.
A stone's throw from the Roman city of Chester, the elegant Georgian manor house is situated in the secluded and tranquil setting of Rowton which serves as an ideal base for exploring the attractions of Chester and the surrounding areas, being close by to Chester Racecourse and Chester Zoo, and within easy reach of Manchester, Liverpool and North Wales.
The 4-star AA hotel had been operated by the previous owners, the Wigginton family, for a number of years before they took the decision to sell to pursue retirement.
New owners, Anderbury Limited, who also own the St George Hotel in Llandudno and Hatherley Manor Hotel & Spa in Gloucestershire, plan to grow their existing portfolio with the acquisition of this new hotel which fitted with their style and location requirements. There is an opportunity for the new owners to add further bedrooms, subject to planning permission, and drive what is already an established business forward.
Rowton Hall Hotel & Spa sold off an asking price of £6.25m.


text:
The Whole Story
Steve Parker (Editor), Alice Roberts (Foreword by)
Evolution: The Whole Story provides an in-depth and up-to-the- minute account of evolution, one of the ultimate keystone theories in modern science. Ten esteemed experts thoroughly survey how each of Earth's major groups of living things diversified and evolved through time and using visual features that make the story comprehensible, the book gives readers, even those with no previous knowledge of the topic, a clear understanding of evolution and how it brought us to the present day.
Each of seven chapters takes one of Earth's major living groups and describes the evolution of its subgroups and how they diversified and evolved. The stories are fascinating. In some cases, a subgroup fell off the evolutionary chain, like the dinosaurs that were part of the Early Reptiles group, and which became extinct by the second extinction event. In other cases, a living subgroup may contain a life form virtually the same as its evolutionary ancestors, such as the horseshoe crab from the Invertebrates group, which is a "living fossil" closely related to prehistoric sea scorpions.
Along with profiles of the most important scientists that have influenced evolutionary theory, the book reveals how these advances have added to and often changed the story. For example, the now-extinct Pederpes, formerly thought to be a fish, was restudied and reclassified in 2002 and is now known to be the first four-limbed vertebrate to evolve to a life on land.
Evolution: The Whole Story makes the story of evolution comprehensible, straightforward and stimulating. The introduction provides an important overview. It includes:
Modern evolutionary theory
Terms such as convergent evolution and speciation; time charts and their eras, periods and epochs
Explanations of graphic devices such as phylogenies and cladograms that depict evolutionary relationships
How we know or surmise about long-gone animals, plants, habitats, and ecosystems
Factors and pressures that drove evolution
How fossils formed and are studied.
Having laid the base for readers, the story begins. Important features include:
Thematic essays that provide a complete account of all the major life groups, explaining in detail their comparative anatomy and evolutionary legacies.
Photographic features that investigate the characteristics of individual organisms, including living species, fossils and skeletons, and how they are direct ancestors or relatives to members of modern life groups.
160 Key Focus features that investigate topics of particular interest.
Stimulating lifelike reconstructions of past habitats and ecosystems.
Historical timelines highlighting key evolutionary events and discoveries.
In-depth coverage of 20 eminent scientists that have made major contributions to our understanding of evolution.
Coverage of Mass Extinctions in their chronological position on the evolutionary timescale.
The 160 Key Focus features investigate topics that add color while they reveal important developments in evolution and its study. Examples are:
Hallucigenia, a wormlike creature so odd that a scientist thought he was hallucinating.
Flowers, insects and co-evolution -- how organisms can progress "hand-in-hand"
Peripatus, today's walking worm with stumpy legs, which may show how arthropods evolved
Eurypterus, at almost 5 feet long it was a real monster for its time.
Arthropleura, a giant millipede-like arthropod the size of a sports car.
Othniel Charles Marsh, Edward Drinker Cope and the Bone Wars, as rivals competed to find the biggest, best dinosaur fossils.
Hobbits, an amazing discovery in 2003 of 3-feet-tall fossil humans -- are they a distinct species?
Reversing evolution and de-extinction -- will we be able to "de-extinct" long-gone species?
Gigantopithecus, a 10-feet-tall close cousin of humans living in Asia up to 100,000 years ago.
Today's sea eagle -- what modern eagles tell us about the evolution of their group.
Are new species evolving?
Evolutionary theorists, paleontologists, paleoecologists, molecular biologists, geneticists, climatologists, the occasional amateur fossil-hunter, and many more people, have contributed to our understanding of evolution. Their passion and work will continue to unravel the complex and challenging story, but in the meantime, Evolution: The Whole Story reveals the compelling evidence we have today.
This book is ideal for all general readers and anyone working in or interested in fields related to the study of evolution. It is an essential selection.
Firefly Books, 9781770854819, 576pp.
Publication Date: August 7, 2015
Steve Parker gained a BSc Honors First Class in Zoology and is a Senior Scientific Fellow of the Zoological Society of London. His passion for animals, plants, and life sciences such as ecology and ethology is reflected in the more than 300 books that he has written, contributed to, or acted as consultant for. They include The Encyclopedia of Sharks and as co-author Planet Ape, both published by Firefly Books. Alice Roberts is a clinical anatomist and Professor of Public Engagement in Science at the University of Birmingham. She has presented several BBC science series including The Incredible Human Journey, Origins of Us, Prehistoric Autopsy and Ice Age Giants. She writes a regular science column for The Observer, and has authored five popular science books.


The Angels announced on Wednesday that catcher Rene Rivera was awarded to the Atlanta Braves on a waiver claim. The announcement was made by general manager Billy Eppler.
Rivera, 35, signed with the Angels as a free agent last January 9. In 30 games with the Halos, he recorded a .244 batting average (20/82) with four doubles, four home runs and 11 RBI. Rivera was recently activated from the disabled list Aug. 15 after missing 76 games with right knee inflammation. He appeared in six rehab games with Single-A Inland Empire before his return.
A native of Bayamon, Puerto Rico, Rivera has played in all or parts of 10 Major League seasons since making his debut with Seattle in September, 2004. In 503 career games, he owns a lifetime .221 average (309/1398) with 62 doubles, two triples, 40 home runs and 164 RBI. A solid defensive catcher, Rivera has thrown out 37 percent of would-be base stealers (126 of 217) during his career, including 43.8% this season (7 of 16).
Drafted by Seattle in the second round of the 2001 MLB Amateur June Draft, Rivera has played for the Mariners, Minnesota, San Diego, Tampa Bay, New York Mets, Chicago Cubs and Angels.


text:
You are here: Home / Music / Classical Music / Classical Music Album Review: Isabelle Faust and Alexander Melnikov play Brahms
Classical Music Album Review: Isabelle Faust and Alexander Melnikov play Brahms
Just about anything Isabelle Faust touches these days is gold – she's one of the finest violinists out there.
By Jonathan Blumhofer
Harmonia mundi's (HM) hardest-working duo is back at it. Violinist Isabelle Faust and pianist Alexander Melnikov, who (with cellist Jean-Guihen Queyras) have been churning out a Schumann cycle for the label, have a new release that's thematically related and, like most of their chamber music collaborations, first rate. This new disc pairs the last two of Brahms' violin sonatas, Schumann's Three Romances, and the "F.A.E." Sonata, a score jointly composed in 1853 by Brahms, Schumann, and Albert Dietrich for violinist Joseph Joachim.
The recording starts, chronologically, at the end and works backwards, opening with Brahms' 1888 Sonata no. 3. It's a late piece and not a little pessimistic to begin with. In Faust's hands it's striking for its grimness and intensity. Her playing in sotto voce passages, especially in the first two movements, demonstrates not just fantastic technical (particularly bow arm) control, but also imbues the music with a haunting character that, in this score, feels appropriate and proves emotionally satisfying. There's warmth, too, in the second movement and bittersweetness in the third. In the finale, she and Melnikov do a fine job emphasizing the extremes of the music's dynamics and articulations. The end of the Sonata is shattering but also beautiful, a bit like watching a sunset over a wasteland.
How we (or Brahms) got to this point seems to be the theme of the rest of the album. The earliest piece here certainly doesn't suggest much by way of emotional turbulence. Schumann's Three Romances date from 1849 and were originally written for oboe and piano. Sure, they're filled with plenty of wistful moments but that's about it, and, in this arrangement for violin and piano, the music fits the Faust-Melnikov duo swimmingly. Their reading of the first movement is a lovely essay in free-flowing melodic playing while the second offers well-balanced contrasts between the dulcet sweetness of the opening theme and the more tempestuous, lively middle section. The finale combines elements of the earlier movements in a warm conclusion.
The second-earliest piece here, the "F.A.E." Sonata, offers a bit more by way of dramatic variety. Its titled comes from the motto Brahms and his circle of friends had adopted at the time: "frei, aber einsam" ("free, but lonely") was their quintessentially Romantic creed and, here, the letters provide some of the signal melodic content for the piece.
As an exercise, it's an interesting, if not wholly successful foray into tag-team composing. Schumann wrote the even-numbered movements, Brahms provided the third, while Dietrich penned the first movement. Elements of Schumann's Violin Concerto (which he was writing around this time) find their way into his contributions, notably the finale, which is a bit on the stodgy side with lots of writing for violin in its middle- and low registers. The second movement, though, is pretty graceful. Brahms' scherzo features the most distinctive music in the piece, intense and wild. Dietrich's installment leaves a bit to be desired: there's lots going on, material-wise, and, while he was a competent composer, there's nothing particularly inspired about the way he handles or develops any of it.
Still, Faust and Melnikov turn in a strong reading of the opening movement that's fairly spacious and, at times, downright epic. Melnikov, especially, plays here with some fierce, rhythmic exactitude. The rest of the performance is lively and engaged, if choppy: good as Faust and Melnikov are, they can't compensate for the score's unevenness.
The key to Brahms' Sonata no. 3, then, appears to be (perhaps unsurprisingly) the Sonata no. 2. In its three movements, it combines the flowing lyricism of the Romances with the jaunty alternations of contrasting materials (and styles) of "F.A.E." And it points the way forward to something weird and unsettling in its finale.
At least that's how it comes over in this performance. The first movement sings sweetly but is also marked by some really heroic keyboard climaxes and impressive clarity between the instruments' various rhythmic textures. Faust and Melnikov mine the second movement's impish good spirits and they capture the restrained character of the finale impressively. There's lots of soft, inward playing in the latter that really forces you to listen quietly. And, in so doing, the movement's structure is illuminated in a revealing, rather disturbing way.
What does it all mean? Well, that's up to the individual listener to determine, but all the keys you need to solve the riddle are provided. Just about anything Faust touches these days is gold – she's one of the finest violinists out there – and she and Melnikov have come up with a disc that not only demonstrates their formidable musical chops but also conveys real musical insights and programming intelligence.
Jonathan Blumhofer is a composer and violist who has been active in the greater Boston area since 2004. His music has received numerous awards and been performed by various ensembles, including the American Composers Orchestra, Kiev Philharmonic, Camerata Chicago, Xanthos Ensemble, and Juventas New Music Group. Since receiving his doctorate from Boston University in 2010, Jon has taught at Clark University, Worcester Polytechnic Institute, and online for the University of Phoenix, in addition to writing music criticism for the Worcester Telegram & Gazette.
By: Jonathan Blumhofer Filed Under: Classical Music, Featured, Music, Review Tagged: Alexander Melnikov, Harmonia Mundi, Isabelle Faust


No-one would tell a newcomer that all technical issues that will arise in the process, and their set there indefinitely, he will have to decide for himself. That through the jungle of terms specific settings, unknown concepts have to wade alone, filling cones, all learning the method of 'spear' trial and error. This, of course, will give invaluable and powerful experience, but the time spent on the science, does not return one! And this, as you know, money! Rarely, when faced with such projects, where you can really help and advice and deed. On the forums of course you can find some help, but when the crucial question for the novice meets some nerd with Internet access – the experience of several years between them there to put it mildly, a misunderstanding.
Simple man slang Internet can inspire horror! How do I transfer all these netiket, flame, moderation, lamer, content, faq, smtp, pop, MySQL, php, Cookie, Proxy, Plug, teasers, banners, targeting, ctr (And this is only the beginning!) In all this, of course you can understand the benefit of Yandex can help phrasebook. But where's the simplicity, speed and ease? But if someone – I decided to learn to make websites and to earn them, then have to learn not for a month or even year. Because launch site – it's just the first step, now it can make and child.
The present economic field is not without frequent enough to participate in various aspects of qualified jurist. Still, many small companies do not separate counsel for teeth, often to the same for him do not be a sufficient number of cases. Specific issues that arise regarding the lawyer at the level of registering the organization, the organization changes, changing some of the important characteristics may be quite practical style, and appear at times. In order to resolve these issues, there are a large number of methods: this is a free legal consultation, and challenge the expert, who for certain period of time will deal with this issue. However, naturally, in a situation of inviting experts it will provoke a decent spending money, which not all firms can afford to provide. It is obvious that expert in any subject – especially in so sought after as a law, would be costly. And yet, as often found medium-sized organizations with questions that can be solved by personal effort – if understand exactly how the method – it sometimes just enough for a full-fledged expert advice to guide the head in the right direction. Then the following way – the choice of all official documents and their delivery to the appropriate instance – can be held and the forces of the organization.
Hence, you only need to find a place where professionals will be able to advise how to proceed in any given situation. For example, the Legal Forum. Lawyers Forum gathers mostly professionals who have a law degree and have accumulated experience in solving various issues. Activity on the legal forum or free manufactured by phone legal advice the lawyer gives the opportunity to grow professionally. And even experienced lawyers often in the questions asked with a legal forum, find previously unknown details certain issues. For bosses of small businesses in the legal forum to be able to not only source of advice on different issues, but also a resource for the legal collections of documents: for example, is actually found and Code of 2010 and the latest legislation, modify the functionality of the firms, and numerous other. Also in this case raises issues, by the way, having a relationship with the tax law, accidents and other provisions, you any case, unable to leave your question lawyer and get an accurate and complete answer.


text:
Emma Watson Nude Photo Threat Exposed as Viral Marketing Stunt
by Tyler Johnson at September 24, 2014 11:01 am .
Earlier this week, we reported that actress Emma Watson was being threatened with a nude photo leak as a result of a speech she recently gave at the United Nations.
The threats were posted on the photo-sharing site 4Chan, which had previously hosted stolen photos of Jennifer Lawrence, as well as the dozens of other female celebrities who were affected by the Hollywood hacking scandal.
Today, we learned that the whole thing was a carefully coordinated stunt by a company called Rantic Marketing.
The website EmmaYouAreNext.com - which had previously featured a clock counting down the seconds until Watson's hacked photos would be posted online - now simply redirects to Rantic's homepage.
Even more ridiculous than the capaign itself is Rantic's strategy for justifying its actions:
Currently (and hilariously), the company's site features a letter addressed to President Obama that begins, "We have been hired by celebrity publicists to help bring this disgusting issue to attention...Every Facebook like, share, and Twitter mention will count as a social signature."
Wow! Now you can get involved and all you have to do is help promote this incredibly shady marketing firm!
Naturally, Rantic is refusing to identify their "employers," but they've been happy to share statistics about how easily they were able to drum up interest in stolen nudity.
Apparently, EmmaYouAreNext.com received over 48 million visitors in just a matter of days, so you may want to consider hiring Rantic next time you have a young feminist to terrorize.
Rantic has yet to make make an argument as to how anyone but them stood to benefit from this stunt, but we're sure to position themselves as the good guys.
As far as we can tell, all they've accomplished is establishing "It was a hoax! Gotcha!" as a viable excuse for anyone threatening to post hacked photos of a celebrity.
Nude Celebrity Photos: Who's Been Hacked?
Tags: Emma Watson, Celebrity Gossip
Emma Watson Biography
Emma Watson is good buddies with Harry Potter. She portrays Hermione Granger in the wildly popular film series. In 2009, Watson announced... More »
Allison Mack to Emma Watson & Kelly Clarkson: I Will Make You My SEX SLAVES!!!
Robert Pattinson and Emma Watson Might Be Dating, Internet Can't Handle It
24 Child Stars Who Didn't Go Totally Insane
Emma Watson Photos
Emma Watson Videos
Emma Watson Wins First-Ever Gender-Neutral Award, Gives Empowering Speech
Emma Watson Fires Back at Critics
Emma Watson: I Can Be a Feminist and Have Boobs!


text:
USDOS – US Department of State
Country Report on Terrorism 2017 - Chapter 5 - Gama'a Al-Islamiyya
aka al-Gama'at; Egyptian al-Gama'at al-Islamiyya; GI; Islamic Gama'at; IG; Islamic Group
Description: Gama'a al-Islamiyya (IG) was designated as a Foreign Terrorist Organization on October 8, 1997. Formed in the 1970s, IG was once Egypt's largest terrorist group. In 2011, it formed the Building and Development political party that competed in the 2011 parliamentary elections and won 13 seats. The external wing, composed mainly of exiled members in several countries, maintained that its primary goal was to replace the Egyptian government with an Islamist state. IG's "spiritual" leader Omar Abd al-Rahman, or the "blind Sheikh," served a life sentence in a U.S. prison for his involvement in the 1993 World Trade Center bombing and died in prison in February 2017.
Activities: In the 1990s, IG conducted armed attacks against Egyptian security, other government officials, and Coptic Christians. IG claimed responsibility for the June 1995 attempted assassination of Egyptian President Hosni Mubarak in Addis Ababa, Ethiopia. The group also launched attacks on tourists in Egypt, most notably the 1997 Luxor attack. In 1999, part of the group publicly renounced violence. IG is not known to have committed a terrorist attack in recent years; the group remained dormant in 2017.
Strength: At its peak, IG likely commanded several thousand core members and a similar number of supporters. Security clampdowns following the 1997 attack in Luxor and the 1999 cease-fire, along with post-September 11, 2001 security measures and defections to al-Qa'ida, have likely resulted in a substantial decrease in what is left of the group.
Location/Area of Operation: Unknown
Funding and External Aid: Unknown
Brief description of Gama'a Al-Islamiyya (Excerpt of chapter 5 of the country report on terrorism 2017)
https://www.state.gov/j/ct/rls/crt/2017/282850.htm


text:
Sir Theodore Beal Pritchett  (born 1890, died 1969), was Lord Mayor of Birmingham and a Deputy Lieutenant of Warwickshire.

He was educated at Bromsgrove School and served in the Royal Artillery during World War I, being awarded the Military Cross.

He was a Councillor on Birmingham City Council from 1924 to 1939, before being appointed as an Alderman. He was Lord Mayor of Birmingham for 1939–40.

A Deputy Lieutenant for Warwickshire, he was knighted in the 1953 Coronation Honours List and was awarded the Freedom of the City of Birmingham on 7 May 1960.

He was club president of Aston Villa when Doug Ellis was first appointed chairman of the club in 1968

References
Hankinson, C. F. J. (ed.), Debrett's Baronetage, Knightage and Companionage, 1954, Odhams Press, 1964
Deadly Doug by Doug Ellis quoted in the first chapter of his autobiography that he was approached by club president Sir Theodore Pritchettt

1890 births
Royal Artillery officers
Recipients of the Military Cross
Knights Bachelor
Deputy Lieutenants of Warwickshire
People educated at Bromsgrove School
British Army personnel of World War I
Mayors of Birmingham, West Midlands
Year of death unknown

redpajama_set_name: RedPajamaWikipedia


Get into the create new query wizard and then close the Show Table dialog box without specifying a table or query. Change to SQL view and type the Access table creation SQL statement.
The next example creates a new employee table with two Text fields, a Date/Time field, and a multi-field (composite) primary key index using the three fields.
Note the Text(20) field type and length designation - this says create a text field with a maximum of 20 characters. If you don't specify the maximum length then Access will typically set the length to 255 characters.
Below is the syntax for the create table statement from the Microsoft Access 2003 help system.
3. In the ribbon menu select Table Design. The table design view will appear.
5. After all Data Fields have been defined choose a field that will be have unique values for each record in the table. Set this field to be the Primary Key of the table by pressing the yellow key symbol in the menu ribbon. Candidate fields for primary key may be SSN, Phone Number, Employee Number, Employee Name, etc. (note: at times you'll need to identify more than one field to create the primary key. In this case select the fields by holding down the CTRL key and then pressing the primary key symbol in the ribbon menu.
6. Save the table and give it an appropriate name.


Signed by President Woodrow Wilson in August 1916, the Organic Act created the National Park Service, the federal bureau that protects our national parks and monuments. Several UC Berkeley alumni with conservationist interests and the 1915 Panama-Pacific International Exposition in San Francisco played key roles in its development. This exhibition explores the origins of the NPS with materials drawn from the University Archives and The Bancroft Library collections.
Exhibit dates & times excludes holidays and when Doe Library is closed.


text:
George Watson (Accountant)
to get instant updates about 'George Watson (Accountant)' on your MyPage. Meet other similar minded people. Its Free!
George Watson, (23 November 1654, Edinburgh – 3 April 1723) was born in Scotland to parents John Watson (a merchant) and Marion Ewing. He was orphaned at an early age, but thanks to his aunt, Elizabeth Davidson, he was sent in 1672 to be educated in book-keeping at Rotterdam. He returned to Edinburgh to become, in 1676, private secretary to Sir James Dick. Based partly on this experience he became one of Scotland's most famed accountants of his time, and was appointed chief accountant to the Bank of Scotland when it was founded in 1695.
George Watson is buried in Edinburgh's Greyfriars Kirkyard, and although the precise location of his remains is unknown, there is a memorial plaque in a wall in the north-west of the graveyard.
Educational benefactions
Having been an early benefactor of Edinburgh's Merchant Maiden Hospital, Watson subsequently bequeathed in his will a generous sum for the Merchant Company of Edinburgh, with specific sums being set aside for educating pupils at the Merchant Maiden Hospital, the Trades Maiden Hospital and Heriot's Hospital (now George Heriot's School). He stipulated that all his beneficiaries were to bear the name Watson or Davidson. (This was not an unusual style of stipulation at the time; another example being the similar founding principle of Edinburgh's Donaldson's Hospital where bursaries were made available to children bearing the name of Donaldson.)
A further £144,000 Pound Scots was left for the foundation of a new charitable...


Representative Joyce Beatty (OH-3rd) presenting Dominiq Dudley the Rising Entrepreneur award for READY Publication in Columbus, OH.
Because of barriers like student debt and inability to access capital, too few Millennials are able to pursue their dreams of entrepreneurship and create small businesses for the next generation. But for young people who are able to overcome these barriers, entrepreneurship can be a pathway to success, particularly for Americans who have struggled to regain their footing following the Great Recession.
Dominiq Dudley, the 21-year old co-owner of READY Magazine, is an impressive example of entrepreneurial success among today's young people. Having just graduated from Howard University within a week of the Leadership Summit, it's clear Dominiq has the drive and vision to succeed as a small business owner.
Only six issues into the publication of READY Magazine, Dominiq has already guided the team to generating a profit and secured a competitive placement on Amazon Kindle. Plus, she's spearheaded efforts to promote the publication digitally to reach a broad range of Millennials. With her leadership, Dominiq is sure to continue the magazine's success as a diverse platform for women on issues ranging from breast cancer treatment centers to human trafficking.
Celia Canfield, Chair of our Board of Directors, presenting the Technology Innovation award to Praveen Madan on behalf of the team behind Giftlit, based in Menlo Park, CA.
Small businesses are tremendous innovators. Their size allows them to be nimble and pioneer new technologies, and our economy depends on their creativity. Of course, some industries are more known for innovation than others – and few people associate technology advancements with bookstores.
But Praveen Madan of Kepler's Books is changing that reputation with a new invention that has made a huge splash in the book world. Praveen launched Giftlit (giftlit.com), a unique subscription gift service that allows customers to send a book every month to friends and family for 3, 6 or 12 months. While there are pre-selected collections that customers can select, the truly innovative aspect of Giftlit is that it allows the giver or receiver to customize the books.
This successful invention has been included in Buzzfeed's "Gifts They'll Love All Year" two years in a row. Giftlit has seen exponential double-digit growth since its launch, and it has allowed Kepler's to raise wages for frontline hourly workers. Giftlit is a clear example of how small businesses are paving the way for new technologies.
enator Jon Tester (MT) presenting the Community Development award to Courtney McKee of Headframe Spirits in Butte, MT.
Small businesses aren't just the driving force behind our economy; they're also the backbones of our communities. Whether that means brightening up Main Street or giving back to local causes, small businesses contribute to vitality in towns across the country. Headframe Spirits, a producer of spirits in Butte, Mont., is a company that has done both.
Headframe Spirits is committed to growth that encompasses and benefits the community of Butte. For instance, the company is in the process of redeveloping a former mine site into the largest distillery West of the Mississippi. This effort will transform an unused piece of land into an economically productive distillery while promoting the area's history and culture. Additionally, the company has produced spirits that honor Butte's local culture, like the Orphan Girl, a bourbon cream liqueur named after a former mine.
Overall, Headframe Spirits has donated nearly $150,000 to the community and generated more than $7 million in economic impact since 2012. It's no surprise the company has previously received awards including the 2016 Small Business Champions of the Year from the U.S. Small Business Administration, the 2015 Tourism Ambassadors of the Year from Governor Steve Bullock and the 2014 Entrepreneurs of the Year from Governor Bullock.


Fine materials and high steel content make this series a superior choice. Each steel handle is individually contoured on a precision lathe, carefully polished and finished with a protective clear coat. An ash rake is included as a bonus to the four tools included.


Choice solutions are built and customized to satisfy client requirements. Our proprietary systems are based on a "single global platform" concept, whereby all components are integrated throughout our business, which provides a holistic perspective into the transportation and inventory management process, and allows for enhanced and robust actionable business intelligence.
Our TMS is the nerve center of our global solution. This user-friendly, web-based platform allows you to track deliveries, and manage the storage and handling of inventory from anywhere in the world. The TMS seamlessly integrates into legacy systems (ERP, CRM, etc.) via EDI, XML, web services, etc. With world class business continuity, unplanned events won't negatively impact your business.
Choice developed a unique proprietary WMS platform that is easily utilized by its vast global network of warehouse partners to unify the management of inventory supply chain within a single Choice solution, which is fully integrated with our TMS and complementary services.
We offer unparalleled visibility into both "live" orders and "historical" transactions through a web- based interface. This transparency enables clients to better manage orders and understand how they are spending money. With speed and efficiency, clients can look at individual or aggregated orders by geography, service, carrier, and date range.
We employ a proprietary algorithm for each shipment to identify and select an optimal carrier based upon origin, destination, service level requirements and cost. A key feature of our rating engine is its ability to leverage multiple rate cards during the selection.
Service Sync offers GPS tracking and event management. It provides real-time updates for shipments originating from Choice. Drives are tracked from dispatch, providing location updates on a map with dynamic ETAs. Additional features include auditing and automated notifications.
Our GTS solutions include a comprehensive collection of global trade regulations and regulatory knowledge of over 200+ countries and territories, which organizes and maintains updated customs data from around the globe, regardless of location or language.


text:
EULEX donates equipment and furniture to the Women's Shelter in Novo Brdo/ Novobërdë
On 8 August in Pristina, EULEX Acting Head of Mission, Bernd Thran, donated office equipment to the Women's Centre for Support and Development in Novo Brdo/ Novobërdë
Antonius Van Der Velden, the Mission's acting Gender Advisor, who coordinated the initiative, highlighted the importance of the joint initiative and said: "This donation contributes to the common efforts to promote the effective empowerment of women."
Vesna Stajić, Head of the Women's Centre for Support and Development expressed her gratitude for the donation and long-standing EULEX support to the shelter's activities: "Since the beginning of the work of our shelter, EULEX has always been supporting our activities through donations. Today's donation has a special significance, as it will allow us to provide a better service to women in need and advance our work".
The Acting Head of EULEX praised Ms Stajić for the importance of the daily work and activities of the Women's Centre for Support and Development and its role in raising awareness and combatting domestic violence in Kosovo


text:
Q: Simple confetti effect using CAShapeLayer and CoreAnimation on iphone? I am building a fairly simple game on my app. the app UI is based a lot core animation so does the game.
I am trying to achieve a simple confetti effect for the game using CAShapeLayer and core animation (in the style of the confetti in "cut the rope").
any help or direction will be appreciated.

A: Well. for any one who looks.
it is now available for iOS 5 with CAParticleLayer & CAEmitterLayer.


The Daily Slice's Mixtape Monday is making a comeback, starting off with a compilation of ladies and femmes rocking this year's Vans Warped Tour. Stay tuned throughout the next month for coverage of the Hartford, CT date of the tour, happening this Sunday!
Bonus track: "Just Fine" by Montage, a group with an amazing R&B-meets-alternative sound that Warped Tour could surely use more of. They played Warped Tour in Ohio on July 18, but if Kevin Lyman knows what's good for him, he'll bring them back on for more dates next year.
Did we miss any of your favorites on the tour this year? Share them with us in the comments below!
It's February 15th, also known as the day after Valentine's Day, also known as the day the value packs of heart-shaped Reece's Peanut Butter Cups go on sale for at least half off and every drug store in the country. Whether you hate that you love the black Friday of Hallmark stores or you love to hate its capitalist schemes, this blessed time of cheap candy and corny trinkets is something we can all appreciate. To celebrate, we've put together a playlist of our favorite angsty teenager-era anti-Valentine's Day anthems for your enjoyment. Follow us on Spotify for more playlists and comment your addition to the list below!
Well, 2016 has been a year. We were serious when it came to memes, ridiculous when it came to elections, and horrified when it came to the amount of important musicians who left us this year. Thankfully, we did have a lot of great music to get us through all the garbage. Naturally, as millennials, we decided to celebrate this beautiful music with a playlist. Hopefully it will continue to help us all through 2017 and beyond.