1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package com.dashitech.migration.task.uc;
- import com.dashitech.migration.BaseTask;
- import com.dashitech.migration.core.FieldMapper;
- 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 XyGroupTask extends BaseTask {
- public static Log log = LogFactory.getLog(XyGroupTask.class);
- @Autowired
- private HospitalTask hospitalTask;
- @Override
- @Transactional
- public void start() {
- log.info(" *** 襄阳工作组group转换开始 *** ");
- StringBuffer sql = new StringBuffer("select 0 as version,a.groupname,a.delete_flag,a.duty_id ,now() as operator_time,1 as schedule_class_id");
- sql.append(" from itsm_uc_groups a join itsm_uc_duty_dept b on a.duty_id = b.id ");
- sql.append("where b.dept not like 'Z%' and dept not like '%保卫%' and b.id not in (20,21)");
- List<Map<String, Object>> groupList = jdbcTemplateMdv2.queryForList(sql.toString());
- //测试
- FieldMapper mapper = new FieldMapper();
- mapper.addOperationUpdate("_hospital_id", "duty_id");
- mapper.addOperationAdd("type", 3);
- Map<Long, Long> hosIdCache = hospitalTask.loadXiangyangCache().getIdCache();
- mapper.addOperationReplace("duty_id", hosIdCache);
- mapper.trans2JdbcRow(groupList);
- JdbcUtil jdbcUtil = new JdbcUtil(jdbcTemplateHsms);
- jdbcUtil.batchPageInsert("itsm_uc_groups", mapper.getRows());
- //clear释放内存
- mapper.clear();
- }
- @Override
- public FieldMapper loadCache() {
- return null;
- }
- }
|