Commit c94daedfd5eb1317a71f1b6c816707460ad13db2
Merge branch 'zhongnanhuang'
Showing
27 changed files
with
588 additions
and
5 deletions
src/main/java/com/order/erp/common/utils/ProfitUtils.java
... | ... | @@ -28,6 +28,6 @@ public class ProfitUtils { |
28 | 28 | |
29 | 29 | BigDecimal customerTotalPrice = new BigDecimal(calculateVO.getCustomerTotalPrice()); |
30 | 30 | |
31 | - return new BigDecimal(1).subtract((productionDepartmentTotalPrice.divide(exchangeRate).add(packetTotalPrice)).divide(customerTotalPrice)).doubleValue(); | |
31 | + return new BigDecimal(1).subtract((productionDepartmentTotalPrice.divide(exchangeRate,4,BigDecimal.ROUND_HALF_UP).add(packetTotalPrice)).divide(customerTotalPrice,4,BigDecimal.ROUND_HALF_UP)).doubleValue(); | |
32 | 32 | } |
33 | 33 | } | ... | ... |
src/main/java/com/order/erp/controller/IndexController.java
0 → 100644
1 | +package com.order.erp.controller; | |
2 | + | |
3 | +import com.order.erp.common.constant.ServerResult; | |
4 | +import com.order.erp.domain.OrderStatusEnum; | |
5 | +import com.order.erp.domain.vo.IndexDataVO; | |
6 | +import com.order.erp.service.order.OrderBaseInfoService; | |
7 | +import com.order.erp.service.order.OrderCompletionReportService; | |
8 | +import com.order.erp.service.order.OrderInspectionStageService; | |
9 | +import com.order.erp.service.order.OrderProfitAnalysisService; | |
10 | +import org.springframework.web.bind.annotation.GetMapping; | |
11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
12 | +import org.springframework.web.bind.annotation.RestController; | |
13 | + | |
14 | +import javax.annotation.Resource; | |
15 | +import java.util.List; | |
16 | +import java.util.Map; | |
17 | + | |
18 | +/** | |
19 | + * @author zhongnanhuang | |
20 | + * @version 1.0 | |
21 | + * @project order-erp | |
22 | + * @description 首页 | |
23 | + * @date 2023/10/23 16:44:55 | |
24 | + */ | |
25 | +@RestController | |
26 | +@RequestMapping("/order/erp/index") | |
27 | +public class IndexController { | |
28 | + | |
29 | + @Resource | |
30 | + OrderBaseInfoService orderBaseInfoService; | |
31 | + | |
32 | + @Resource | |
33 | + OrderInspectionStageService orderInspectionStageService; | |
34 | + | |
35 | + @Resource | |
36 | + OrderProfitAnalysisService orderProfitAnalysisService; | |
37 | + | |
38 | + @Resource | |
39 | + OrderCompletionReportService orderCompletionReportService; | |
40 | + | |
41 | + @GetMapping("/data") | |
42 | + public ServerResult getData(){ | |
43 | + //订单总完成数 | |
44 | + long orderTotalFinished = orderBaseInfoService.countByOrderStatus(OrderStatusEnum.ORDER_FINISH.getStatus()); | |
45 | + //订单当月完成数 | |
46 | + long orderRecentMonthFinished = orderBaseInfoService.countRecentMonthByOrderStatus(OrderStatusEnum.ORDER_FINISH.getStatus()); | |
47 | + | |
48 | + | |
49 | + //跟单和质检中 | |
50 | + long inspecting = orderInspectionStageService.countByOrderStatus(OrderStatusEnum.INSPECT_ING.getStatus()); | |
51 | + long recentMonthInspecting = orderInspectionStageService.countRecentMonthByOrderStatus(OrderStatusEnum.INSPECT_ING.getStatus()); | |
52 | + | |
53 | + //利润分析表待审核 | |
54 | + long orderProfitWaitAudit = orderProfitAnalysisService.countByOrderStatus(OrderStatusEnum.PROFIT_WAIT_AUDIT.getStatus()); | |
55 | + long orderRecentWeekProfitWaitAudit = orderProfitAnalysisService.countRecentWeekByOrderStatus(OrderStatusEnum.PROFIT_WAIT_AUDIT.getStatus()); | |
56 | + | |
57 | + //项目报告书待审核 | |
58 | + long orderReport = orderCompletionReportService.countByOrderStatus(OrderStatusEnum.REPORT_WAIT_AUDIT.getStatus()); | |
59 | + long orderYearReport = orderCompletionReportService.countYearByOrderStatus(OrderStatusEnum.REPORT_WAIT_AUDIT.getStatus()); | |
60 | + | |
61 | + | |
62 | + IndexDataVO indexDataVo = new IndexDataVO(); | |
63 | + indexDataVo.setOrderFinishedCount(orderTotalFinished); | |
64 | + indexDataVo.setOrderRecentMonthFinishedCount(orderRecentMonthFinished); | |
65 | + indexDataVo.setOrderInspectingCount(inspecting); | |
66 | + indexDataVo.setOrderRecentMonthInspectingCount(recentMonthInspecting); | |
67 | + indexDataVo.setOrderProfitWaitAuditCount(orderProfitWaitAudit); | |
68 | + indexDataVo.setOrderRecentWeekProfitWaitAuditCount(orderRecentWeekProfitWaitAudit); | |
69 | + indexDataVo.setOrderReportWaitAuditCount(orderReport); | |
70 | + indexDataVo.setOrderReportRecentYearWaitAuditCount(orderYearReport); | |
71 | + | |
72 | + return ServerResult.success(indexDataVo); | |
73 | + } | |
74 | + | |
75 | + @GetMapping("/chartData") | |
76 | + public ServerResult getChartData(){ | |
77 | + //订单趋势数据 | |
78 | + List<Map<String,Integer>> chartData = orderBaseInfoService.countDaysOrder(); | |
79 | + return ServerResult.success(chartData); | |
80 | + } | |
81 | +} | ... | ... |
src/main/java/com/order/erp/controller/OrderProfitController.java
0 → 100644
1 | +package com.order.erp.controller; | |
2 | + | |
3 | +import com.order.erp.common.constant.ServerResult; | |
4 | +import com.order.erp.domain.dto.order.OrderProfitAnalysisDO; | |
5 | +import com.order.erp.service.order.OrderProfitAnalysisService; | |
6 | +import org.springframework.web.bind.annotation.PostMapping; | |
7 | +import org.springframework.web.bind.annotation.RequestBody; | |
8 | +import org.springframework.web.bind.annotation.RequestMapping; | |
9 | +import org.springframework.web.bind.annotation.RestController; | |
10 | + | |
11 | +import javax.annotation.Resource; | |
12 | +import java.util.List; | |
13 | +import java.util.Map; | |
14 | + | |
15 | +/** | |
16 | + * @author zhongnanhuang | |
17 | + * @version 1.0 | |
18 | + * @project order-erp | |
19 | + * @description 订单利润表控制层 | |
20 | + * @date 2023/10/23 11:48:36 | |
21 | + */ | |
22 | +@RestController | |
23 | +@RequestMapping("/order/erp/profit") | |
24 | +public class OrderProfitController { | |
25 | + | |
26 | + @Resource | |
27 | + OrderProfitAnalysisService orderProfitAnalysisService; | |
28 | + | |
29 | + @PostMapping("/analysis") | |
30 | + public ServerResult analysis(@RequestBody Map<String,List<Long>> body){ | |
31 | + List<Long> orderIds = body.get("orderIds"); | |
32 | + if (orderIds==null||orderIds.size()<=0){ | |
33 | + return ServerResult.fail("订单不能为空"); | |
34 | + } | |
35 | + | |
36 | + OrderProfitAnalysisDO orderProfitAnalysisDO = orderProfitAnalysisService.analysisByOrderIds(orderIds); | |
37 | + | |
38 | + if (orderProfitAnalysisDO==null){ | |
39 | + return ServerResult.fail("找不到订单信息"); | |
40 | + } | |
41 | + | |
42 | + return ServerResult.success(orderProfitAnalysisDO); | |
43 | + } | |
44 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/IndexDataVO.java
0 → 100644
1 | +package com.order.erp.domain.vo; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Data; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import lombok.ToString; | |
7 | + | |
8 | +/** | |
9 | + * @author zhongnanhuang | |
10 | + * @version 1.0 | |
11 | + * @project order-erp | |
12 | + * @description 首页数据展示 | |
13 | + * @date 2023/10/24 09:03:20 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +public class IndexDataVO { | |
20 | + private Long orderFinishedCount; | |
21 | + | |
22 | + private Long orderRecentMonthFinishedCount; | |
23 | + | |
24 | + private Long orderInspectingCount; | |
25 | + | |
26 | + private Long orderRecentMonthInspectingCount; | |
27 | + | |
28 | + private Long orderProfitWaitAuditCount; | |
29 | + | |
30 | + private Long orderRecentWeekProfitWaitAuditCount; | |
31 | + | |
32 | + private Long orderReportWaitAuditCount; | |
33 | + | |
34 | + private Long orderReportRecentYearWaitAuditCount; | |
35 | + | |
36 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/OrderCountVO.java
0 → 100644
1 | +package com.order.erp.domain.vo; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Data; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import lombok.ToString; | |
7 | + | |
8 | +/** | |
9 | + * @author zhongnanhuang | |
10 | + * @version 1.0 | |
11 | + * @project order-erp | |
12 | + * @description 订单每日数据 | |
13 | + * @date 2023/10/24 10:28:59 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@NoArgsConstructor | |
18 | +@ToString | |
19 | +public class OrderCountVO { | |
20 | + private String hour; | |
21 | + private Integer count; | |
22 | +} | ... | ... |
src/main/java/com/order/erp/mapper/order/OrderBaseInfoMapper.java
1 | 1 | package com.order.erp.mapper.order; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | +import com.order.erp.domain.OrderStatusEnum; | |
4 | 5 | import com.order.erp.domain.dto.order.OrderBaseInfoDO; |
6 | +import com.order.erp.domain.vo.OrderCountVO; | |
7 | +import org.apache.ibatis.annotations.Select; | |
8 | + | |
9 | +import java.util.List; | |
10 | +import java.util.Map; | |
5 | 11 | |
6 | 12 | /** |
7 | 13 | * 订单基础信息表(OrderBaseInfo)表数据库访问层 |
... | ... | @@ -12,5 +18,10 @@ import com.order.erp.domain.dto.order.OrderBaseInfoDO; |
12 | 18 | public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfoDO> { |
13 | 19 | |
14 | 20 | |
21 | + @Select("SELECT count(*) FROM order_base_info WHERE order_status=#{orderStatus} and DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(create_time);") | |
22 | + long countRecentMonthByOrderStatus(Integer orderStatus); | |
23 | + | |
24 | + @Select("SELECT DATE(create_time) AS dateTime, COUNT(*) AS orderCount FROM order_base_info GROUP BY dateTime;") | |
25 | + List<Map<String, Integer>> countDaysOrder(); | |
15 | 26 | } |
16 | 27 | ... | ... |
src/main/java/com/order/erp/mapper/order/OrderCompletionReportMapper.java
... | ... | @@ -2,6 +2,7 @@ package com.order.erp.mapper.order; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | 4 | import com.order.erp.domain.dto.order.OrderCompletionReportDO; |
5 | +import org.apache.ibatis.annotations.Select; | |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * 订单-项目完成报告书(OrderCompletionReport)表数据库访问层 |
... | ... | @@ -12,5 +13,7 @@ import com.order.erp.domain.dto.order.OrderCompletionReportDO; |
12 | 13 | public interface OrderCompletionReportMapper extends BaseMapper<OrderCompletionReportDO> { |
13 | 14 | |
14 | 15 | |
16 | + @Select("SELECT count(*) FROM order_completion_report WHERE order_status=20 and create_time >= DATE_SUB(NOW(), INTERVAL 1 YEAR);SELECT * FROM order_completion_report WHERE order_status=#{status} and create_time >= DATE_SUB(NOW(), INTERVAL 1 YEAR);") | |
17 | + long countYearByOrderStatus(Integer status); | |
15 | 18 | } |
16 | 19 | ... | ... |
src/main/java/com/order/erp/mapper/order/OrderInspectionStageMapper.java
... | ... | @@ -2,6 +2,7 @@ package com.order.erp.mapper.order; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | 4 | import com.order.erp.domain.dto.order.OrderInspectionStageDO; |
5 | +import org.apache.ibatis.annotations.Select; | |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * 订单-质检环节(OrderInspectionStage)表数据库访问层 |
... | ... | @@ -12,5 +13,7 @@ import com.order.erp.domain.dto.order.OrderInspectionStageDO; |
12 | 13 | public interface OrderInspectionStageMapper extends BaseMapper<OrderInspectionStageDO> { |
13 | 14 | |
14 | 15 | |
16 | + @Select("SELECT count(*) FROM order_inspection_stage WHERE order_status=#{status} and DATE_SUB(CURDATE(), INTERVAL 1 MONTH) <= date(create_time);") | |
17 | + long countRecentMonthByOrderStatus(Integer status); | |
15 | 18 | } |
16 | 19 | ... | ... |
src/main/java/com/order/erp/mapper/order/OrderProfitAnalysisMapper.java
... | ... | @@ -2,6 +2,7 @@ package com.order.erp.mapper.order; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | 4 | import com.order.erp.domain.dto.order.OrderProfitAnalysisDO; |
5 | +import org.apache.ibatis.annotations.Select; | |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * 订单利润分析表(OrderProfitAnalysis)表数据库访问层 |
... | ... | @@ -12,5 +13,7 @@ import com.order.erp.domain.dto.order.OrderProfitAnalysisDO; |
12 | 13 | public interface OrderProfitAnalysisMapper extends BaseMapper<OrderProfitAnalysisDO> { |
13 | 14 | |
14 | 15 | |
16 | + @Select("SELECT count(*) FROM order_profit_analysis WHERE order_status=#{status} and create_time >= DATE_SUB(NOW(), INTERVAL 1 WEEK);") | |
17 | + long countRecentWeekByOrderStatus(Integer status); | |
15 | 18 | } |
16 | 19 | ... | ... |
src/main/java/com/order/erp/service/order/OrderAuditLogService.java
... | ... | @@ -6,6 +6,8 @@ import com.order.erp.domain.dto.order.OrderAuditLogDO; |
6 | 6 | import com.order.erp.domain.vo.order.OrderAuditLogQueryVO; |
7 | 7 | import com.order.erp.domain.vo.order.OrderAuditLogVO; |
8 | 8 | |
9 | +import java.util.List; | |
10 | + | |
9 | 11 | /** |
10 | 12 | * 用户订单审批日志表(OrderAuditLog)表服务接口 |
11 | 13 | * |
... | ... | @@ -54,4 +56,7 @@ public interface OrderAuditLogService extends IService<OrderAuditLogDO> { |
54 | 56 | */ |
55 | 57 | ServerResult deleteById(OrderAuditLogQueryVO orderAuditLogQueryVO); |
56 | 58 | |
59 | + boolean deleteByOrderId(Long getId); | |
60 | + | |
61 | + boolean deleteByOrderIds(List<Long> orderIds); | |
57 | 62 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderBaseInfoService.java
... | ... | @@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import com.order.erp.common.constant.ServerResult; |
5 | 5 | import com.order.erp.common.excel4j.exceptions.Excel4JException; |
6 | 6 | import com.order.erp.domain.dto.order.OrderBaseInfoDO; |
7 | +import com.order.erp.domain.vo.IndexDataVO; | |
7 | 8 | import com.order.erp.domain.vo.order.*; |
8 | 9 | |
9 | 10 | import javax.servlet.http.HttpServletResponse; |
10 | 11 | import java.io.IOException; |
12 | +import java.util.List; | |
13 | +import java.util.Map; | |
11 | 14 | |
12 | 15 | /** |
13 | 16 | * 订单基础信息表(OrderBaseInfo)表服务接口 |
... | ... | @@ -80,4 +83,10 @@ public interface OrderBaseInfoService extends IService<OrderBaseInfoDO> { |
80 | 83 | */ |
81 | 84 | ServerResult deleteById(OrderBaseInfoQueryVO orderBaseInfoQueryVO); |
82 | 85 | |
86 | + long countByOrderStatus(Integer orderFinish); | |
87 | + | |
88 | + long countRecentMonthByOrderStatus(Integer orderFinish); | |
89 | + | |
90 | + | |
91 | + List<Map<String, Integer>> countDaysOrder(); | |
83 | 92 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderCompletionReportService.java
... | ... | @@ -6,6 +6,8 @@ import com.order.erp.domain.dto.order.OrderCompletionReportDO; |
6 | 6 | import com.order.erp.domain.vo.order.OrderCompletionReportQueryVO; |
7 | 7 | import com.order.erp.domain.vo.order.OrderCompletionReportVO; |
8 | 8 | |
9 | +import java.util.List; | |
10 | + | |
9 | 11 | /** |
10 | 12 | * 订单-项目完成报告书(OrderCompletionReport)表服务接口 |
11 | 13 | * |
... | ... | @@ -54,4 +56,11 @@ public interface OrderCompletionReportService extends IService<OrderCompletionRe |
54 | 56 | */ |
55 | 57 | ServerResult deleteById(OrderCompletionReportQueryVO orderCompletionReportQueryVO); |
56 | 58 | |
59 | + boolean deleteByOrderId(Long orderId); | |
60 | + | |
61 | + boolean deleteByOrderIds(List<Long> orderIds); | |
62 | + | |
63 | + long countByOrderStatus(Integer status); | |
64 | + | |
65 | + long countYearByOrderStatus(Integer status); | |
57 | 66 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderFieldLockApplyService.java
... | ... | @@ -7,6 +7,8 @@ import com.order.erp.domain.vo.order.AuditVO; |
7 | 7 | import com.order.erp.domain.vo.order.OrderFieldLockApplyQueryVO; |
8 | 8 | import com.order.erp.domain.vo.order.OrderFieldLockApplyVO; |
9 | 9 | |
10 | +import java.util.List; | |
11 | + | |
10 | 12 | /** |
11 | 13 | * 用户订单-字段锁定申请表(OrderFieldLockApply)表服务接口 |
12 | 14 | * |
... | ... | @@ -67,4 +69,7 @@ public interface OrderFieldLockApplyService extends IService<OrderFieldLockApply |
67 | 69 | */ |
68 | 70 | ServerResult deleteById(OrderFieldLockApplyQueryVO orderFieldLockApplyQueryVO); |
69 | 71 | |
72 | + boolean deleteByOrderId(Long orderId); | |
73 | + | |
74 | + boolean deleteByOrderIds(List<Long> orderIds); | |
70 | 75 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderFieldLockRecordService.java
... | ... | @@ -6,6 +6,8 @@ import com.order.erp.domain.dto.order.OrderFieldLockRecordDO; |
6 | 6 | import com.order.erp.domain.vo.order.OrderFieldLockRecordQueryVO; |
7 | 7 | import com.order.erp.domain.vo.order.OrderFieldLockRecordVO; |
8 | 8 | |
9 | +import java.util.List; | |
10 | + | |
9 | 11 | /** |
10 | 12 | * 用户订单-字段锁定记录表(OrderFieldLockRecord)表服务接口 |
11 | 13 | * |
... | ... | @@ -54,4 +56,7 @@ public interface OrderFieldLockRecordService extends IService<OrderFieldLockReco |
54 | 56 | */ |
55 | 57 | ServerResult deleteById(OrderFieldLockRecordQueryVO orderFieldLockRecordQueryVO); |
56 | 58 | |
59 | + boolean deleteByOrderId(Long orderId); | |
60 | + | |
61 | + boolean deleteByOrderIds(List<Long> orderIds); | |
57 | 62 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderInspectionStageService.java
... | ... | @@ -2,10 +2,13 @@ package com.order.erp.service.order; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import com.order.erp.common.constant.ServerResult; |
5 | +import com.order.erp.domain.OrderStatusEnum; | |
5 | 6 | import com.order.erp.domain.dto.order.OrderInspectionStageDO; |
6 | 7 | import com.order.erp.domain.vo.order.OrderInspectionStageQueryVO; |
7 | 8 | import com.order.erp.domain.vo.order.OrderInspectionStageVO; |
8 | 9 | |
10 | +import java.util.List; | |
11 | + | |
9 | 12 | /** |
10 | 13 | * 订单-质检环节(OrderInspectionStage)表服务接口 |
11 | 14 | * |
... | ... | @@ -54,4 +57,11 @@ public interface OrderInspectionStageService extends IService<OrderInspectionSta |
54 | 57 | */ |
55 | 58 | ServerResult deleteById(OrderInspectionStageQueryVO orderInspectionStageQueryVO); |
56 | 59 | |
60 | + boolean deleteByOrderId(Long orderId); | |
61 | + | |
62 | + boolean deleteByOrderIds(List<Long> orderIds); | |
63 | + | |
64 | + long countByOrderStatus(Integer orderStatus); | |
65 | + | |
66 | + long countRecentMonthByOrderStatus(Integer status); | |
57 | 67 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderOptLogService.java
... | ... | @@ -6,6 +6,8 @@ import com.order.erp.domain.dto.order.OrderOptLogDO; |
6 | 6 | import com.order.erp.domain.vo.order.OrderOptLogQueryVO; |
7 | 7 | import com.order.erp.domain.vo.order.OrderOptLogVO; |
8 | 8 | |
9 | +import java.util.List; | |
10 | + | |
9 | 11 | /** |
10 | 12 | * 用户订单操作日志表(OrderOptLog)表服务接口 |
11 | 13 | * |
... | ... | @@ -54,4 +56,7 @@ public interface OrderOptLogService extends IService<OrderOptLogDO> { |
54 | 56 | */ |
55 | 57 | ServerResult deleteById(OrderOptLogQueryVO orderOptLogQueryVO); |
56 | 58 | |
59 | + boolean deleteByOrderId(Long orderId); | |
60 | + | |
61 | + boolean deleteByOrderIds(List<Long> orderIds); | |
57 | 62 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderProfitAnalysisService.java
... | ... | @@ -6,6 +6,8 @@ import com.order.erp.domain.dto.order.OrderProfitAnalysisDO; |
6 | 6 | import com.order.erp.domain.vo.order.OrderProfitAnalysisQueryVO; |
7 | 7 | import com.order.erp.domain.vo.order.OrderProfitAnalysisVO; |
8 | 8 | |
9 | +import java.util.List; | |
10 | + | |
9 | 11 | /** |
10 | 12 | * 订单利润分析表(OrderProfitAnalysis)表服务接口 |
11 | 13 | * |
... | ... | @@ -54,4 +56,13 @@ public interface OrderProfitAnalysisService extends IService<OrderProfitAnalysis |
54 | 56 | */ |
55 | 57 | ServerResult deleteById(OrderProfitAnalysisQueryVO orderProfitAnalysisQueryVO); |
56 | 58 | |
59 | + boolean deleteByOrderId(Long orderId); | |
60 | + | |
61 | + boolean deleteByOrderIds(List<Long> orderIds); | |
62 | + | |
63 | + OrderProfitAnalysisDO analysisByOrderIds(List<Long> orderIds); | |
64 | + | |
65 | + long countByOrderStatus(Integer status); | |
66 | + | |
67 | + long countRecentWeekByOrderStatus(Integer status); | |
57 | 68 | } | ... | ... |
src/main/java/com/order/erp/service/order/OrderTrackStageService.java
... | ... | @@ -6,6 +6,8 @@ import com.order.erp.domain.dto.order.OrderTrackStageDO; |
6 | 6 | import com.order.erp.domain.vo.order.OrderTrackStageQueryVO; |
7 | 7 | import com.order.erp.domain.vo.order.OrderTrackStageVO; |
8 | 8 | |
9 | +import java.util.List; | |
10 | + | |
9 | 11 | /** |
10 | 12 | * 订单-跟单环节(OrderTrackStage)表服务接口 |
11 | 13 | * |
... | ... | @@ -54,4 +56,7 @@ public interface OrderTrackStageService extends IService<OrderTrackStageDO> { |
54 | 56 | */ |
55 | 57 | ServerResult deleteById(OrderTrackStageQueryVO orderTrackStageQueryVO); |
56 | 58 | |
59 | + boolean deleteByOrderId(Long orderId); | |
60 | + | |
61 | + boolean deleteByOrderIds(List<Long> orderIds); | |
57 | 62 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderAuditLogServiceImpl.java
... | ... | @@ -120,4 +120,25 @@ public class OrderAuditLogServiceImpl extends ServiceImpl<OrderAuditLogMapper, O |
120 | 120 | update(updateWrapper); |
121 | 121 | return ServerResult.success(); |
122 | 122 | } |
123 | + | |
124 | + /** | |
125 | + * 逻辑删除,通过订单id删除 用户订单审批日志表(OrderAuditLog)实体类 | |
126 | + * @param orderId | |
127 | + * @return | |
128 | + */ | |
129 | + @Override | |
130 | + public boolean deleteByOrderId(Long orderId) { | |
131 | + LambdaUpdateWrapper<OrderAuditLogDO> updateWrapper = new LambdaUpdateWrapper<OrderAuditLogDO>() | |
132 | + .eq(OrderAuditLogDO::getOrderId, orderId) | |
133 | + .set(OrderAuditLogDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
134 | + return update(updateWrapper); | |
135 | + } | |
136 | + | |
137 | + @Override | |
138 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
139 | + LambdaUpdateWrapper<OrderAuditLogDO> updateWrapper = new LambdaUpdateWrapper<OrderAuditLogDO>() | |
140 | + .in(OrderAuditLogDO::getOrderId, orderIds) | |
141 | + .set(OrderAuditLogDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
142 | + return update(updateWrapper); | |
143 | + } | |
123 | 144 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... | ... | @@ -26,20 +26,20 @@ import com.order.erp.domain.OrderStatusEnum; |
26 | 26 | import com.order.erp.domain.dto.BaseDO; |
27 | 27 | import com.order.erp.domain.dto.order.*; |
28 | 28 | import com.order.erp.domain.excel.OrderExcelVO; |
29 | +import com.order.erp.domain.vo.IndexDataVO; | |
30 | +import com.order.erp.domain.vo.OrderCountVO; | |
29 | 31 | import com.order.erp.domain.vo.order.*; |
30 | 32 | import com.order.erp.mapper.order.OrderBaseInfoMapper; |
31 | 33 | import com.order.erp.service.order.*; |
32 | 34 | import lombok.extern.slf4j.Slf4j; |
33 | 35 | import org.springframework.beans.BeanUtils; |
34 | 36 | import org.springframework.stereotype.Service; |
37 | +import org.springframework.transaction.annotation.Transactional; | |
35 | 38 | |
36 | 39 | import javax.annotation.Resource; |
37 | 40 | import javax.servlet.http.HttpServletResponse; |
38 | 41 | import java.io.IOException; |
39 | -import java.util.List; | |
40 | -import java.util.Map; | |
41 | -import java.util.Objects; | |
42 | -import java.util.Set; | |
42 | +import java.util.*; | |
43 | 43 | import java.util.function.Function; |
44 | 44 | import java.util.stream.Collectors; |
45 | 45 | |
... | ... | @@ -73,6 +73,21 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
73 | 73 | private OrderFieldLockApplyService orderFieldLockApplyService; |
74 | 74 | |
75 | 75 | @Resource |
76 | + private OrderAuditLogService orderAuditLogService; | |
77 | + | |
78 | + @Resource | |
79 | + private OrderCompletionReportService orderCompletionReportService; | |
80 | + | |
81 | + @Resource | |
82 | + private OrderInspectionStageService orderInspectionStageService; | |
83 | + | |
84 | + @Resource | |
85 | + private OrderOptLogService orderOptLogService; | |
86 | + | |
87 | + @Resource | |
88 | + private OrderFieldLockRecordService orderFieldLockRecordService; | |
89 | + | |
90 | + @Resource | |
76 | 91 | private DataScope dataScope; |
77 | 92 | |
78 | 93 | /** |
... | ... | @@ -538,6 +553,7 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
538 | 553 | * @return 是否成功 |
539 | 554 | */ |
540 | 555 | @Override |
556 | + @Transactional | |
541 | 557 | public ServerResult deleteById(OrderBaseInfoQueryVO orderBaseInfoQueryVO) { |
542 | 558 | List<Long> ids = orderBaseInfoQueryVO.getIds(); |
543 | 559 | if (CollUtil.isEmpty(ids)) { |
... | ... | @@ -548,10 +564,61 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
548 | 564 | return ServerResult.success(); |
549 | 565 | } |
550 | 566 | //todo 校验是否可以逻辑删除 |
567 | + //订单基本信息 | |
551 | 568 | LambdaUpdateWrapper<OrderBaseInfoDO> updateWrapper = new LambdaUpdateWrapper<OrderBaseInfoDO>() |
552 | 569 | .in(OrderBaseInfoDO::getId, ids) |
553 | 570 | .set(OrderBaseInfoDO::getEnableFlag, Constant.UNABLE_TWENTY); |
554 | 571 | update(updateWrapper); |
572 | + | |
573 | + | |
574 | + //删除订单关联信息 | |
575 | + //订单审批日志 | |
576 | + orderAuditLogService.deleteByOrderIds(ids); | |
577 | + | |
578 | + //订单-项目完成报告书 | |
579 | + orderCompletionReportService.deleteByOrderIds(ids); | |
580 | + | |
581 | + //用户订单-字段锁定申请表 | |
582 | + orderFieldLockApplyService.deleteByOrderIds(ids); | |
583 | + | |
584 | + //用户订单-字段锁定记录表 | |
585 | + orderFieldLockRecordService.deleteByOrderIds(ids); | |
586 | + | |
587 | + //订单-质检环节 | |
588 | + orderInspectionStageService.deleteByOrderIds(ids); | |
589 | + | |
590 | + //用户订单操作日志表 | |
591 | + orderOptLogService.deleteByOrderIds(ids); | |
592 | + | |
593 | + //订单利润分析表 | |
594 | + profitAnalysisService.deleteByOrderIds(ids); | |
595 | + | |
596 | + //订单-跟单环节 | |
597 | + trackStageService.deleteByOrderIds(ids); | |
598 | + | |
599 | + | |
555 | 600 | return ServerResult.success(); |
556 | 601 | } |
602 | + | |
603 | + /** | |
604 | + * 根据订单状态统计订单数量 | |
605 | + * @param orderStatus | |
606 | + * @return | |
607 | + */ | |
608 | + @Override | |
609 | + public long countByOrderStatus(Integer orderStatus) { | |
610 | + return this.count(new LambdaQueryWrapper<OrderBaseInfoDO>().eq(OrderBaseInfoDO::getOrderStatus,orderStatus)); | |
611 | + } | |
612 | + | |
613 | + @Override | |
614 | + public long countRecentMonthByOrderStatus(Integer orderStatus) { | |
615 | + return this.baseMapper.countRecentMonthByOrderStatus(orderStatus); | |
616 | + } | |
617 | + | |
618 | + @Override | |
619 | + public List<Map<String, Integer>> countDaysOrder() { | |
620 | + return this.baseMapper.countDaysOrder(); | |
621 | + } | |
622 | + | |
623 | + | |
557 | 624 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderCompletionReportServiceImpl.java
... | ... | @@ -2,6 +2,7 @@ package com.order.erp.service.order.impl; |
2 | 2 | |
3 | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
5 | 6 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | 8 | import com.order.erp.common.constant.Constant; |
... | ... | @@ -120,4 +121,38 @@ public class OrderCompletionReportServiceImpl extends ServiceImpl<OrderCompletio |
120 | 121 | update(updateWrapper); |
121 | 122 | return ServerResult.success(); |
122 | 123 | } |
124 | + | |
125 | + /** | |
126 | + * 通过订单id逻辑删除 | |
127 | + * @param orderId | |
128 | + * @return | |
129 | + */ | |
130 | + @Override | |
131 | + public boolean deleteByOrderId(Long orderId) { | |
132 | + LambdaUpdateWrapper<OrderCompletionReportDO> updateWrapper = new LambdaUpdateWrapper<OrderCompletionReportDO>() | |
133 | + .eq(OrderCompletionReportDO::getOrderId, orderId) | |
134 | + .set(OrderCompletionReportDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
135 | + | |
136 | + return update(updateWrapper); | |
137 | + } | |
138 | + | |
139 | + @Override | |
140 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
141 | + LambdaUpdateWrapper<OrderCompletionReportDO> updateWrapper = new LambdaUpdateWrapper<OrderCompletionReportDO>() | |
142 | + .in(OrderCompletionReportDO::getOrderId, orderIds) | |
143 | + .set(OrderCompletionReportDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
144 | + | |
145 | + return update(updateWrapper); | |
146 | + } | |
147 | + | |
148 | + @Override | |
149 | + public long countByOrderStatus(Integer status) { | |
150 | + return baseMapper.selectCount(new LambdaQueryWrapper<OrderCompletionReportDO>() | |
151 | + .eq(OrderCompletionReportDO::getOrderStatus, status)); | |
152 | + } | |
153 | + | |
154 | + @Override | |
155 | + public long countYearByOrderStatus(Integer status) { | |
156 | + return baseMapper.countYearByOrderStatus(status); | |
157 | + } | |
123 | 158 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
... | ... | @@ -252,4 +252,27 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
252 | 252 | update(updateWrapper); |
253 | 253 | return ServerResult.success(); |
254 | 254 | } |
255 | + | |
256 | + /** | |
257 | + * 通过订单id逻辑删除 | |
258 | + * @param orderId | |
259 | + * @return | |
260 | + */ | |
261 | + @Override | |
262 | + public boolean deleteByOrderId(Long orderId) { | |
263 | + LambdaUpdateWrapper<OrderFieldLockApplyDO> updateWrapper = new LambdaUpdateWrapper<OrderFieldLockApplyDO>() | |
264 | + .in(OrderFieldLockApplyDO::getOrderId, orderId) | |
265 | + .set(OrderFieldLockApplyDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
266 | + | |
267 | + return update(updateWrapper); | |
268 | + } | |
269 | + | |
270 | + @Override | |
271 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
272 | + LambdaUpdateWrapper<OrderFieldLockApplyDO> updateWrapper = new LambdaUpdateWrapper<OrderFieldLockApplyDO>() | |
273 | + .eq(OrderFieldLockApplyDO::getOrderId, orderIds) | |
274 | + .set(OrderFieldLockApplyDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
275 | + | |
276 | + return update(updateWrapper); | |
277 | + } | |
255 | 278 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderFieldLockRecordServiceImpl.java
... | ... | @@ -120,4 +120,27 @@ public class OrderFieldLockRecordServiceImpl extends ServiceImpl<OrderFieldLockR |
120 | 120 | update(updateWrapper); |
121 | 121 | return ServerResult.success(); |
122 | 122 | } |
123 | + | |
124 | + /** | |
125 | + * 通过订单id逻辑删除 | |
126 | + * @param orderId | |
127 | + * @return | |
128 | + */ | |
129 | + @Override | |
130 | + public boolean deleteByOrderId(Long orderId) { | |
131 | + LambdaUpdateWrapper<OrderFieldLockRecordDO> updateWrapper = new LambdaUpdateWrapper<OrderFieldLockRecordDO>() | |
132 | + .eq(OrderFieldLockRecordDO::getOrderId, orderId) | |
133 | + .set(OrderFieldLockRecordDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
134 | + | |
135 | + return update(updateWrapper); | |
136 | + } | |
137 | + | |
138 | + @Override | |
139 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
140 | + LambdaUpdateWrapper<OrderFieldLockRecordDO> updateWrapper = new LambdaUpdateWrapper<OrderFieldLockRecordDO>() | |
141 | + .in(OrderFieldLockRecordDO::getOrderId, orderIds) | |
142 | + .set(OrderFieldLockRecordDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
143 | + | |
144 | + return update(updateWrapper); | |
145 | + } | |
123 | 146 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderInspectionStageServiceImpl.java
... | ... | @@ -2,10 +2,12 @@ package com.order.erp.service.order.impl; |
2 | 2 | |
3 | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
5 | 6 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | 8 | import com.order.erp.common.constant.Constant; |
8 | 9 | import com.order.erp.common.constant.ServerResult; |
10 | +import com.order.erp.domain.OrderStatusEnum; | |
9 | 11 | import com.order.erp.domain.dto.order.OrderInspectionStageDO; |
10 | 12 | import com.order.erp.domain.vo.order.OrderInspectionStageQueryVO; |
11 | 13 | import com.order.erp.domain.vo.order.OrderInspectionStageVO; |
... | ... | @@ -120,4 +122,30 @@ public class OrderInspectionStageServiceImpl extends ServiceImpl<OrderInspection |
120 | 122 | update(updateWrapper); |
121 | 123 | return ServerResult.success(); |
122 | 124 | } |
125 | + | |
126 | + @Override | |
127 | + public boolean deleteByOrderId(Long orderId) { | |
128 | + LambdaUpdateWrapper<OrderInspectionStageDO> updateWrapper = new LambdaUpdateWrapper<OrderInspectionStageDO>() | |
129 | + .eq(OrderInspectionStageDO::getOrderId, orderId) | |
130 | + .set(OrderInspectionStageDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
131 | + return update(updateWrapper); | |
132 | + } | |
133 | + | |
134 | + @Override | |
135 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
136 | + LambdaUpdateWrapper<OrderInspectionStageDO> updateWrapper = new LambdaUpdateWrapper<OrderInspectionStageDO>() | |
137 | + .in(OrderInspectionStageDO::getOrderId, orderIds) | |
138 | + .set(OrderInspectionStageDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
139 | + return update(updateWrapper); | |
140 | + } | |
141 | + | |
142 | + @Override | |
143 | + public long countByOrderStatus(Integer orderStatus) { | |
144 | + return this.count(new LambdaQueryWrapper<OrderInspectionStageDO>().eq(OrderInspectionStageDO::getOrderStatus,orderStatus)); | |
145 | + } | |
146 | + | |
147 | + @Override | |
148 | + public long countRecentMonthByOrderStatus(Integer status) { | |
149 | + return this.baseMapper.countRecentMonthByOrderStatus(status); | |
150 | + } | |
123 | 151 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderOptLogServiceImpl.java
... | ... | @@ -120,4 +120,25 @@ public class OrderOptLogServiceImpl extends ServiceImpl<OrderOptLogMapper, Order |
120 | 120 | update(updateWrapper); |
121 | 121 | return ServerResult.success(); |
122 | 122 | } |
123 | + | |
124 | + /** | |
125 | + * 通过订单id逻辑删除 | |
126 | + * @param orderId | |
127 | + * @return | |
128 | + */ | |
129 | + @Override | |
130 | + public boolean deleteByOrderId(Long orderId) { | |
131 | + LambdaUpdateWrapper<OrderOptLogDO> updateWrapper = new LambdaUpdateWrapper<OrderOptLogDO>() | |
132 | + .eq(OrderOptLogDO::getOrderId, orderId) | |
133 | + .set(OrderOptLogDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
134 | + return update(updateWrapper); | |
135 | + } | |
136 | + | |
137 | + @Override | |
138 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
139 | + LambdaUpdateWrapper<OrderOptLogDO> updateWrapper = new LambdaUpdateWrapper<OrderOptLogDO>() | |
140 | + .in(OrderOptLogDO::getOrderId, orderIds) | |
141 | + .set(OrderOptLogDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
142 | + return update(updateWrapper); | |
143 | + } | |
123 | 144 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderProfitAnalysisServiceImpl.java
... | ... | @@ -2,18 +2,26 @@ package com.order.erp.service.order.impl; |
2 | 2 | |
3 | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | |
6 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
7 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
5 | 8 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | 10 | import com.order.erp.common.constant.Constant; |
8 | 11 | import com.order.erp.common.constant.ServerResult; |
12 | +import com.order.erp.common.utils.ProfitUtils; | |
9 | 13 | import com.order.erp.domain.dto.order.OrderProfitAnalysisDO; |
10 | 14 | import com.order.erp.domain.vo.order.OrderProfitAnalysisQueryVO; |
11 | 15 | import com.order.erp.domain.vo.order.OrderProfitAnalysisVO; |
16 | +import com.order.erp.domain.vo.order.ProfitCalculateVO; | |
12 | 17 | import com.order.erp.mapper.order.OrderProfitAnalysisMapper; |
13 | 18 | import com.order.erp.service.order.OrderProfitAnalysisService; |
14 | 19 | import lombok.extern.slf4j.Slf4j; |
20 | +import org.springframework.beans.BeanUtils; | |
15 | 21 | import org.springframework.stereotype.Service; |
16 | 22 | |
23 | +import java.math.BigDecimal; | |
24 | +import java.util.Arrays; | |
17 | 25 | import java.util.List; |
18 | 26 | import java.util.Objects; |
19 | 27 | |
... | ... | @@ -120,4 +128,73 @@ public class OrderProfitAnalysisServiceImpl extends ServiceImpl<OrderProfitAnaly |
120 | 128 | update(updateWrapper); |
121 | 129 | return ServerResult.success(); |
122 | 130 | } |
131 | + | |
132 | + /** | |
133 | + * 通过订单id逻辑删除 | |
134 | + * @param orderId | |
135 | + * @return | |
136 | + */ | |
137 | + @Override | |
138 | + public boolean deleteByOrderId(Long orderId) { | |
139 | + LambdaUpdateWrapper<OrderProfitAnalysisDO> updateWrapper = new LambdaUpdateWrapper<OrderProfitAnalysisDO>() | |
140 | + .eq(OrderProfitAnalysisDO::getOrderId, orderId) | |
141 | + .set(OrderProfitAnalysisDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
142 | + return update(updateWrapper); | |
143 | + } | |
144 | + | |
145 | + @Override | |
146 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
147 | + LambdaUpdateWrapper<OrderProfitAnalysisDO> updateWrapper = new LambdaUpdateWrapper<OrderProfitAnalysisDO>() | |
148 | + .in(OrderProfitAnalysisDO::getOrderId, orderIds) | |
149 | + .set(OrderProfitAnalysisDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
150 | + return update(updateWrapper); | |
151 | + } | |
152 | + | |
153 | + @Override | |
154 | + public OrderProfitAnalysisDO analysisByOrderIds(List<Long> orderIds) { | |
155 | + //查询订单id的利润分析数据 | |
156 | + QueryWrapper queryWrapper = new QueryWrapper<OrderProfitAnalysisVO>().in("order_id", orderIds); | |
157 | + List<OrderProfitAnalysisDO> orderProfits = list(queryWrapper); | |
158 | + | |
159 | + | |
160 | + if (orderProfits==null||orderProfits.isEmpty()){ | |
161 | + return null; | |
162 | + } | |
163 | + | |
164 | + BigDecimal packetTotalPrice = new BigDecimal("0"); | |
165 | + BigDecimal customerTotalPrice = new BigDecimal("0"); | |
166 | + BigDecimal productionDepartmentTotalPrice = new BigDecimal("0"); | |
167 | + double profits = 0; | |
168 | + //分别计算每个orderProfit的利润率,通过ProfitUtils的calculateProfitRate方法计算 | |
169 | + for (OrderProfitAnalysisDO orderProfit : orderProfits) { | |
170 | + ProfitCalculateVO profitCalculateVO = new ProfitCalculateVO(); | |
171 | + BeanUtils.copyProperties(orderProfit,profitCalculateVO); | |
172 | + double profit = ProfitUtils.calculateProfitRate(profitCalculateVO); | |
173 | + | |
174 | + packetTotalPrice = packetTotalPrice.add(new BigDecimal(orderProfit.getPacketTotalPrice())); | |
175 | + customerTotalPrice = customerTotalPrice.add(new BigDecimal(orderProfit.getCustomerTotalPrice())); | |
176 | + productionDepartmentTotalPrice = productionDepartmentTotalPrice.add(new BigDecimal(orderProfit.getProductionDepartmentTotalPrice())); | |
177 | + profits+=profit; | |
178 | + } | |
179 | + | |
180 | + profits = (profits / orderProfits.size()); | |
181 | + | |
182 | + OrderProfitAnalysisDO orderProfitAnalysisDO = new OrderProfitAnalysisDO(); | |
183 | + orderProfitAnalysisDO.setPacketTotalPrice(packetTotalPrice.doubleValue()); | |
184 | + orderProfitAnalysisDO.setCustomerTotalPrice(customerTotalPrice.doubleValue()); | |
185 | + orderProfitAnalysisDO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.doubleValue()); | |
186 | + orderProfitAnalysisDO.setProfitRate(profits); | |
187 | + | |
188 | + return orderProfitAnalysisDO; | |
189 | + } | |
190 | + | |
191 | + @Override | |
192 | + public long countByOrderStatus(Integer status) { | |
193 | + return this.count(new LambdaQueryWrapper<OrderProfitAnalysisDO>().eq(OrderProfitAnalysisDO::getOrderStatus,status)); | |
194 | + } | |
195 | + | |
196 | + @Override | |
197 | + public long countRecentWeekByOrderStatus(Integer status) { | |
198 | + return this.baseMapper.countRecentWeekByOrderStatus(status); | |
199 | + } | |
123 | 200 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderTrackStageServiceImpl.java
... | ... | @@ -120,4 +120,25 @@ public class OrderTrackStageServiceImpl extends ServiceImpl<OrderTrackStageMappe |
120 | 120 | update(updateWrapper); |
121 | 121 | return ServerResult.success(); |
122 | 122 | } |
123 | + | |
124 | + /** | |
125 | + * 通过订单id逻辑删除 | |
126 | + * @param orderId | |
127 | + * @return | |
128 | + */ | |
129 | + @Override | |
130 | + public boolean deleteByOrderId(Long orderId) { | |
131 | + LambdaUpdateWrapper<OrderTrackStageDO> updateWrapper = new LambdaUpdateWrapper<OrderTrackStageDO>() | |
132 | + .eq(OrderTrackStageDO::getOrderId, orderId) | |
133 | + .set(OrderTrackStageDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
134 | + return update(updateWrapper); | |
135 | + } | |
136 | + | |
137 | + @Override | |
138 | + public boolean deleteByOrderIds(List<Long> orderIds) { | |
139 | + LambdaUpdateWrapper<OrderTrackStageDO> updateWrapper = new LambdaUpdateWrapper<OrderTrackStageDO>() | |
140 | + .eq(OrderTrackStageDO::getOrderId, orderIds) | |
141 | + .set(OrderTrackStageDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
142 | + return update(updateWrapper); | |
143 | + } | |
123 | 144 | } | ... | ... |