|
@@ -7,6 +7,7 @@ import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.ucenter.common.PageInfo;
|
|
|
import com.fdkankan.ucenter.common.RedisKeyUtil;
|
|
|
+import com.fdkankan.ucenter.common.SceneSourceUtil;
|
|
|
import com.fdkankan.ucenter.common.constants.NacosProperty;
|
|
|
import com.fdkankan.ucenter.constant.LoginConstant;
|
|
|
import com.fdkankan.ucenter.entity.*;
|
|
@@ -115,23 +116,6 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
this.saveBatch(list);
|
|
|
|
|
|
- if(resourceIdList.size() >0){
|
|
|
- List<SceneResourceCooperation> resourceCooperationList = new ArrayList<>();
|
|
|
- for (SceneCooperation sceneCooperation : list) {
|
|
|
- for (Long resourceId : resourceIdList) {
|
|
|
- SceneResourceCooperation sceneResourceCooperation = new SceneResourceCooperation();
|
|
|
- sceneResourceCooperation.setSceneResourceId(resourceId);
|
|
|
- sceneResourceCooperation.setSceneCooperationId(sceneCooperation.getId());
|
|
|
- sceneResourceCooperation.setRecStatus("A");
|
|
|
- sceneResourceCooperation.setCreateTime(DateUserUtil.getDate(new Date()));
|
|
|
- sceneResourceCooperation.setUpdateTime(DateUserUtil.getDate(new Date()));
|
|
|
- resourceCooperationList.add(sceneResourceCooperation);
|
|
|
- }
|
|
|
- }
|
|
|
- if(resourceCooperationList.size() >0){
|
|
|
- sceneResourceCooperationService.saveBatch(resourceCooperationList,10000);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -221,7 +205,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
|
|
|
@Override
|
|
|
public void saveCooperation(SceneCooperationParam param, String username) {
|
|
|
- if(StringUtils.isEmpty(param.getUserName()) || StringUtils.isEmpty(param.getSceneNum()) || StringUtils.isEmpty(param.getResourceIds())){
|
|
|
+ if(StringUtils.isEmpty(param.getUserName()) || StringUtils.isEmpty(param.getSceneNum())){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
if(param.getUserName().equals( username)){
|
|
@@ -231,36 +215,57 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
if(user == null){
|
|
|
throw new BusinessException(LoginConstant.FAILURE_CODE_3021, LoginConstant.FAILURE_MSG_3021);
|
|
|
}
|
|
|
+ saveCooperationCommon(param,Arrays.asList(user));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveBatchCooperation(SceneCooperationParam param, String username) {
|
|
|
+ if(param.getUserNameList() == null || param.getUserNameList().isEmpty() || StringUtils.isEmpty(param.getSceneNum())){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
+ }
|
|
|
+ if(param.getUserName().contains( username)){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3024, LoginConstant.FAILURE_MSG_3024);
|
|
|
+ }
|
|
|
+ List<User> users = new ArrayList<>();
|
|
|
+ for (String userName : param.getUserNameList()) {
|
|
|
+ User user = userService.getByUserName(userName);
|
|
|
+ if(user == null){
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3021, LoginConstant.FAILURE_MSG_3021);
|
|
|
+ }
|
|
|
+ users.add(user);
|
|
|
+ }
|
|
|
String[] nums = param.getSceneNum().split(",");
|
|
|
List<String> numList = Arrays.asList(nums);
|
|
|
List<ScenePro> proList = sceneProService.getListByNums(numList);
|
|
|
List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
|
this.deleteCooperationList(proList,plusList);
|
|
|
|
|
|
- List<SceneResource> v3List = new ArrayList<>();
|
|
|
- List<SceneResource> v4List = new ArrayList<>();
|
|
|
- List<Long> resourceIdList = new ArrayList<>();
|
|
|
- if (StringUtils.isNotEmpty(param.getResourceIds())) {
|
|
|
- for (String rId : param.getResourceIds().split(",")) {
|
|
|
- resourceIdList.add(Long.valueOf(rId));
|
|
|
- }
|
|
|
- List<SceneResource> sceneResources = sceneResourceService.listByIds(resourceIdList);
|
|
|
- v3List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v3")).collect(Collectors.toList());
|
|
|
- v4List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v4")).collect(Collectors.toList());
|
|
|
- }
|
|
|
+ saveCooperationCommon(param,users);
|
|
|
+
|
|
|
+ }
|
|
|
+ @Autowired
|
|
|
+ LaserService laserService;
|
|
|
+
|
|
|
+ private void saveCooperationCommon(SceneCooperationParam param,List<User> user){
|
|
|
|
|
|
- if(!v3List.isEmpty() && !proList.isEmpty()){
|
|
|
- List<Long> v3Ids = v3List.stream().map(SceneResource::getId).collect(Collectors.toList());
|
|
|
- this.saveBatchByList(proList,new ArrayList<>(),user.getId(),v3Ids);
|
|
|
+
|
|
|
+ if( !proList.isEmpty()){
|
|
|
+ this.saveBatchByList(proList,new ArrayList<>(),user.getId(),null);
|
|
|
}
|
|
|
- if(!v4List.isEmpty() && !plusList.isEmpty()){
|
|
|
- List<Long> v4Ids = v4List.stream().map(SceneResource::getId).collect(Collectors.toList());
|
|
|
- this.saveBatchByList(new ArrayList<>(),plusList,user.getId(),v4Ids);
|
|
|
+ if(!plusList.isEmpty()){
|
|
|
+ this.saveBatchByList(new ArrayList<>(),plusList,user.getId(),null);
|
|
|
}
|
|
|
|
|
|
if("aws".equals(NacosProperty.uploadType)){
|
|
|
- mailTemplateService.sendSceneCooperation(proList,plusList,param.getUserName(),param.getLang());
|
|
|
+ mailTemplateService.sendSceneCooperation(proList,plusList,user.getUserName(),param.getLang());
|
|
|
}
|
|
|
+ List<ScenePro> collect1 = proList.stream().filter(e -> SceneSourceUtil.getLaserList().contains(e.getSceneSource())).collect(Collectors.toList());
|
|
|
+ List<ScenePlus> collect2 = plusList.stream().filter(e -> SceneSourceUtil.getLaserList().contains(e.getSceneSource())).collect(Collectors.toList());
|
|
|
+ List<String> numList1 = collect1.stream().map(ScenePro::getNum).collect(Collectors.toList());
|
|
|
+ List<String> numList2 = collect2.stream().map(ScenePlus::getNum).collect(Collectors.toList());
|
|
|
+ numList1.addAll(numList2);
|
|
|
+ laserService.saveBatchCooperation(numList2,param.getUserName(),param.getUserNameList());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|