package com.steerinfo.meterwork.meterworkimagetemp.service.impl;

import com.steerinfo.baseinfo.combaseinfo.mapper.ComBaseInfoMapper;
import com.steerinfo.baseinfo.combaseinfo.model.ComBaseInfo;
import com.steerinfo.framework.controller.RESTfulResult;
import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.meterwork.meterworkimage.mapper.MeterWorkImageMapper;
import com.steerinfo.meterwork.meterworkimage.model.MeterWorkImage;
import com.steerinfo.meterwork.meterworkimagetemp.mapper.MeterWorkImageTempMapper;
import com.steerinfo.meterwork.meterworkimagetemp.model.MeterWorkImageTemp;
import com.steerinfo.meterwork.meterworkimagetemp.service.IMeterWorkImageTempService;
import com.steerinfo.meterwork.meterworkrailwayreceived.mapper.MeterWorkRailwayReceivedMapper;
import com.steerinfo.meterwork.meterworkrailwayreceived.model.MeterWorkRailwayReceived;
import com.steerinfo.util.PublicMethod;
import com.steerinfo.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * MeterWorkImageTemp服务实现：
 * @author generator
 * @version 1.0-SNAPSHORT 2022-08-20 09:39
 * 类描述
 * 修订历史：
 * 日期：2022-08-20
 * 作者：generator
 * 参考：
 * 描述：MeterWorkImageTemp服务实现
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@Service(value = "meterWorkImageTempService")
public class MeterWorkImageTempServiceImpl extends BaseServiceImpl<MeterWorkImageTemp, String> implements IMeterWorkImageTempService {

    @Resource
    private MeterWorkImageTempMapper meterWorkImageTempMapper;

    @Resource
    private MeterWorkImageMapper meterWorkImageMapper;

    @Resource
    private MeterWorkRailwayReceivedMapper meterWorkRailwayReceivedMapper;

    @Resource
    private ComBaseInfoMapper comBaseInfoMapper;

    @Override
    protected IBaseMapper<MeterWorkImageTemp, String> getMapper() {
        return meterWorkImageTempMapper;
    }

    @Override
    public RESTfulResult doSaveRailwayWf(MeterWorkImageTemp mwi) {
        RESTfulResult rm = new RESTfulResult();
        rm.setFailed();
        try{
            mwi.setImageNo(PublicMethod.IdCreate(3));
            meterWorkImageTempMapper.insertSelective(mwi);
            rm.setSucceed(true);
            rm.setMessage("操作成功");
            rm.setData(mwi.toString());
        }catch(Exception ex){
            rm.setMessage("图片信息写入表异常："+ex.getMessage());
        }
        return rm;
    }
}
