|
@@ -111,7 +111,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<SceneCooperation> saveBatchByList(List<String> numList, List<Long> userIds,String type) {
|
|
|
+ public List<SceneCooperation> saveBatchByList(List<String> numList, List<Long> userIds,String type,String sceneType) {
|
|
|
List<SceneCooperation> list = new ArrayList<>();
|
|
|
List<String> delList = new ArrayList<>();
|
|
|
|
|
@@ -138,6 +138,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
SceneCooperation sceneCooperationEntity = new SceneCooperation();
|
|
|
sceneCooperationEntity.setUserId(userId);
|
|
|
sceneCooperationEntity.setSceneNum(num);
|
|
|
+ sceneCooperationEntity.setSceneType(sceneType);
|
|
|
sceneCooperationEntity.setRecStatus("A");
|
|
|
sceneCooperationEntity.setCreateTime(DateUserUtil.getDate(new Date()));
|
|
|
sceneCooperationEntity.setUpdateTime(DateUserUtil.getDate(new Date()));
|
|
@@ -272,7 +273,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
|
//this.deleteCooperationList(proList,plusList,Arrays.asList(user.getId()));
|
|
|
|
|
|
- saveCooperationCommon(loginUser,param.getLang(),Arrays.asList(user),proList,plusList,null,"scene");
|
|
|
+ saveCooperationCommon(loginUser,param.getLang(),Arrays.asList(user),proList,plusList,null,"scene","mesh");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -306,10 +307,10 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
|
|
|
|
|
|
- ProductOrder productOrder = checkNeedPay(numList, users, loginUser, param.getPayType(), param.getTimeZone(),null,param.getLang());
|
|
|
+ ProductOrder productOrder = checkNeedPay(numList, users, loginUser, param.getPayType(), param.getTimeZone(),null,param.getLang(),param.getSceneType());
|
|
|
|
|
|
if(productOrder == null){
|
|
|
- successAddCooperation(numList,users,param.getLang(),loginUser);
|
|
|
+ successAddCooperation(numList,users,param.getLang(),loginUser,param.getSceneType());
|
|
|
}else {
|
|
|
productCooperationService.add(productOrder,users,numList,null);
|
|
|
}
|
|
@@ -351,9 +352,9 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
allList.addAll(v3NumList);
|
|
|
allList.addAll(v4NumList);
|
|
|
|
|
|
- ProductOrder productOrder = checkNeedPay(allList, Arrays.asList(user), loginUser, param.getPayType(), param.getTimeZone(),param.getCameraId(),param.getLang());
|
|
|
+ ProductOrder productOrder = checkNeedPay(allList, Arrays.asList(user), loginUser, param.getPayType(), param.getTimeZone(),param.getCameraId(),param.getLang(),null);
|
|
|
if(productOrder == null){
|
|
|
- successAddCooperation(v3List,v4List,Arrays.asList(user),param.getLang(),loginUser,Arrays.asList(camera));
|
|
|
+ successAddCooperation(v3List,v4List,Arrays.asList(user),param.getLang(),loginUser,Arrays.asList(camera),null);
|
|
|
cameraDetailService.updateCooperationByIds(Arrays.asList(param.getCameraId()),user.getId());
|
|
|
}else {
|
|
|
productCooperationService.add(productOrder,Arrays.asList(user),allList,param.getCameraId());
|
|
@@ -362,17 +363,17 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
return productOrder;
|
|
|
}
|
|
|
|
|
|
- private void successAddCooperation(List<String> numList, List<User> users, String lang, User loginUser){
|
|
|
+ private void successAddCooperation(List<String> numList, List<User> users, String lang, User loginUser,String sceneType){
|
|
|
List<ScenePro> proList = sceneProService.getListByNums(numList);
|
|
|
List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
|
List<Long> userIds = users.stream().map(User::getId).collect(Collectors.toList());
|
|
|
//this.deleteCooperationList(proList,plusList,userIds);
|
|
|
|
|
|
- saveCooperationCommon(loginUser,lang,users,proList,plusList,null,"scene");
|
|
|
+ saveCooperationCommon(loginUser,lang,users,proList,plusList,null,"scene",sceneType);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void successAddCooperation(List<String> numList,List<Long> userIds,Long loginUserId,Long cameraId,String lang){
|
|
|
+ public void successAddCooperation(List<String> numList,List<Long> userIds,Long loginUserId,Long cameraId,String lang,String sceneType){
|
|
|
//this.deleteCooperationList(numList,userIds);
|
|
|
List<ScenePro> proList = sceneProService.getListByNums(numList);
|
|
|
List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
@@ -380,27 +381,26 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
User user = userService.getById(loginUserId);
|
|
|
if(cameraId != null ){
|
|
|
Camera camera = cameraService.getById(cameraId);
|
|
|
- saveCooperationCommon(user,lang,users,proList,plusList,Arrays.asList(camera),"camera");
|
|
|
+ saveCooperationCommon(user,lang,users,proList,plusList,Arrays.asList(camera),"camera",sceneType);
|
|
|
cameraDetailService.updateCooperationByIds(Arrays.asList(cameraId),userIds.get(0));
|
|
|
}else {
|
|
|
- saveCooperationCommon(user,lang,users,proList,plusList,null,"scene");
|
|
|
-
|
|
|
+ saveCooperationCommon(user,lang,users,proList,plusList,null,"scene",sceneType);
|
|
|
}
|
|
|
- sceneCooperationCountService.saveCount(numList,userIds.size());
|
|
|
+ sceneCooperationCountService.saveCount(numList,userIds.size(),sceneType);
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void successAddCooperation(List<ScenePro> v3List,List<ScenePlus> v4List,List<User> users,String lang,User loginUser,List<Camera>cameraList){
|
|
|
+ private void successAddCooperation(List<ScenePro> v3List,List<ScenePlus> v4List,List<User> users,String lang,User loginUser,List<Camera>cameraList,String sceneType){
|
|
|
List<Long> userIds = users.stream().map(User::getId).collect(Collectors.toList());
|
|
|
//this.deleteCooperationList(v3List,v4List,userIds);
|
|
|
- saveCooperationCommon(loginUser,lang,users,v3List,v4List,cameraList,"camera");
|
|
|
+ saveCooperationCommon(loginUser,lang,users,v3List,v4List,cameraList,"camera",sceneType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- private ProductOrder checkNeedPay(List<String> numList, List<User> users,User loginUser,Integer payType,Integer timeZone,Long cameraId,String lang) {
|
|
|
- List<SceneCooperationCount> freeCountList = sceneCooperationCountService.getByNumList(numList);
|
|
|
+ private ProductOrder checkNeedPay(List<String> numList, List<User> users,User loginUser,Integer payType,Integer timeZone,Long cameraId,String lang,String sceneType) {
|
|
|
+ List<SceneCooperationCount> freeCountList = sceneCooperationCountService.getByNumList(numList,sceneType);
|
|
|
HashMap<String,Integer> freeMap = new HashMap<>();
|
|
|
freeCountList.forEach(e -> freeMap.put(e.getNum(),e.getCount()));
|
|
|
|
|
@@ -424,14 +424,14 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
if(totalCount <=0){
|
|
|
return null;
|
|
|
}
|
|
|
- return productOrderService.createOrder(totalCount, "cooperation", loginUser, payType, timeZone,cameraId,lang);
|
|
|
+ return productOrderService.createOrder(totalCount, "cooperation", loginUser, payType, timeZone,cameraId,lang,sceneType);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
LaserService laserService;
|
|
|
|
|
|
- private void saveCooperationCommon(User LoginUser,String lang,List<User> userList,List<ScenePro> proList, List<ScenePlus> plusList,List<Camera >cameraList,String type){
|
|
|
+ private void saveCooperationCommon(User LoginUser,String lang,List<User> userList,List<ScenePro> proList, List<ScenePlus> plusList,List<Camera >cameraList,String type,String sceneType){
|
|
|
|
|
|
List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
Set<String> numList = new HashSet<>();
|
|
@@ -439,9 +439,22 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
List<String> v4List = plusList.stream().map(ScenePlus::getNum).collect(Collectors.toList());
|
|
|
numList.addAll(v3List);
|
|
|
numList.addAll(v4List);
|
|
|
+
|
|
|
+ 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());
|
|
|
+ Set<String> numList1 = collect1.stream().map(ScenePro::getNum).collect(Collectors.toSet());
|
|
|
+ Set<String> numList2 = collect2.stream().map(ScenePlus::getNum).collect(Collectors.toSet());
|
|
|
+ numList1.addAll(numList2);
|
|
|
+
|
|
|
+
|
|
|
List<SceneCooperation> addList =new ArrayList<>();
|
|
|
if( !numList.isEmpty()){
|
|
|
- addList = this.saveBatchByList(new ArrayList<>(numList), userIds, type);
|
|
|
+ if(StringUtils.isBlank(sceneType)){
|
|
|
+ addList = this.saveBatchByList(new ArrayList<>(numList), userIds, type,"mesh");
|
|
|
+ if(!numList1.isEmpty()){
|
|
|
+ this.saveBatchByList(new ArrayList<>(numList1), userIds, type,"laser");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
List<Long> collect3 = addList.stream().map(SceneCooperation::getUserId).collect(Collectors.toList());
|
|
|
for (User user : userList) {
|
|
@@ -457,18 +470,16 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- 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());
|
|
|
- Set<String> numList1 = collect1.stream().map(ScenePro::getNum).collect(Collectors.toSet());
|
|
|
- Set<String> numList2 = collect2.stream().map(ScenePlus::getNum).collect(Collectors.toSet());
|
|
|
- numList1.addAll(numList2);
|
|
|
+
|
|
|
|
|
|
List<String> collect = userList.stream().map(User::getUserName).collect(Collectors.toList());
|
|
|
List<String> snCodeList = new ArrayList<>();
|
|
|
if(cameraList !=null ){
|
|
|
snCodeList = cameraList.stream().map(Camera::getSnCode).collect(Collectors.toList());
|
|
|
}
|
|
|
- laserService.saveBatchCooperation(new ArrayList<>(numList1),snCodeList,LoginUser.getUserName(),collect,type);
|
|
|
+ if(StringUtils.isNotBlank(sceneType) || "laser".equals(sceneType)){
|
|
|
+ laserService.saveBatchCooperation(new ArrayList<>(numList1),snCodeList,LoginUser.getUserName(),collect,type);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|