4.12新需求修改
This commit is contained in:
parent
fb5dad9511
commit
47b65b2528
@ -11,6 +11,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.asinkj.amz.domain.BizLogisticsOrder;
|
||||||
import org.asinkj.amz.domain.bo.BizLogisticsCreateOrderBo;
|
import org.asinkj.amz.domain.bo.BizLogisticsCreateOrderBo;
|
||||||
import org.asinkj.common.core.utils.StringUtils;
|
import org.asinkj.common.core.utils.StringUtils;
|
||||||
import org.asinkj.common.core.utils.file.MimeTypeUtils;
|
import org.asinkj.common.core.utils.file.MimeTypeUtils;
|
||||||
@ -157,4 +158,10 @@ public class BizLogisticsOrderController extends BaseController {
|
|||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||||
return toAjax(bizLogisticsOrderService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(bizLogisticsOrderService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/query")
|
||||||
|
public R<List<BizLogisticsOrder>> query() {
|
||||||
|
return R.ok(bizLogisticsOrderService.selectOrdersByUserId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,13 @@ package org.asinkj.amz.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import org.asinkj.amz.domain.bo.BizLogisticsQuoteMostBo;
|
import org.asinkj.amz.domain.bo.BizLogisticsQuoteMostBo;
|
||||||
|
import org.asinkj.amz.domain.bo.BizLogisticsQuoteReportBo;
|
||||||
import org.asinkj.amz.domain.vo.InquiryQuoteStatusDTO;
|
import org.asinkj.amz.domain.vo.InquiryQuoteStatusDTO;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -57,22 +59,20 @@ public class BizLogisticsQuoteController extends BaseController {
|
|||||||
@SaCheckPermission("amz:shipmentPlan:edit")
|
@SaCheckPermission("amz:shipmentPlan:edit")
|
||||||
@GetMapping("/query/{destination}/{channelId}/{date}")
|
@GetMapping("/query/{destination}/{channelId}/{date}")
|
||||||
public TableDataInfo<BizLogisticsQuoteVo> queryWithDesAndChannel(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
|
public TableDataInfo<BizLogisticsQuoteVo> queryWithDesAndChannel(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
|
||||||
@PathVariable("channelId") @NotNull(message = "渠道不能为空") String channelId,
|
@PathVariable("channelId") @NotNull(message = "渠道不能为空") String channelId,
|
||||||
@PathVariable("date") @NotNull(message = "日期不能为空") String date) {
|
@PathVariable("date") @NotNull(message = "日期不能为空") String date) {
|
||||||
return bizLogisticsQuoteService.listWithDesAndChannel(destination, channelId,date);
|
return bizLogisticsQuoteService.listWithDesAndChannel(destination, channelId, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SaCheckPermission("amz:shipmentPlan:edit")
|
@SaCheckPermission("amz:shipmentPlan:edit")
|
||||||
@GetMapping("/queryWithDes/{destination}/{date}")
|
@GetMapping("/queryWithDes/{destination}/{date}")
|
||||||
public TableDataInfo<BizLogisticsQuoteVo> queryWithDes(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
|
public TableDataInfo<BizLogisticsQuoteVo> queryWithDes(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
|
||||||
@PathVariable("date") @NotNull(message = "日期不能为空") String date) {
|
@PathVariable("date") @NotNull(message = "日期不能为空") String date) {
|
||||||
return bizLogisticsQuoteService.listWithDes(destination,date);
|
return bizLogisticsQuoteService.listWithDes(destination, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出物流报价列表
|
* 导出物流报价列表
|
||||||
*/
|
*/
|
||||||
@ -92,7 +92,7 @@ public class BizLogisticsQuoteController extends BaseController {
|
|||||||
@SaCheckPermission("amz:logisticsQuote:query")
|
@SaCheckPermission("amz:logisticsQuote:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<BizLogisticsQuoteVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<BizLogisticsQuoteVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long id) {
|
@PathVariable Long id) {
|
||||||
return R.ok(bizLogisticsQuoteService.queryById(id));
|
return R.ok(bizLogisticsQuoteService.queryById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,11 +161,15 @@ public class BizLogisticsQuoteController extends BaseController {
|
|||||||
return toAjax(bizLogisticsQuoteService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(bizLogisticsQuoteService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@SaCheckPermission("amz:logisticsQuote:query")
|
@SaCheckPermission("amz:logisticsQuote:query")
|
||||||
@GetMapping("/report")
|
@PostMapping("/report")
|
||||||
public R<List<Map<String, Object>>> getInfo() {
|
public R<List<Map<String, Object>>> getInfo(@Valid @RequestBody BizLogisticsQuoteReportBo bo) {
|
||||||
List<Map<String, Object>> maps = bizLogisticsQuoteService.generateReport();
|
List<Map<String, Object>> maps = bizLogisticsQuoteService.generateReport(bo);
|
||||||
return R.ok(maps);
|
return R.ok(maps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package org.asinkj.amz.domain.bo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.asinkj.amz.domain.BizLogisticsQuote;
|
||||||
|
import org.asinkj.common.core.validate.AddGroup;
|
||||||
|
import org.asinkj.common.core.validate.EditGroup;
|
||||||
|
import org.asinkj.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流报价业务对象 biz_logistics_quote
|
||||||
|
*
|
||||||
|
* @author shuo hu
|
||||||
|
* @date 2025-03-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = BizLogisticsQuote.class, reverseConvertGenerate = false)
|
||||||
|
public class BizLogisticsQuoteReportBo extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -8065228533338642055L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目的地(建议使用ISO国家代码如CN/US/GB)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "目的地(建议使用ISO国家代码如CN/US/GB)不能为空")
|
||||||
|
private String destination;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报价开始生效日期
|
||||||
|
*/
|
||||||
|
@NotNull(message = "报价开始生效日期不能为空")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "UTC")
|
||||||
|
private Date quoteStartDate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报价开始生效日期
|
||||||
|
*/
|
||||||
|
@NotNull(message = "报价结束生效日期不能为空")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "UTC")
|
||||||
|
private Date quoteEndDate;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
package org.asinkj.amz.mapper;
|
package org.asinkj.amz.mapper;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.asinkj.amz.domain.BizLogisticsQuote;
|
import org.asinkj.amz.domain.BizLogisticsQuote;
|
||||||
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
|
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
|
||||||
import org.asinkj.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.asinkj.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -25,4 +28,13 @@ public interface BizLogisticsQuoteMapper extends BaseMapperPlus<BizLogisticsQuot
|
|||||||
|
|
||||||
List<Map<String, Object>> selectDynamicReport(@Param("channels") List<String> channels);
|
List<Map<String, Object>> selectDynamicReport(@Param("channels") List<String> channels);
|
||||||
|
|
||||||
|
|
||||||
|
List<Map<String, Object>> getQuoteReport( @Param("columns") List<String> channels,
|
||||||
|
@Param("startDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
|
||||||
|
@Param("endDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
|
||||||
|
@Param("destination") @Size(max = 10) String destination);
|
||||||
|
|
||||||
|
|
||||||
|
List<Map<String, Object>> getQuoteAvgDayReport(@Param("columns") List<String> channels);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,4 +71,7 @@ public interface IBizLogisticsOrderService {
|
|||||||
void createByBo(BizLogisticsCreateOrderBo bo);
|
void createByBo(BizLogisticsCreateOrderBo bo);
|
||||||
|
|
||||||
void updateByOrderId(BizLogisticsOrderBo bizLogisticsOrderBo);
|
void updateByOrderId(BizLogisticsOrderBo bizLogisticsOrderBo);
|
||||||
|
|
||||||
|
|
||||||
|
List<BizLogisticsOrder> selectOrdersByUserId();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.lang.Opt;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.asinkj.amz.domain.BizLogisticsQuote;
|
import org.asinkj.amz.domain.BizLogisticsQuote;
|
||||||
import org.asinkj.amz.domain.bo.BizLogisticsQuoteMostBo;
|
import org.asinkj.amz.domain.bo.BizLogisticsQuoteMostBo;
|
||||||
|
import org.asinkj.amz.domain.bo.BizLogisticsQuoteReportBo;
|
||||||
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
|
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
|
||||||
import org.asinkj.amz.domain.bo.BizLogisticsQuoteBo;
|
import org.asinkj.amz.domain.bo.BizLogisticsQuoteBo;
|
||||||
import org.asinkj.amz.domain.vo.InquiryQuoteStatusDTO;
|
import org.asinkj.amz.domain.vo.InquiryQuoteStatusDTO;
|
||||||
@ -32,7 +33,9 @@ public interface IBizLogisticsQuoteService {
|
|||||||
*/
|
*/
|
||||||
BizLogisticsQuoteVo queryById(Long id);
|
BizLogisticsQuoteVo queryById(Long id);
|
||||||
|
|
||||||
List<Map<String, Object>> generateReport();
|
List<Map<String, Object>> generateReport(BizLogisticsQuoteReportBo bo);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getQuoteAvgDayReport();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询物流报价列表
|
* 分页查询物流报价列表
|
||||||
|
@ -20,8 +20,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.asinkj.common.satoken.utils.LoginHelper;
|
import org.asinkj.common.satoken.utils.LoginHelper;
|
||||||
import org.asinkj.system.api.RemoteUserService;
|
import org.asinkj.system.api.RemoteUserService;
|
||||||
import org.asinkj.system.api.model.LoginUser;
|
|
||||||
import org.asinkj.system.api.model.RoleDTO;
|
|
||||||
import org.asinkj.utils.SerialNoGenerator;
|
import org.asinkj.utils.SerialNoGenerator;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.asinkj.amz.domain.bo.BizLogisticsOrderBo;
|
import org.asinkj.amz.domain.bo.BizLogisticsOrderBo;
|
||||||
@ -30,7 +28,6 @@ import org.asinkj.amz.mapper.BizLogisticsOrderMapper;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -306,4 +303,9 @@ public class BizLogisticsOrderServiceImpl implements IBizLogisticsOrderService {
|
|||||||
baseMapper.update(updateWrapper);
|
baseMapper.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BizLogisticsOrder> selectOrdersByUserId() {
|
||||||
|
return baseMapper.selectOrdersByUserId(LoginHelper.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,11 @@ package org.asinkj.amz.service.impl;
|
|||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.lang.Opt;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.asinkj.amz.domain.BizInquiryRequest;
|
import org.asinkj.amz.domain.BizInquiryRequest;
|
||||||
import org.asinkj.amz.domain.bo.BizLogisticsQuoteMostBo;
|
import org.asinkj.amz.domain.bo.BizLogisticsQuoteMostBo;
|
||||||
|
import org.asinkj.amz.domain.bo.BizLogisticsQuoteReportBo;
|
||||||
import org.asinkj.amz.domain.vo.InquiryQuoteStatusDTO;
|
import org.asinkj.amz.domain.vo.InquiryQuoteStatusDTO;
|
||||||
import org.asinkj.amz.mapper.BizInquiryRequestMapper;
|
import org.asinkj.amz.mapper.BizInquiryRequestMapper;
|
||||||
import org.asinkj.amz.mapper.BizLogisticsChannelMapper;
|
import org.asinkj.amz.mapper.BizLogisticsChannelMapper;
|
||||||
@ -79,12 +79,25 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> generateReport() {
|
public List<Map<String, Object>> generateReport(BizLogisticsQuoteReportBo bo) {
|
||||||
// 1. 获取所有渠道名称
|
// 1. 获取所有渠道名称
|
||||||
List<String> channels = bizLogisticsChannelMapper.listAllChannels();
|
List<String> channels = bizLogisticsChannelMapper.listAllChannels();
|
||||||
|
|
||||||
// 2. 调用动态报表查询
|
// 2. 调用动态报表查询
|
||||||
return baseMapper.selectDynamicReport(channels);
|
// return baseMapper.selectDynamicReport(channels);
|
||||||
|
|
||||||
|
return baseMapper.getQuoteReport(channels,bo.getQuoteStartDate(), bo.getQuoteEndDate(),bo.getDestination());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getQuoteAvgDayReport() {
|
||||||
|
// 1. 获取所有渠道名称
|
||||||
|
List<String> channels = bizLogisticsChannelMapper.listAllChannels();
|
||||||
|
|
||||||
|
// 2. 调用动态报表查询
|
||||||
|
// return baseMapper.selectDynamicReport(channels);
|
||||||
|
|
||||||
|
return baseMapper.getQuoteAvgDayReport(channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,6 +5,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<mapper namespace="org.asinkj.amz.mapper.BizLogisticsChannelMapper">
|
<mapper namespace="org.asinkj.amz.mapper.BizLogisticsChannelMapper">
|
||||||
|
|
||||||
<select id="listAllChannels" resultType="java.lang.String">
|
<select id="listAllChannels" resultType="java.lang.String">
|
||||||
SELECT DISTINCT channel_name FROM biz_logistics_channel
|
SELECT DISTINCT c.channel_name FROM biz_logistics_channel c
|
||||||
|
INNER JOIN biz_logistics_quote q ON c.id = q.channel_id
|
||||||
|
WHERE q.del_flag = '0'
|
||||||
|
AND c.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -36,4 +36,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
WHERE rn = 1
|
WHERE rn = 1
|
||||||
GROUP BY logistics_name
|
GROUP BY logistics_name
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getQuoteReport" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
q.logistics_name AS "物流商名称",
|
||||||
|
<foreach item="col" collection="columns" separator=",">
|
||||||
|
COALESCE(MAX(CASE WHEN q.channel_name = #{col} THEN price END), 0) AS "${col}_报价",
|
||||||
|
COALESCE(MAX(CASE WHEN q.channel_name = #{col} THEN lead_time END), 0) AS "${col}_时效"
|
||||||
|
</foreach>
|
||||||
|
FROM biz_logistics_quote q
|
||||||
|
INNER JOIN biz_logistics_channel c ON q.channel_id = c.id
|
||||||
|
<where>
|
||||||
|
q.del_flag = '0'
|
||||||
|
AND c.del_flag = '0'
|
||||||
|
<choose>
|
||||||
|
<when test="startDate != null and endDate != null">
|
||||||
|
AND q.quote_date BETWEEN #{startDate} AND #{endDate}
|
||||||
|
</when>
|
||||||
|
<when test="startDate != null">
|
||||||
|
AND q.quote_date <![CDATA[ >= ]]> #{startDate}
|
||||||
|
</when>
|
||||||
|
<when test="endDate != null">
|
||||||
|
AND q.quote_date <![CDATA[ <= ]]> #{endDate}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
<if test="destination != null and destination != ''">
|
||||||
|
AND q.destination = #{destination}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY logistics_name
|
||||||
|
</select>
|
||||||
|
<select id="getQuoteAvgDayReport" resultType="java.util.Map">
|
||||||
|
SELECT logistics_name,
|
||||||
|
<foreach collection="columns" item="channel" separator=",">
|
||||||
|
COALESCE(AVG(CASE WHEN channel_name = #{channel} THEN lead_time END),0) AS "${channel}"
|
||||||
|
</foreach>
|
||||||
|
FROM biz_logistics_quote
|
||||||
|
WHERE del_flag = '0'
|
||||||
|
GROUP BY logistics_name
|
||||||
|
LIMIT #{pageSize} OFFSET #{offset}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user