|
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
@@ -31,6 +32,7 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Service实现类
|
|
@@ -365,16 +367,21 @@ public class BrandServiceImpl implements BrandService {
|
|
|
return brandEntity;
|
|
|
}
|
|
|
//{brandId: 1, canShow: 0, type: -1, userId: "1"}
|
|
|
- public void bindUsers(List<BrandBindUserVo> brandBindUserVoList) {
|
|
|
- brandBindUserVoList.parallelStream().filter(vo -> !ObjectUtils.isEmpty(vo.getType())).forEach(vo -> {
|
|
|
- //绑定或者修改带看权限
|
|
|
- if (vo.getType().compareTo(1) == 0) {
|
|
|
- bindUser(vo.getUserId(), vo.getBrandId(), vo.getCanShow());
|
|
|
- } else {
|
|
|
- unbindUser(vo.getUserId(), vo.getBrandId());
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
+ public void bindUsers(Integer brandId,List<BrandBindUserVo> brandBindUserVoList) {
|
|
|
+ List<Long> userIdList = brandBindUserVoList.stream().map(BrandBindUserVo::getUserId).collect(Collectors.toList());
|
|
|
+ mySysUserBrandService.unbindUserByBrandId(brandId,userIdList);
|
|
|
+ for (BrandBindUserVo vo : brandBindUserVoList) {
|
|
|
+ bindUser(vo.getUserId(), vo.getBrandId(), vo.getCanShow());
|
|
|
+ }
|
|
|
+// brandBindUserVoList.parallelStream().filter(vo -> !ObjectUtils.isEmpty(vo.getType())).forEach(vo -> {
|
|
|
+// //绑定或者修改带看权限
|
|
|
+// if (vo.getType().compareTo(1) == 0) {
|
|
|
+// bindUser(vo.getUserId(), vo.getBrandId(), vo.getCanShow());
|
|
|
+// } else {
|
|
|
+// unbindUser(vo.getUserId(), vo.getBrandId());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// );
|
|
|
}
|
|
|
|
|
|
public void bindUser(Long userId,Integer brandId,Integer canShow) {
|