///**
// * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
// */
//package com.jeeplus.modules.workprequalification.service;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import com.jeeplus.modules.sys.entity.User;
//import com.jeeplus.modules.sys.utils.UserUtils;
//import com.jeeplus.modules.workclientinfo.dao.WorkClientLinkmanDao;
//import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
//import com.jeeplus.common.persistence.Page;
//import com.jeeplus.common.service.CrudService;
//import com.jeeplus.common.utils.StringUtils;
//import com.jeeplus.modules.workprequalification.entity.WorkPrequalification;
//import com.jeeplus.modules.workprequalification.entity.WorkProjectLinkman;
//import com.jeeplus.modules.workprequalification.dao.WorkPrequalificationDao;
//import com.jeeplus.modules.workprequalification.dao.WorkProjectLinkmanDao;
//
///**
// * 投标资格预审Service
// * @author  mengxy
// * @version 2017-05-24
// */
//@Service
//@Transactional(readOnly = true)
//public class WorkPrequalificationService extends CrudService<WorkPrequalificationDao, WorkPrequalification> {
//
//	@Autowired
//	private WorkClientLinkmanDao workClientLinkmanDao;
//
//	@Autowired
//	private WorkProjectLinkmanDao workProjectLinkmanDao;
//
//	public WorkPrequalification get(String id) {
//		WorkPrequalification workPrequalification = super.get(id);
//		WorkProjectLinkman linkman =new WorkProjectLinkman();
//		linkman.setProjectId(id);
//		workPrequalification.setWorkProjectLinkmanList(workProjectLinkmanDao.findList(linkman));
//		List<String> userId = dao.getProjectMember(workPrequalification);
//		List<User> userList = new ArrayList<User>();
//		for (int i = 0; i < userId.size(); i++) {
//			userList.add(UserUtils.get(userId.get(i)));
//		}
//		workPrequalification.setMemberList(userList);
//		return workPrequalification;
//	}
//
//	public List<WorkProjectLinkman> findLinkmanList(String projectId) {
//		WorkProjectLinkman linkman = new WorkProjectLinkman();
//		linkman.setProjectId(projectId);
//		return workProjectLinkmanDao.findList(linkman);
//	}
//
//	public List<WorkPrequalification> findList(WorkPrequalification workPrequalification) {
//		List<WorkPrequalification> preList =super.findList(workPrequalification);
//		List<WorkProjectLinkman> linkmanList =new ArrayList<WorkProjectLinkman>();
//		for (WorkPrequalification pre : preList) {
//			linkmanList = findLinkmanList(pre.getId());
//			List<String> userId = dao.getProjectMember(pre);
//			List<User> userList = new ArrayList<User>();
//			for (int i = 0; i < userId.size(); i++) {
//				userList.add(UserUtils.get(userId.get(i)));
//			}
//			pre.setMasterList(userList);
//			pre.setWorkProjectLinkmanList(linkmanList);
//		}
//
//		return preList;
//	}
//
//	public Page<WorkPrequalification> findPage(Page<WorkPrequalification> page, WorkPrequalification workPrequalification) {
//		workPrequalification.setPage(page);
//		page.setList(findList(workPrequalification));
//		return page;
//	}
//
//	@Transactional(readOnly = false)
//	public void save(WorkPrequalification workPrequalification) {
//		super.save(workPrequalification);
//
//		for (WorkProjectLinkman workProjectLinkman : workPrequalification.getWorkProjectLinkmanList()){
//			if (workProjectLinkman.getId() == null){
//				continue;
//			}
//			if (WorkProjectLinkman.DEL_FLAG_NORMAL.equals(workProjectLinkman.getDelFlag())){
//				if (StringUtils.isNotBlank(workProjectLinkman.getId()) && workClientLinkmanDao.get(workProjectLinkman.getId())!=null){
//					workProjectLinkman.setProjectId(workPrequalification.getId());
//					workProjectLinkman.preInsert();
//					workProjectLinkmanDao.insert(workProjectLinkman);
//				}else if (StringUtils.isBlank(workProjectLinkman.getId())){
//					workProjectLinkman.setProjectId(workPrequalification.getId());
//					workProjectLinkman.preInsert();
//					workProjectLinkmanDao.insert(workProjectLinkman);
//				}else{
//					workProjectLinkman.preUpdate();
//					workProjectLinkmanDao.update(workProjectLinkman);
//				}
//			}else{
//				workProjectLinkmanDao.delete(workProjectLinkman);
//			}
//		}
//
//
//
//		for (User user : workPrequalification.getMemberList()){
//			if (user.getId() == null){
//				continue;
//			}
//			dao.deleteProjectMember(workPrequalification);
//			dao.insertProjectMember(workPrequalification);
//		}
//	}
//
//	@Transactional(readOnly = false)
//	public void delete(WorkPrequalification workPrequalification) {
//		super.delete(workPrequalification);
//		WorkProjectLinkman linkman = new WorkProjectLinkman();
//		linkman.setProjectId(workPrequalification.getId());
//		dao.deleteProjectUser(workPrequalification);
//		workProjectLinkmanDao.delete(linkman);
//	}
//
//	public Page<WorkClientInfo> findPageBybiddingCompany(Page<WorkClientInfo> page, WorkClientInfo biddingCompany) {
//		biddingCompany.setPage(page);
//		page.setList(dao.findListBybiddingCompany(biddingCompany));
//		return page;
//	}
//
//
//
//}