mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增单个组织查询 购买记录和延期信息
This commit is contained in:
+18
-9
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
@@ -38,7 +39,6 @@ import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.e
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.TENANT_PACKAGE_NOT_EXISTS;
|
||||
|
||||
@Tag(name = "管理后台 - 组织")
|
||||
@RestController
|
||||
@@ -111,14 +111,23 @@ public class OrganController {
|
||||
if (ObjectUtil.isNull(organ)) {
|
||||
throw exception(ORGAN_NOT_EXISTS);
|
||||
}
|
||||
TenantPackageDO tenantPackageDO = tenantPackageMapper.selectById(organ.getPackageId());
|
||||
if (ObjectUtil.isNotNull(tenantPackageDO)) {
|
||||
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
||||
bean.setPackageName(Objects.isNull(tenantPackageDO) ? "" : tenantPackageDO.getName());
|
||||
return success(bean);
|
||||
} else {
|
||||
throw exception(TENANT_PACKAGE_NOT_EXISTS);
|
||||
}
|
||||
OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class);
|
||||
|
||||
Long organId = bean.getId();
|
||||
// 查询当次列表组织下的所有购买记录
|
||||
List<OrganPagePurchaseRespVO> orgPurchaseList = BeanUtil.copyToList(purchaseService.getOrgPurchaseList(Set.of(organId)), OrganPagePurchaseRespVO.class);
|
||||
// 查询购买记录下的延期记录
|
||||
orgPurchaseList.forEach(p -> {
|
||||
List<ProductDelayRespVO> delayRecordsByPurchaseId = productDelayService.getRecordsByPurchaseId(p.getId(), organId);
|
||||
if (CollUtil.isNotEmpty(delayRecordsByPurchaseId)) {
|
||||
// 产品有效时间展示为第一项的计算延期时间
|
||||
p.setEndTime(delayRecordsByPurchaseId.get(0).getDelayTime());
|
||||
// 延期时长展示为延期记录的时长+单位,用顿号分隔
|
||||
p.setDelayDuration(delayRecordsByPurchaseId.stream().map(m -> m.getDelayDuration() + DurationUnitEnum.getDesc(m.getDelayDurationUnit())).collect(Collectors.joining("、")));
|
||||
}
|
||||
});
|
||||
bean.setOrganPurchaseList(orgPurchaseList);
|
||||
return success(bean);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
||||
Reference in New Issue
Block a user