Browse Source

feat(all): 报表模块

1 增加配送质量报表
fix-sign
zhaoqiaobo 5 months ago
parent
commit
ecbfe99878
  1. 17
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/QualityDispatchNumberMapper.xml
  2. 3
      blade-service/logpm-report/src/main/java/com/logpm/report/query/QualityDispatchTaskQuery.java
  3. 45
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/QualityDispatchNumberServiceImpl.java
  4. 4
      blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java
  5. 84
      blade-service/logpm-report/src/main/java/com/logpm/report/vo/qulity/dispatch/QualityDispatchNumberExcelVO.java

17
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/QualityDispatchNumberMapper.xml

@ -23,9 +23,9 @@
else
ROUND((ifnull(sum(case when t.conditions = 3 then ifnull(t.sign_num, 0) end), 0)
/ ifnull(sum(case when t.conditions = 3 then ifnull(t.sign_num, 0) end), 0)) * 100,
2) end, '.00', ''), '%') signRate,
2) end, '.00', ''), '%') signStockRate,
count(distinct t.plan_reservation_code) customerCount,
count(distinct case when t.review_num != 0 then t.plan_reservation_code else null end) customerCount,
count(distinct case when t.review_num != 0 then t.plan_reservation_code else null end) reviewCustomerCount,
concat(replace(case
when count(distinct case when t.review_num != 0 then t.plan_reservation_code else null end) =
0 then 0
@ -81,6 +81,10 @@
<if test="query.deliveryType != null and query.deliveryType != ''">
,t.delivery_type
</if>
order by t.warehouse_name
<if test="query.deliveryType != null and query.deliveryType != ''">
,t.delivery_type
</if>
</select>
<select id="task" resultType="com.logpm.report.vo.qulity.dispatch.QualityDispatchTaskVO">
@ -119,9 +123,9 @@
else
ROUND((ifnull(sum(case when t.conditions = 3 then ifnull(t.sign_num, 0) end), 0)
/ ifnull(sum(case when t.conditions = 3 then ifnull(t.sign_num, 0) end), 0)) * 100,
2) end, '.00', ''), '%') signRate,
2) end, '.00', ''), '%') signStockRate,
count(distinct t.plan_reservation_code) customerCount,
count(distinct case when t.review_num != 0 then t.plan_reservation_code else null end) customerCount,
count(distinct case when t.review_num != 0 then t.plan_reservation_code else null end) reviewCustomerCount,
concat(replace(case
when count(distinct case when t.review_num != 0 then t.plan_reservation_code else null end) =
0 then 0
@ -180,6 +184,11 @@
</if>
group by t.plan_reservation_code,t.conditions
) t
<where>
<if test="query.reviewStatus != null and query.reviewStatus != ''">
and t.reviewStatus = #{query.reviewStatus}
</if>
</where>
group by t.plan_reservation_code
</select>
</mapper>

3
blade-service/logpm-report/src/main/java/com/logpm/report/query/QualityDispatchTaskQuery.java

@ -27,4 +27,7 @@ public class QualityDispatchTaskQuery extends Query {
@ApiModelProperty(value = "配送类型", position = 4)
private String deliveryType;
@ApiModelProperty(value = "审核状态", position = 5)
private String reviewStatus;
}

45
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/QualityDispatchNumberServiceImpl.java

@ -1,5 +1,8 @@
package com.logpm.report.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -9,15 +12,19 @@ import com.logpm.report.mapper.QualityDispatchNumberMapper;
import com.logpm.report.query.QualityDispatchNumberQuery;
import com.logpm.report.query.QualityDispatchTaskQuery;
import com.logpm.report.service.QualityDispatchNumberService;
import com.logpm.report.vo.qulity.dispatch.QualityDispatchNumberExcelVO;
import com.logpm.report.vo.qulity.dispatch.QualityDispatchNumberVO;
import com.logpm.report.vo.qulity.dispatch.QualityDispatchTaskVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -36,6 +43,14 @@ public class QualityDispatchNumberServiceImpl implements QualityDispatchNumberSe
@Override
public IPage<QualityDispatchNumberVO> number(QualityDispatchNumberQuery query) {
IPage<QualityDispatchNumberVO> page = Condition.getPage(query);
if (ObjectUtil.isNotEmpty(query.getStartTaskTime()) || ObjectUtil.isNotEmpty(query.getEndTaskTime())) {
boolean withinOneMonth = DateUtil.between(DateUtil.parseDate(query.getStartTaskTime()), DateUtil.parseDate(query.getEndTaskTime()), DateUnit.DAY) <= 31;
if (!withinOneMonth) {
throw new ServiceException("时间不能超过一个月");
}
} else {
throw new ServiceException("时间不能为空");
}
page.setPages(1);
page.setSize(-1);
if (StrUtil.isEmpty(query.getWarehouseName())) {
@ -47,7 +62,7 @@ public class QualityDispatchNumberServiceImpl implements QualityDispatchNumberSe
query.setWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
}
}
List<QualityDispatchNumberVO> list = numberMapper.number(page,query);
List<QualityDispatchNumberVO> list = numberMapper.number(page, query);
// 查询异常数
return page.setRecords(list);
}
@ -55,6 +70,14 @@ public class QualityDispatchNumberServiceImpl implements QualityDispatchNumberSe
@Override
public void exporNumber(HttpServletResponse response, QualityDispatchNumberQuery query) {
IPage<QualityDispatchNumberVO> page = Condition.getPage(query);
if (ObjectUtil.isNotEmpty(query.getStartTaskTime()) || ObjectUtil.isNotEmpty(query.getEndTaskTime())) {
boolean withinOneMonth = DateUtil.between(DateUtil.parseDate(query.getStartTaskTime()), DateUtil.parseDate(query.getEndTaskTime()), DateUnit.DAY) <= 31;
if (!withinOneMonth) {
throw new ServiceException("时间不能超过一个月");
}
} else {
throw new ServiceException("时间不能为空");
}
page.setPages(1);
page.setSize(-1);
if (StrUtil.isEmpty(query.getWarehouseName())) {
@ -66,8 +89,20 @@ public class QualityDispatchNumberServiceImpl implements QualityDispatchNumberSe
query.setWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
}
}
List<QualityDispatchNumberVO> list = numberMapper.number(page,query);
ExcelUtil.export(response, list, QualityDispatchNumberVO.class);
List<QualityDispatchNumberVO> list = numberMapper.number(page, query);
if (StrUtil.isEmpty(query.getDeliveryType())) {
List<QualityDispatchNumberExcelVO> excelVOS = new ArrayList<>();
if (CollUtil.isNotEmpty(list)) {
for (QualityDispatchNumberVO qualityDispatchNumberVO : list) {
QualityDispatchNumberExcelVO qualityDispatchNumberExcelVO = new QualityDispatchNumberExcelVO();
BeanUtil.copyProperties(qualityDispatchNumberVO, qualityDispatchNumberExcelVO);
excelVOS.add(qualityDispatchNumberExcelVO);
}
}
ExcelUtil.export(response, excelVOS, QualityDispatchNumberExcelVO.class);
} else {
ExcelUtil.export(response, list, QualityDispatchNumberVO.class);
}
}
@Override
@ -82,7 +117,7 @@ public class QualityDispatchNumberServiceImpl implements QualityDispatchNumberSe
query.setWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
}
}
List<QualityDispatchTaskVO> list = numberMapper.task(page,query);
List<QualityDispatchTaskVO> list = numberMapper.task(page, query);
// 查询异常数
return page.setRecords(list);
}
@ -101,7 +136,7 @@ public class QualityDispatchNumberServiceImpl implements QualityDispatchNumberSe
query.setWarehouseName(warehouseEntities.stream().map(BasicdataWarehouseEntity::getName).collect(Collectors.joining(",")));
}
}
List<QualityDispatchTaskVO> list = numberMapper.task(page,query);
List<QualityDispatchTaskVO> list = numberMapper.task(page, query);
ExcelUtil.export(response, list, QualityDispatchTaskVO.class);
}

