UserScoreSignServiceImpl 代码记录

package com.iflytek.edu.zx.archive.service.impl;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.annotation.Resource;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import com.iflytek.edu.elp.common.dto.page.PageParam;
import com.iflytek.edu.elp.user.domain.Clazz;
import com.iflytek.edu.elp.user.service.ClazzService;
import com.iflytek.edu.elp.user.service.UserService;
import com.iflytek.edu.zx.archive.dao.UserScoreSignDao;
import com.iflytek.edu.zx.archive.model.PaperArchive;
import com.iflytek.edu.zx.archive.model.UserScoreSign;
import com.iflytek.edu.zx.archive.service.PaperArchiveService;
import com.iflytek.edu.zx.archive.service.UserScoreSignService;

/**
 * @author yywang5
 */
@Service("userScoreSignService")
public class UserScoreSignServiceImpl implements UserScoreSignService{

	@Resource
	private UserScoreSignDao userScoreSignDao;

	@Resource
	private UserService userService;

	@Resource
	private ClazzService clazzService;
	
	@Resource
	private PaperArchiveService paperArchiveService;

	private static final Logger LOGGER = LoggerFactory.getLogger(UserScoreSignServiceImpl.class);

	@Override
	public void save(UserScoreSign userScoreSign) {
		Assert.notNull(userScoreSign,"userScoreSign is required!");
		userScoreSignDao.insert(userScoreSign);
	}

	@Override
	public UserScoreSign get(String topicSetId, String userId) {
		return userScoreSignDao.find(topicSetId,userId);
	}

	@Override
	public List getByTeacherId(String teacherId, PageParam pageParam) {
		List ussList = new ArrayList();
		if (StringUtils.isEmpty(teacherId)) {
			LOGGER.info("teacherId is required!");
			return ussList;
		}

		List clazzList = clazzService.getClassesByTeacherId(teacherId);
		Set clazzIds = new HashSet();
		if (CollectionUtils.isNotEmpty(clazzList)) {
			for (Clazz clazz : clazzList) {
				clazzIds.add(clazz.getId());
			}
			ussList = userScoreSignDao.findByClassId(clazzIds, pageParam);
		}
		
		return ussList;
	}


}

你可能感兴趣的:(工作代码记录)