13 changed files with 373 additions and 6 deletions
@ -0,0 +1,30 @@
|
||||
package com.logpm.report.controller; |
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.logpm.report.dto.ReportIncomingDTO; |
||||
import com.logpm.report.service.IReportIncomingService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/reportIncoming") |
||||
@Api(value = "收入报表", tags = "收入报表") |
||||
public class ReportIncomingController extends BladeController { |
||||
|
||||
private final IReportIncomingService reportIncomingService; |
||||
|
||||
@GetMapping("/deptIncomingPage") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "营业部收入报表", notes = "营业部收入报表") |
||||
public R deptIncomingPage(ReportIncomingDTO reportIncomingDTO) { |
||||
return reportIncomingService.deptIncomingPage(reportIncomingDTO); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.logpm.report.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class ReportIncomingDTO implements Serializable { |
||||
|
||||
private Integer pageNum; |
||||
private Integer pageSize; |
||||
|
||||
|
||||
private String startTimeStr; |
||||
private String endTimeStr; |
||||
|
||||
private Date startTime; |
||||
private Date endTime; |
||||
|
||||
private String year; |
||||
private String month; |
||||
|
||||
private String businessLine; |
||||
private String departureWarehouseName; |
||||
private String destinationWarehouseName; |
||||
private String brand; |
||||
|
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.logpm.report.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.logpm.report.dto.ReportIncomingDTO; |
||||
import com.logpm.report.vo.ReportDeptIncomingNumVO; |
||||
import com.logpm.report.vo.ReportDeptIncomingVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface ReportIncomingMapper { |
||||
|
||||
|
||||
IPage<ReportDeptIncomingVO> deptIncomingPage(IPage<Object> page, @Param("param") ReportIncomingDTO reportIncomingDTO); |
||||
|
||||
List<ReportDeptIncomingNumVO> findIncomingNum( @Param("param") ReportIncomingDTO reportIncomingDTO); |
||||
} |
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="com.logpm.report.mapper.ReportIncomingMapper"> |
||||
|
||||
|
||||
<select id="deptIncomingPage" resultType="com.logpm.report.vo.ReportDeptIncomingVO"> |
||||
select waw.business_line businessLine, |
||||
lww.departure_warehouse_name departureWarehouseName, |
||||
lww.destination_warehouse_name destinationWarehouseName, |
||||
lww.brand brand, |
||||
count(lww.id) waybillNum, |
||||
sum(lww.total_count) num, |
||||
sum(IFNULL(lww.total_weight,0)) weight, |
||||
sum(IFNULL(lww.total_volume,0)) volume, |
||||
sum(IFNULL(lww.pickup_fee,0)) pickupFee, |
||||
sum(IFNULL(lww.total_freight,0)) freightFee, |
||||
sum(IFNULL(lww.delivery_fee,0)) deliveryFee, |
||||
sum(IFNULL(lww.warehouse_management_fee,0)) warehouseManagementFee, |
||||
sum(IFNULL(lww.storage_fee,0)) storageFee, |
||||
sum(IFNULL(lww.handling_fee,0)) handlingFee, |
||||
sum(IFNULL(lww.sorting_fee,0)) sortingFee, |
||||
sum(IFNULL(lww.install_fee,0)) installFee, |
||||
sum(IFNULL(lww.other_fee,0)) otherFee, |
||||
sum(IFNULL(lww.pickup_fee,0))+sum(IFNULL(lww.total_freight,0))+sum(IFNULL(lww.delivery_fee,0))+sum(IFNULL(lww.warehouse_management_fee,0))+sum(IFNULL(lww.storage_fee,0))+sum(IFNULL(lww.handling_fee,0))+sum(IFNULL(lww.sorting_fee,0))+sum(IFNULL(lww.install_fee,0))+sum(IFNULL(lww.other_fee,0)) totalFee |
||||
from logpm_warehouse_waybill lww |
||||
left join logpm_warehouse_warehouse waw on waw.id = lww.destination_warehouse_id |
||||
where lww.document_making_time > '2024-10-22 00:00:00' |
||||
and lww.departure_warehouse_id != 1847456188105195522 |
||||
<if test="param.businessLine != null and param.businessLine != '' "> |
||||
and waw.business_line like concat('%',#{param.businessLine},'%') |
||||
</if> |
||||
<if test="param.departureWarehouseName != null and param.departureWarehouseName != '' "> |
||||
and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') |
||||
</if> |
||||
<if test="param.destinationWarehouseName != null and param.destinationWarehouseName != '' "> |
||||
and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') |
||||
</if> |
||||
<if test="param.brand != null and param.brand != '' "> |
||||
and lww.brand like concat('%',#{param.brand},'%') |
||||
</if> |
||||
<if test="param.startTime != null "> |
||||
and lww.document_making_time >= #{param.startTime} |
||||
</if> |
||||
<if test="param.endTime != null "> |
||||
and lww.document_making_time <= #{param.endTime} |
||||
</if> |
||||
group by waw.business_line,lww.departure_warehouse_name, |
||||
lww.destination_warehouse_name, |
||||
lww.brand |
||||
</select> |
||||
|
||||
|
||||
<select id="findIncomingNum" resultType="com.logpm.report.vo.ReportDeptIncomingNumVO"> |
||||
select waw.business_line businessLine, |
||||
lww.departure_warehouse_name departureWarehouseName, |
||||
lww.destination_warehouse_name destinationWarehouseName, |
||||
lww.brand brand, |
||||
case when lww.waybill_type = '1' then count(ldpl.id) |
||||
when lww.waybill_type = '2' then sum(ldpn.quantity) end stockNum, |
||||
case when lww.waybill_type = '1' then sum(IF(ldpl.order_package_status='70',1,0)) |
||||
when lww.waybill_type = '2' then sum(ldpn.signin_quantity) end signNum, |
||||
from logpm_warehouse_waybill lww |
||||
left join logpm_warehouse_warehouse waw on waw.id = lww.destination_warehouse_id |
||||
left join logpm_distribution_parcel_list ldpl on ldpl.waybill_id = lww.id |
||||
left join logpm_distribution_parcel_number ldpn on ldpn.parcel_list_id = ldpl.id |
||||
where lww.document_making_time > '2024-10-22 00:00:00' |
||||
and lww.departure_warehouse_id != 1847456188105195522 |
||||
<if test="param.businessLine != null and param.businessLine != '' "> |
||||
and waw.business_line like concat('%',#{param.businessLine},'%') |
||||
</if> |
||||
<if test="param.departureWarehouseName != null and param.departureWarehouseName != '' "> |
||||
and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') |
||||
</if> |
||||
<if test="param.destinationWarehouseName != null and param.destinationWarehouseName != '' "> |
||||
and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') |
||||
</if> |
||||
<if test="param.brand != null and param.brand != '' "> |
||||
and lww.brand like concat('%',#{param.brand},'%') |
||||
</if> |
||||
<if test="param.startTime != null "> |
||||
and lww.document_making_time >= #{param.startTime} |
||||
</if> |
||||
<if test="param.endTime != null "> |
||||
and lww.document_making_time <= #{param.endTime} |
||||
</if> |
||||
group by waw.business_line,lww.departure_warehouse_name, |
||||
lww.destination_warehouse_name, |
||||
lww.brand |
||||
</select> |
||||
|
||||
|
||||
</mapper> |
@ -0,0 +1,10 @@
|
||||
package com.logpm.report.service; |
||||
|
||||
import com.logpm.report.dto.ReportIncomingDTO; |
||||
import org.springblade.core.tool.api.R; |
||||
|
||||
public interface IReportIncomingService { |
||||
|
||||
|
||||
R deptIncomingPage(ReportIncomingDTO reportIncomingDTO); |
||||
} |
@ -0,0 +1,112 @@
|
||||
package com.logpm.report.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.logpm.report.dto.ReportIncomingDTO; |
||||
import com.logpm.report.mapper.ReportIncomingMapper; |
||||
import com.logpm.report.service.IReportIncomingService; |
||||
import com.logpm.report.vo.ReportDeptIncomingNumVO; |
||||
import com.logpm.report.vo.ReportDeptIncomingVO; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.utils.CommonUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Calendar; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
@Service |
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
public class ReportIncomingServiceImpl implements IReportIncomingService { |
||||
|
||||
private final ReportIncomingMapper reportIncomingMapper; |
||||
|
||||
|
||||
@Override |
||||
public R deptIncomingPage(ReportIncomingDTO reportIncomingDTO) { |
||||
IPage<Object> page = new Page<>(); |
||||
page.setCurrent(reportIncomingDTO.getPageNum()); |
||||
page.setSize(reportIncomingDTO.getPageSize()); |
||||
|
||||
String year = reportIncomingDTO.getYear(); |
||||
String month = reportIncomingDTO.getMonth(); |
||||
String startTimeStr = reportIncomingDTO.getStartTimeStr(); |
||||
String endTimeStr = reportIncomingDTO.getEndTimeStr(); |
||||
|
||||
if(StringUtil.isNotBlank(startTimeStr) && StringUtil.isNotBlank(endTimeStr)){ |
||||
reportIncomingDTO.setStartTime(CommonUtil.getStartByDateStr(startTimeStr)); |
||||
reportIncomingDTO.setEndTime(CommonUtil.getEndByDateStr(endTimeStr)); |
||||
}else{ |
||||
if(StringUtil.isNotBlank(month)){ |
||||
Calendar instance = Calendar.getInstance(); |
||||
if(StringUtil.isBlank(year)){ |
||||
log.info("############deptIncomingPage:请选择年份"); |
||||
return R.fail(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()); |
||||
}catch (Exception e){ |
||||
log.info("############deptIncomingPage:"); |
||||
return R.fail(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()); |
||||
}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()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
IPage<ReportDeptIncomingVO> iPage = reportIncomingMapper.deptIncomingPage(page,reportIncomingDTO); |
||||
|
||||
//查询数据对应的在库数和签收数
|
||||
List<ReportDeptIncomingNumVO> ls = reportIncomingMapper.findIncomingNum(reportIncomingDTO); |
||||
|
||||
|
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.logpm.report.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Data |
||||
public class ReportDeptIncomingNumVO implements Serializable { |
||||
|
||||
private String businessLine;//事业线
|
||||
private String departureWarehouseName;//始发仓
|
||||
private String destinationWarehouseName;//目的仓
|
||||
private String brand;//品牌
|
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.logpm.report.vo; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
|
||||
@Data |
||||
public class ReportDeptIncomingVO implements Serializable { |
||||
|
||||
|
||||
private String businessLine;//事业线
|
||||
private String departureWarehouseName;//始发仓
|
||||
private String destinationWarehouseName;//目的仓
|
||||
private String brand;//品牌
|
||||
private Integer waybillNum;//运单数
|
||||
private Integer num;//件数
|
||||
private BigDecimal weight;//重量
|
||||
private BigDecimal volume;//体积
|
||||
private Integer stockNum;//到货件数
|
||||
private Integer signNum;//签收件数
|
||||
private BigDecimal pickupFee;//提货费
|
||||
private BigDecimal freightFee;//运费
|
||||
private BigDecimal deliveryFee;//送货费
|
||||
private BigDecimal warehouseManagementFee;//仓库管理费
|
||||
private BigDecimal storageFee;//仓储费
|
||||
private BigDecimal handlingFee;//仓储操作费
|
||||
private BigDecimal sortingFee;//仓储分拣费
|
||||
private BigDecimal installFee;//安装费
|
||||
private BigDecimal otherFee;//其他费
|
||||
private BigDecimal totalFee;//总费用
|
||||
|
||||
} |
Loading…
Reference in new issue