|
|
@@ -0,0 +1,43 @@
|
|
|
+package com.uas.erp.schedular.init;
|
|
|
+
|
|
|
+import com.uas.erp.schedular.entity.MasterTaskConfigEntity;
|
|
|
+import com.uas.erp.schedular.repository.MasterTaskConfigRepository;
|
|
|
+import com.uas.erp.schedular.service.ScheduledTaskService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.CommandLineRunner;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by Pro1 on 2017/7/26.
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class ReplyInitializer implements CommandLineRunner {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ScheduledTaskService scheduledTaskService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MasterTaskConfigRepository masterTaskConfigRepository;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run(String... strings) throws Exception {
|
|
|
+ List<MasterTaskConfigEntity> entity = masterTaskConfigRepository
|
|
|
+ .findByBeanNameAndMethodName("purchaseTask", "uploadPurchaseReply");
|
|
|
+ List<MasterTaskConfigEntity> entities = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(entity)) {
|
|
|
+ for (MasterTaskConfigEntity configEntity : entity) {
|
|
|
+ configEntity.setEnabled(false);
|
|
|
+ entities.add(configEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(entities)) {
|
|
|
+ masterTaskConfigRepository.save(entities);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|