@Scheduled(cron = "0 0 * * * ?")
@IocBean(create="init",args = {"refer:dao"})
public class AllGetEmergencyOptionListJob extends EntityRepositoryServiceImpl<EmergencyOption> implements Job {
//这个初始化无法执行
public void init(){
System.out.println("############");
List<Map> list = findAll();
for (int i = 0; i < list.size(); i++) {
EmergencyOption option = new EmergencyOption();
option.setCode1(0L);
option.setOptionId((String) list.get(i).get("id"));
option.setCode((String) list.get(i).get("code"));
option.setFaultCode((String) list.get(i).get("faultCode"));
option.setDescription1((String) list.get(i).get("parts"));
option.setDescription2((String) list.get(i).get("type"));
option.setLiftCategory((String) list.get(i).get("managerCode"));
option.setFraction(40);
emergencyOptionServiceI.saveOrUpdateByOptionId(option);
}
}
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
List<Map> list = findAll();
for (int i = 0; i < list.size(); i++) {
EmergencyOption option = new EmergencyOption();
option.setCode1(0L);
option.setOptionId((String) list.get(i).get("id"));
option.setCode((String) list.get(i).get("code"));
option.setFaultCode((String) list.get(i).get("faultCode"));
option.setDescription1((String) list.get(i).get("parts"));
option.setDescription2((String) list.get(i).get("type"));
option.setLiftCategory((String) list.get(i).get("managerCode"));
option.setFraction(40);
emergencyOptionServiceI.saveOrUpdateByOptionId(option);
}
}
}
添加回复
请先登陆