|
|
@@ -521,14 +521,14 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
* @return 分配结果 成功或失败
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean bindVendorToUser(Long id, List<User> userList) {
|
|
|
+ public boolean bindVendorToUser(Long id, List<UserBaseInfo> userList) {
|
|
|
if (!CollectionUtils.isEmpty(userList)) {
|
|
|
List<VendorDistribute> needSaveOrUpdateList = new ArrayList<>();
|
|
|
List<VendorDistribute> needDeleteList = new ArrayList<>();
|
|
|
- for (User user : userList) {
|
|
|
+ for (UserBaseInfo user : userList) {
|
|
|
Long userUU = user.getUserUU();
|
|
|
VendorDistribute distribute = new VendorDistribute();
|
|
|
- if (user.getDistribute()) {
|
|
|
+ if (user.isDistribute()) {
|
|
|
List<VendorDistribute> distributes = vendorDistributeDao.findByUserUUAndVendorId(userUU, id);
|
|
|
if (CollectionUtils.isEmpty(distributes)) {
|
|
|
distribute.setUserUU(userUU);
|
|
|
@@ -577,15 +577,15 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
* @return 转移结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean transferVendorToUser(Long id, List<User> users) throws IllegalAccessException {
|
|
|
+ public boolean transferVendorToUser(Long id, List<UserBaseInfo> users) throws IllegalAccessException {
|
|
|
Vendor vendor = vendorDao.findOne(id);
|
|
|
if (!CollectionUtils.isEmpty(users)) {
|
|
|
List<VendorDistribute> saveList = new ArrayList<>();
|
|
|
- for (User u : users) {
|
|
|
+ for (UserBaseInfo u : users) {
|
|
|
if (null != u.getUserUU()) {
|
|
|
VendorDistribute distribute = new VendorDistribute();
|
|
|
List<VendorDistribute> distributes = vendorDistributeDao.findByUserUUAndVendorId(u.getUserUU(), vendor.getId());
|
|
|
- if (u.getTransfer()) {
|
|
|
+ if (u.isTransfer()) {
|
|
|
if (CollectionUtils.isEmpty(distributes)) {
|
|
|
distribute.setUserUU(u.getUserUU());
|
|
|
distribute.setVendorId(vendor.getId());
|
|
|
@@ -653,30 +653,6 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 删除用户的所有关联节点
|
|
|
- * @param vendorId 供应商关系id
|
|
|
- * @param userUU 用户UU
|
|
|
- * @param deleteList 删除idList
|
|
|
- * @return
|
|
|
- */
|
|
|
- private List<VendorDistribute> deleteChildrenDistributes(Long vendorId, Long userUU, List<VendorDistribute> deleteList) {
|
|
|
- // 删除时,同时删除被其分配权限的其他用户
|
|
|
- List<VendorDistribute> distributes = vendorDistributeDao.findByVendorIdAndLeaderUU(vendorId, userUU);
|
|
|
- List<VendorDistribute> vendorDistributes = new ArrayList<>();
|
|
|
- if (!CollectionUtils.isEmpty(distributes)) {
|
|
|
- deleteList.addAll(distributes);
|
|
|
- // 被删除用户拥有转移权限时,继续删除其子节点
|
|
|
- for (VendorDistribute distribute : distributes) {
|
|
|
- if (null != distribute.getIsTransfer() && 1 == distribute.getIsTransfer()) {
|
|
|
- distribute.setIsTransfer(Constant.NO);
|
|
|
- vendorDistributes.add(distribute);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return deleteList;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 通过供应商UU查询供应商分配信息
|
|
|
*
|