|
@@ -311,8 +311,6 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
|
|
|
if(productOrder == null){
|
|
|
successAddCooperation(numList,users,param.getLang(),loginUser,param.getSceneType());
|
|
|
- }else {
|
|
|
- productCooperationService.add(productOrder,users,numList,null);
|
|
|
}
|
|
|
return productOrder;
|
|
|
|
|
@@ -356,8 +354,6 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
if(productOrder == null){
|
|
|
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());
|
|
|
}
|
|
|
|
|
|
return productOrder;
|
|
@@ -373,7 +369,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void successAddCooperation(List<String> numList,List<Long> userIds,Long loginUserId,Long cameraId,String lang,String sceneType){
|
|
|
+ public void successAddCooperation(List<String> numList,List<Long> userIds,Long loginUserId,Long cameraId,String lang,String sceneType,List<ProductCooperation> needPay ){
|
|
|
//this.deleteCooperationList(numList,userIds);
|
|
|
List<ScenePro> proList = sceneProService.getListByNums(numList);
|
|
|
List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
|
|
@@ -386,12 +382,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}else {
|
|
|
saveCooperationCommon(user,lang,users,proList,plusList,null,"scene",sceneType);
|
|
|
}
|
|
|
- if(StringUtils.isBlank(sceneType)){
|
|
|
- sceneCooperationCountService.saveCount(numList,userIds.size(),"mesh","camera");
|
|
|
- sceneCooperationCountService.saveCount(numList,userIds.size(),"laser","camera");
|
|
|
- }else {
|
|
|
- sceneCooperationCountService.saveCount(numList,userIds.size(),sceneType,"scene");
|
|
|
- }
|
|
|
+ sceneCooperationCountService.saveCount(needPay,userIds.size());
|
|
|
|
|
|
}
|
|
|
|
|
@@ -405,27 +396,27 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
|
|
|
|
|
|
private ProductOrder checkNeedPay(List<String> numList, List<User> users,User loginUser,Integer payType,Integer timeZone,Long cameraId,String lang,String sceneType) {
|
|
|
- Integer totalCount = 0;
|
|
|
+ HashSet<String> needNumListMesh =new HashSet<>();
|
|
|
+ HashSet<String> needNumListLaser =new HashSet<>();
|
|
|
if(StringUtils.isBlank(sceneType)){
|
|
|
- totalCount += getTotalCount(numList,users,"mesh",cameraId);
|
|
|
- totalCount += getTotalCount(numList,users,"laser",cameraId);
|
|
|
+ needNumListMesh = getTotalCount(numList,users,"mesh",cameraId);
|
|
|
+ needNumListLaser = getTotalCount(numList,users,"laser",cameraId);
|
|
|
}else {
|
|
|
- totalCount += getTotalCount(numList,users,sceneType,cameraId);
|
|
|
+ needNumListMesh = getTotalCount(numList,users,sceneType,cameraId);
|
|
|
}
|
|
|
- if(totalCount <=0){
|
|
|
- return null;
|
|
|
- }
|
|
|
- return productOrderService.createOrder(totalCount, "cooperation", loginUser, payType, timeZone,cameraId,lang,sceneType);
|
|
|
+ ProductOrder productOrder = productOrderService.createOrder(needNumListMesh.size() + needNumListLaser.size(), "cooperation", loginUser, payType, timeZone, cameraId, lang, sceneType);
|
|
|
+ productCooperationService.add(productOrder,users,numList,needNumListMesh,needNumListLaser,sceneType);
|
|
|
+ return productOrder;
|
|
|
|
|
|
}
|
|
|
|
|
|
- private Integer getTotalCount(List<String> numList, List<User> users,String sceneType,Long cameraId){
|
|
|
+ private HashSet<String> getTotalCount(List<String> numList, List<User> users,String sceneType,Long cameraId){
|
|
|
List<SceneCooperationCount> freeCountList = sceneCooperationCountService.getByNumList(numList,sceneType);
|
|
|
HashMap<String,Integer> freeMap = new HashMap<>();
|
|
|
freeCountList.forEach(e -> freeMap.put(e.getNum(),e.getCount()));
|
|
|
|
|
|
HashMap<String, List<User>> map = this.getByNumList(numList,sceneType);
|
|
|
- Integer totalCount = 0;
|
|
|
+ HashSet<String> needNumList = new HashSet<>();
|
|
|
for (String num : numList) {
|
|
|
Integer freeCount = freeMap.get(num) == null ? 1 :freeMap.get(num);
|
|
|
|
|
@@ -438,10 +429,12 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- totalCount += (users.size() - freeCount );
|
|
|
+ if(users.size() - freeCount >0){
|
|
|
+ needNumList.add(num);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
- return totalCount;
|
|
|
+ return needNumList;
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@@ -565,14 +558,12 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public SceneCooperation getByNum(String num) {
|
|
|
+ public List<SceneCooperation> getByNum(String num,String sceneType) {
|
|
|
LambdaQueryWrapper<SceneCooperation> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(SceneCooperation::getSceneNum,num);
|
|
|
+ wrapper.eq(SceneCooperation::getSceneType,sceneType);
|
|
|
List<SceneCooperation> list = this.list(wrapper);
|
|
|
- if(list == null || list.size() <=0){
|
|
|
- return null;
|
|
|
- }
|
|
|
- return list.get(0);
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
@Override
|