|
|
@@ -534,8 +534,14 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
for (UserBaseInfo user : userList) {
|
|
|
Long userUU = user.getUserUU();
|
|
|
VendorDistribute distribute = new VendorDistribute();
|
|
|
+ List<VendorDistribute> distributes = vendorDistributeDao.findByUserUUAndVendorId(userUU, id);
|
|
|
+ // 根据前端选择是否分配判断
|
|
|
if (user.isDistribute()) {
|
|
|
- List<VendorDistribute> distributes = vendorDistributeDao.findByUserUUAndVendorId(userUU, id);
|
|
|
+ /*
|
|
|
+ * 判断是否已存在分配关系
|
|
|
+ * 1、 不存在新增
|
|
|
+ * 2、 存在判断绑定状态,不为1的时候设置为1,更新,状态为1不处理
|
|
|
+ */
|
|
|
if (CollectionUtils.isEmpty(distributes)) {
|
|
|
distribute.setUserUU(userUU);
|
|
|
distribute.setVendorId(id);
|
|
|
@@ -543,11 +549,12 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
needSaveOrUpdateList.add(distribute);
|
|
|
} else {
|
|
|
distribute = distributes.get(0);
|
|
|
- distribute.setDistribute(Constant.YES);
|
|
|
- needSaveOrUpdateList.add(distribute);
|
|
|
+ if (null == distribute.getDistribute() || Constant.NO == distribute.getDistribute()) {
|
|
|
+ distribute.setDistribute(Constant.YES);
|
|
|
+ needSaveOrUpdateList.add(distribute);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- List<VendorDistribute> distributes = vendorDistributeDao.findByUserUUAndVendorId(userUU, id);
|
|
|
if (!CollectionUtils.isEmpty(distributes)) {
|
|
|
/*
|
|
|
* 判断分配和权限转移关系
|