From aa09d8e96c49fe69b77dcf6c2c6f1c0cba80bd21 Mon Sep 17 00:00:00 2001 From: lym <1994302445@qq.com> Date: Mon, 15 Jul 2024 18:20:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=A6=96=E9=A1=B5-=E6=96=B0=E7=BB=9F?= =?UTF-8?q?=E8=AE=A11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/order/OrderController.java | 117 +++++++++++++++- .../order/vo/order/OrderPlateCountVO.java | 15 ++ .../vo/order/OrderPlatesDetailReqVO.java | 2 +- .../admin/plate/vo/PlateRespVO.java | 6 +- .../dal/dataobject/order/OrderDO.java | 4 + .../executor/dal/mysql/order/OrderMapper.java | 60 ++++++++ .../dal/mysql/orderItem/OrderItemMapper.java | 11 ++ .../executor/service/order/OrderService.java | 41 +++++- .../service/order/OrderServiceImpl.java | 132 +++++++++++++++--- .../resources/mapper/order/OrderMapper.xml | 12 ++ .../mapper/orderItem/OrderItemMapper.xml | 2 +- 11 files changed, 374 insertions(+), 28 deletions(-) create mode 100644 cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlateCountVO.java diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java index 10feaab5f..38b2e0dd0 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java @@ -153,6 +153,14 @@ public class OrderController { List orderBodyMap = orderService.getOrderBody(orderId); return success(orderBodyMap); } + @GetMapping("/get-roomToString") + @Operation(summary = "生产单详情-房间和柜体id(toString)") + @Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('production:manager-list:detail')") + public CommonResult getRoomToString(@RequestParam("orderId") Long orderId) { + String orderBodyMap = orderService.getOrderBodyToString(orderId); + return success(orderBodyMap); + } @GetMapping("/get-room-and-body") @Operation(summary = "获取柜体和房间信息") @@ -191,7 +199,29 @@ public class OrderController { List moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName); return success(moduleDOList); } + @GetMapping("/get-platesDetailsPage") + @Operation(summary = "生产单详情-板材详细信息(分页)") + @Parameters({ + @Parameter(name = "orderId", description = "生产单编号", example = "1024"), + @Parameter(name = "roomId", description = "房间编号", example = "1024"), + @Parameter(name = "bodyId", description = "柜体编号", example = "1024"), + @Parameter(name = "groupId", description = "加工组编号", example = "1024"), + @Parameter(name = "groupName", description = "加工组名称", example = "弧形"), + @Parameter(name = "pageNo", description = "第几页", example = "1"), + @Parameter(name = "pageSize", description = "条数", example = "10") + }) + @PreAuthorize("@ss.hasPermission('production:manager-list:detail')") + public CommonResult> platesDetails(@RequestParam("orderId") Long orderId, + @RequestParam(value = "roomId", required = false) Long roomId, + @RequestParam(value = "bodyId", required = false) Long bodyId, + @RequestParam(value = "groupId", required = false) Long groupId, + @RequestParam(value = "groupName", required = false) String groupName, + @RequestParam(value = "pageNo") Integer pageNo, + @RequestParam(value = "pageSize") Integer pageSize) { + PageResult moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName, pageNo, pageSize); + return success(moduleDOList); + } @GetMapping("/get-partsDetails") @Operation(summary = "生产单详情-配件详细信息") @Parameters({ @@ -208,7 +238,26 @@ public class OrderController { List moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId, name); return success(moduleDOList); } - + @GetMapping("/get-partsDetailsPage") + @Operation(summary = "生产单详情-配件详细信息(分页)") + @Parameters({ + @Parameter(name = "orderId", description = "生产单编号", example = "1024"), + @Parameter(name = "roomId", description = "房间编号", example = "1024"), + @Parameter(name = "bodyId", description = "柜体编号", example = "1024"), + @Parameter(name = "name", description = "配件名称", example = "1024"), + @Parameter(name = "pageNo", description = "第几页", example = "1"), + @Parameter(name = "pageSize", description = "条数", example = "10") + }) + @PreAuthorize("@ss.hasPermission('production:manager-list:detail')") + public CommonResult> partsDetails(@RequestParam("orderId") Long orderId, + @RequestParam(value = "roomId", required = false) Long roomId, + @RequestParam(value = "bodyId", required = false) Long bodyId, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "pageNo") Integer pageNo, + @RequestParam(value = "pageSize") Integer pageSize) { + PageResult moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId, name, pageNo, pageSize); + return success(moduleDOList); + } // 柜体数据获取,需要加上柜体的属性 @GetMapping("/get-body") @Operation(summary = "生产单柜体数据获取") @@ -366,6 +415,8 @@ public class OrderController { return success(orderService.getApiOrderList(orderList)); } + +// 统计 // 生产单状态分组统计返回 @GetMapping("/getOrderStatusCount") @Operation(summary = "生产单状态分组统计返回") @@ -383,12 +434,68 @@ public class OrderController { return success(orderService.getOrderPlateAnalysisCount()); } -// 生产单超期告警 +// 生产单超期/到期告警 (工作台) @GetMapping("/getOrderWarn") @Operation(summary = "生产单警告") - @Parameter(name = "startTerm", description = "时间段选择", required = false, example = "1,3,7") @PreAuthorize("@ss.hasPermission('productManager:List')") - public CommonResult>> getOrderOverdue(@RequestParam(value = "startTerm", required = false) Integer startTerm) { - return success(orderService.getOrderWarn(startTerm)); + public CommonResult>> getOrderOverdue() { + return success(orderService.getOrderWarn()); + } + +// 生产单总数 + @GetMapping("/orderCount") + @Operation(summary = "生产单总数") + @PreAuthorize("@ss.hasPermission('productManager:List')") + public CommonResult getOrderCount() { + return success(orderService.orderCount()); + } + +// 今日新增生产单总数 + @GetMapping("/orderCountToday") + @Operation(summary = "今日新增生产单总数") + @PreAuthorize("@ss.hasPermission('productManager:List')") + public CommonResult getOrderCountToday() { + return success(orderService.orderCountToday()); + } + +// 今日生产单完成总数 + @GetMapping("/orderCountTodayFinish") + @Operation(summary = "今日生产单完成总数") + @PreAuthorize("@ss.hasPermission('productManager:List')") + public CommonResult getOrderCountTodayFinish() { + return success(orderService.orderCountTodayFinish()); + } + +// 生产中生产单总数 + @GetMapping("/orderCountProduce") + @Operation(summary = "生产中生产单总数") + @PreAuthorize("@ss.hasPermission('productManager:List')") + public CommonResult getOrderCountProduce() { + return success(orderService.orderCountProduce()); + } + +// 生产中生产平方数 + @GetMapping("/orderSquareProduce") + @Operation(summary = "生产中生产平方数") + @PreAuthorize("@ss.hasPermission('productManager:List')") + public CommonResult getOrderSquareProduce() { + return success(orderService.orderSquareProduce()); + } + +// 小板数量 + @GetMapping("/getPlateCount") + @Operation(summary = "小板数量") + @Parameters({ + @Parameter(name = "startTime", description = "开始时间", required = false), + @Parameter(name = "endTime", description = "结束时间", required = false), + @Parameter(name = "goodsId", description = "材料id", required = true), + @Parameter(name = "organId", description = "组织id", required = false, example = "1") + }) + @PreAuthorize("@ss.hasPermission('productManager:List')") + public CommonResult getPlateCount(@RequestParam(value = "startTime", required = false) String startTime, + @RequestParam(value = "endTime", required = false) String endTime, + @RequestParam(value = "goodsId", required = false) Set goodsId, + @RequestParam("orderId") Long organId) { + return success(orderService.plateCount()); } } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlateCountVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlateCountVO.java new file mode 100644 index 000000000..58f83a4fa --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlateCountVO.java @@ -0,0 +1,15 @@ +package com.cf.imes.module.executor.controller.admin.order.vo.order; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Schema(description = "分析页 - 小板数量") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ToString(callSuper = true) +public class OrderPlateCountVO { + @Schema(description = "订单id") + private Long orderId; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlatesDetailReqVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlatesDetailReqVO.java index 2a88b3ff4..1a73f3190 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlatesDetailReqVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/vo/order/OrderPlatesDetailReqVO.java @@ -61,7 +61,7 @@ public class OrderPlatesDetailReqVO { private Boolean isSculpt; @Schema(description = "是否排孔", requiredMode = Schema.RequiredMode.REQUIRED) - private Boolean isHole; + private Boolean isRowHole; @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") @ExcelProperty("备注") diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java index 0fcaa7a15..673982e7b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.executor.controller.admin.plate.vo; +import com.cf.imes.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -15,7 +16,7 @@ import com.alibaba.excel.annotation.*; @Schema(description = "管理后台 - 生产单板件 Response VO") @Data @ExcelIgnoreUnannotated -public class PlateRespVO { +public class PlateRespVO extends PageParam { @Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32523") @ExcelProperty("板件 ID") @@ -165,6 +166,9 @@ public class PlateRespVO { @ExcelProperty("是否作废") private Boolean isCancel; + @Schema(description = "是否排孔", requiredMode = Schema.RequiredMode.REQUIRED) + private Boolean isRowHole; + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") private LocalDateTime createTime; diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/order/OrderDO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/order/OrderDO.java index 6a50e30e7..424130499 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/order/OrderDO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/order/OrderDO.java @@ -49,6 +49,10 @@ public class OrderDO extends BaseDO { * 交付日期 */ private LocalDateTime deliveryDate; + /** + * 生产单的完成时间 + */ + private LocalDateTime finishTime; /** * 生产单类型,1主单 2子单 */ diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java index 5cf254f59..b9f63f201 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java @@ -9,12 +9,14 @@ import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.QueryWrapperX; +import com.cf.imes.framework.organ.core.aop.OrganIgnore; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPageReqVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatusRespVO; import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds; import com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; +import com.cf.imes.module.executor.enums.OrderStatusEnum; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -145,4 +147,62 @@ public interface OrderMapper extends BaseMapperX { // 生产单逾期统计 List selectOrderOverdue(@Param("today") LocalDateTime today, @Param("organId") Long organId); + +// 生产单数量统计 + default Integer selectOrderCount(Long organId){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getOrganId, organId) + .eq(OrderDO::getDeleted, 0))); + } + @OrganIgnore + default Integer selectOrderCount(){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getDeleted, 0))); + } + +// 今日新增生产单总数统计 + default Integer selectOrderCountToday(Long organId){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getOrganId, organId) + .eq(OrderDO::getDeleted, 0) + .between(OrderDO::getCreateTime, LocalDateTime.now().withHour(0).withMinute(0).withSecond(0), LocalDateTime.now().withHour(23).withMinute(59).withSecond(59)))); + } + @OrganIgnore + default Integer selectOrderCountToday(){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getDeleted, 0) + .between(OrderDO::getCreateTime, LocalDateTime.now().withHour(0).withMinute(0).withSecond(0), LocalDateTime.now().withHour(23).withMinute(59).withSecond(59)))); + } + +// 今日新增生产单总数统计 + default Integer selectOrderCountTodayFinish(Long organId){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getOrganId, organId) + .eq(OrderDO::getDeleted, 0) + .between(OrderDO::getFinishTime, LocalDateTime.now().withHour(0).withMinute(0).withSecond(0), LocalDateTime.now().withHour(23).withMinute(59).withSecond(59)))); + } + @OrganIgnore + default Integer selectOrderCountTodayFinish(){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getDeleted, 0) + .between(OrderDO::getFinishTime, LocalDateTime.now().withHour(0).withMinute(0).withSecond(0), LocalDateTime.now().withHour(23).withMinute(59).withSecond(59)))); + } + +// 今日新增生产单总数统计 + default Integer selectOrderCountProduce(Long organId){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getOrganId, organId) + .eq(OrderDO::getDeleted, 0) + .eq(OrderDO::getStatus, OrderStatusEnum.IN_PRODUCTION.getStatus()))); + } + @OrganIgnore + default Integer selectOrderCountProduce(){ + return Math.toIntExact(selectCount(new LambdaQueryWrapper() + .eq(OrderDO::getDeleted, 0) + .eq(OrderDO::getStatus, OrderStatusEnum.IN_PRODUCTION.getStatus()))); + } + +// 生产中生产平方数 + @OrganIgnore + Integer selectOrderSquareProduce(@Param("organId") Long organId); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java index 1a84cfe75..ed5f9d185 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java @@ -1,5 +1,8 @@ package com.cf.imes.module.executor.dal.mysql.orderItem; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO; @@ -10,6 +13,7 @@ import com.cf.imes.module.executor.controller.admin.plan.saveOptimize.PrintOrder import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO; +import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO; import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO; import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO; @@ -31,10 +35,17 @@ public interface OrderItemMapper extends BaseMapperX { @Param("bodyId") Long bodyId, @Param("groupId") Long groupId, @Param("groupName") String groupName, @Param("organId") Long organId, @Param("deleted") Integer deleted); + IPage selectPlatesDetailByOrderId(@Param("page") IPage page, @Param("orderId") Long orderId, @Param("roomId") Long roomId, + @Param("bodyId") Long bodyId, @Param("groupId") Long groupId, + @Param("groupName") String groupName, @Param("organId") Long organId, + @Param("deleted") Integer deleted); List selectPartsDetailByOrderId(@Param("orderId") Long orderId, @Param("roomId") Long roomId, @Param("bodyId") Long bodyId, @Param("name") String name, @Param("organId") Long organId, @Param("deleted") Integer deleted); + IPage selectPartsDetailByOrderId(@Param("page") IPage page,@Param("orderId") Long orderId, @Param("roomId") Long roomId, + @Param("bodyId") Long bodyId, @Param("name") String name, + @Param("organId") Long organId, @Param("deleted") Integer deleted); List selectPartsByOrderId(@Param("orderId") Long orderId, diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderService.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderService.java index 0c663138c..510a9d248 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderService.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderService.java @@ -96,6 +96,7 @@ public interface OrderService { * 需要修改返回值 */ List getPlatesDetail(Long orderId, Long roomId , Long bodyId , Long groupId, String groupName); + PageResult getPlatesDetail(Long orderId, Long roomId, Long bodyId, Long groupId, String groupName, Integer pageNo, Integer pageSize); /** * @param orderId: 生产单id @@ -105,6 +106,7 @@ public interface OrderService { * 需要修改返回值 */ List getPartsDetail(Long orderId, Long roomId , Long bodyId , String name); + PageResult getPartsDetail(Long orderId, Long roomId , Long bodyId , String name, Integer pageNo, Integer pageSize); /** * 删除柜体 @@ -185,5 +187,42 @@ public interface OrderService { /** * 生产单超期告警分析统计 */ - Map> getOrderWarn(Integer startTerm); + Map> getOrderWarn(); + + /** + * 今日要完成生产单数 + */ + List getOrderOverdue(); + + String getOrderBodyToString(Long orderId); + + /** + * 生产单总数统计 + */ + Integer orderCount(); + + /** + * 今日新增生产单总数统计 + */ + Integer orderCountToday(); + + /** + * 今日生产单完成总数 + */ + Integer orderCountTodayFinish(); + + /** + * 今日生产单完成总数 + */ + Integer orderCountProduce(); + + /** + * 今日生产单完成总数 + */ + Integer orderSquareProduce(); + + /** + * 小板数量 + */ + Integer plateCount(); } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java index 985052d13..4db2513ef 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java @@ -1,19 +1,25 @@ package com.cf.imes.module.executor.service.order; import cn.smallbun.screw.core.util.CollectionUtils; +import co.elastic.clients.elasticsearch.nodes.Ingest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; +import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; import com.cf.imes.framework.organ.core.context.OrganContextHolder; +import com.cf.imes.framework.security.core.LoginUser; import com.cf.imes.module.executor.controller.admin.order.vo.order.*; import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils; import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO; import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark; import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO; +import com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVOCopy; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateGoodsIdVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO; import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO; @@ -279,6 +285,78 @@ public class OrderServiceImpl implements OrderService { orderBodyMapper.selectList(orderId, deleted, SecurityFrameworkUtils.getLoginUser().getOrganId()), OrderBodyRespVO.class); return orderBodyRespVOList; } + @Override + public String getOrderBodyToString(Long orderId) { + // 判断生产单是否删除 + Integer deleted = getOrderDeleted(orderId); + + List orderBodyRespVOList = BeanUtils.toBean( + orderBodyMapper.selectList(orderId, deleted, SecurityFrameworkUtils.getLoginUser().getOrganId()), OrderBodyRespVO.class); + String orderBodyToString = JSON.toJSONString(orderBodyRespVOList); + + return JsonUtils.zipString(orderBodyToString); + } + + @Override + public Integer orderCount() { +// 角色判断 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + System.out.println("loginUser " + loginUser); +// 数据查询 + if (loginUser.getIsSupAdmin()){ + return orderMapper.selectOrderCount(); + } + return orderMapper.selectOrderCount(getUserOrganId()); + } + + @Override + public Integer orderCountToday() { +// 角色判断 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); +// 数据查询 + if (loginUser.getIsSupAdmin()){ + return orderMapper.selectOrderCountToday(); + } + return orderMapper.selectOrderCountToday(getUserOrganId()); + } + + @Override + public Integer orderCountTodayFinish() { +// 角色判断 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); +// 数据查询 + if (loginUser.getIsSupAdmin()){ + return orderMapper.selectOrderCountTodayFinish(); + } + return orderMapper.selectOrderCountTodayFinish(getUserOrganId()); + } + + @Override + public Integer orderCountProduce() { +// 角色判断 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); +// 数据查询 + if (loginUser.getIsSupAdmin()){ + return orderMapper.selectOrderCountProduce(); + } + return orderMapper.selectOrderCountProduce(getUserOrganId()); + } + + @Override + public Integer orderSquareProduce() { +// 角色判断 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); +// 数据查询 + if (loginUser.getIsSupAdmin()){ + return orderMapper.selectOrderSquareProduce(null); + } + return orderMapper.selectOrderSquareProduce(getUserOrganId()); + } + + @Override + public Integer plateCount() { + return null; + } @Override public List getRoomAndBody(Long planId) { @@ -317,14 +395,26 @@ public class OrderServiceImpl implements OrderService { List platesDetailReqVOS = new ArrayList<>(); orderDetail.forEach(orderPlatesDetailRespVO -> { OrderPlatesDetailReqVO orderPlatesDetailReqVO = BeanUtils.toBean(orderPlatesDetailRespVO, OrderPlatesDetailReqVO.class) - .setIsHole(false); + .setIsRowHole(false); if (orderPlatesDetailRespVO.getUnregularPointCount() > 0 || orderPlatesDetailRespVO.getFrontHoleCount() > 0 || orderPlatesDetailRespVO.getBackHoleCount() > 0 || orderPlatesDetailRespVO.getSideHoleCount() > 0) - orderPlatesDetailReqVO.setIsHole(true); + orderPlatesDetailReqVO.setIsRowHole(true); platesDetailReqVOS.add(orderPlatesDetailReqVO); }); return platesDetailReqVOS; } + @Override + public PageResult getPlatesDetail(Long orderId, Long roomId, Long bodyId, Long groupId, String groupName, Integer pageNo, Integer pageSize) { + PageDTO page = new PageDTO<>(pageNo, pageSize); + // 判断生产单是否删除 (包含判断存在) + Integer deleted = getOrderDeleted(orderId); + IPage plateRespVOPage = orderItemMapper.selectPlatesDetailByOrderId(page,orderId, roomId, bodyId, groupId, + groupName, SecurityFrameworkUtils.getLoginUser().getOrganId(), deleted); + List orderDetail = plateRespVOPage.getRecords(); + List platesDetailReqVOS = BeanUtils.toBean(orderDetail, OrderPlatesDetailReqVO.class); + PageResult pageResult = new PageResult(platesDetailReqVOS, plateRespVOPage.getTotal()); + return pageResult; + } @Override public List getPartsDetail(Long orderId, Long roomId, Long bodyId, String name) { @@ -334,6 +424,16 @@ public class OrderServiceImpl implements OrderService { SecurityFrameworkUtils.getLoginUser().getOrganId(), deleted); return orderDetail; } + @Override + public PageResult getPartsDetail(Long orderId, Long roomId, Long bodyId, String name, Integer pageNo, Integer pageSize) { + PageDTO page = new PageDTO<>(pageNo, pageSize); + // 判断生产单是否删除 (包含判断存在) + Integer deleted = getOrderDeleted(orderId); + IPage orderDetail = orderItemMapper.selectPartsDetailByOrderId(page, orderId, roomId, bodyId, name, + SecurityFrameworkUtils.getLoginUser().getOrganId(), deleted); + PageResult pageResult = new PageResult(orderDetail.getRecords(), orderDetail.getTotal()); + return pageResult; + } @Override @Transactional(rollbackFor = Exception.class) @@ -607,34 +707,28 @@ public class OrderServiceImpl implements OrderService { } @Override - public Map> getOrderWarn(Integer startTerm) { + public Map> getOrderWarn() { Map> map = new HashMap<>(); - LocalDateTime today = LocalDateTime.now(); -// 根据开始条件选择 - LocalDateTime orderDate = null; + LocalDateTime yesterdayDay = LocalDateTime.now().minus(1, ChronoUnit.DAYS).withHour(23).withMinute(59).withSecond(59); - switch (startTerm) { - case 3: - orderDate = LocalDateTime.now().minus(3, ChronoUnit.DAYS); - break; - case 7: - orderDate = LocalDateTime.now().minus(7, ChronoUnit.DAYS); - break; - default: - orderDate = LocalDateTime.now().minus(1, ChronoUnit.DAYS); - break; + LocalDateTime today = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0); + LocalDateTime tomorrowDay = LocalDateTime.now().plus(1, ChronoUnit.DAYS).withHour(23).withMinute(59).withSecond(59); - } // 查询预警单 - List orderNearVOS = orderMapper.selectOrderNear(today, orderDate, OrganContextHolder.getOrganId()); + List orderNearVOS = orderMapper.selectOrderNear(today, tomorrowDay, OrganContextHolder.getOrganId()); map.put("orderNearVOS",orderNearVOS); // 查询超时单 - List orderOverdueVOS = orderMapper.selectOrderOverdue(today, OrganContextHolder.getOrganId()); + List orderOverdueVOS = orderMapper.selectOrderOverdue(yesterdayDay, OrganContextHolder.getOrganId()); map.put("orderOverdueVOS",orderOverdueVOS); return map; } + @Override + public List getOrderOverdue() { + return null; + } + // 判断是否已经导入 private Boolean validateOrderNoExists(String orderNo, Long organId) { if (orderMapper.selectCount(new LambdaQueryWrapper() diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml index a14e05546..32febc1dc 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml @@ -122,6 +122,7 @@ from orders o where o.organ_id = #{organId} and o.deleted = 0 + and o.status != 4 and o.delivery_date between #{orderDate} and #{today} @@ -155,6 +156,17 @@ from orders o where o.organ_id = #{organId} and o.deleted = 0 + and o.status != 4 and #{today} > DATE(o.delivery_date) + + + \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml index c5765081f..2d31502d4 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml @@ -6,7 +6,7 @@ + select distinct m.*, + coalesce(r.id is not null, true) as readStatus + , r.read_time readTime + from system_notify_message m + left join system_notify_message_readinfo r on r.message_id = m.id + + + r.id is not null + + + r.id is null + + + and m.create_time between #{reqVo.createTime[0]} and #{reqVo.createTime[1]} + + + and m.user_type = #{reqVo.userType} + + + and m.template_code = #{reqVo.templateCode} + + + and m.template_type = #{reqVo.templateType} + + and m.user_id in (#{reqVo.userId},0) + + order by m.id desc + + + + + + \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/test/java/com/cf/imes/module/system/service/notify/NotifyMessageServiceImplTest.java b/cf-module-system/cf-module-system-biz/src/test/java/com/cf/imes/module/system/service/notify/NotifyMessageServiceImplTest.java index 54d76143c..e1bbab365 100644 --- a/cf-module-system/cf-module-system-biz/src/test/java/com/cf/imes/module/system/service/notify/NotifyMessageServiceImplTest.java +++ b/cf-module-system/cf-module-system-biz/src/test/java/com/cf/imes/module/system/service/notify/NotifyMessageServiceImplTest.java @@ -5,7 +5,6 @@ import com.cf.imes.framework.common.enums.UserTypeEnum; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.mybatis.core.enums.SqlConstants; import com.cf.imes.framework.test.core.ut.BaseDbUnitTest; -import com.cf.imes.module.system.controller.admin.notify.vo.message.NotifyMessageMyPageReqVO; import com.cf.imes.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; import com.cf.imes.module.system.dal.dataobject.notify.NotifyMessageDO; import com.cf.imes.module.system.dal.dataobject.notify.NotifyTemplateDO; @@ -17,7 +16,6 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.Arrays; import java.util.Collection; -import java.util.List; import java.util.Map; import static cn.hutool.core.util.RandomUtil.randomEle; @@ -101,7 +99,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest { reqVO.setCreateTime(buildBetweenTime(2022, 1, 1, 2022, 1, 10)); // 调用 - PageResult pageResult = notifyMessageService.getNotifyMessagePage(reqVO); + PageResult pageResult = notifyMessageService.getMyMyNotifyMessagePage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -144,12 +142,14 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest { // 准备参数 Long userId = 1L; Integer userType = UserTypeEnum.ADMIN.getValue(); - NotifyMessageMyPageReqVO reqVO = new NotifyMessageMyPageReqVO(); + NotifyMessagePageReqVO reqVO = new NotifyMessagePageReqVO(); reqVO.setReadStatus(true); reqVO.setCreateTime(buildBetweenTime(2022, 1, 1, 2022, 1, 10)); + reqVO.setUserId(userId); + reqVO.setUserType(userType); // 调用 - PageResult pageResult = notifyMessageService.getMyMyNotifyMessagePage(reqVO, userId, userType); + PageResult pageResult = notifyMessageService.getMyMyNotifyMessagePage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -163,7 +163,6 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest { NotifyMessageDO dbNotifyMessage = randomPojo(NotifyMessageDO.class, o -> { // 等会查询到 o.setUserId(1L); o.setUserType(UserTypeEnum.ADMIN.getValue()); - //o.setReadStatus(false); o.setTemplateParams(randomTemplateParams()); }); notifyMessageMapper.insert(dbNotifyMessage); @@ -176,13 +175,17 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest { // 准备参数 Long userId = 1L; Integer userType = UserTypeEnum.ADMIN.getValue(); - Integer size = 10; - + NotifyMessagePageReqVO reqVO = new NotifyMessagePageReqVO(); + reqVO.setReadStatus(false); + reqVO.setPageSize(10); + reqVO.setPageNo(1); + reqVO.setUserId(userId); + reqVO.setUserType(userType); // 调用 - List list = notifyMessageService.getUnreadNotifyMessageList(userId, userType, size); + PageResult pageResult = notifyMessageService.getMyMyNotifyMessagePage(reqVO); // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbNotifyMessage, list.get(0)); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbNotifyMessage, pageResult.getList().get(0)); } @Test From 82885b9ca8798127763d37f065b16e8e60f81b9b Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Tue, 16 Jul 2024 15:18:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8Csystem=5Fnotify=5Fmessage=5Freadinfo=E8=A1=A8?= =?UTF-8?q?=E6=9A=82=E4=B8=8D=E8=B5=B0=E5=A4=9A=E6=9C=BA=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4DO=E4=B8=AD=E7=9A=84organId=EF=BC=9B2?= =?UTF-8?q?=E3=80=81=E6=B6=88=E6=81=AF=E8=AE=B0=E5=BD=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9A=82=E5=92=8C=E6=88=91=E7=9A=84=E6=B6=88=E6=81=AF=E8=B5=B0?= =?UTF-8?q?=E7=9B=B8=E5=90=8Cservice=E5=AE=9E=E7=8E=B0=EF=BC=9B3=E3=80=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8=E6=97=B6?= =?UTF-8?q?userId=E4=BD=9C=E7=94=A8=E4=BA=8E=E5=85=B3=E8=81=94readinfo?= =?UTF-8?q?=E8=80=8C=E4=B8=8D=E7=AD=9B=E9=80=89message=E8=A1=A8=E6=9C=AC?= =?UTF-8?q?=E8=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/notify/NotifyMessageController.java | 2 ++ .../dataobject/notify/NotifyMessageReadInfoDO.java | 5 ----- .../src/main/resources/application.yaml | 1 + .../mapper/message/NotifyMessageMapper.xml | 13 +++++-------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/notify/NotifyMessageController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/notify/NotifyMessageController.java index c8354558d..25574f088 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/notify/NotifyMessageController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/notify/NotifyMessageController.java @@ -46,6 +46,8 @@ public class NotifyMessageController { @Operation(summary = "获得站内信分页") @PreAuthorize("@ss.hasPermission('system:notify-message:query')") public CommonResult> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) { + pageVO.setUserId(getLoginUserId()); + pageVO.setUserType(UserTypeEnum.ADMIN.getValue()); PageResult pageResult = notifyMessageService.getMyMyNotifyMessagePage(pageVO); return success(BeanUtils.toBean(pageResult, NotifyMessageRespVO.class)); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/notify/NotifyMessageReadInfoDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/notify/NotifyMessageReadInfoDO.java index 47d4b0099..a45af8da1 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/notify/NotifyMessageReadInfoDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/notify/NotifyMessageReadInfoDO.java @@ -29,11 +29,6 @@ public class NotifyMessageReadInfoDO { @TableId private Long id; - /** - * 组织id - */ - private Long organId; - /** * 站内信消息id */ diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml b/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml index 0ac67136f..853140d0c 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml @@ -187,6 +187,7 @@ chenfeng: - system_label_element_template - system_data_source - system_notify_message + - system_notify_message_readinfo - system_data_source_field use-data-code: imes_prod #动态数据源标识,后期添加的数据源需要修改此值 diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/mapper/message/NotifyMessageMapper.xml b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/message/NotifyMessageMapper.xml index 4cd8097cc..aec9177ac 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/mapper/message/NotifyMessageMapper.xml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/message/NotifyMessageMapper.xml @@ -10,7 +10,7 @@ coalesce(r.id is not null, true) as readStatus , r.read_time readTime from system_notify_message m - left join system_notify_message_readinfo r on r.message_id = m.id + left join system_notify_message_readinfo r on r.message_id = m.id and r.user_id = #{reqVo.userId} r.id is not null @@ -30,7 +30,6 @@ and m.template_type = #{reqVo.templateType} - and m.user_id in (#{reqVo.userId},0) order by m.id desc @@ -38,18 +37,16 @@ \ No newline at end of file