Commit 356ddc0e by 谢海旭

批量更新车辆组织层级接口逻辑调整

1 parent a2687147
......@@ -221,4 +221,19 @@ public class OrganizationApiService {
}
return StringUtil.EMPTY;
}
/**
* 根据部门id获取部门信息
*
* @param departmentId
* @return
*/
public Organization findOrgById(Long departmentId) {
log.info("根据部门id获取部门信息==={}", departmentId);
R<Organization> org = organizationService.findOrgById(departmentId);
log.info("根据部门id获取部门信息返回结果==={}", JSONUtil.toJsonStr(org));
Organization data = org.getData(Organization.class);
return data;
}
}
......@@ -39,6 +39,7 @@ import cn.com.glsx.publiccenter.api.dto.response.SysDictDataResponse;
import cn.com.glsx.stdinterface.api.VehicleServiceClient;
import cn.com.glsx.stdinterface.dto.*;
import cn.com.glsx.usercenter.api.dto.response.CUser;
import cn.com.glsx.usercenter.api.dto.response.Organization;
import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.dto.tree.OrgTreeModel;
import cn.hutool.core.collection.CollectionUtil;
......@@ -2671,14 +2672,21 @@ public class VehicleService extends AbstractCommonService {
@Transactional
public void orgBatchUpdate(VehicleOrgBatchUpdateBO updateBO) {
Long orgId = updateBO.getOrgId();
User org = remoteUserService.getUserById(orgId);
if (Objects.isNull(org)) {
User user = remoteUserService.getUserById(orgId);
if (Objects.isNull(user)) {
log.info("组织不存在,orgId:{}", orgId);
throw new AdminException(ResultEnum.PARAM_ERROR);
}
Long departmentId = user.getOrgId();
Organization organization = organizationApiService.findOrgById(departmentId);
if (Objects.isNull(organization)) {
log.info("查询组织上级数据失败,orgId:{}", orgId);
throw new AdminException("查询组织上级数据失败");
}
List<Long> vehicleIds = updateBO.getVehicleIds();
if (org.getUsername().contains("结清")) {
if (organization.getOrgName().contains("结清")) {
// 假如移到已结清组织层级下,则需要将车辆状态同时置为已结清
vehicleMapper.settleFlagBatchUpdate(VehicleSettleFlagEnum.SETTLED.getCode(), vehicleIds);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!