Browse Source

1.报表bug修复

dev
zhenghaoyu 3 weeks ago
parent
commit
4726f0b3e4
  1. 80
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportIncomingServiceImpl.java

80
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportIncomingServiceImpl.java

@ -553,79 +553,11 @@ public class ReportIncomingServiceImpl implements IReportIncomingService {
@Override
public void deptIncomingExportNew(ReportIncomingDTO reportIncomingDTO, HttpServletResponse response) {
String year = reportIncomingDTO.getYear();
String month = reportIncomingDTO.getMonth();
String startTimeStr = reportIncomingDTO.getStartTimeStr();
String endTimeStr = reportIncomingDTO.getEndTimeStr();
String timeStr = null;
if(StringUtil.isNotBlank(startTimeStr) && StringUtil.isNotBlank(endTimeStr)){
reportIncomingDTO.setStartTime(CommonUtil.getStartByDateStr(startTimeStr));
reportIncomingDTO.setEndTime(CommonUtil.getEndByDateStr(endTimeStr));
timeStr=startTimeStr+"至"+endTimeStr;
}else{
if(StringUtil.isNotBlank(month)){
Calendar instance = Calendar.getInstance();
if(StringUtil.isBlank(year)){
log.info("############deptIncomingPage:请选择年份");
throw new CustomerException(405,"请选择年份");
}
try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
final Date parse = sdf.parse(year+"-"+month);
reportIncomingDTO.setStartTime(CommonUtil.StringToDate(sdf1.format(parse)));
final Calendar cal = Calendar.getInstance();
cal.setTime(parse);
final int last = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, last);
cal.add(Calendar.DATE, +1);
cal.add(Calendar.SECOND, -1);
reportIncomingDTO.setEndTime(cal.getTime());
timeStr = year+"年"+month+"月";
}catch (Exception e){
log.info("############deptIncomingPage:请选择年份11111");
throw new CustomerException(405,"请选择年份");
}
}else{
if(StringUtil.isNotBlank(year)){
Calendar instance = Calendar.getInstance();
instance.set(Calendar.YEAR,Integer.parseInt(year));
instance.set(Calendar.MONTH,Calendar.JANUARY);
instance.set(Calendar.DAY_OF_MONTH,1);
instance.set(Calendar.HOUR_OF_DAY, 0);
instance.set(Calendar.MINUTE, 0);
instance.set(Calendar.SECOND, 0);
instance.set(Calendar.MILLISECOND, 0);
reportIncomingDTO.setStartTime(instance.getTime());
instance.set(Calendar.MONTH,Calendar.DECEMBER);
instance.set(Calendar.DAY_OF_MONTH,31);
instance.set(Calendar.HOUR_OF_DAY, 23);
instance.set(Calendar.MINUTE, 59);
instance.set(Calendar.SECOND, 59);
instance.set(Calendar.MILLISECOND, 999);
reportIncomingDTO.setEndTime(instance.getTime());
timeStr = year+"年";
}else{
Calendar instance = Calendar.getInstance();
instance.set(Calendar.HOUR_OF_DAY, 23);
instance.set(Calendar.MINUTE, 59);
instance.set(Calendar.SECOND, 59);
instance.set(Calendar.MILLISECOND, 999);
reportIncomingDTO.setEndTime(instance.getTime());
instance.add(Calendar.DATE, -7);
instance.set(Calendar.HOUR_OF_DAY, 0);
instance.set(Calendar.MINUTE, 0);
instance.set(Calendar.SECOND, 0);
instance.set(Calendar.MILLISECOND, 0);
reportIncomingDTO.setStartTime(instance.getTime());
timeStr=CommonUtil.dateToStringGeneral(reportIncomingDTO.getStartTime())+"至"+CommonUtil.dateToStringGeneral(reportIncomingDTO.getEndTime());
}
}
}
reportIncomingDTO.setStartTime(CommonUtil.getStartByDateStr(startTimeStr));
reportIncomingDTO.setEndTime(CommonUtil.getEndByDateStr(endTimeStr));
List<ReportDeptIncomingExportVO> list = reportIncomingMapper.deptIncomingExportNew(reportIncomingDTO);
@ -633,9 +565,7 @@ public class ReportIncomingServiceImpl implements IReportIncomingService {
List<ReportDeptIncomingNumVO> ls = reportIncomingMapper.findIncomingNumNew(reportIncomingDTO);
//把ls转化为以businessLine,brand,departureWarehouseName,destinationWarehouseName为key的map
Map<String, ReportDeptIncomingNumVO> map = ls.stream()
.collect(Collectors.toMap(t-> t.getBusinessLine()+"&&"+t.getBrand()+"&&"+t.getDepartureWarehouseName()+"&&"+t.getDestinationWarehouseName()+"&&"+t.getNian()+"&&"+t.getYue(), reportDeptIncomingNumVO -> reportDeptIncomingNumVO));
String finalTimeStr = timeStr;
.collect(Collectors.toMap(t-> t.getBusinessLine()+"&&"+t.getBrand()+"&&"+t.getDepartureWarehouseName()+"&&"+t.getDestinationWarehouseName()+"&&"+t.getTimeStr(), reportDeptIncomingNumVO -> reportDeptIncomingNumVO));
list.forEach(reportDeptIncomingVO -> {
String businessLine = reportDeptIncomingVO.getBusinessLine();
String brand = reportDeptIncomingVO.getBrand();
@ -643,9 +573,9 @@ public class ReportIncomingServiceImpl implements IReportIncomingService {
String destinationWarehouseName = reportDeptIncomingVO.getDestinationWarehouseName();
String nian = reportDeptIncomingVO.getNian();
String yue = reportDeptIncomingVO.getYue();
reportDeptIncomingVO.setTimeStr(finalTimeStr);
String timeStr = reportDeptIncomingVO.getTimeStr();
ReportDeptIncomingNumVO reportDeptIncomingNumVO = map.get(businessLine + "&&" + brand + "&&" + departureWarehouseName + "&&" + destinationWarehouseName+"&&"+nian+"&&"+yue);
ReportDeptIncomingNumVO reportDeptIncomingNumVO = map.get(businessLine + "&&" + brand + "&&" + departureWarehouseName + "&&" + destinationWarehouseName+"&&"+timeStr);
if(!Objects.isNull(reportDeptIncomingNumVO)){
reportDeptIncomingVO.setStockNum(reportDeptIncomingNumVO.getStockNum());
reportDeptIncomingVO.setSignNum(reportDeptIncomingNumVO.getSignNum());

Loading…
Cancel
Save