Commit 7689f33e authored by lanbaoming's avatar lanbaoming

2024-05-15提交

parent 3746638b
......@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
......@@ -47,7 +48,7 @@ public class SalesReportControl {
lanbm 2024-04-01
*/
@PostMapping("/FirstCustomerCount")
public CommonResult<SalesReportCusTarget> FirstCustomerCount(@RequestBody SalesReportReq Req) {
public CommonResult<SalesReportCusTarget> FirstCustomerCount(@RequestBody SalesReportReq Req) throws ParseException {
SalesReportCusTarget nR = salesReportService.FirstCustomerCount(Req);
return success(nR);
}
......@@ -57,19 +58,24 @@ public class SalesReportControl {
Get请求一定要注意参数类型
*/
@GetMapping("/CustomerTargetCount")
public CommonResult<SalesReportCusTarget> CustomerTargetCount(@Valid SalesReportReq Req) {
public CommonResult<SalesReportCusTarget> CustomerTargetCount(@Valid SalesReportReq Req) throws ParseException {
SalesReportCusTarget objR = salesReportService.CustomerTargetCount(Req);
return success(objR);
}
/*
按运输方式统计重量和方数
lanbm 2024-04-01
*/
@PostMapping("/SalesReportCount")
public CommonResult<List<SalesReportRespShow>> SalesReportCount(@RequestBody SalesReportReq Req) {
List<SalesReportRespShow> list = salesReportService.SalesReportCount(Req);
public CommonResult<List<SalesReportResp>> SalesReportCount(@RequestBody SalesReportReq Req) throws ParseException {
List<SalesReportResp> list = new ArrayList<>();
SalesReportResp r0 = salesReportService.SalesReportCount(Req);
SalesReportResp r1 = salesReportService.SalesReportCountSea(Req);
SalesReportResp r3 = salesReportService.SalesReportCountAir(Req);
list.add(r0);
list.add(r1);
list.add(r3);
return success(list);
}
......@@ -78,7 +84,7 @@ public class SalesReportControl {
lanbm 2024-04-01 add
*/
@PostMapping("/SalesReportList")
public CommonResult<SalesReportCusTarget> SalesReportList(@RequestBody SalesReportReq Req) {
public CommonResult<SalesReportCusTarget> SalesReportList(@RequestBody SalesReportReq Req) throws ParseException {
SalesReportCusTarget objR = salesReportService.FirstCustomerCount(Req);
return success(objR);
}
......@@ -88,75 +94,9 @@ public class SalesReportControl {
*/
@GetMapping("/getEChartData")
public CommonResult<CustomerReportBar>
getEChartData(@Valid SalesAnalysisReq query) {
CustomerReportBar customerReportBar = new CustomerReportBar();
yAxis y = new yAxis();
y.setType("category");
y.setInverse(true);
List<String> l = new ArrayList<>();
l.add("1");
l.add("2");
l.add("3");
l.add("4");
l.add("5");
y.setData(l);
customerReportBar.setObjyAxis(y);
List<series> sl = new ArrayList<>();
//总V值
series s1 = new series();
s1.setName("2024");
s1.setType("bar");
s1.setBarGap("60%");
s1.setBarCategoryGap("60%");
List<String> s1L = new ArrayList<>();
s1L.add("12");
s1L.add("4");
s1L.add("7");
s1L.add("10");
s1L.add("20");
s1.setData(s1L);
sl.add(s1);
//海运
series s2 = new series();
s2.setName("2023");
s2.setType("bar");
s2.setBarGap("60%");
s2.setBarCategoryGap("60%");
List<String> s2L = new ArrayList<>();
s2L.add("10");
s2L.add("13");
s2L.add("6");
s2L.add("8");
s2L.add("9");
s2.setData(s2L);
sl.add(s2);
//空运
series s3 = new series();
s3.setName("2022");
s3.setType("bar");
s3.setBarGap("60%");
s3.setBarCategoryGap("60%");
List<String> s3L = new ArrayList<>();
s3L.add("10");
s3L.add("13");
s3L.add("19");
s3L.add("8");
s3L.add("19");
s3.setData(s3L);
sl.add(s3);
customerReportBar.setObSseries(sl);
// customerReportBar.setResultList(lis);
getEChartData(@Valid SalesReportReq query) throws ParseException {
CustomerReportBar customerReportBar =
salesReportService.getCustomerReportBar(query);
return success(customerReportBar);
}
......
......@@ -6,6 +6,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
/*
销售看板查询请求参数
......@@ -17,6 +19,11 @@ import lombok.ToString;
@ToString(callSuper = true)
public class SalesReportReq {
/*
时间区间中的月数 lanbm 2024-05-14 add
*/
private long sumMonth;
/*
销售经理
*/
......@@ -43,6 +50,9 @@ public class SalesReportReq {
private String sDate;
private String sDuiBiDate;
private Date dS;
private Date dE;
/*
结束日期
*/
......
......@@ -17,19 +17,21 @@ import java.math.BigDecimal;
public class SalesReportResp {
/*
所有运输方式的总体积,换算V值结果
当前值
*/
private BigDecimal allsumvolume;
private BigDecimal curValue;
/*
海运体积
同比值
*/
private BigDecimal sumvolume1;
private BigDecimal tbValue;
private String tbShow;
/*
专线空运重量
环比值
*/
private BigDecimal sumweight3;
private BigDecimal hbValue;
private String hbShow;
}
......@@ -12,7 +12,7 @@ public class SalesReportRespShow {
/*
当前数据
*/
private BigDecimal sumAll;
private BigDecimal sumData;
/*
对比数据
......
package cn.iocoder.yudao.module.delivery.job;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
/*
财务收款单 全部核销定时任务
lanbm 2024-05-14 add
*/
@Component
@TenantJob
@Slf4j
public class AllWriteOffJob implements JobHandler {
@Override
public String execute(String param) throws Exception {
int var1 = 30;
int var2 = 3;
int var3 = 6;
if (StringUtils.isNotBlank(param)){
String[] vars = param.split(StrUtil.COMMA);
if (vars.length > 0){
var1 = Integer.parseInt(vars[0]);
}
if (vars.length > 1){
var2 = Integer.parseInt(vars[1]);
}
if (vars.length > 2){
var3 = Integer.parseInt(vars[2]);
}
}
return "";
}
}
package cn.iocoder.yudao.module.delivery.listener;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderVValueEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
......@@ -19,8 +16,6 @@ import java.math.BigDecimal;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_EXPRESS_NUMBER_TOO_LONG;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
import static cn.iocoder.yudao.module.delivery.enums.ErrorCodeConstants.VCONFIG_NOT_EXISTS;
......
......@@ -13,8 +13,22 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SalesReportMapper {
/*
总值统计
*/
SalesReportResp SalesReportCount(SalesReportReq Req);
/*
海运统计
*/
SalesReportResp SalesReportCountSea(SalesReportReq Req);
/*
空运统计
*/
SalesReportResp SalesReportCountAir(SalesReportReq Req);
int FirstCustomerCount(SalesReportReq Req);
/*
......
......@@ -4,21 +4,46 @@ import cn.iocoder.yudao.module.delivery.entity.SalesReportCusTarget;
import cn.iocoder.yudao.module.delivery.entity.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import cn.iocoder.yudao.module.delivery.entity.SalesReportRespShow;
import cn.iocoder.yudao.module.delivery.entity.bar.CustomerReportBar;
import java.text.ParseException;
import java.util.List;
public interface SalesReportService {
List<SalesReportRespShow> SalesReportCount(SalesReportReq Req);
/*
总值统计
*/
SalesReportResp SalesReportCount(SalesReportReq Req)
throws ParseException;
/*
海运统计
*/
SalesReportResp SalesReportCountSea(SalesReportReq Req)
throws ParseException;
SalesReportCusTarget FirstCustomerCount(SalesReportReq Req);
/*
空运统计
*/
SalesReportResp SalesReportCountAir(SalesReportReq Req)
throws ParseException;
SalesReportCusTarget FirstCustomerCount(SalesReportReq Req) throws ParseException;
/*
统计一段时间内客户成交数目,出重客户
lanbm 2024-05-09 add
*/
SalesReportCusTarget CustomerTargetCount(SalesReportReq Req);
SalesReportCusTarget CustomerTargetCount(SalesReportReq Req) throws ParseException;
/*
获取统计图表数据
lanbm 2024-05-14 add
*/
CustomerReportBar getCustomerReportBar(SalesReportReq Req) throws ParseException;
}
<?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="cn.iocoder.yudao.module.delivery.mapper.SalesReportMapper">
<!--总值统计-->
<select id="SalesReportCount" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportResp">
SELECT (
SELECT sum(sum_volume)
SELECT sum(if(transport_id=1,sum_volume,)
FROM ecw_order
WHERE is_del = 0
AND (transport_id = 1 OR transport_id = 3)
AND create_time BETWEEN '2023-01-01'
AND '2023-03-31'
) AS allsumvolume,
) AS curValue,
(SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS sumvolume1,
AND (transport_id = 1 OR transport_id = 3)
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS tbValue,
(SELECT sum(sum_weight)
FROM ecw_order
WHERE is_del = 0
AND (transport_id = 1 OR transport_id = 3)
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS hbValue
FROM DUAL
</select>
<!--海运统计-->
<select id="SalesReportCountSea" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportResp">
SELECT (
SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND create_time BETWEEN '2023-01-01'
AND '2023-03-31'
) AS curValue,
(SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS tbValue,
(SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS hbValue
FROM DUAL
</select>
<!--空运统计-->
<select id="SalesReportCountAir" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportResp">
SELECT (
SELECT sum(sum_w)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 3
AND create_time BETWEEN '2023-01-01'
AND '2023-03-31'
) AS curValue,
(SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 3
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS tbValue,
(SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 3
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS sumweight3
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS hbValue
FROM DUAL
</select>
<!--2024-04-22-->
<select id="FirstCustomerCount" resultType="int">
SELECT count(c.customer_id) as s_customer_id
......@@ -45,7 +93,7 @@
and achievement_time BETWEEN #{sDate} and #{eDate}
</if>
<if test="salesmanid!=null and salesmanid!=''">
<!--客户经理查询条件-->
<!--客户经理查询条件-->
and user_id= #{salesmanid}
</if>
<if test="deptid!=null and deptid!=''">
......
......@@ -205,15 +205,18 @@ public class ProdCostCalculation {
Long consignorCustomerId, Long consigneeCustomerId,
Long consignorCustomerContactsId, Long consigneeCustomerContactsId,
Integer transportId, Long lineId, Long channelId) {
// 获取所有货币
//获取所有货币
List<CurrencyDO> currencyDOList = currencyService.list();
if (CollectionUtil.isEmpty(currencyDOList)) {
throw exception(NOT_FIND_CURRENCY);
}
// // 美元货币ID
Integer usdCurrency = currencyDOList.stream().filter(currencyDO -> StringUtils.equals("$", currencyDO.getFuhao())).findFirst().get().getId();
// // 美元货币ID
Integer usdCurrency =
currencyDOList.stream().filter(currencyDO -> StringUtils.equals("$", currencyDO.getFuhao())).findFirst().get().getId();
// 人民币货币ID
Integer rmbCurrency = currencyDOList.stream().filter(currencyDO -> StringUtils.equals("¥", currencyDO.getFuhao())).findFirst().get().getId();
Integer rmbCurrency =
currencyDOList.stream().filter(currencyDO -> StringUtils.equals("¥", currencyDO.getFuhao())).findFirst().get().getId();
if (CollectionUtil.isEmpty(prodConditionParamList)) {
throw exception(PROD_PARAM_NOT_NULL);
......@@ -346,22 +349,34 @@ public class ProdCostCalculation {
BigDecimal totalWeight = prodCostDtoList.stream().collect(CollectorsUtil.summingBigDecimal(ProdCostDto::getWeight));
costDto.setTotalWeight(totalWeight);
dto.setProdCostDtoList(prodCostDtoList);
// 计算报价费用 货值:与保价费相关:保价费 = 货值*1.1*0.002*汇率,汇率为人民币换目标货币(默认为美元)的汇率
Long insuranceCurrencyId = Objects.nonNull(usdCurrency) ? usdCurrency.longValue() : null;
// 计算报价费用 货值:与保价费相关:保价费 = 货值*1.1*0.002*汇率,
// 汇率为人民币换目标货币(默认为美元)的汇率
Long insuranceCurrencyId =
Objects.nonNull(usdCurrency) ? usdCurrency.longValue() : null;
BigDecimal minInsuranceFee = new BigDecimal("2");// 2美元的最低保费
WarehouseLineDO warehouseLineDO = warehouseLineMapper.selectById(lineId);
if (Objects.nonNull(warehouseLineDO) && Objects.nonNull(warehouseLineDO.getCurrencyUnit()) && warehouseLineDO.getCurrencyUnit() > 0) {
if (Objects.nonNull(warehouseLineDO) &&
Objects.nonNull(warehouseLineDO.getCurrencyUnit())
&& warehouseLineDO.getCurrencyUnit() > 0) {
// 当线路服务中设置了保费货币单位时,就以服务设置的为准,否则使用默认美元
insuranceCurrencyId = warehouseLineDO.getCurrencyUnit();
minInsuranceFee = warehouseLineDO.getMinPrice();
}
if (Objects.nonNull(insuranceCurrencyId)) {
ExchangeRateRespDTO exchangeRateRespDTO = currencyApi.getCurrencyRate(rmbCurrency.longValue(), insuranceCurrencyId);
ExchangeRateRespDTO exchangeRateRespDTO =
currencyApi.getCurrencyRate(rmbCurrency.longValue(),
insuranceCurrencyId);
FeeDto feeDto = new FeeDto();
if (costDto.getTotalWorth().compareTo(BigDecimal.ZERO) > 0) {
// 因为货值为RMB计算,保价费应换算为目标货币(默认为美元)
BigDecimal insuranceFee = costDto.getTotalWorth().multiply(new BigDecimal("1.1"))
.multiply(new BigDecimal("0.002")).multiply(exchangeRateRespDTO.getCurrencyRate()).setScale(0, RoundingMode.HALF_UP);
BigDecimal insuranceFee = costDto.getTotalWorth().
multiply(new BigDecimal("1.1")).
multiply(new BigDecimal("0.002")).
multiply(exchangeRateRespDTO.getCurrencyRate()).
setScale(0, RoundingMode.HALF_UP);
//insuranceFee lanbm 2024-05-14 修改报价费币种BUG
costDto.setInsuranceFee(insuranceFee);
feeDto.setAmount(insuranceFee);
} else {
......
......@@ -81,6 +81,7 @@ public class CostDto {
@ApiModelProperty(value = "总体积")
private BigDecimal totalVolume = BigDecimal.ZERO;
//lanbm 2024-05-14 修改BUG 报价费要按配置参数中的币种来计算
@ApiModelProperty(value = "美元(USD)保价费")
private BigDecimal insuranceFee = new BigDecimal("2");
......
......@@ -49,7 +49,8 @@ public class AppProdLinePriceController {
*/
@PostMapping("/calculation")
@ApiOperation("计算单种运输方式的商品费用(单个商品也做数组传参)")
public CommonResult<CalculationCostResultDto> calculationProdCost(@Valid @RequestBody ConditionParam param) {
public CommonResult<CalculationCostResultDto> calculationProdCost(
@Valid @RequestBody ConditionParam param) {
if (CollectionUtil.isEmpty(param.getProdConditionParamList())){
return error(ORDER_ITEM_PROD_NOT_EXISTS);
}
......@@ -57,7 +58,8 @@ public class AppProdLinePriceController {
List<ProdConditionParam> prodConditionParams = prodCostCalculation.obtainProdLineOnePrice(param.getProdConditionParamList(), "",
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1,
null, param.getTransportId(), param.getLineId(), param.getChannelId(), false);
CalculationCostResultDto dto = prodCostCalculation.calculationProdCost(prodConditionParams, "", param.getOrderType(),
CalculationCostResultDto dto =
prodCostCalculation.calculationProdCost(prodConditionParams, "", param.getOrderType(),
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1, Objects.nonNull(param.getIsCargoControl()) && param.getIsCargoControl() ? 1 : 0,
null, null, param.getConsignorCustomerId(), param.getConsigneeCustomerId(), param.getConsignorCustomerContactsId(),
param.getConsigneeCustomerContactsId(), param.getTransportId(), param.getLineId(), param.getChannelId());
......
......@@ -86,6 +86,7 @@ public class ReceiptItemDO extends BaseDO {
* 核销金额
*/
private java.math.BigDecimal writeOffAmount;
/**
* 流程审核状态
*/
......
......@@ -88,6 +88,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
private static final String RECEIPT_NEW_NUMBER = "receipt:new:number";
@Override
@Transactional(rollbackFor = Exception.class)
public Long createReceipt(ReceiptCreateReqVO createReqVO) {
......@@ -412,8 +413,72 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
page.setField("er.id");
IPage<ReceiptBackVO> mpPage = MyBatisUtils.buildPage(page);
receiptMapper.getReceiptBackPage(mpPage, query);
//lanbm 2024-05-14 添加明细状态计算列表
//MxStatus
//获取List指定字段的List
List<Long> idList = mpPage.getRecords().stream()
.map(ReceiptBackVO::getId)
.collect(Collectors.toList());
//根据List获取本页中所有的明细信息
LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(ReceiptItemDO::getReceiptId, idList);
List<ReceiptItemDO> listItem = receiptItemMapper.selectList(lambdaQueryWrapper);
for (ReceiptBackVO r : mpPage.getRecords()
) {
String sR = getReceiptMxStatus(listItem, r.getId());
r.setMxStatus(sR);
}
return PageResult.of(mpPage);
}
/*
lanbm 2024-05-13 计算收款单明细状态
收款单主表
SELECT * from ecw_receipt where receipt_no='SKD00006547'
收款单明细表
SELECT * from ecw_receipt_item where receipt_id=6554
*/
private String getReceiptMxStatus(List<ReceiptItemDO> listItem, long ReceiptId) {
//未录入 收款单下无收款明细
//未提交 :收款单下有收款明细且全未提交
//部分提交
//未审核
//部分审核
//全部审核
String sMxStatus = "";
//计算明细总数
Long iCount = listItem.stream().filter(i -> i.getReceiptId() == ReceiptId).
collect(Collectors.counting());
if (iCount == 0) {
sMxStatus = "未录入";
return sMxStatus;
} else {
//存在记录就判断状态
//status 状态0待核销,1已核销
//2核销审核中,3反核销审核中
//bmpStatus
//PROCESS(1, "处理中"),APPROVE(2, "通过"),
//REJECT(3, "不通过"),CANCEL(4, "已取消");
long Item0 = listItem.stream().
filter(i -> i.getStatus() == 0).
collect(Collectors.counting());
long Item1 = listItem.stream().
filter(i -> i.getStatus() == 1).
collect(Collectors.counting());
long Item2 = listItem.stream().
filter(i -> i.getStatus() == 2).
collect(Collectors.counting());
long Item3 = listItem.stream().
filter(i -> i.getStatus() == 3).
collect(Collectors.counting());
}
return sMxStatus;
}
@Override
......
......@@ -196,6 +196,14 @@ public class ReceiptBackVO {
@ApiModelProperty(value = "财务备注")
private String financeRemark;
/*
lanbm 2024-05-14 add
*/
@ExcelProperty("明细状态")
@ApiModelProperty(value = "明细状态")
private String mxStatus;
/* @ApiModelProperty(value = "应收明细列表")
private List<ReceivableDetail> receivableDetailList;
......
......@@ -90,6 +90,7 @@ public class ReceiptController {
@ApiOperation("获得收款单分页")
//@PreAuthorize("@ss.hasPermission('ecw:receipt:query')")
public CommonResult<PageResult<ReceiptBackVO>> getReceiptPage(@Valid ReceiptQueryVO query, PageVO page) {
//lanbm 2024-05-14 添加收款单明细状态计算功能
PageResult<ReceiptBackVO> pageResult = receiptService.getReceiptPage(query, page);
return success(pageResult);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment