|
|
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
@@ -27,6 +26,7 @@ import org.springblade.salesPart.excel.CorpsImportBrandExcel;
|
|
|
import org.springblade.salesPart.excel.SupplierImportExcel;
|
|
|
import org.springblade.salesPart.order.mapper.OrderMapper;
|
|
|
import org.springblade.salesPart.storage.service.IStorageDescService;
|
|
|
+import org.springblade.salesPart.util.ParameterUtils;
|
|
|
import org.springblade.salesPart.vo.CorpsDescVO;
|
|
|
import org.springblade.system.entity.Dept;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
@@ -93,7 +93,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
desc.setCorpsAddrList(corpsAddrService.list(new QueryWrapper<PjCorpsAddr>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
//获取客户附件
|
|
|
desc.setCorpsFilesList(corpsFilesService.list(new QueryWrapper<PjCorpsFiles>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
- if(org.springframework.util.StringUtils.hasText(desc.getResourceWarehouse())) {
|
|
|
+ if (org.springframework.util.StringUtils.hasText(desc.getResourceWarehouse())) {
|
|
|
desc.setResourceWarehouseList(JSONArray.parseArray(desc.getResourceWarehouse(), Long.class));
|
|
|
}
|
|
|
//获取客户类别
|
|
|
@@ -191,7 +191,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
.eq(PjCorpsDesc::getSalesCompanyId, AuthUtil.getTenantId())
|
|
|
.eq(PjCorpsDesc::getCname, corpsDesc.getCname()));
|
|
|
//保存客户信息
|
|
|
- if(!org.springframework.util.CollectionUtils.isEmpty(corpsDesc.getResourceWarehouseList())) {
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(corpsDesc.getResourceWarehouseList())) {
|
|
|
corpsDesc.setResourceWarehouse(JSONArray.toJSONString(corpsDesc.getResourceWarehouseList()));
|
|
|
}
|
|
|
if (corpsDesc.getId() == null) {
|
|
|
@@ -215,8 +215,21 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
corpsDesc.setUpdateTime(date);
|
|
|
corpsDesc.setCreateDept(Long.valueOf(SecureUtil.getDeptId()));
|
|
|
corpsDesc.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ String status = sysClient.getParamServiceDWT("whether.branch.management", AuthUtil.getTenantId());
|
|
|
+ if ("1".equals(status)) {
|
|
|
+ PjCorpsDesc desc = baseMapper.selectById(corpsDesc.getId());
|
|
|
+ if (!corpsDesc.getDeliveryWarehouseId().equals(desc.getDeliveryWarehouseId()) &&
|
|
|
+ ObjectUtils.isNotNull(corpsDesc.getCorpsAttnList()) && !corpsDesc.getCorpsAttnList().isEmpty()) {
|
|
|
+ String userIds = "";
|
|
|
+ for (PjCorpsAttn item : corpsDesc.getCorpsAttnList()) {
|
|
|
+ userIds = userIds+item.getUserId() + ",";
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(userIds)) {
|
|
|
+ userClient.updateUserStorageId(userIds.substring(0, userIds.length() - 1), corpsDesc.getDeliveryWarehouseId(), corpsDesc.getDeliveryWarehouseName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
baseMapper.updateById(corpsDesc);
|
|
|
-
|
|
|
/*List<PjOrder> orderList = orderMapper.selectList(new LambdaQueryWrapper<PjOrder>()
|
|
|
.eq(PjOrder::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PjOrder::getIsDeleted, 0)
|
|
|
@@ -440,7 +453,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
saveUser.setRoleId("");
|
|
|
}
|
|
|
saveUser.setPassword("123456");
|
|
|
- saveUser.setStorageId(corpsDesc.getDeliveryWarehouseId()+"");
|
|
|
+ saveUser.setStorageId(corpsDesc.getDeliveryWarehouseId() + "");
|
|
|
saveUser.setStorageName(corpsDesc.getDeliveryWarehouseName());
|
|
|
R<Boolean> result = userClient.saveUser(saveUser);
|
|
|
if (!result.isSuccess()) {
|
|
|
@@ -910,7 +923,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
saveUser.setRoleId("");
|
|
|
}
|
|
|
saveUser.setPassword("123456");
|
|
|
- saveUser.setStorageId(corpsDesc.getDeliveryWarehouseId()+"");
|
|
|
+ saveUser.setStorageId(corpsDesc.getDeliveryWarehouseId() + "");
|
|
|
saveUser.setStorageName(corpsDesc.getDeliveryWarehouseName());
|
|
|
R<Boolean> result = userClient.saveUser(saveUser);
|
|
|
if (!result.isSuccess()) {
|
|
|
@@ -963,7 +976,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
throw new RuntimeException("手机号已存在,提交失败");
|
|
|
}
|
|
|
corpsAttn.setUserId(user.getId());
|
|
|
- user.setStorageId(corpsDesc.getDeliveryWarehouseId()+"");
|
|
|
+ user.setStorageId(corpsDesc.getDeliveryWarehouseId() + "");
|
|
|
user.setStorageName(corpsDesc.getDeliveryWarehouseName());
|
|
|
userClient.updateUser(user);
|
|
|
}
|
|
|
@@ -1038,6 +1051,13 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
corpsAttn.setSalesCompanyId(deptId);
|
|
|
corpsAttn.setSalesCompanyName(deptName);
|
|
|
corpsAttnService.updateById(corpsAttn);
|
|
|
+ if (ParameterUtils.whetherDatabaseSharding()) {
|
|
|
+ PjCorpsDesc desc = baseMapper.selectById(corpsDesc.getId());
|
|
|
+ if (!corpsDesc.getDeliveryWarehouseId().equals(desc.getDeliveryWarehouseId()) &&
|
|
|
+ ObjectUtils.isNotNull(corpsDesc.getCorpsAttnList()) && !corpsDesc.getCorpsAttnList().isEmpty()) {
|
|
|
+ userClient.updateUserStorageId(user.getId() + "", corpsDesc.getDeliveryWarehouseId(), corpsDesc.getDeliveryWarehouseName());
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
if (!corpsAttnList.isEmpty()) {
|
|
|
throw new RuntimeException("客户" + corpsDesc.getTel() + "已存在,请勿重复添加!");
|
|
|
@@ -1277,7 +1297,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
|
|
|
if (ObjectUtils.isNotNull(user)) {
|
|
|
corpsAttn.setUserId(user.getId());
|
|
|
- user.setStorageId(pjCorpsDesc.getDeliveryWarehouseId()+"");
|
|
|
+ user.setStorageId(pjCorpsDesc.getDeliveryWarehouseId() + "");
|
|
|
user.setStorageName(pjCorpsDesc.getDeliveryWarehouseName());
|
|
|
userClient.updateUser(user);
|
|
|
}
|
|
|
@@ -1295,7 +1315,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
User user = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), resDept.getData().getAppletsId());
|
|
|
if (ObjectUtils.isNotNull(user)) {
|
|
|
corpsAttn1.setUserId(user.getId());
|
|
|
- user.setStorageId(pjCorpsDesc.getDeliveryWarehouseId()+"");
|
|
|
+ user.setStorageId(pjCorpsDesc.getDeliveryWarehouseId() + "");
|
|
|
user.setStorageName(pjCorpsDesc.getDeliveryWarehouseName());
|
|
|
userClient.updateUser(user);
|
|
|
}
|
|
|
@@ -1377,8 +1397,8 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
throw new RuntimeException("手机号已存在,提交失败");
|
|
|
}
|
|
|
corpsAttn.setUserId(user.getId());
|
|
|
- user.setStorageId(pjCorpsDesc.getDeliveryWarehouseId()+"");
|
|
|
- user.setStorageName(pjCorpsDesc.getDeliveryWarehouseName());
|
|
|
+ user.setStorageId(corpsDesc.getDeliveryWarehouseId() + "");
|
|
|
+ user.setStorageName(corpsDesc.getDeliveryWarehouseName());
|
|
|
userClient.updateUser(user);
|
|
|
}
|
|
|
corpsAttn.setCname(corpsDesc.getAttn());
|