Commit dd85e6bd4bbae741685f28f4dbb4bed419945eb9
1 parent
936783f9
♻️ refactor(mes): 使用 ListUtil 替换 List.of
Showing
22 changed files
with
67 additions
and
47 deletions
yudao-framework/yudao-spring-boot-starter-excel/src/test/java/cn/iocoder/yudao/framework/dict/core/util/DictFrameworkUtilsTest.java
| 1 | package cn.iocoder.yudao.framework.dict.core.util; | 1 | package cn.iocoder.yudao.framework.dict.core.util; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.ListUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.biz.system.dict.DictDataCommonApi; | 4 | import cn.iocoder.yudao.framework.common.biz.system.dict.DictDataCommonApi; |
| 4 | import cn.iocoder.yudao.framework.common.biz.system.dict.dto.DictDataRespDTO; | 5 | import cn.iocoder.yudao.framework.common.biz.system.dict.dto.DictDataRespDTO; |
| 5 | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | 6 | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| @@ -32,7 +33,7 @@ public class DictFrameworkUtilsTest extends BaseMockitoUnitTest { | @@ -32,7 +33,7 @@ public class DictFrameworkUtilsTest extends BaseMockitoUnitTest { | ||
| 32 | @Test | 33 | @Test |
| 33 | public void testParseDictDataLabel() { | 34 | public void testParseDictDataLabel() { |
| 34 | // mock 数据 | 35 | // mock 数据 |
| 35 | - List<DictDataRespDTO> dictDatas = List.of( | 36 | + List<DictDataRespDTO> dictDatas = ListUtil.of( |
| 36 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("cat").setLabel("猫")), | 37 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("cat").setLabel("猫")), |
| 37 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("dog").setLabel("狗")) | 38 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("dog").setLabel("狗")) |
| 38 | ); | 39 | ); |
| @@ -46,7 +47,7 @@ public class DictFrameworkUtilsTest extends BaseMockitoUnitTest { | @@ -46,7 +47,7 @@ public class DictFrameworkUtilsTest extends BaseMockitoUnitTest { | ||
| 46 | @Test | 47 | @Test |
| 47 | public void testParseDictDataValue() { | 48 | public void testParseDictDataValue() { |
| 48 | // mock 数据 | 49 | // mock 数据 |
| 49 | - List<DictDataRespDTO> dictDatas = List.of( | 50 | + List<DictDataRespDTO> dictDatas = ListUtil.of( |
| 50 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("cat").setLabel("猫")), | 51 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("cat").setLabel("猫")), |
| 51 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("dog").setLabel("狗")) | 52 | randomPojo(DictDataRespDTO.class, o -> o.setDictType("animal").setValue("dog").setLabel("狗")) |
| 52 | ); | 53 | ); |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/andon/MesProAndonConfigController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.andon; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.andon; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 7 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| @@ -73,7 +74,7 @@ public class MesProAndonConfigController { | @@ -73,7 +74,7 @@ public class MesProAndonConfigController { | ||
| 73 | if (config == null) { | 74 | if (config == null) { |
| 74 | return success(null); | 75 | return success(null); |
| 75 | } | 76 | } |
| 76 | - return success(buildConfigRespVOList(List.of(config)).get(0)); | 77 | + return success(buildConfigRespVOList(ListUtil.of(config)).get(0)); |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | @GetMapping("/page") | 80 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/andon/MesProAndonRecordController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.andon; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.andon; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | 5 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| @@ -95,7 +96,7 @@ public class MesProAndonRecordController { | @@ -95,7 +96,7 @@ public class MesProAndonRecordController { | ||
| 95 | if (record == null) { | 96 | if (record == null) { |
| 96 | return success(null); | 97 | return success(null); |
| 97 | } | 98 | } |
| 98 | - return success(buildRecordRespVOList(List.of(record)).get(0)); | 99 | + return success(buildRecordRespVOList(ListUtil.of(record)).get(0)); |
| 99 | } | 100 | } |
| 100 | 101 | ||
| 101 | @GetMapping("/page") | 102 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/card/MesProCardController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.card; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.card; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | 5 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| @@ -116,7 +117,7 @@ public class MesProCardController { | @@ -116,7 +117,7 @@ public class MesProCardController { | ||
| 116 | if (card == null) { | 117 | if (card == null) { |
| 117 | return success(null); | 118 | return success(null); |
| 118 | } | 119 | } |
| 119 | - return success(buildCardRespVOList(List.of(card)).get(0)); | 120 | + return success(buildCardRespVOList(ListUtil.of(card)).get(0)); |
| 120 | } | 121 | } |
| 121 | 122 | ||
| 122 | @GetMapping("/page") | 123 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/card/MesProCardProcessController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.card; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.card; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 7 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| @@ -82,7 +83,7 @@ public class MesProCardProcessController { | @@ -82,7 +83,7 @@ public class MesProCardProcessController { | ||
| 82 | if (cardProcess == null) { | 83 | if (cardProcess == null) { |
| 83 | return success(null); | 84 | return success(null); |
| 84 | } | 85 | } |
| 85 | - return success(buildCardProcessRespVOList(List.of(cardProcess)).get(0)); | 86 | + return success(buildCardProcessRespVOList(ListUtil.of(cardProcess)).get(0)); |
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | @GetMapping("/page") | 89 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/MesProFeedbackController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.feedback; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.feedback; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | 5 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| @@ -111,7 +112,7 @@ public class MesProFeedbackController { | @@ -111,7 +112,7 @@ public class MesProFeedbackController { | ||
| 111 | if (feedback == null) { | 112 | if (feedback == null) { |
| 112 | return success(null); | 113 | return success(null); |
| 113 | } | 114 | } |
| 114 | - return success(buildFeedbackRespVOList(List.of(feedback)).get(0)); | 115 | + return success(buildFeedbackRespVOList(ListUtil.of(feedback)).get(0)); |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | @GetMapping("/page") | 118 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/route/MesProRouteProcessController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.route; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.route; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| @@ -129,7 +130,7 @@ public class MesProRouteProcessController { | @@ -129,7 +130,7 @@ public class MesProRouteProcessController { | ||
| 129 | if (routeProcess == null) { | 130 | if (routeProcess == null) { |
| 130 | return null; | 131 | return null; |
| 131 | } | 132 | } |
| 132 | - return buildRouteProcessRespVOList(List.of(routeProcess)).get(0); | 133 | + return buildRouteProcessRespVOList(ListUtil.of(routeProcess)).get(0); |
| 133 | } | 134 | } |
| 134 | 135 | ||
| 135 | } | 136 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/route/MesProRouteProductBomController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.route; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.route; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| @@ -120,7 +121,7 @@ public class MesProRouteProductBomController { | @@ -120,7 +121,7 @@ public class MesProRouteProductBomController { | ||
| 120 | if (routeProductBom == null) { | 121 | if (routeProductBom == null) { |
| 121 | return null; | 122 | return null; |
| 122 | } | 123 | } |
| 123 | - return buildRouteProductBomRespVOList(List.of(routeProductBom)).get(0); | 124 | + return buildRouteProductBomRespVOList(ListUtil.of(routeProductBom)).get(0); |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | } | 127 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/route/MesProRouteProductController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.route; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.route; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| @@ -112,7 +113,7 @@ public class MesProRouteProductController { | @@ -112,7 +113,7 @@ public class MesProRouteProductController { | ||
| 112 | if (routeProduct == null) { | 113 | if (routeProduct == null) { |
| 113 | return null; | 114 | return null; |
| 114 | } | 115 | } |
| 115 | - return buildRouteProductRespVOList(List.of(routeProduct)).get(0); | 116 | + return buildRouteProductRespVOList(ListUtil.of(routeProduct)).get(0); |
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | } | 119 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/MesProTaskController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.task; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.task; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.hutool.core.util.ObjUtil; | 5 | import cn.hutool.core.util.ObjUtil; |
| 5 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | 6 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| @@ -110,7 +111,7 @@ public class MesProTaskController { | @@ -110,7 +111,7 @@ public class MesProTaskController { | ||
| 110 | if (task == null) { | 111 | if (task == null) { |
| 111 | return success(null); | 112 | return success(null); |
| 112 | } | 113 | } |
| 113 | - return success(buildTaskRespVOList(List.of(task)).get(0)); | 114 | + return success(buildTaskRespVOList(ListUtil.of(task)).get(0)); |
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | @GetMapping("/page") | 117 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/MesProTaskIssueController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.task; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.task; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| @@ -79,7 +80,7 @@ public class MesProTaskIssueController { | @@ -79,7 +80,7 @@ public class MesProTaskIssueController { | ||
| 79 | if (taskIssue == null) { | 80 | if (taskIssue == null) { |
| 80 | return success(null); | 81 | return success(null); |
| 81 | } | 82 | } |
| 82 | - return success(buildIssueRespVOList(List.of(taskIssue)).get(0)); | 83 | + return success(buildIssueRespVOList(ListUtil.of(taskIssue)).get(0)); |
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | @GetMapping("/page") | 86 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/workorder/MesProWorkOrderBomController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.workorder; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.workorder; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 7 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| @@ -88,7 +89,7 @@ public class MesProWorkOrderBomController { | @@ -88,7 +89,7 @@ public class MesProWorkOrderBomController { | ||
| 88 | if (workOrderBom == null) { | 89 | if (workOrderBom == null) { |
| 89 | return success(null); | 90 | return success(null); |
| 90 | } | 91 | } |
| 91 | - return success(buildWorkOrderBomRespVOList(List.of(workOrderBom)).get(0)); | 92 | + return success(buildWorkOrderBomRespVOList(ListUtil.of(workOrderBom)).get(0)); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | @GetMapping("/page") | 95 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/workorder/MesProWorkOrderController.java
| 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.workorder; | 1 | package cn.iocoder.yudao.module.mes.controller.admin.pro.workorder; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | 5 | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| @@ -92,7 +93,7 @@ public class MesProWorkOrderController { | @@ -92,7 +93,7 @@ public class MesProWorkOrderController { | ||
| 92 | if (workOrder == null) { | 93 | if (workOrder == null) { |
| 93 | return success(null); | 94 | return success(null); |
| 94 | } | 95 | } |
| 95 | - return success(buildWorkOrderRespVOList(List.of(workOrder)).get(0)); | 96 | + return success(buildWorkOrderRespVOList(ListUtil.of(workOrder)).get(0)); |
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | @GetMapping("/page") | 99 | @GetMapping("/page") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/tm/tool/MesTmToolServiceImpl.java
| 1 | package cn.iocoder.yudao.module.mes.service.tm.tool; | 1 | package cn.iocoder.yudao.module.mes.service.tm.tool; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.ListUtil; | ||
| 3 | import cn.hutool.core.util.ObjUtil; | 4 | import cn.hutool.core.util.ObjUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| @@ -127,7 +128,7 @@ public class MesTmToolServiceImpl implements MesTmToolService { | @@ -127,7 +128,7 @@ public class MesTmToolServiceImpl implements MesTmToolService { | ||
| 127 | @Override | 128 | @Override |
| 128 | public List<MesTmToolDO> getToolList(Collection<Long> ids) { | 129 | public List<MesTmToolDO> getToolList(Collection<Long> ids) { |
| 129 | if (ids == null || ids.isEmpty()) { | 130 | if (ids == null || ids.isEmpty()) { |
| 130 | - return List.of(); | 131 | + return ListUtil.of(); |
| 131 | } | 132 | } |
| 132 | return toolMapper.selectBatchIds(ids); | 133 | return toolMapper.selectBatchIds(ids); |
| 133 | } | 134 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourceissue/MesWmOutsourceIssueServiceImpl.java
| 1 | package cn.iocoder.yudao.module.mes.service.wm.outsourceissue; | 1 | package cn.iocoder.yudao.module.mes.service.wm.outsourceissue; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.hutool.core.util.StrUtil; | 5 | import cn.hutool.core.util.StrUtil; |
| 5 | import cn.hutool.core.util.ObjUtil; | 6 | import cn.hutool.core.util.ObjUtil; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| @@ -146,7 +147,7 @@ public class MesWmOutsourceIssueServiceImpl implements MesWmOutsourceIssueServic | @@ -146,7 +147,7 @@ public class MesWmOutsourceIssueServiceImpl implements MesWmOutsourceIssueServic | ||
| 146 | allDetails, MesWmOutsourceIssueDetailDO::getLineId); | 147 | allDetails, MesWmOutsourceIssueDetailDO::getLineId); |
| 147 | // 检查每行的明细数量 | 148 | // 检查每行的明细数量 |
| 148 | for (MesWmOutsourceIssueLineDO line : lines) { | 149 | for (MesWmOutsourceIssueLineDO line : lines) { |
| 149 | - List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), List.of()); | 150 | + List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), ListUtil.of()); |
| 150 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, | 151 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, |
| 151 | MesWmOutsourceIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); | 152 | MesWmOutsourceIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); |
| 152 | // 对比行数量与明细总数量,不满足直接抛出 | 153 | // 对比行数量与明细总数量,不满足直接抛出 |
| @@ -219,7 +220,7 @@ public class MesWmOutsourceIssueServiceImpl implements MesWmOutsourceIssueServic | @@ -219,7 +220,7 @@ public class MesWmOutsourceIssueServiceImpl implements MesWmOutsourceIssueServic | ||
| 219 | allDetails, MesWmOutsourceIssueDetailDO::getLineId); | 220 | allDetails, MesWmOutsourceIssueDetailDO::getLineId); |
| 220 | // 检查每行的明细数量 | 221 | // 检查每行的明细数量 |
| 221 | for (MesWmOutsourceIssueLineDO line : lines) { | 222 | for (MesWmOutsourceIssueLineDO line : lines) { |
| 222 | - List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), List.of()); | 223 | + List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), ListUtil.of()); |
| 223 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, | 224 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, |
| 224 | MesWmOutsourceIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); | 225 | MesWmOutsourceIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); |
| 225 | // 对比行数量与明细总数量 | 226 | // 对比行数量与明细总数量 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourcereceipt/MesWmOutsourceReceiptServiceImpl.java
| 1 | package cn.iocoder.yudao.module.mes.service.wm.outsourcereceipt; | 1 | package cn.iocoder.yudao.module.mes.service.wm.outsourcereceipt; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.hutool.core.util.ObjUtil; | 5 | import cn.hutool.core.util.ObjUtil; |
| 5 | import cn.hutool.core.util.StrUtil; | 6 | import cn.hutool.core.util.StrUtil; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| @@ -165,7 +166,7 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe | @@ -165,7 +166,7 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe | ||
| 165 | allDetails, MesWmOutsourceReceiptDetailDO::getLineId); | 166 | allDetails, MesWmOutsourceReceiptDetailDO::getLineId); |
| 166 | // 检查每行的明细数量 | 167 | // 检查每行的明细数量 |
| 167 | for (MesWmOutsourceReceiptLineDO line : lines) { | 168 | for (MesWmOutsourceReceiptLineDO line : lines) { |
| 168 | - List<MesWmOutsourceReceiptDetailDO> details = detailMap.getOrDefault(line.getId(), List.of()); | 169 | + List<MesWmOutsourceReceiptDetailDO> details = detailMap.getOrDefault(line.getId(), ListUtil.of()); |
| 169 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, | 170 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, |
| 170 | MesWmOutsourceReceiptDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); | 171 | MesWmOutsourceReceiptDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); |
| 171 | // 对比行数量与明细总数量,不满足直接抛出 | 172 | // 对比行数量与明细总数量,不满足直接抛出 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnissue/MesWmReturnIssueServiceImpl.java
| 1 | package cn.iocoder.yudao.module.mes.service.wm.returnissue; | 1 | package cn.iocoder.yudao.module.mes.service.wm.returnissue; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.hutool.core.util.ObjUtil; | 5 | import cn.hutool.core.util.ObjUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 7 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| @@ -161,7 +162,7 @@ public class MesWmReturnIssueServiceImpl implements MesWmReturnIssueService { | @@ -161,7 +162,7 @@ public class MesWmReturnIssueServiceImpl implements MesWmReturnIssueService { | ||
| 161 | allDetails, MesWmReturnIssueDetailDO::getLineId); | 162 | allDetails, MesWmReturnIssueDetailDO::getLineId); |
| 162 | // 检查每行的明细数量 | 163 | // 检查每行的明细数量 |
| 163 | for (MesWmReturnIssueLineDO line : lines) { | 164 | for (MesWmReturnIssueLineDO line : lines) { |
| 164 | - List<MesWmReturnIssueDetailDO> details = detailMap.getOrDefault(line.getId(), List.of()); | 165 | + List<MesWmReturnIssueDetailDO> details = detailMap.getOrDefault(line.getId(), ListUtil.of()); |
| 165 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, | 166 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, |
| 166 | MesWmReturnIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); | 167 | MesWmReturnIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); |
| 167 | // 对比行数量与明细总数量,不满足直接抛出 | 168 | // 对比行数量与明细总数量,不满足直接抛出 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnsales/MesWmReturnSalesServiceImpl.java
| 1 | package cn.iocoder.yudao.module.mes.service.wm.returnsales; | 1 | package cn.iocoder.yudao.module.mes.service.wm.returnsales; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.hutool.core.util.ObjUtil; | 5 | import cn.hutool.core.util.ObjUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 7 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| @@ -163,7 +164,7 @@ public class MesWmReturnSalesServiceImpl implements MesWmReturnSalesService { | @@ -163,7 +164,7 @@ public class MesWmReturnSalesServiceImpl implements MesWmReturnSalesService { | ||
| 163 | allDetails, MesWmReturnSalesDetailDO::getLineId); | 164 | allDetails, MesWmReturnSalesDetailDO::getLineId); |
| 164 | // 检查每行的明细数量 | 165 | // 检查每行的明细数量 |
| 165 | for (MesWmReturnSalesLineDO line : lines) { | 166 | for (MesWmReturnSalesLineDO line : lines) { |
| 166 | - List<MesWmReturnSalesDetailDO> details = detailMap.getOrDefault(line.getId(), List.of()); | 167 | + List<MesWmReturnSalesDetailDO> details = detailMap.getOrDefault(line.getId(), ListUtil.of()); |
| 167 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, | 168 | BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details, |
| 168 | MesWmReturnSalesDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); | 169 | MesWmReturnSalesDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); |
| 169 | // 对比行数量与明细总数量,不满足直接抛出 | 170 | // 对比行数量与明细总数量,不满足直接抛出 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/transfer/MesWmTransferServiceImpl.java
| 1 | package cn.iocoder.yudao.module.mes.service.wm.transfer; | 1 | package cn.iocoder.yudao.module.mes.service.wm.transfer; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| @@ -186,7 +187,7 @@ public class MesWmTransferServiceImpl implements MesWmTransferService { | @@ -186,7 +187,7 @@ public class MesWmTransferServiceImpl implements MesWmTransferService { | ||
| 186 | allDetails, MesWmTransferDetailDO::getLineId); | 187 | allDetails, MesWmTransferDetailDO::getLineId); |
| 187 | // 2. 遍历行和对应的明细,创建事务 | 188 | // 2. 遍历行和对应的明细,创建事务 |
| 188 | for (MesWmTransferLineDO line : lines) { | 189 | for (MesWmTransferLineDO line : lines) { |
| 189 | - List<MesWmTransferDetailDO> details = detailMap.getOrDefault(line.getId(), List.of()); | 190 | + List<MesWmTransferDetailDO> details = detailMap.getOrDefault(line.getId(), ListUtil.of()); |
| 190 | for (MesWmTransferDetailDO detail : details) { | 191 | for (MesWmTransferDetailDO detail : details) { |
| 191 | // 2.1 先执行出库:调拨移出(从源仓库扣减库存),出库数量基于当前明细的数量 | 192 | // 2.1 先执行出库:调拨移出(从源仓库扣减库存),出库数量基于当前明细的数量 |
| 192 | Long outTransactionId = wmTransactionService.createTransaction(new MesWmTransactionSaveReqDTO() | 193 | Long outTransactionId = wmTransactionService.createTransaction(new MesWmTransactionSaveReqDTO() |
yudao-module-mes/src/test/java/cn/iocoder/yudao/module/mes/service/pro/feedback/MesProFeedbackServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.mes.service.pro.feedback; | 1 | package cn.iocoder.yudao.module.mes.service.pro.feedback; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.ListUtil; | ||
| 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 4 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; | 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; |
| 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; | 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| @@ -19,11 +20,11 @@ import org.springframework.context.annotation.Import; | @@ -19,11 +20,11 @@ import org.springframework.context.annotation.Import; | ||
| 19 | import org.springframework.test.context.bean.override.mockito.MockitoBean; | 20 | import org.springframework.test.context.bean.override.mockito.MockitoBean; |
| 20 | 21 | ||
| 21 | import java.math.BigDecimal; | 22 | import java.math.BigDecimal; |
| 22 | -import java.util.List; | ||
| 23 | 23 | ||
| 24 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | 24 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; |
| 25 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 25 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 26 | -import static org.junit.jupiter.api.Assertions.*; | 26 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 27 | +import static org.junit.jupiter.api.Assertions.assertThrows; | ||
| 27 | import static org.mockito.Mockito.*; | 28 | import static org.mockito.Mockito.*; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| @@ -78,7 +79,7 @@ public class MesProFeedbackServiceImplTest extends BaseDbUnitTest { | @@ -78,7 +79,7 @@ public class MesProFeedbackServiceImplTest extends BaseDbUnitTest { | ||
| 78 | .qualityStatus(MesWmQualityStatusEnum.FAIL.getStatus()) | 79 | .qualityStatus(MesWmQualityStatusEnum.FAIL.getStatus()) |
| 79 | .build(); | 80 | .build(); |
| 80 | when(produceLineService.getProductProduceLineListByFeedbackId(feedback.getId())) | 81 | when(produceLineService.getProductProduceLineListByFeedbackId(feedback.getId())) |
| 81 | - .thenReturn(List.of(qualifiedLine, unqualifiedLine)); | 82 | + .thenReturn(ListUtil.of(qualifiedLine, unqualifiedLine)); |
| 82 | 83 | ||
| 83 | // 调用 | 84 | // 调用 |
| 84 | BigDecimal qualifiedQty = BigDecimal.valueOf(80); | 85 | BigDecimal qualifiedQty = BigDecimal.valueOf(80); |
| @@ -133,7 +134,7 @@ public class MesProFeedbackServiceImplTest extends BaseDbUnitTest { | @@ -133,7 +134,7 @@ public class MesProFeedbackServiceImplTest extends BaseDbUnitTest { | ||
| 133 | .qualityStatus(MesWmQualityStatusEnum.PASS.getStatus()) | 134 | .qualityStatus(MesWmQualityStatusEnum.PASS.getStatus()) |
| 134 | .build(); | 135 | .build(); |
| 135 | when(produceLineService.getProductProduceLineListByFeedbackId(feedback.getId())) | 136 | when(produceLineService.getProductProduceLineListByFeedbackId(feedback.getId())) |
| 136 | - .thenReturn(List.of(qualifiedLine)); | 137 | + .thenReturn(ListUtil.of(qualifiedLine)); |
| 137 | 138 | ||
| 138 | // 调用 | 139 | // 调用 |
| 139 | feedbackService.updateProFeedbackWhenIpqcFinish(feedback.getId(), | 140 | feedbackService.updateProFeedbackWhenIpqcFinish(feedback.getId(), |
yudao-module-mes/src/test/java/cn/iocoder/yudao/module/mes/service/wm/itemconsume/MesWmItemConsumeServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.mes.service.wm.itemconsume; | 1 | package cn.iocoder.yudao.module.mes.service.wm.itemconsume; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.ListUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | 4 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 5 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockListReqVO; | 6 | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockListReqVO; |
| @@ -43,9 +44,7 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId | @@ -43,9 +44,7 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId | ||
| 43 | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_FEEDBACK_ROUTE_PROCESS_INVALID; | 44 | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_FEEDBACK_ROUTE_PROCESS_INVALID; |
| 44 | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_ROUTE_NOT_EXISTS; | 45 | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_ROUTE_NOT_EXISTS; |
| 45 | import static org.junit.jupiter.api.Assertions.*; | 46 | import static org.junit.jupiter.api.Assertions.*; |
| 46 | -import static org.mockito.ArgumentMatchers.any; | ||
| 47 | -import static org.mockito.ArgumentMatchers.anyLong; | ||
| 48 | -import static org.mockito.ArgumentMatchers.argThat; | 47 | +import static org.mockito.ArgumentMatchers.*; |
| 49 | import static org.mockito.Mockito.*; | 48 | import static org.mockito.Mockito.*; |
| 50 | 49 | ||
| 51 | /** | 50 | /** |
| @@ -181,7 +180,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | @@ -181,7 +180,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | ||
| 181 | bom.setItemId(bomItemId); | 180 | bom.setItemId(bomItemId); |
| 182 | bom.setQuantity(new BigDecimal("2")); // 用料比例 = 2 | 181 | bom.setQuantity(new BigDecimal("2")); // 用料比例 = 2 |
| 183 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) | 182 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) |
| 184 | - .thenReturn(List.of(bom)); | 183 | + .thenReturn(ListUtil.of(bom)); |
| 185 | when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class))) | 184 | when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class))) |
| 186 | .thenReturn(Collections.emptyList()); | 185 | .thenReturn(Collections.emptyList()); |
| 187 | 186 | ||
| @@ -229,7 +228,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | @@ -229,7 +228,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | ||
| 229 | bom.setItemId(bomItemId); | 228 | bom.setItemId(bomItemId); |
| 230 | bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30 | 229 | bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30 |
| 231 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) | 230 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) |
| 232 | - .thenReturn(List.of(bom)); | 231 | + .thenReturn(ListUtil.of(bom)); |
| 233 | 232 | ||
| 234 | Long stockId = randomLongId(); | 233 | Long stockId = randomLongId(); |
| 235 | Long batchId = randomLongId(); | 234 | Long batchId = randomLongId(); |
| @@ -240,7 +239,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | @@ -240,7 +239,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | ||
| 240 | stock.setBatchId(batchId); | 239 | stock.setBatchId(batchId); |
| 241 | stock.setBatchCode("BATCH-001"); | 240 | stock.setBatchCode("BATCH-001"); |
| 242 | when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class))) | 241 | when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class))) |
| 243 | - .thenReturn(List.of(stock)); | 242 | + .thenReturn(ListUtil.of(stock)); |
| 244 | 243 | ||
| 245 | // 调用 | 244 | // 调用 |
| 246 | MesWmItemConsumeDO result = itemConsumeService.generateItemConsume(feedback); | 245 | MesWmItemConsumeDO result = itemConsumeService.generateItemConsume(feedback); |
| @@ -268,7 +267,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | @@ -268,7 +267,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | ||
| 268 | bom.setItemId(bomItemId); | 267 | bom.setItemId(bomItemId); |
| 269 | bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30 | 268 | bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30 |
| 270 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) | 269 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) |
| 271 | - .thenReturn(List.of(bom)); | 270 | + .thenReturn(ListUtil.of(bom)); |
| 272 | 271 | ||
| 273 | Long stockId1 = randomLongId(); | 272 | Long stockId1 = randomLongId(); |
| 274 | Long stockId2 = randomLongId(); | 273 | Long stockId2 = randomLongId(); |
| @@ -321,7 +320,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | @@ -321,7 +320,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | ||
| 321 | bom.setItemId(bomItemId); | 320 | bom.setItemId(bomItemId); |
| 322 | bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30 | 321 | bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30 |
| 323 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) | 322 | when(routeProductBomService.getRouteProductBomList(any(), any(), any())) |
| 324 | - .thenReturn(List.of(bom)); | 323 | + .thenReturn(ListUtil.of(bom)); |
| 325 | 324 | ||
| 326 | Long stockId = randomLongId(); | 325 | Long stockId = randomLongId(); |
| 327 | MesWmMaterialStockDO stock = new MesWmMaterialStockDO(); | 326 | MesWmMaterialStockDO stock = new MesWmMaterialStockDO(); |
| @@ -331,7 +330,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | @@ -331,7 +330,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | ||
| 331 | stock.setBatchId(1L); | 330 | stock.setBatchId(1L); |
| 332 | stock.setBatchCode("BATCH-001"); | 331 | stock.setBatchCode("BATCH-001"); |
| 333 | when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class))) | 332 | when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class))) |
| 334 | - .thenReturn(List.of(stock)); | 333 | + .thenReturn(ListUtil.of(stock)); |
| 335 | 334 | ||
| 336 | // 调用 | 335 | // 调用 |
| 337 | MesWmItemConsumeDO result = itemConsumeService.generateItemConsume(feedback); | 336 | MesWmItemConsumeDO result = itemConsumeService.generateItemConsume(feedback); |
| @@ -383,7 +382,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | @@ -383,7 +382,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest { | ||
| 383 | 382 | ||
| 384 | when(materialStockService.getMaterialStockList(argThat((MesWmMaterialStockListReqVO req) -> | 383 | when(materialStockService.getMaterialStockList(argThat((MesWmMaterialStockListReqVO req) -> |
| 385 | req != null && itemA.equals(req.getItemId())))) | 384 | req != null && itemA.equals(req.getItemId())))) |
| 386 | - .thenReturn(List.of(stockA)); | 385 | + .thenReturn(ListUtil.of(stockA)); |
| 387 | when(materialStockService.getMaterialStockList(argThat((MesWmMaterialStockListReqVO req) -> | 386 | when(materialStockService.getMaterialStockList(argThat((MesWmMaterialStockListReqVO req) -> |
| 388 | req != null && itemB.equals(req.getItemId())))) | 387 | req != null && itemB.equals(req.getItemId())))) |
| 389 | .thenReturn(Collections.emptyList()); | 388 | .thenReturn(Collections.emptyList()); |
yudao-module-mes/src/test/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.mes.service.wm.productproduce; | 1 | package cn.iocoder.yudao.module.mes.service.wm.productproduce; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.ListUtil; | ||
| 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 4 | -import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDetailDO; | ||
| 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDO; | 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDO; |
| 6 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDetailDO; | ||
| 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; | 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; |
| 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; | 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; |
| @@ -23,11 +24,11 @@ import org.springframework.context.annotation.Import; | @@ -23,11 +24,11 @@ import org.springframework.context.annotation.Import; | ||
| 23 | import org.springframework.test.context.bean.override.mockito.MockitoBean; | 24 | import org.springframework.test.context.bean.override.mockito.MockitoBean; |
| 24 | 25 | ||
| 25 | import java.math.BigDecimal; | 26 | import java.math.BigDecimal; |
| 26 | -import java.util.List; | ||
| 27 | 27 | ||
| 28 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | 28 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; |
| 29 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 29 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 30 | -import static org.junit.jupiter.api.Assertions.*; | 30 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 31 | +import static org.junit.jupiter.api.Assertions.assertThrows; | ||
| 31 | import static org.mockito.Mockito.*; | 32 | import static org.mockito.Mockito.*; |
| 32 | 33 | ||
| 33 | /** | 34 | /** |
| @@ -92,7 +93,7 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | @@ -92,7 +93,7 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | ||
| 92 | .qualityStatus(MesWmQualityStatusEnum.PENDING.getStatus()) | 93 | .qualityStatus(MesWmQualityStatusEnum.PENDING.getStatus()) |
| 93 | .build(); | 94 | .build(); |
| 94 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) | 95 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) |
| 95 | - .thenReturn(List.of(pendingLine)); | 96 | + .thenReturn(ListUtil.of(pendingLine)); |
| 96 | 97 | ||
| 97 | // mock: finishProductProduce 内部会再查一次行和明细(用于创建库存事务) | 98 | // mock: finishProductProduce 内部会再查一次行和明细(用于创建库存事务) |
| 98 | // 由于 finishProductProduce 在拆分行后调用,此时行已经变了,但由于 line/detail 是 mock 的, | 99 | // 由于 finishProductProduce 在拆分行后调用,此时行已经变了,但由于 line/detail 是 mock 的, |
| @@ -109,8 +110,8 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | @@ -109,8 +110,8 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | ||
| 109 | .build(); | 110 | .build(); |
| 110 | // finishProductProduce 内部第二次调用 getProductProduceLineListByProduceId | 111 | // finishProductProduce 内部第二次调用 getProductProduceLineListByProduceId |
| 111 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) | 112 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) |
| 112 | - .thenReturn(List.of(pendingLine)) // 第 1 次:splitPendingAndFinishProduce 查待检行 | ||
| 113 | - .thenReturn(List.of(qualifiedLine, unqualifiedLine)); // 第 2 次:finishProductProduce 查所有行 | 113 | + .thenReturn(ListUtil.of(pendingLine)) // 第 1 次:splitPendingAndFinishProduce 查待检行 |
| 114 | + .thenReturn(ListUtil.of(qualifiedLine, unqualifiedLine)); // 第 2 次:finishProductProduce 查所有行 | ||
| 114 | 115 | ||
| 115 | // mock: finishProductProduce 中按行查明细 | 116 | // mock: finishProductProduce 中按行查明细 |
| 116 | MesWmProductProduceDetailDO qualifiedDetail = MesWmProductProduceDetailDO.builder() | 117 | MesWmProductProduceDetailDO qualifiedDetail = MesWmProductProduceDetailDO.builder() |
| @@ -118,9 +119,9 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | @@ -118,9 +119,9 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | ||
| 118 | MesWmProductProduceDetailDO unqualifiedDetail = MesWmProductProduceDetailDO.builder() | 119 | MesWmProductProduceDetailDO unqualifiedDetail = MesWmProductProduceDetailDO.builder() |
| 119 | .lineId(101L).quantity(BigDecimal.valueOf(20)).build(); | 120 | .lineId(101L).quantity(BigDecimal.valueOf(20)).build(); |
| 120 | when(productProduceDetailService.getProductProduceDetailListByLineId(100L)) | 121 | when(productProduceDetailService.getProductProduceDetailListByLineId(100L)) |
| 121 | - .thenReturn(List.of(qualifiedDetail)); | 122 | + .thenReturn(ListUtil.of(qualifiedDetail)); |
| 122 | when(productProduceDetailService.getProductProduceDetailListByLineId(101L)) | 123 | when(productProduceDetailService.getProductProduceDetailListByLineId(101L)) |
| 123 | - .thenReturn(List.of(unqualifiedDetail)); | 124 | + .thenReturn(ListUtil.of(unqualifiedDetail)); |
| 124 | 125 | ||
| 125 | // 调用 | 126 | // 调用 |
| 126 | productProduceService.splitPendingAndFinishProduce(feedbackId, BigDecimal.valueOf(80), BigDecimal.valueOf(20)); | 127 | productProduceService.splitPendingAndFinishProduce(feedbackId, BigDecimal.valueOf(80), BigDecimal.valueOf(20)); |
| @@ -185,14 +186,14 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | @@ -185,14 +186,14 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | ||
| 185 | .qualityStatus(MesWmQualityStatusEnum.PASS.getStatus()) | 186 | .qualityStatus(MesWmQualityStatusEnum.PASS.getStatus()) |
| 186 | .build(); | 187 | .build(); |
| 187 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) | 188 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) |
| 188 | - .thenReturn(List.of(pendingLine)) | ||
| 189 | - .thenReturn(List.of(qualifiedLine)); | 189 | + .thenReturn(ListUtil.of(pendingLine)) |
| 190 | + .thenReturn(ListUtil.of(qualifiedLine)); | ||
| 190 | 191 | ||
| 191 | // mock: finishProductProduce 中按行查明细 | 192 | // mock: finishProductProduce 中按行查明细 |
| 192 | MesWmProductProduceDetailDO detail = MesWmProductProduceDetailDO.builder() | 193 | MesWmProductProduceDetailDO detail = MesWmProductProduceDetailDO.builder() |
| 193 | .lineId(200L).quantity(BigDecimal.valueOf(50)).build(); | 194 | .lineId(200L).quantity(BigDecimal.valueOf(50)).build(); |
| 194 | when(productProduceDetailService.getProductProduceDetailListByLineId(200L)) | 195 | when(productProduceDetailService.getProductProduceDetailListByLineId(200L)) |
| 195 | - .thenReturn(List.of(detail)); | 196 | + .thenReturn(ListUtil.of(detail)); |
| 196 | 197 | ||
| 197 | // 调用:不合格品数量 = 0 | 198 | // 调用:不合格品数量 = 0 |
| 198 | productProduceService.splitPendingAndFinishProduce(feedbackId, BigDecimal.valueOf(50), BigDecimal.ZERO); | 199 | productProduceService.splitPendingAndFinishProduce(feedbackId, BigDecimal.valueOf(50), BigDecimal.ZERO); |
| @@ -245,7 +246,7 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | @@ -245,7 +246,7 @@ public class MesWmProductProduceServiceImplTest extends BaseDbUnitTest { | ||
| 245 | .qualityStatus(MesWmQualityStatusEnum.PASS.getStatus()) | 246 | .qualityStatus(MesWmQualityStatusEnum.PASS.getStatus()) |
| 246 | .build(); | 247 | .build(); |
| 247 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) | 248 | when(productProduceLineService.getProductProduceLineListByProduceId(produce.getId())) |
| 248 | - .thenReturn(List.of(passLine)); | 249 | + .thenReturn(ListUtil.of(passLine)); |
| 249 | 250 | ||
| 250 | // 调用,应该抛异常(找不到 PENDING 行) | 251 | // 调用,应该抛异常(找不到 PENDING 行) |
| 251 | assertThrows(Exception.class, () -> | 252 | assertThrows(Exception.class, () -> |