package com.dashitech.migration.task.solution; import com.dashitech.migration.BaseTask; import com.dashitech.migration.core.FieldMapper; import com.dashitech.migration.task.uc.UserTask; import com.dashitech.migration.util.JdbcUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; /** * @author song * @date 2024年10月12日 */ @Component public class SolutionIntroduceTask extends BaseTask { private Log log = LogFactory.getLog(SolutionIntroduceTask.class); @Autowired private UserTask userTask; @Override @Transactional(rollbackFor = Exception.class) public void start() { log.info("知识库引用数据SolutionIntroduceTask转换开始"); StringBuffer sql = new StringBuffer("select * from itsm_solution_introduce"); List> solutionStarList = jdbcTemplateMdv2.queryForList(sql.toString()); FieldMapper mapper = new FieldMapper(); Map userIdCache = userTask.loadCache().getIdCache(); mapper.addOperationReplace("user_id", userIdCache); mapper.trans2JdbcRow(solutionStarList); JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms); jdbcUtil.batchPageInsert("itsm_itsm_solution_introduce", mapper.getRows()); } @Override public FieldMapper loadCache() { return null; } }