Showing
3 changed files
with
28 additions
and
1 deletions
| ... | ... | @@ -108,6 +108,10 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | private List<ShipmentQuantityIndustryStatisticsDto> buildFilledList(QueryShipmentQuantityIndustryStatisticsVo vo) { |
| 111 | + if (!hasAccessibleBaseData(vo)) { | |
| 112 | + return new ArrayList<>(); | |
| 113 | + } | |
| 114 | + | |
| 111 | 115 | LocalDate startDate = parse(vo.getShipmentDateStart()); |
| 112 | 116 | LocalDate endDate = parse(vo.getShipmentDateEnd()); |
| 113 | 117 | LocalDate today = LocalDate.now(); |
| ... | ... | @@ -220,6 +224,15 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu |
| 220 | 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 | 236 | private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityIndustryStatisticsVo vo) { |
| 224 | 237 | ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityIndustryStatisticsMapper.queryDateRange(vo); |
| 225 | 238 | if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { | ... | ... |
| ... | ... | @@ -109,6 +109,10 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | private List<ShipmentQuantityStatisticsDto> buildFilledList(QueryShipmentQuantityStatisticsVo vo) { |
| 112 | + if (!hasAccessibleBaseData(vo)) { | |
| 113 | + return new ArrayList<>(); | |
| 114 | + } | |
| 115 | + | |
| 112 | 116 | LocalDate startDate = parse(vo.getShipmentDateStart()); |
| 113 | 117 | LocalDate endDate = parse(vo.getShipmentDateEnd()); |
| 114 | 118 | LocalDate today = LocalDate.now(); |
| ... | ... | @@ -236,6 +240,15 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt |
| 236 | 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 | 252 | private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityStatisticsVo vo) { |
| 240 | 253 | ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityStatisticsMapper.queryDateRange(vo); |
| 241 | 254 | if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { | ... | ... |
| ... | ... | @@ -89,7 +89,8 @@ |
| 89 | 89 | MAX(t.shipment_date) AS end_date |
| 90 | 90 | FROM ( |
| 91 | 91 | SELECT |
| 92 | - ol.delivery_date AS shipment_date | |
| 92 | + ol.delivery_date AS shipment_date, | |
| 93 | + o.workshop_id AS workshop_id | |
| 93 | 94 | FROM tbl_purchase_order_line ol |
| 94 | 95 | INNER JOIN purchase_order_info o ON o.id = ol.purchase_order_id |
| 95 | 96 | WHERE | ... | ... |