|
|
@ -949,6 +949,40 @@ public class StoreEmployeeService {
|
|
|
|
return bsdResponse.getSuccess();
|
|
|
|
return bsdResponse.getSuccess();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 添加组织 大区
|
|
|
|
|
|
|
|
* @param name 名称
|
|
|
|
|
|
|
|
* @param code 编码
|
|
|
|
|
|
|
|
* @author dexiang.jiang
|
|
|
|
|
|
|
|
* @date 2020/05/20 14:57
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
|
|
public boolean addOrganizationalByRegion(String name, String code) throws KiisooException {
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("name", name);
|
|
|
|
|
|
|
|
map.put("code", code);
|
|
|
|
|
|
|
|
map.put("level", 1);
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> list = retailCompanyMapper.selectByMap(map);
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(list) && list.size() > 0){
|
|
|
|
|
|
|
|
throw new KiisooException(Constants.MSG_ORGANIZATIONAL_HAS, Constants.CODE_ORGANIZATIONAL_HAS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrivilageOrganizational entity = new PrivilageOrganizational();
|
|
|
|
|
|
|
|
entity.setName(name);
|
|
|
|
|
|
|
|
entity.setCode(code);
|
|
|
|
|
|
|
|
entity.setParentId(0L);
|
|
|
|
|
|
|
|
entity.setLevel(1L);
|
|
|
|
|
|
|
|
entity.setStatus(1L);
|
|
|
|
|
|
|
|
entity.setType(1L);
|
|
|
|
|
|
|
|
entity.setCreateBy(Constants.SYS_OPERATION);
|
|
|
|
|
|
|
|
entity.setUpdateBy(Constants.SYS_OPERATION);
|
|
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
entity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
int b = retailCompanyMapper.insert(entity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return b > 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加组织
|
|
|
|
* 添加组织
|
|
|
|
* @param name 名称
|
|
|
|
* @param name 名称
|
|
|
@ -956,6 +990,75 @@ public class StoreEmployeeService {
|
|
|
|
* @author dexiang.jiang
|
|
|
|
* @author dexiang.jiang
|
|
|
|
* @date 2020/05/20 14:57
|
|
|
|
* @date 2020/05/20 14:57
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
|
|
public boolean addOrganizationalByCode(String name, String code, String parentCode, Long level) throws KiisooException {
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("name", name);
|
|
|
|
|
|
|
|
map.put("code", code);
|
|
|
|
|
|
|
|
map.put("level", level);
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> list = retailCompanyMapper.selectByMap(map);
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(list) && list.size() > 0){
|
|
|
|
|
|
|
|
throw new KiisooException(Constants.MSG_ORGANIZATIONAL_HAS, Constants.CODE_ORGANIZATIONAL_HAS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> cMap = new HashMap<>();
|
|
|
|
|
|
|
|
cMap.put("code", parentCode);
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> companyList = retailCompanyMapper.selectByMap(cMap);
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(companyList)){
|
|
|
|
|
|
|
|
throw new KiisooException(Constants.MSG_ORGANIZATIONAL_HAS, Constants.CODE_ORGANIZATIONAL_HAS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrivilageOrganizational item = companyList.get(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrivilageOrganizational entity = new PrivilageOrganizational();
|
|
|
|
|
|
|
|
entity.setName(name);
|
|
|
|
|
|
|
|
entity.setCode(code);
|
|
|
|
|
|
|
|
entity.setParentId(item.getId());
|
|
|
|
|
|
|
|
entity.setLevel(level);
|
|
|
|
|
|
|
|
entity.setStatus(1L);
|
|
|
|
|
|
|
|
entity.setType(1L);
|
|
|
|
|
|
|
|
entity.setCreateBy(Constants.SYS_OPERATION);
|
|
|
|
|
|
|
|
entity.setUpdateBy(Constants.SYS_OPERATION);
|
|
|
|
|
|
|
|
entity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
entity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
int b = retailCompanyMapper.insert(entity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(level == 3){
|
|
|
|
|
|
|
|
//添加客户多了2步骤
|
|
|
|
|
|
|
|
Map<String, Object> domainEntityMap = new HashMap<>();
|
|
|
|
|
|
|
|
domainEntityMap.put("name", name);
|
|
|
|
|
|
|
|
List<PrivilageDomainDO> domainList = privilageDomainDOMapper.selectByMap(domainEntityMap);
|
|
|
|
|
|
|
|
if(domainList.size() > 1){
|
|
|
|
|
|
|
|
throw new KiisooException(Constants.MSG_DOMAIN_ENTITY_HAS, Constants.CODE_DOMAIN_ENTITY_HAS);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//添加域
|
|
|
|
|
|
|
|
PrivilageDomainDO domainEntity = new PrivilageDomainDO();
|
|
|
|
|
|
|
|
domainEntity.setName(name);
|
|
|
|
|
|
|
|
domainEntity.setStatus(1);
|
|
|
|
|
|
|
|
domainEntity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
domainEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
domainEntity.setCreateBy(Constants.SYS_OPERATION);
|
|
|
|
|
|
|
|
domainEntity.setUpdateBy(Constants.SYS_OPERATION);
|
|
|
|
|
|
|
|
int b2 = privilageDomainDOMapper.insert(domainEntity);
|
|
|
|
|
|
|
|
//添加域和组织的关系
|
|
|
|
|
|
|
|
PrivilageOrganizationalDomain orgDomainEntity = new PrivilageOrganizationalDomain();
|
|
|
|
|
|
|
|
orgDomainEntity.setOrgId(entity.getId());
|
|
|
|
|
|
|
|
orgDomainEntity.setDomainId(domainEntity.getId());
|
|
|
|
|
|
|
|
int b3 = privilageOrganizationalDomainMapper.insert(orgDomainEntity);
|
|
|
|
|
|
|
|
return (b + b2 + b3) == 3;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
return b > 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 添加组织
|
|
|
|
|
|
|
|
* @param name 名称
|
|
|
|
|
|
|
|
* @param code 编码
|
|
|
|
|
|
|
|
* @author dexiang.jiang
|
|
|
|
|
|
|
|
* @date 2020/05/20 14:57
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public boolean addOrganizational(String name, String code, Long parentId, Long level) throws KiisooException {
|
|
|
|
public boolean addOrganizational(String name, String code, Long parentId, Long level) throws KiisooException {
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
map.put("name", name);
|
|
|
|
map.put("name", name);
|
|
|
@ -1036,7 +1139,6 @@ public class StoreEmployeeService {
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> domainMap = new HashMap<>();
|
|
|
|
Map<String, Object> domainMap = new HashMap<>();
|
|
|
|
domainMap.put("name", poiStore.getCustomerName());
|
|
|
|
domainMap.put("name", poiStore.getCustomerName());
|
|
|
|
domainMap.put("code", poiStore.getCustomerCode());
|
|
|
|
|
|
|
|
List<PrivilageDomainDO> domainList = privilageDomainDOMapper.selectByMap(domainMap);
|
|
|
|
List<PrivilageDomainDO> domainList = privilageDomainDOMapper.selectByMap(domainMap);
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(domainList)){
|
|
|
|
if(CollectionUtils.isEmpty(domainList)){
|
|
|
|