Commit 8ba7bb00 authored by 王飞's avatar 王飞

Merge branch 'wangfei' into 'dev'

Feat

See merge request !32
parents 7bf8a1ba 7fe0c2fd
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import com.ruoyi.service.StrategyCarReviewTask; import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.service.StrategySystemReviewTask;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -15,11 +16,11 @@ public class StrategyCarReviewTaskContext { ...@@ -15,11 +16,11 @@ public class StrategyCarReviewTaskContext {
@Autowired @Autowired
private final Map<String, StrategyCarReviewTask> resourceMap = new ConcurrentHashMap<>(); private final Map<String, StrategyCarReviewTask> resourceMap = new ConcurrentHashMap<>();
public StrategyCarReviewTaskContext(Map<String, StrategyCarReviewTask> strategyMap) { public void putResource(String key, StrategyCarReviewTask strategyCarReviewTask) {
this.resourceMap.clear(); resourceMap.put(key, strategyCarReviewTask);
strategyMap.forEach(resourceMap::put);
} }
public StrategyCarReviewTask getResource(String operation){ public StrategyCarReviewTask getResource(String operation){
return resourceMap.get(operation); return resourceMap.get(operation);
} }
......
...@@ -8,7 +8,9 @@ import com.ruoyi.service.ReviewSceneChangeTaskService; ...@@ -8,7 +8,9 @@ import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.service.ReviewStandardService; import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategyCarReviewTask; import com.ruoyi.service.StrategyCarReviewTask;
import com.ruoyi.web.response.CarReviewTaskViewResponse; import com.ruoyi.web.response.CarReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -18,8 +20,13 @@ import java.util.function.Function; ...@@ -18,8 +20,13 @@ import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Transactional @Transactional
@Service(CarReviewTask.TASK_STATUS_PENDING) @Service
public class StrategyCarReviewTaskPending implements StrategyCarReviewTask { public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, InitializingBean {
@Autowired
private StrategyCarReviewTaskContext strategyCarReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired @Autowired
private ReviewStandardService reviewStandardService; private ReviewStandardService reviewStandardService;
...@@ -82,4 +89,9 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask { ...@@ -82,4 +89,9 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask {
} }
} }
} }
@Override
public void afterPropertiesSet() throws Exception {
strategyCarReviewTaskContext.putResource(CarReviewTask.TASK_STATUS_PENDING, applicationContext.getBean(this.getClass()));
}
} }
...@@ -5,13 +5,20 @@ import com.ruoyi.domain.ReviewSceneChangeTask; ...@@ -5,13 +5,20 @@ import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.mapper.ReviewSceneMapper; import com.ruoyi.mapper.ReviewSceneMapper;
import com.ruoyi.service.StrategyReviewSceneChange; import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneChangeTaskService; import com.ruoyi.service.ReviewSceneChangeTaskService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Transactional @Transactional
@Service(ReviewSceneChangeTask.OPERATION_ADD) @Service
public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange { public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange, InitializingBean {
@Autowired
private StrategyReviewSceneChangeContext strategyReviewSceneChangeContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired @Autowired
private ReviewSceneMapper reviewSceneMapper; private ReviewSceneMapper reviewSceneMapper;
...@@ -38,4 +45,8 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange { ...@@ -38,4 +45,8 @@ public class StrategyReviewSceneChangeAdd implements StrategyReviewSceneChange {
} }
@Override
public void afterPropertiesSet() throws Exception {
strategyReviewSceneChangeContext.putResource(ReviewSceneChangeTask.OPERATION_ADD, applicationContext.getBean(this.getClass()));
}
} }
...@@ -15,9 +15,8 @@ public class StrategyReviewSceneChangeContext { ...@@ -15,9 +15,8 @@ public class StrategyReviewSceneChangeContext {
@Autowired @Autowired
private final Map<String, StrategyReviewSceneChange> strategyMap = new ConcurrentHashMap<>(); private final Map<String, StrategyReviewSceneChange> strategyMap = new ConcurrentHashMap<>();
public StrategyReviewSceneChangeContext(Map<String, StrategyReviewSceneChange> strategyMap) { public void putResource(String key, StrategyReviewSceneChange strategySystemReviewTask) {
this.strategyMap.clear(); strategyMap.put(key, strategySystemReviewTask);
strategyMap.forEach(strategyMap::put);
} }
public StrategyReviewSceneChange getResource(String operation){ public StrategyReviewSceneChange getResource(String operation){
......
...@@ -3,13 +3,20 @@ package com.ruoyi.service.impl; ...@@ -3,13 +3,20 @@ package com.ruoyi.service.impl;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.StrategyReviewSceneChange; import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneService; import com.ruoyi.service.ReviewSceneService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Transactional @Transactional
@Service(ReviewSceneChangeTask.OPERATION_DELETE) @Service
public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChange { public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChange, InitializingBean {
@Autowired
private StrategyReviewSceneChangeContext strategyReviewSceneChangeContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired @Autowired
private ReviewSceneService reviewSceneService; private ReviewSceneService reviewSceneService;
...@@ -18,4 +25,9 @@ public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChang ...@@ -18,4 +25,9 @@ public class StrategyReviewSceneChangeDelete implements StrategyReviewSceneChang
public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) { public void doChange(ReviewSceneChangeTask reviewSceneChangeTask) {
reviewSceneService.removeById(reviewSceneChangeTask.getReviewSceneId()); reviewSceneService.removeById(reviewSceneChangeTask.getReviewSceneId());
} }
@Override
public void afterPropertiesSet() throws Exception {
strategyReviewSceneChangeContext.putResource(ReviewSceneChangeTask.OPERATION_DELETE, applicationContext.getBean(this.getClass()));
}
} }
...@@ -4,13 +4,21 @@ import com.ruoyi.domain.ReviewScene; ...@@ -4,13 +4,21 @@ import com.ruoyi.domain.ReviewScene;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.StrategyReviewSceneChange; import com.ruoyi.service.StrategyReviewSceneChange;
import com.ruoyi.service.ReviewSceneService; import com.ruoyi.service.ReviewSceneService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Transactional @Transactional
@Service(ReviewSceneChangeTask.OPERATION_UPDATE) @Service
public class StrategyReviewSceneChangeUpdate implements StrategyReviewSceneChange { public class StrategyReviewSceneChangeUpdate implements StrategyReviewSceneChange, InitializingBean {
@Autowired
private StrategyReviewSceneChangeContext strategyReviewSceneChangeContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired @Autowired
private ReviewSceneService reviewSceneService; private ReviewSceneService reviewSceneService;
...@@ -22,4 +30,9 @@ public class StrategyReviewSceneChangeUpdate implements StrategyReviewSceneChang ...@@ -22,4 +30,9 @@ public class StrategyReviewSceneChangeUpdate implements StrategyReviewSceneChang
reviewSceneService.updateById(reviewScene); reviewSceneService.updateById(reviewScene);
} }
@Override
public void afterPropertiesSet() throws Exception {
strategyReviewSceneChangeContext.putResource(ReviewSceneChangeTask.OPERATION_UPDATE, applicationContext.getBean(this.getClass()));
}
} }
...@@ -5,12 +5,20 @@ import com.ruoyi.common.exception.ServiceException; ...@@ -5,12 +5,20 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.SystemReviewTask; import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.StrategySystemReviewTask; import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Transactional @Transactional
@Service(SystemReviewTask.STATUS_CLOSE) @Service
public class StrategySystemReviewTaskClose implements StrategySystemReviewTask { public class StrategySystemReviewTaskClose implements StrategySystemReviewTask, InitializingBean {
@Autowired
private StrategySystemReviewTaskContext strategySystemReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Override @Override
public void doStart(SystemReviewTask systemReviewTask) { public void doStart(SystemReviewTask systemReviewTask) {
...@@ -39,4 +47,9 @@ public class StrategySystemReviewTaskClose implements StrategySystemReviewTask { ...@@ -39,4 +47,9 @@ public class StrategySystemReviewTaskClose implements StrategySystemReviewTask {
return response; return response;
} }
@Override
public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_CLOSE, applicationContext.getBean(this.getClass()));
}
} }
...@@ -15,9 +15,8 @@ public class StrategySystemReviewTaskContext { ...@@ -15,9 +15,8 @@ public class StrategySystemReviewTaskContext {
@Autowired @Autowired
private final Map<String, StrategySystemReviewTask> resourceMap = new ConcurrentHashMap<>(); private final Map<String, StrategySystemReviewTask> resourceMap = new ConcurrentHashMap<>();
public StrategySystemReviewTaskContext(Map<String, StrategySystemReviewTask> strategyMap) { public void putResource(String key, StrategySystemReviewTask strategySystemReviewTask) {
this.resourceMap.clear(); resourceMap.put(key, strategySystemReviewTask);
strategyMap.forEach(resourceMap::put);
} }
public StrategySystemReviewTask getResource(String operation){ public StrategySystemReviewTask getResource(String operation){
......
...@@ -5,12 +5,20 @@ import com.ruoyi.common.exception.ServiceException; ...@@ -5,12 +5,20 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.SystemReviewTask; import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.StrategySystemReviewTask; import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Transactional @Transactional
@Service(SystemReviewTask.STATUS_FINISH) @Service
public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask { public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask, InitializingBean {
@Autowired
private StrategySystemReviewTaskContext strategySystemReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Override @Override
public void doStart(SystemReviewTask systemReviewTask) { public void doStart(SystemReviewTask systemReviewTask) {
...@@ -39,4 +47,9 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask ...@@ -39,4 +47,9 @@ public class StrategySystemReviewTaskFinish implements StrategySystemReviewTask
return response; return response;
} }
@Override
public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_FINISH, applicationContext.getBean(this.getClass()));
}
} }
...@@ -8,7 +8,9 @@ import com.ruoyi.mapper.SystemReviewTaskMapper; ...@@ -8,7 +8,9 @@ import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.ReviewStandardService; import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.service.StrategySystemReviewTask; import com.ruoyi.service.StrategySystemReviewTask;
import com.ruoyi.web.response.SystemReviewTaskViewResponse; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -16,8 +18,13 @@ import java.util.Date; ...@@ -16,8 +18,13 @@ import java.util.Date;
import java.util.List; import java.util.List;
@Transactional @Transactional
@Service(SystemReviewTask.STATUS_NEW) @Service
public class StrategySystemReviewTaskNew implements StrategySystemReviewTask { public class StrategySystemReviewTaskNew implements StrategySystemReviewTask, InitializingBean {
@Autowired
private StrategySystemReviewTaskContext strategySystemReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired @Autowired
private ReviewStandardService reviewStandardService; private ReviewStandardService reviewStandardService;
...@@ -63,4 +70,9 @@ public class StrategySystemReviewTaskNew implements StrategySystemReviewTask { ...@@ -63,4 +70,9 @@ public class StrategySystemReviewTaskNew implements StrategySystemReviewTask {
return response; return response;
} }
@Override
public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_NEW, applicationContext.getBean(this.getClass()));
}
} }
...@@ -9,7 +9,9 @@ import com.ruoyi.mapper.ReviewDetailsResultMapper; ...@@ -9,7 +9,9 @@ import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper; import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.web.response.SystemReviewTaskViewResponse; import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -20,8 +22,13 @@ import java.util.function.Function; ...@@ -20,8 +22,13 @@ import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Transactional @Transactional
@Service(SystemReviewTask.STATUS_PENDING + "SystemReviewTask") @Service
public class StrategySystemReviewTaskPending implements StrategySystemReviewTask { public class StrategySystemReviewTaskPending implements StrategySystemReviewTask, InitializingBean {
@Autowired
private StrategySystemReviewTaskContext strategySystemReviewTaskContext;
@Autowired
private ApplicationContext applicationContext;
@Autowired @Autowired
private ReviewStandardService reviewStandardService; private ReviewStandardService reviewStandardService;
...@@ -38,7 +45,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -38,7 +45,6 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired @Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper; private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Override @Override
public void doStart(SystemReviewTask systemReviewTask) { public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR); throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR);
...@@ -130,4 +136,9 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -130,4 +136,9 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
} }
} }
} }
@Override
public void afterPropertiesSet() throws Exception {
strategySystemReviewTaskContext.putResource(SystemReviewTask.STATUS_PENDING, applicationContext.getBean(this.getClass()));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment