|
@@ -36,6 +36,11 @@ public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperat
|
|
|
if(needPay == null || needPay.isEmpty() || size <=0){
|
|
|
return;
|
|
|
}
|
|
|
+ HashMap<String,Integer> map = new HashMap<>();
|
|
|
+ for (ProductCooperation productCooperation : needPay) {
|
|
|
+ map.merge(productCooperation.getSceneType(), 1, Integer::sum);
|
|
|
+ }
|
|
|
+
|
|
|
HashSet<String> hashSet = new HashSet<>();
|
|
|
for (ProductCooperation productCooperation : needPay) {
|
|
|
if(hashSet.contains(productCooperation.getNum()+productCooperation.getSceneType())){
|
|
@@ -49,12 +54,12 @@ public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperat
|
|
|
SceneCooperationCount count = new SceneCooperationCount();
|
|
|
count.setSceneType(productCooperation.getSceneType());
|
|
|
count.setNum(num);
|
|
|
- count.setCount( needPay.size() );
|
|
|
+ count.setCount( map.get(productCooperation.getSceneType()));
|
|
|
this.save(count);
|
|
|
}else {
|
|
|
LambdaUpdateWrapper<SceneCooperationCount> wrapper = new LambdaUpdateWrapper<>();
|
|
|
wrapper.eq(SceneCooperationCount::getId,byNum.getId());
|
|
|
- wrapper.set(SceneCooperationCount::getCount, byNum.getCount() + needPay.size());
|
|
|
+ wrapper.set(SceneCooperationCount::getCount, byNum.getCount() + map.get(productCooperation.getSceneType()));
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
}
|