//package com.ai.da.common.task;
//
//import com.ai.da.common.utils.CopyUtil;
//import com.ai.da.common.utils.ExcelReader;
//import com.ai.da.common.utils.MinioUtil;
//import com.ai.da.common.utils.SendEmailUtil;
//import com.ai.da.mapper.primary.*;
//import com.ai.da.mapper.primary.entity.*;
//import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
//import com.ai.da.mapper.third.*;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.poi.ss.usermodel.Row;
//import org.apache.poi.ss.usermodel.Sheet;
//import org.apache.poi.ss.usermodel.Workbook;
//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
//import org.springframework.stereotype.Component;
//import org.springframework.util.CollectionUtils;
//
//import javax.annotation.PostConstruct;
//import javax.annotation.Resource;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.nio.file.Files;
//import java.nio.file.Paths;
//import java.time.LocalDate;
//import java.time.format.DateTimeFormatter;
//import java.util.List;
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//import java.util.concurrent.TimeUnit;
//import java.util.stream.Collectors;
//
//@Component
//public class MoveDataScheduler {
//
//    @PostConstruct
//    public void test() {
//        moveData();
//    }
//
//    @Resource
//    private UserLikeGroupMapper userLikeGroupMapper;
//    @Resource
//    private UserLikeGroupZSMapper userLikeGroupZSMapper;
//    @Resource
//    private UserLikeMapper userLikeMapper;
//    @Resource
//    private UserLikeZSMapper userLikeZSMapper;
//    @Resource
//    private CollectionElementMapper collectionElementMapper;
//    @Resource
//    private CollectionElementZSMapper collectionElementZSMapper;
//
//    @Resource
//    private CollectionMapper collectionMapper;
//
//    @Resource
//    private CollectionZSMapper collectionZSMapper;
//
//    @Resource
//    private DesignMapper designMapper;
//
//    @Resource
//    private DesignZSMapper designZSMapper;
//
//    @Resource
//    private DesignItemMapper designItemMapper;
//
//    @Resource
//    private DesignItemZSMapper designItemZSMapper;
//
//    @Resource
//    private TDesignPythonOutfitMapper designPythonOutfitMapper;
//
//    @Resource
//    private TDesignPythonOutfitZSMapper designPythonOutfitZSMapper;
//
//    @Resource
//    private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
//
//    @Resource
//    private TDesignPythonOutfitDetailZSMapper designPythonOutfitDetailZSMapper;
//
//    @Resource
//    private DesignItemDetailMapper designItemDetailMapper;
//    @Resource
//    private DesignItemZSDetailMapper designItemDetailZSMapper;
//
//    @Resource
//    private DesignItemDetailPrintMapper designItemDetailPrintMapper;
//
//    @Resource
//    private DesignItemDetailPrintZSMapper designItemDetailPrintZSMapper;
//
//
//    private void moveData() {
//        // 查询用户所有history记录
//        QueryWrapper<UserLikeGroup> userLikeGroupQueryWrapper = new QueryWrapper<>();
//        userLikeGroupQueryWrapper.lambda().eq(UserLikeGroup::getAccountId, 11411);
//        List<UserLikeGroup> userLikeGroupList = userLikeGroupMapper.selectList(userLikeGroupQueryWrapper);
//
//        for (UserLikeGroup userLikeGroup : userLikeGroupList) {
//
//            com.ai.da.mapper.third.entity.UserLikeGroup userLikeGroupZS = CopyUtil.copyObject(userLikeGroup, com.ai.da.mapper.third.entity.UserLikeGroup.class);
//            userLikeGroupZS.setAccountId(11420L);
//            userLikeGroupZS.setId(null);
//            Collection collection = collectionMapper.selectById(userLikeGroup.getCollectionId());
//            com.ai.da.mapper.third.entity.Collection collectionZS = CopyUtil.copyObject(collection, com.ai.da.mapper.third.entity.Collection.class);
//            collectionZS.setAccountId(11420L);
//            collectionZS.setId(null);
//
//            if (collection.getMoodTemplateId() != null) {
//                CollectionElement element = collectionElementMapper.selectById(collection.getMoodTemplateId());
//                com.ai.da.mapper.third.entity.CollectionElement collectionElementZS = CopyUtil.copyObject(element, com.ai.da.mapper.third.entity.CollectionElement.class);
//                collectionElementZS.setAccountId(11420L);
//                collectionElementZS.setId(null);
//                collectionElementZSMapper.insert(collectionElementZS);
//                collectionZS.setMoodTemplateId(String.valueOf(collectionElementZS.getId()));
//            }
//            collectionZSMapper.insert(collectionZS);
//            userLikeGroupZS.setCollectionId(collectionZS.getId());
//            userLikeGroupZSMapper.insert(userLikeGroupZS);
//
//            // 生成元素
//            QueryWrapper<CollectionElement> collectionElementQueryWrapper = new QueryWrapper<>();
//            collectionElementQueryWrapper.lambda().eq(CollectionElement::getCollectionId, userLikeGroup.getCollectionId());
//            List<CollectionElement> collectionElements = collectionElementMapper.selectList(collectionElementQueryWrapper);
//
//            for (CollectionElement collectionElement : collectionElements) {
//                com.ai.da.mapper.third.entity.CollectionElement collectionElementZS = CopyUtil.copyObject(collectionElement, com.ai.da.mapper.third.entity.CollectionElement.class);
//                collectionElementZS.setId(null);
//                collectionElementZS.setAccountId(11420L);
//                collectionElementZS.setCollectionId(collectionZS.getId());
//                collectionElementZSMapper.insert(collectionElementZS);
//            }
//
//            // 查询记录关联
//            QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
//            userLikeQueryWrapper.lambda().eq(UserLike::getUserLikeGroupId, userLikeGroup.getId());
//            List<UserLike> userLikes = userLikeMapper.selectList(userLikeQueryWrapper);
//            for (UserLike userLike : userLikes) {
//                Design design = designMapper.selectById(userLike.getDesignId());
//                com.ai.da.mapper.third.entity.Design designZS = CopyUtil.copyObject(design, com.ai.da.mapper.third.entity.Design.class);
//                designZS.setId(null);
//                designZS.setAccountId(11420L);
//                designZS.setCollectionId(collectionZS.getId());
//                designZSMapper.insert(designZS);
//
//                com.ai.da.mapper.third.entity.UserLike userLikeZS = CopyUtil.copyObject(userLike, com.ai.da.mapper.third.entity.UserLike.class);
////                Design design = designMapper.selectById(userLike.getDesignId());
//                userLikeZS.setId(null);
//                DesignItem designItem = designItemMapper.selectById(userLike.getDesignItemId());
//                com.ai.da.mapper.third.entity.DesignItem designItemZS = CopyUtil.copyObject(designItem, com.ai.da.mapper.third.entity.DesignItem.class);
//                designItemZS.setId(null);
//                designItemZS.setAccountId(11420L);
//                designItemZS.setDesignId(designZS.getId());
//                designItemZSMapper.insert(designItemZS);
//
//                QueryWrapper<DesignItemDetail> designItemDetailQueryWrapper = new QueryWrapper<>();
//                designItemDetailQueryWrapper.lambda().eq(DesignItemDetail::getDesignItemId, designItem.getId());
//                List<DesignItemDetail> designItemDetails = designItemDetailMapper.selectList(designItemDetailQueryWrapper);
//                for (DesignItemDetail designItemDetail : designItemDetails) {
//                    com.ai.da.mapper.third.entity.DesignItemDetail designItemDetailZS = CopyUtil.copyObject(designItemDetail, com.ai.da.mapper.third.entity.DesignItemDetail.class);
//                    designItemDetailZS.setId(null);
//                    designItemDetailZS.setDesignItemId(designItemZS.getId());
//                    designItemDetailZS.setAccountId(11420L);
//                    designItemDetailZS.setDesignId(designZS.getId());
//                    designItemDetailZSMapper.insert(designItemDetailZS);
//
//                    QueryWrapper<DesignItemDetailPrint> designItemDetailPrintQueryWrapper = new QueryWrapper<>();
//                    designItemDetailPrintQueryWrapper.lambda().eq(DesignItemDetailPrint::getDesignItemDetailId, designItemDetail.getId());
//                    List<DesignItemDetailPrint> designItemDetailPrintList = designItemDetailPrintMapper.selectList(designItemDetailPrintQueryWrapper);
//                    if (!CollectionUtils.isEmpty(designItemDetailPrintList)) {
//                        for (DesignItemDetailPrint designItemDetailPrint : designItemDetailPrintList) {
//                            com.ai.da.mapper.third.entity.DesignItemDetailPrint designItemDetailPrintZS = CopyUtil.copyObject(designItemDetailPrint, com.ai.da.mapper.third.entity.DesignItemDetailPrint.class);
//                            designItemDetailPrintZS.setId(null);
//                            designItemDetailPrintZS.setDesignItemDetailId(designItemDetailZS.getId());
//                            designItemDetailPrintZSMapper.insert(designItemDetailPrintZS);
//                        }
//                    }
//                }
//
//                userLikeZS.setDesignItemId(designItemZS.getId());
//                TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(userLike.getDesignOutfitId());
//                com.ai.da.mapper.third.entity.TDesignPythonOutfit tDesignPythonOutfitZS = CopyUtil.copyObject(tDesignPythonOutfit, com.ai.da.mapper.third.entity.TDesignPythonOutfit.class);
//                tDesignPythonOutfitZS.setId(null);
//                tDesignPythonOutfitZS.setDesignItemId(designItemZS.getId());
//                tDesignPythonOutfitZS.setCollectionId(collectionZS.getId());
//                tDesignPythonOutfitZS.setUserId(11420L);
//                tDesignPythonOutfitZS.setDesignId(designZS.getId());
//                designPythonOutfitZSMapper.insert(tDesignPythonOutfitZS);
//
//                userLikeZS.setUserLikeGroupId(userLikeGroupZS.getId());
//                userLikeZS.setDesignId(designZS.getId());
//                userLikeZS.setDesignOutfitId(tDesignPythonOutfitZS.getId());
//                userLikeZSMapper.insert(userLikeZS);
//
//                QueryWrapper<TDesignPythonOutfitDetail> designPythonOutfitDetailQueryWrapper = new QueryWrapper<>();
//                designPythonOutfitDetailQueryWrapper.lambda().eq(TDesignPythonOutfitDetail::getDesignPythonOutfitId, tDesignPythonOutfit.getId());
//                List<TDesignPythonOutfitDetail> tDesignPythonOutfitDetails = designPythonOutfitDetailMapper.selectList(designPythonOutfitDetailQueryWrapper);
//                for (TDesignPythonOutfitDetail tDesignPythonOutfitDetail : tDesignPythonOutfitDetails) {
//                    com.ai.da.mapper.third.entity.TDesignPythonOutfitDetail tDesignPythonOutfitDetailZS = CopyUtil.copyObject(tDesignPythonOutfitDetail, com.ai.da.mapper.third.entity.TDesignPythonOutfitDetail.class);
//                    tDesignPythonOutfitDetailZS.setDesignPythonOutfitId(tDesignPythonOutfitZS.getId());
//                    tDesignPythonOutfitDetailZS.setId(null);
//                    tDesignPythonOutfitDetailZS.setDesignId(designZS.getId());
//                    designPythonOutfitDetailZSMapper.insert(tDesignPythonOutfitDetailZS);
//                }
//            }
//        }
//
//
//    }
//
//
//}
