package com.mortals.xhx.module.matter.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.matter.model.MatterAcceptEntity;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.matter.dao.MatterFlowlimitDao;
import com.mortals.xhx.module.matter.model.MatterFlowlimitEntity;
import com.mortals.xhx.module.matter.service.MatterFlowlimitService;
import org.springframework.util.ObjectUtils;

/**
* MatterFlowlimitService
* 事项办理流程 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("matterFlowlimitService")
public class MatterFlowlimitServiceImpl extends AbstractCRUDServiceImpl<MatterFlowlimitDao, MatterFlowlimitEntity, Long> implements MatterFlowlimitService {

    @Autowired
    private MatterService matterService;


    @Override
    protected void saveBefore(MatterFlowlimitEntity entity, Context context) throws AppException {

        if(!ObjectUtils.isEmpty(entity.getMatterId())){
            MatterEntity matterEntity = matterService.get(entity.getMatterId());
            entity.setMatterName(matterEntity==null?"":matterEntity.getMatterName());
        }
        super.saveBefore(entity, context);
    }
}