Commit 5da8a74e4ba6d285e9c40527eb7a3dacbdd1349e

Authored by 房远帅
1 parent ab1da0f4

办事处、行业统计梳理:没权限数据不在补0

@@ -108,6 +108,10 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu @@ -108,6 +108,10 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu
108 } 108 }
109 109
110 private List<ShipmentQuantityIndustryStatisticsDto> buildFilledList(QueryShipmentQuantityIndustryStatisticsVo vo) { 110 private List<ShipmentQuantityIndustryStatisticsDto> buildFilledList(QueryShipmentQuantityIndustryStatisticsVo vo) {
  111 + if (!hasAccessibleBaseData(vo)) {
  112 + return new ArrayList<>();
  113 + }
  114 +
111 LocalDate startDate = parse(vo.getShipmentDateStart()); 115 LocalDate startDate = parse(vo.getShipmentDateStart());
112 LocalDate endDate = parse(vo.getShipmentDateEnd()); 116 LocalDate endDate = parse(vo.getShipmentDateEnd());
113 LocalDate today = LocalDate.now(); 117 LocalDate today = LocalDate.now();
@@ -220,6 +224,15 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu @@ -220,6 +224,15 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu
220 return date + "|" + industry + "|" + workshopId; 224 return date + "|" + industry + "|" + workshopId;
221 } 225 }
222 226
  227 + private boolean hasAccessibleBaseData(QueryShipmentQuantityIndustryStatisticsVo vo) {
  228 + QueryShipmentQuantityIndustryStatisticsVo permissionCheckVo = new QueryShipmentQuantityIndustryStatisticsVo();
  229 + permissionCheckVo.setIndustry(vo.getIndustry());
  230 + permissionCheckVo.setWorkshopId(vo.getWorkshopId());
  231 +
  232 + ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityIndustryStatisticsMapper.queryDateRange(permissionCheckVo);
  233 + return dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null;
  234 + }
  235 +
223 private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityIndustryStatisticsVo vo) { 236 private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityIndustryStatisticsVo vo) {
224 ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityIndustryStatisticsMapper.queryDateRange(vo); 237 ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityIndustryStatisticsMapper.queryDateRange(vo);
225 if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { 238 if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) {
@@ -109,6 +109,10 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt @@ -109,6 +109,10 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt
109 } 109 }
110 110
111 private List<ShipmentQuantityStatisticsDto> buildFilledList(QueryShipmentQuantityStatisticsVo vo) { 111 private List<ShipmentQuantityStatisticsDto> buildFilledList(QueryShipmentQuantityStatisticsVo vo) {
  112 + if (!hasAccessibleBaseData(vo)) {
  113 + return new ArrayList<>();
  114 + }
  115 +
112 LocalDate startDate = parse(vo.getShipmentDateStart()); 116 LocalDate startDate = parse(vo.getShipmentDateStart());
113 LocalDate endDate = parse(vo.getShipmentDateEnd()); 117 LocalDate endDate = parse(vo.getShipmentDateEnd());
114 LocalDate today = LocalDate.now(); 118 LocalDate today = LocalDate.now();
@@ -236,6 +240,15 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt @@ -236,6 +240,15 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt
236 return date + "|" + deptId + "|" + workshopId; 240 return date + "|" + deptId + "|" + workshopId;
237 } 241 }
238 242
  243 + private boolean hasAccessibleBaseData(QueryShipmentQuantityStatisticsVo vo) {
  244 + QueryShipmentQuantityStatisticsVo permissionCheckVo = new QueryShipmentQuantityStatisticsVo();
  245 + permissionCheckVo.setDeptId(vo.getDeptId());
  246 + permissionCheckVo.setWorkshopId(vo.getWorkshopId());
  247 +
  248 + ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityStatisticsMapper.queryDateRange(permissionCheckVo);
  249 + return dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null;
  250 + }
  251 +
239 private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityStatisticsVo vo) { 252 private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityStatisticsVo vo) {
240 ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityStatisticsMapper.queryDateRange(vo); 253 ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityStatisticsMapper.queryDateRange(vo);
241 if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { 254 if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) {
@@ -89,7 +89,8 @@ @@ -89,7 +89,8 @@
89 MAX(t.shipment_date) AS end_date 89 MAX(t.shipment_date) AS end_date
90 FROM ( 90 FROM (
91 SELECT 91 SELECT
92 - ol.delivery_date AS shipment_date 92 + ol.delivery_date AS shipment_date,
  93 + o.workshop_id AS workshop_id
93 FROM tbl_purchase_order_line ol 94 FROM tbl_purchase_order_line ol
94 INNER JOIN purchase_order_info o ON o.id = ol.purchase_order_id 95 INNER JOIN purchase_order_info o ON o.id = ol.purchase_order_id
95 WHERE 96 WHERE