|
@@ -1,5 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.system.controller.admin.saporg;
|
|
package cn.iocoder.yudao.module.system.controller.admin.saporg;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
@@ -27,6 +29,7 @@ import java.util.List;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
|
|
|
|
|
|
|
|
@Tag(name = "管理后台 - SAP中的组织主数据(工厂 成本中心)")
|
|
@Tag(name = "管理后台 - SAP中的组织主数据(工厂 成本中心)")
|
|
|
@RestController
|
|
@RestController
|
|
@@ -108,7 +111,30 @@ public class SapOrgController {
|
|
|
List<SapOrgDO> list = sapOrgService.getSelectedList(reqVO);
|
|
List<SapOrgDO> list = sapOrgService.getSelectedList(reqVO);
|
|
|
// 排序后,返回给前端
|
|
// 排序后,返回给前端
|
|
|
list.sort(Comparator.comparing(SapOrgDO::getSort));
|
|
list.sort(Comparator.comparing(SapOrgDO::getSort));
|
|
|
- return success(BeanUtils.toBean(list, SapOrgSimpleRespVO.class));
|
|
|
|
|
|
|
+ return success(buildSapOrgs(list));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 设置sap组织返回信息
|
|
|
|
|
+ * @param sapOrgs
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<SapOrgSimpleRespVO> buildSapOrgs(List<SapOrgDO> sapOrgs) {
|
|
|
|
|
+ // 拼接 工厂-成本中心 工厂-库存地点
|
|
|
|
|
+ if (CollUtil.isEmpty(sapOrgs)) {
|
|
|
|
|
+ return Collections.emptyList();
|
|
|
|
|
+ }
|
|
|
|
|
+ return BeanUtils.toBean(sapOrgs, SapOrgSimpleRespVO.class, (sapOrgVO) -> {
|
|
|
|
|
+ String factoryName = sapOrgVO.getFactoryName();
|
|
|
|
|
+ String costCenterName = sapOrgVO.getCostCenterName();
|
|
|
|
|
+ String storageLocationName = sapOrgVO.getStorageLocationName();
|
|
|
|
|
+ if (StrUtil.isNotBlank(costCenterName)) {
|
|
|
|
|
+ sapOrgVO.setCostCenterName(StrUtil.join("-", factoryName, costCenterName));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isNotBlank(storageLocationName)) {
|
|
|
|
|
+ sapOrgVO.setStorageLocationName(StrUtil.join("-", factoryName, storageLocationName));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
@GetMapping("/export-excel")
|