package org.jeecg.module.custom.ocr.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.module.custom.ocr.base.BaseServiceImpl;
import org.jeecg.module.custom.ocr.dataDao.OcrTaskchildPictureMybatisDao;
import org.jeecg.module.custom.ocr.dataobject.OcrPicture;
import org.jeecg.module.custom.ocr.dataobject.OcrTaskchildPicture;
import org.jeecg.module.custom.ocr.service.OcrTaskchildPictureService;
import org.springframework.stereotype.Service;

/**
 * 业务层实现
 */
@Service("ocrTaskchildPictureService")
@Slf4j
public class OcrTaskchildPictureServiceImpl extends BaseServiceImpl<OcrTaskchildPictureMybatisDao, OcrTaskchildPicture> implements OcrTaskchildPictureService {

    @Override
    public boolean createTaskOldPicture(OcrPicture picture) {
        OcrTaskchildPicture taskchildPicture = new OcrTaskchildPicture();
//        taskchildPicture.setTenantid(picture.getTenantId());
        taskchildPicture.setPictureid(picture.getId());
//        taskchildPicture.setCategoryid(picture.getCategoryid());
        int states = 0;
//        if ("8".equals(picture.getTaskstatus())) {
//            states = 3;
//        } else if ("9".equals(picture.getTaskstatus()) || "10".equals(picture.getTaskstatus())) {
//            states = 5;
//        } else {
//            return false;
//        }
        taskchildPicture.setStates(states);
        taskchildPicture.setAssignee("admin");
        taskchildPicture.setAssigneename("全量拉取");
        taskchildPicture.setGuidang(1);
        taskchildPicture.setCreateuser("admin");
        taskchildPicture.setCreatedate(System.currentTimeMillis());
        taskchildPicture.setFromtaskid(String.valueOf(picture.getTaskId()));
//        taskchildPicture.setFromtaskname(picture.getTaskname());
//        taskchildPicture.setFromuserid(picture.getUpuserid());
//        taskchildPicture.setFromusername(picture.getUpname());
//        taskchildPicture.setFromuptime(picture.getSubmitDateTimestamp());
//        taskchildPicture.setFromplanid(picture.getPlanid());
//        taskchildPicture.setFromprojectid(picture.getProjectid());
//        taskchildPicture.setFromprojectname(picture.getProjectidname());
//        taskchildPicture.setFromsourceid(picture.getField4());
        taskchildPicture.setFinishtime(System.currentTimeMillis());
        taskchildPicture.setIsFinal(1);
        taskchildPicture.setTaskNode("finale_judgment");
        taskchildPicture.setIsRepeatedNodules(0);
        taskchildPicture.setSendResult(0);
        return this.save(taskchildPicture);
    }

}