4
blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/ReportDeliverServiceImpl.java

@ -480,13 +480,13 @@ public class ReportDeliverServiceImpl implements ReportDeliverService {
if (StrUtil.isNotEmpty(query.getTrainNumber()) || StrUtil.isNotEmpty(query.getOrderPackageCode()) || StrUtil.isNotEmpty(query.getReservationCode()) || StrUtil.isNotEmpty(query.getStockArticleId())) {
} else {
if (ObjectUtil.isNotEmpty(query.getStartTaskTime()) || ObjectUtil.isNotEmpty(query.getEndTaskTime())) {
boolean withinOneMonth = DateUtil.between(query.getStartTaskTime(), query.getEndTaskTime(), DateUnit.DAY) <= 30;
boolean withinOneMonth = DateUtil.between(query.getStartTaskTime(), query.getEndTaskTime(), DateUnit.DAY) <= 31;
if (!withinOneMonth) {
throw new ServiceException("配送日期必选且时间不超过一个月");
}
} else {
if (ObjectUtil.isNotEmpty(query.getStartSjsigningTime()) || ObjectUtil.isNotEmpty(query.getEndSjsigningTime())) {
boolean withinOneMonth = DateUtil.between(query.getStartSjsigningTime(), query.getEndSjsigningTime(), DateUnit.DAY) <= 30;
boolean withinOneMonth = DateUtil.between(query.getStartSjsigningTime(), query.getEndSjsigningTime(), DateUnit.DAY) <= 31;
if (!withinOneMonth) {
throw new ServiceException("签收日期必选且时间不超过一个月");
}

84
blade-service/logpm-report/src/main/java/com/logpm/report/vo/qulity/dispatch/QualityDispatchNumberExcelVO.java

@ -0,0 +1,84 @@
package com.logpm.report.vo.qulity.dispatch;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 配送统计汇总
*
* @author zhaoqiaobo
* @create 2024-03-06 16:02
*/
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
@ApiModel(value = "配送统计汇总", description = "配送统计汇总")
@Data
public class QualityDispatchNumberExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "仓库")
@ExcelProperty("仓库")
private String warehouseName;
@ApiModelProperty(value = "预约件数")
@ExcelProperty("预约件数")
private String planNum;
@ApiModelProperty(value = "装车件数")
@ExcelProperty("装车件数")
private String loadNum;
@ApiModelProperty(value = "签收件数")
@ExcelProperty("签收件数")
private String signNum;
@ApiModelProperty(value = "签收率")
@ExcelProperty("签收率")
private String signRate;
@ApiModelProperty(value = "预约库存品件数")
@ExcelProperty("预约库存品件数")
private String planStockNum;
@ApiModelProperty(value = "库存品装车件数")
@ExcelProperty("库存品装车件数")
private String loadStockNum;
@ApiModelProperty(value = "库存品签收件数")
@ExcelProperty("库存品签收件数")
private String signStockNum;
@ApiModelProperty(value = "库存品签收率")
@ExcelProperty("库存品签收率")
private String signStockRate;
@ApiModelProperty(value = "异常数")
@ExcelProperty("异常数")
private String exceptionNum;
@ApiModelProperty(value = "计划准确率")
@ExcelProperty("计划准确率")
private String planAccuracy;
@ApiModelProperty(value = "客户数")
@ExcelProperty("客户数")
private String customerCount;
@ApiModelProperty(value = "审核客户数")
@ExcelProperty("审核客户数")
private String reviewCustomerCount;
@ApiModelProperty(value = "审核率")
@ExcelProperty("审核率")
private String reviewRate;
}
Loading…
Cancel
Save