package com.zcloud.service.relatedparty.impl;

import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.relatedparty.OutSourcedMapper;
import com.zcloud.service.relatedparty.OutSourcedService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * 说明：外包工程
 * 作者：luoxiaobao
 * 时间：2022-06-14
 * 官网：www.zcloudchina.com
 */
@Service
@Transactional //开启事物
public class OutSourcedServiceImpl implements OutSourcedService{

	@Autowired
	private OutSourcedMapper outsourcedMapper;

	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		outsourcedMapper.save(pd);
	}

	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		outsourcedMapper.delete(pd);
	}

	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		outsourcedMapper.edit(pd);
	}

	/**列表
	 * @param page
	 * @throws Exception
	 */
	public List<PageData> list(Page page)throws Exception{
		return outsourcedMapper.datalistPage(page);
	}

	/**列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	public List<PageData> listAll(PageData pd)throws Exception{
		return outsourcedMapper.listAll(pd);
	}

	/**通过id获取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findById(PageData pd)throws Exception{
		return outsourcedMapper.findById(pd);
	}

	/**批量删除
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		outsourcedMapper.deleteAll(ArrayDATA_IDS);
	}

	/**通过登录人id获取首页数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData homepagedata(PageData pd)throws Exception{
		return outsourcedMapper.homepagedata(pd);
	}

	public String getDeptId(String userId) {
		return outsourcedMapper.getDeptId(userId);
	}

	@Override
	public String getCorpInfoByOutsourcesCreator(PageData pd) {
		return outsourcedMapper.getCorpInfoByOutsourcesCreator(pd);
	}

	@Override
	public List<PageData> applylist(Page page) {
		return outsourcedMapper.applylistPage(page);
	}

	/**坐标定位
	 * @param pd
	 * @throws Exception
	 */
	public void editDingWei(PageData pd)throws Exception{
		outsourcedMapper.editDingWei(pd);
	}

	@Override
	public PageData jieshuOutSourced(PageData pd) {
		return outsourcedMapper.jieshuOutSourced(pd);
	}

	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void jie(PageData pd)throws Exception{
		outsourcedMapper.jie(pd);
	}

	@Override
	public void start(PageData pd) {
		outsourcedMapper.start(pd);
	}

	@Override
	public void updateState(PageData pd) {
		pd.put("OPERATTIME", DateUtil.date2Str(new Date()));

		outsourcedMapper.updateState(pd);
	}

	@Override
	public List<PageData> outSouceslistPage(Page page) {
		return outsourcedMapper.outSouceslistPage(page);
	}

	@Override
	public Integer getDingWeiSum(PageData pd) {
		return outsourcedMapper.getDingWeiSum(pd);
	}

	@Override
	public List<PageData> getPUNISHlist(Page page) {
		return outsourcedMapper.getPUNISHlistPage(page);
	}

}

