Commit 3be86770 by huangjinxin

feat:组织机构网点导入代码

1 parent 8d4244f9
...@@ -31,7 +31,7 @@ public class OrgClusterEntity { ...@@ -31,7 +31,7 @@ public class OrgClusterEntity {
private String cityName; private String cityName;
private Integer status; private Integer status = 1;
private String updateUser; private String updateUser;
......
...@@ -88,5 +88,37 @@ public class OrgGroupEntity { ...@@ -88,5 +88,37 @@ public class OrgGroupEntity {
*/ */
private LocalDateTime updateTime = LocalDateTime.now(); private LocalDateTime updateTime = LocalDateTime.now();
public OrgGroupEntity() {} public OrgGroupEntity() {
}
/**
* 管理城市列表
*/
private String citycodeList;
/**
* 部门缩写
*/
private String abbreviation;
/**
* 部门编号
*/
private String code;
/**
* 部门负责人联系方式
*/
private String phone;
/**
* 是否启用外围仓 0未启用 1启用
*/
private Integer warehouseEnabled = 0;
/**
* 最长配件保留时长(天)
*/
private Integer reserveTimeMax = 0;
/**
* 帐号状态(0无效 1有效)
*/
private Integer status = 1;
} }
...@@ -22,7 +22,7 @@ public class ServiceOrg { ...@@ -22,7 +22,7 @@ public class ServiceOrg {
/** /**
* 状态;1正常、0注销 * 状态;1正常、0注销
*/ */
private int status; private Integer status;
/** /**
* 服务商类型 * 服务商类型
*/ */
......
...@@ -135,6 +135,11 @@ public class BeanRemoteServiceImpl { ...@@ -135,6 +135,11 @@ public class BeanRemoteServiceImpl {
} }
/**
* 处理全部机构
*
* @return
*/
public Result allDepartment() { public Result allDepartment() {
//获取token //获取token
final String accessToken = getAccessToken(); final String accessToken = getAccessToken();
...@@ -143,13 +148,20 @@ public class BeanRemoteServiceImpl { ...@@ -143,13 +148,20 @@ public class BeanRemoteServiceImpl {
return Result.failed(beanR.getMessage()); return Result.failed(beanR.getMessage());
} }
for (Department department : beanR.getData()) { for (Department department : beanR.getData()) {
log.info("处理部门详情---->{}" + department.getBsDeptId()); log.info("处理部门详情---->{}", department.getBsDeptId());
Result result = this.departmentDetail(accessToken, department.getBsDeptId()); Result result = this.departmentDetail(accessToken, department.getBsDeptId());
log.info("处理部门详情,id:{},结果---->{}" + department.getBsDeptId(), result.getCode()); log.info("处理部门详情,id:{},结果---->{}", department.getBsDeptId(), result.getCode());
} }
return Result.success(); return Result.success();
} }
/**
* 处理单极机构,包含大区,分部,分站
*
* @param token
* @param orgId
* @return
*/
public Result departmentDetail(String token, String orgId) { public Result departmentDetail(String token, String orgId) {
//获取token //获取token
BeanR<Department> departmentBeanR = beanRemoteService.departmentDetail(token, orgId); BeanR<Department> departmentBeanR = beanRemoteService.departmentDetail(token, orgId);
...@@ -201,14 +213,33 @@ public class BeanRemoteServiceImpl { ...@@ -201,14 +213,33 @@ public class BeanRemoteServiceImpl {
groupEntity = new OrgGroupEntity(); groupEntity = new OrgGroupEntity();
} }
groupEntity.setGroupName(data.getTagName()); groupEntity.setGroupName(data.getTagName());
//groupEntity.setAbbreviation(data.getAbbreviation()); groupEntity.setAbbreviation(data.getAbbreviation());
//groupEntity.setStatus(data.getEnable()); groupEntity.setStatus(data.getEnable());
//groupEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "" : JSONObject.toJSONString(data.getManageCityList())); groupEntity.setCitycodeList(CollectionUtils.isEmpty(data.getManageCityList()) ? "" : JSONObject.toJSONString(data.getManageCityList()));
//groupEntity.setMemo(data.getDesc()); groupEntity.setMemo(data.getDesc());
//groupEntity.setCode(data.getCode()); groupEntity.setCode(data.getCode());
//groupEntity.setPhone(data.getPhone()); groupEntity.setPhone(data.getPhone());
//groupEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled()); groupEntity.setWarehouseEnabled(data.getPeripheralWarehouseEnabled());
//groupEntity.setReserveTimeMax(data.getPartReserveTimeMax()); groupEntity.setReserveTimeMax(data.getPartReserveTimeMax());
//处理clusterId和branchId
OrgBranchEntity branchEntity = branchMap.get(data.getParentId());
if (ObjUtil.isNull(branchEntity)) {
branchEntity = orgBranchDao.getByBranchId(data.getParentId());
if (ObjUtil.isNull(branchEntity)) {
return Result.failed();
}
branchMap.put(data.getParentId(), branchEntity);
}
groupEntity.setBranchId(data.getParentId());
groupEntity.setClusterId(branchEntity.getClusterId());
//处理分站外围
if (data.getDeptType().equals(BeanOrgLevelEnum.PERIPHERY.getCode())) {
groupEntity.setKind(2);
}
if (data.getDeptType().equals(BeanOrgLevelEnum.STATION.getCode())) {
groupEntity.setKind(1);
}
groupEntity.setCategory(1);
orgGroupDao.save(groupEntity); orgGroupDao.save(groupEntity);
return Result.success(); return Result.success();
} }
...@@ -217,6 +248,53 @@ public class BeanRemoteServiceImpl { ...@@ -217,6 +248,53 @@ public class BeanRemoteServiceImpl {
/** /**
* 处理全部网点
*
* @return
*/
public Result serviceOrgList() {
//获取token
final String accessToken = getAccessToken();
BeanR<List<ServiceOrg>> listBeanR = beanRemoteService.serviceOrgList(accessToken, 1);
log.info("[查询网点/车队列表]【/api/openapi/department/queryServiceOrgList】返回值-------------------->{}", JsonUtil.toJson(listBeanR));
if (!listBeanR.getSuccess() || ObjUtil.isNull(listBeanR.getData())) {
return Result.failed(listBeanR.getMessage());
}
for (ServiceOrg serviceOrg : listBeanR.getData()) {
log.info("处理网点部门详情---->{}", serviceOrg.getServiceOrgId());
Result result = this.serviceOrgDetail(accessToken, serviceOrg);
log.info("处理网点部门详情,id:{},结果---->{}", serviceOrg.getServiceOrgId(), result.getCode());
}
return Result.success();
}
private Result serviceOrgDetail(String accessToken, ServiceOrg serviceOrg) {
BeanR<ServiceOrgDetail> beanR = beanRemoteService.serviceOrgDetail(accessToken, serviceOrg.getServiceOrgId());
log.info("[查询网点/车队列表]【/api/openapi/department/queryServiceOrgList】返回值-------------------->{}", JsonUtil.toJson(beanR));
if (!beanR.getSuccess() || ObjUtil.isNull(beanR.getData())) {
return Result.failed(beanR.getMessage());
}
ServiceOrgDetail data = beanR.getData();
OrgGroupEntity groupEntity = orgGroupDao.getByGroupId(data.getServiceOrgId());
if (ObjUtil.isNull(groupEntity)) {
groupEntity = new OrgGroupEntity();
}
groupEntity.setGroupName(data.getName());
groupEntity.setStatus(data.getStatus());
groupEntity.setCitycodeList(CollectionUtils.isEmpty(data.getServiceRange()) ? "" : JSONObject.toJSONString(data.getServiceRange()));
groupEntity.setPhone(data.getContactPhone());
groupEntity.setBranchId(data.getBelongBranch().getBsDeptId());
groupEntity.setClusterId(data.getBelongRegion().getBsDeptId());
//处理分站外围
groupEntity.setKind(4);
groupEntity.setCategory(2);
groupEntity.setAddress(data.getBusinessAddress().getAddress());
orgGroupDao.save(groupEntity);
return Result.success();
}
/**
* 获取bean token * 获取bean token
* *
* @return * @return
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!