|
@@ -21,6 +21,9 @@ import org.jeecg.common.util.SpringContextUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletRulerConfig;
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletRulerConfig;
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.mapper.BilletRulerConfigMapper;
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.mapper.BilletRulerConfigMapper;
|
|
|
|
+import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
|
|
|
|
+import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
|
|
|
|
+import org.jeecg.modules.billet.billetOriginalProductRecord.entity.BilletOriginalProductRecord;
|
|
import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
|
|
import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
|
|
import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeDetailsService;
|
|
import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeDetailsService;
|
|
import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
|
|
import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
|
|
@@ -48,6 +51,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
+import java.time.ZoneId;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -69,6 +73,8 @@ public class RollClubThreeDetailsController extends JeecgController<RollClubThre
|
|
private ISysDictService sysDictService;
|
|
private ISysDictService sysDictService;
|
|
@Autowired
|
|
@Autowired
|
|
private BilletRulerConfigMapper billetRulerConfigMapper;
|
|
private BilletRulerConfigMapper billetRulerConfigMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IBilletHotsendChangeShiftService billetHotsendChangeShiftService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
@@ -240,22 +246,66 @@ public class RollClubThreeDetailsController extends JeecgController<RollClubThre
|
|
if (oConvertUtils.isNotEmpty(storageBillPrint.getLicensePlate())) {
|
|
if (oConvertUtils.isNotEmpty(storageBillPrint.getLicensePlate())) {
|
|
queryWrapper.eq("license_plate", storageBillPrint.getLicensePlate());
|
|
queryWrapper.eq("license_plate", storageBillPrint.getLicensePlate());
|
|
}
|
|
}
|
|
- if (oConvertUtils.isNotEmpty(storageBillPrint.getDestination())) {
|
|
|
|
- queryWrapper.eq("destination", storageBillPrint.getDestination());
|
|
|
|
|
|
+
|
|
|
|
+ queryWrapper.eq("destination", "棒三");
|
|
|
|
+
|
|
|
|
+ Date finalStartTime = null;
|
|
|
|
+ Date finalEndTime = null;
|
|
|
|
+
|
|
|
|
+ boolean hasQueryDate = storageBillPrint.getQueryDate() != null;
|
|
|
|
+ boolean hasChangeShiftId = oConvertUtils.isNotEmpty(storageBillPrint.getChangeShiftId());
|
|
|
|
+ boolean hasRange = storageBillPrint.getStartTime() != null || storageBillPrint.getEndTime() != null;
|
|
|
|
+
|
|
|
|
+ // 校验:只能传一个
|
|
|
|
+ int count = (hasQueryDate ? 1 : 0) + (hasChangeShiftId ? 1 : 0) + (hasRange ? 1 : 0);
|
|
|
|
+ if (count > 1) {
|
|
|
|
+ log.warn("参数冲突:queryDate、changeShiftId、startTime/endTime 只能传一个");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 处理 queryDate:某一天
|
|
|
|
+ if (hasQueryDate) {
|
|
|
|
+ Date queryDate = storageBillPrint.getQueryDate();
|
|
|
|
+ // 当天 0 点
|
|
|
|
+ finalStartTime = Date.from(queryDate.toInstant().atZone(ZoneId.systemDefault())
|
|
|
|
+ .toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
|
+ // 第二天 0 点减 1 毫秒 = 当天 23:59:59.999
|
|
|
|
+ finalEndTime = Date.from(queryDate.toInstant().atZone(ZoneId.systemDefault())
|
|
|
|
+ .toLocalDate().plusDays(1).atStartOfDay(ZoneId.systemDefault()).minusNanos(1).toInstant());
|
|
|
|
+ // 处理交班记录
|
|
|
|
+ } else if (hasChangeShiftId) {
|
|
|
|
+ LambdaQueryWrapper<BilletHotsendChangeShift> shiftWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ shiftWrapper.eq(BilletHotsendChangeShift::getId, storageBillPrint.getChangeShiftId());
|
|
|
|
+ BilletHotsendChangeShift shift = billetHotsendChangeShiftService.getOne(shiftWrapper);
|
|
|
|
+ if (shift != null) {
|
|
|
|
+ finalStartTime = shift.getCreateTime();
|
|
|
|
+ finalEndTime = shift.getChangeShiftTime() != null ? shift.getChangeShiftTime() : new Date();
|
|
|
|
+ if (StringUtils.isNotBlank(shift.getShift()) && StringUtils.isNotBlank(shift.getShiftGroup())) {
|
|
|
|
+ String combinedClass = shift.getShift() + "/" + shift.getShiftGroup();
|
|
|
|
+ queryWrapper.eq("classes", combinedClass);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 处理时间范围
|
|
|
|
+ } else if (hasRange) {
|
|
|
|
+ finalStartTime = storageBillPrint.getStartTime();
|
|
|
|
+ finalEndTime = storageBillPrint.getEndTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 校验时间区间是否合法
|
|
|
|
+ if (finalStartTime != null && finalEndTime != null && finalStartTime.after(finalEndTime)) {
|
|
|
|
+ log.warn("无效时间区间:start={}, end={}", finalStartTime, finalEndTime);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 应用到 wrapper 上
|
|
|
|
+ if (finalStartTime != null) {
|
|
|
|
+ queryWrapper.ge("arrival_time", finalStartTime);
|
|
|
|
+ }
|
|
|
|
+ if (finalEndTime != null) {
|
|
|
|
+ queryWrapper.le("arrival_time", finalEndTime);
|
|
}
|
|
}
|
|
- // 开始时间
|
|
|
|
- Date startTime = storageBillPrint.getArrivalTime();
|
|
|
|
- // 结束时间
|
|
|
|
- Date endTime = storageBillPrint.getCreateTime();
|
|
|
|
-
|
|
|
|
- log.info("查询时间范围:startTime={}, endTime={}", startTime, endTime);
|
|
|
|
-
|
|
|
|
- // 修改时间范围查询条件为 >= startTime 且 <= endTime
|
|
|
|
- queryWrapper.ge("arrival_time", startTime) // 大于等于开始时间
|
|
|
|
- .le("arrival_time", endTime); // 小于等于结束时间
|
|
|
|
- // Step.2 获取导出数据
|
|
|
|
- // 打印完整的查询条件
|
|
|
|
- log.info("最终查询条件:{}", queryWrapper.getSqlSegment());
|
|
|
|
|
|
+ //
|
|
|
|
+ queryWrapper.orderByDesc("arrival_time");
|
|
List<StorageBillPrint> exportList = storageBillPrintService.list(queryWrapper);
|
|
List<StorageBillPrint> exportList = storageBillPrintService.list(queryWrapper);
|
|
|
|
|
|
// 用于存储拆分后的新数据
|
|
// 用于存储拆分后的新数据
|