Commit 7689f33e authored by lanbaoming's avatar lanbaoming

2024-05-15提交

parent 3746638b
...@@ -118,7 +118,6 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -118,7 +118,6 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
private CustomerMapper customerMapper; private CustomerMapper customerMapper;
@Resource @Resource
private ParamValidatorService paramValidatorService; private ParamValidatorService paramValidatorService;
...@@ -320,7 +319,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -320,7 +319,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
RLock rLock = redissonClient.getLock("customer_number"); RLock rLock = redissonClient.getLock("customer_number");
try { try {
boolean success = rLock.tryLock(5, 5, TimeUnit.SECONDS); boolean success = rLock.tryLock(5, 5, TimeUnit.SECONDS);
if(!success) throw new ServiceException(500, "操作忙,请稍后再试"); if (!success) throw new ServiceException(500, "操作忙,请稍后再试");
String customerNumber = genCustomerNumber(countryId); String customerNumber = genCustomerNumber(countryId);
customer.setNumber(customerNumber); customer.setNumber(customerNumber);
...@@ -332,7 +331,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -332,7 +331,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if(rLock.isLocked()) { if (rLock.isLocked()) {
rLock.unlock(); rLock.unlock();
} }
} }
...@@ -519,13 +518,13 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -519,13 +518,13 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
.setRemark("完善-确认接收" + (isFcl ? "(整柜客户)" : "")); .setRemark("完善-确认接收" + (isFcl ? "(整柜客户)" : ""));
//分配确认接收回调 //分配确认接收回调
applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerNew.getCustomerService())); applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId, customerNew.getCustomerService()));
//完善客户信息顺便确认接收,对客户类型做逻辑运算 //完善客户信息顺便确认接收,对客户类型做逻辑运算
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑 //lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息 //前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO customer2 = customerMapper.selectById(customerId); CustomerDO customer2 = customerMapper.selectById(customerId);
ReceiveCustomerCalTypeEvent event=new ReceiveCustomerCalTypeEvent(); ReceiveCustomerCalTypeEvent event = new ReceiveCustomerCalTypeEvent();
event.setCustomerId(customerId); event.setCustomerId(customerId);
event.setCustomerNumber(customer2.getNumber()); event.setCustomerNumber(customer2.getNumber());
event.setIsNew(customer2.getIsNew()); event.setIsNew(customer2.getIsNew());
...@@ -550,7 +549,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -550,7 +549,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
RLock rLock = redissonClient.getLock("customer_number"); RLock rLock = redissonClient.getLock("customer_number");
try { try {
boolean success = rLock.tryLock(5, 5, TimeUnit.SECONDS); boolean success = rLock.tryLock(5, 5, TimeUnit.SECONDS);
if(!success) throw new ServiceException(500, "操作忙,请稍后再试"); if (!success) throw new ServiceException(500, "操作忙,请稍后再试");
String customerNumber = genCustomerNumber(countryNew); String customerNumber = genCustomerNumber(countryNew);
customerNew.setNumber(customerNumber); customerNew.setNumber(customerNumber);
...@@ -560,7 +559,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -560,7 +559,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if(rLock.isLocked()) { if (rLock.isLocked()) {
rLock.unlock(); rLock.unlock();
} }
} }
...@@ -1801,7 +1800,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -1801,7 +1800,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
if (Objects.isNull(customerDO)) { if (Objects.isNull(customerDO)) {
throw exception(CUSTOMER_NOT_EXISTS); throw exception(CUSTOMER_NOT_EXISTS);
} }
if(customerDO.getDelayApprovalNum() >=1){ if (customerDO.getDelayApprovalNum() >= 1) {
throw exception(CUSTOMER_DELAY_APPROVAL_MORE_THEN_ONE); throw exception(CUSTOMER_DELAY_APPROVAL_MORE_THEN_ONE);
} }
if (customerDO.getIsInOpenSea()) { if (customerDO.getIsInOpenSea()) {
...@@ -1818,7 +1817,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -1818,7 +1817,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
} }
// TODO 待加入配置 最大延期时间 // TODO 待加入配置 最大延期时间
//long maxTime = 31 * 24 * 60 * 60 * 1000L;//原逻辑按一个月31天计算 ,现改为最多6个月 //long maxTime = 31 * 24 * 60 * 60 * 1000L;//原逻辑按一个月31天计算 ,现改为最多6个月
long maxTime = 6*31 * 24 * 60 * 60 * 1000L;//原逻辑按一个月31天计算 ,现改为最多6个月 long maxTime = 6 * 31 * 24 * 60 * 60 * 1000L;//原逻辑按一个月31天计算 ,现改为最多6个月
// long minTime = 24 * 60 * 60 * 1000L; // long minTime = 24 * 60 * 60 * 1000L;
long time = DateUtils.getTimeInMillis(delayApprovalInfoDto.getEstimateEnterOpenSeaTime()) - DateUtils.getTimeInMillis(customerDO.getEstimateEnterOpenSeaTime()); long time = DateUtils.getTimeInMillis(delayApprovalInfoDto.getEstimateEnterOpenSeaTime()) - DateUtils.getTimeInMillis(customerDO.getEstimateEnterOpenSeaTime());
if (time <= 0 || time > maxTime) { if (time <= 0 || time > maxTime) {
...@@ -1849,7 +1848,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -1849,7 +1848,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
customerApprovalService.updateById(customerApprovalDO); customerApprovalService.updateById(customerApprovalDO);
//记录延期申请审核次数 //记录延期申请审核次数
customerMapper.updateCustomerDelayApprovalNum(customerDO.getId(),customerDO.getDelayApprovalNum()+1) ; customerMapper.updateCustomerDelayApprovalNum(customerDO.getId(), customerDO.getDelayApprovalNum() + 1);
//纪录日志 //纪录日志
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
...@@ -2428,12 +2427,12 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2428,12 +2427,12 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO); customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
//分配确认接收回调 //分配确认接收回调
applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerService)); applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId, customerService));
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑 //lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息 //前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO customer2 = customerMapper.selectById(customerId); CustomerDO customer2 = customerMapper.selectById(customerId);
ReceiveCustomerCalTypeEvent event=new ReceiveCustomerCalTypeEvent(); ReceiveCustomerCalTypeEvent event = new ReceiveCustomerCalTypeEvent();
event.setCustomerId(customerId); event.setCustomerId(customerId);
event.setCustomerNumber(customer2.getNumber()); event.setCustomerNumber(customer2.getNumber());
event.setIsNew(customer2.getIsNew()); event.setIsNew(customer2.getIsNew());
...@@ -2587,7 +2586,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2587,7 +2586,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
//lanbm 2024-05-07 添加捞取后修改客户是否为新客户的相关逻辑 //lanbm 2024-05-07 添加捞取后修改客户是否为新客户的相关逻辑
CalculateCustomerTypeEvent cevent=new CalculateCustomerTypeEvent(); CalculateCustomerTypeEvent cevent = new CalculateCustomerTypeEvent();
cevent.setCustomerNumber(customer.getNumber()); cevent.setCustomerNumber(customer.getNumber());
cevent.setStatus(customer.getStatus()); cevent.setStatus(customer.getStatus());
cevent.setOldCustomerService(newCustomerService); cevent.setOldCustomerService(newCustomerService);
...@@ -2653,14 +2652,14 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2653,14 +2652,14 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO); customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
//分配确认接收回调 //分配确认接收回调
applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerDO.getCustomerService())); applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId, customerDO.getCustomerService()));
//报价成功后就会确认接收客户,所以在此做客户类型逻辑运算 //报价成功后就会确认接收客户,所以在此做客户类型逻辑运算
//lanbm 2024-05-08 add //lanbm 2024-05-08 add
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑 //lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息 //前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO customer2 = customerMapper.selectById(customerId); CustomerDO customer2 = customerMapper.selectById(customerId);
ReceiveCustomerCalTypeEvent event=new ReceiveCustomerCalTypeEvent(); ReceiveCustomerCalTypeEvent event = new ReceiveCustomerCalTypeEvent();
event.setCustomerId(customerId); event.setCustomerId(customerId);
event.setCustomerNumber(customer2.getNumber()); event.setCustomerNumber(customer2.getNumber());
event.setIsNew(customer2.getIsNew()); event.setIsNew(customer2.getIsNew());
...@@ -3362,7 +3361,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -3362,7 +3361,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
} }
if (Objects.equals(customerDO.getIsNew(), isNew)) { if (Objects.equals(customerDO.getIsNew(), isNew)) {
throw exception(CUSTOMER_IS_NEW_OR_OLD_NO_CHANGE, isNew ? "新" : "老"); // throw exception(CUSTOMER_IS_NEW_OR_OLD_NO_CHANGE, isNew ? "新" : "老");
//lanbm 2024-05-15 修改此处逻辑,修改客户类型时,不用炮异常,直接不修改就可以了
return;
} }
// 更新 // 更新
......
...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -47,7 +48,7 @@ public class SalesReportControl { ...@@ -47,7 +48,7 @@ public class SalesReportControl {
lanbm 2024-04-01 lanbm 2024-04-01
*/ */
@PostMapping("/FirstCustomerCount") @PostMapping("/FirstCustomerCount")
public CommonResult<SalesReportCusTarget> FirstCustomerCount(@RequestBody SalesReportReq Req) { public CommonResult<SalesReportCusTarget> FirstCustomerCount(@RequestBody SalesReportReq Req) throws ParseException {
SalesReportCusTarget nR = salesReportService.FirstCustomerCount(Req); SalesReportCusTarget nR = salesReportService.FirstCustomerCount(Req);
return success(nR); return success(nR);
} }
...@@ -57,19 +58,24 @@ public class SalesReportControl { ...@@ -57,19 +58,24 @@ public class SalesReportControl {
Get请求一定要注意参数类型 Get请求一定要注意参数类型
*/ */
@GetMapping("/CustomerTargetCount") @GetMapping("/CustomerTargetCount")
public CommonResult<SalesReportCusTarget> CustomerTargetCount(@Valid SalesReportReq Req) { public CommonResult<SalesReportCusTarget> CustomerTargetCount(@Valid SalesReportReq Req) throws ParseException {
SalesReportCusTarget objR = salesReportService.CustomerTargetCount(Req); SalesReportCusTarget objR = salesReportService.CustomerTargetCount(Req);
return success(objR); return success(objR);
} }
/* /*
按运输方式统计重量和方数 按运输方式统计重量和方数
lanbm 2024-04-01 lanbm 2024-04-01
*/ */
@PostMapping("/SalesReportCount") @PostMapping("/SalesReportCount")
public CommonResult<List<SalesReportRespShow>> SalesReportCount(@RequestBody SalesReportReq Req) { public CommonResult<List<SalesReportResp>> SalesReportCount(@RequestBody SalesReportReq Req) throws ParseException {
List<SalesReportRespShow> list = salesReportService.SalesReportCount(Req); 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); return success(list);
} }
...@@ -78,7 +84,7 @@ public class SalesReportControl { ...@@ -78,7 +84,7 @@ public class SalesReportControl {
lanbm 2024-04-01 add lanbm 2024-04-01 add
*/ */
@PostMapping("/SalesReportList") @PostMapping("/SalesReportList")
public CommonResult<SalesReportCusTarget> SalesReportList(@RequestBody SalesReportReq Req) { public CommonResult<SalesReportCusTarget> SalesReportList(@RequestBody SalesReportReq Req) throws ParseException {
SalesReportCusTarget objR = salesReportService.FirstCustomerCount(Req); SalesReportCusTarget objR = salesReportService.FirstCustomerCount(Req);
return success(objR); return success(objR);
} }
...@@ -88,75 +94,9 @@ public class SalesReportControl { ...@@ -88,75 +94,9 @@ public class SalesReportControl {
*/ */
@GetMapping("/getEChartData") @GetMapping("/getEChartData")
public CommonResult<CustomerReportBar> public CommonResult<CustomerReportBar>
getEChartData(@Valid SalesAnalysisReq query) { getEChartData(@Valid SalesReportReq query) throws ParseException {
CustomerReportBar customerReportBar = new CustomerReportBar(); CustomerReportBar customerReportBar =
salesReportService.getCustomerReportBar(query);
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);
return success(customerReportBar); return success(customerReportBar);
} }
......
...@@ -6,6 +6,8 @@ import lombok.Data; ...@@ -6,6 +6,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import java.util.Date;
/* /*
销售看板查询请求参数 销售看板查询请求参数
...@@ -17,6 +19,11 @@ import lombok.ToString; ...@@ -17,6 +19,11 @@ import lombok.ToString;
@ToString(callSuper = true) @ToString(callSuper = true)
public class SalesReportReq { public class SalesReportReq {
/*
时间区间中的月数 lanbm 2024-05-14 add
*/
private long sumMonth;
/* /*
销售经理 销售经理
*/ */
...@@ -43,6 +50,9 @@ public class SalesReportReq { ...@@ -43,6 +50,9 @@ public class SalesReportReq {
private String sDate; private String sDate;
private String sDuiBiDate; private String sDuiBiDate;
private Date dS;
private Date dE;
/* /*
结束日期 结束日期
*/ */
......
...@@ -17,19 +17,21 @@ import java.math.BigDecimal; ...@@ -17,19 +17,21 @@ import java.math.BigDecimal;
public class SalesReportResp { 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 { ...@@ -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; 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.CalculateOrderVValueEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 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.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.service.EcwVzService; import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO; import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
...@@ -19,8 +16,6 @@ import java.math.BigDecimal; ...@@ -19,8 +16,6 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 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.order.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
import static cn.iocoder.yudao.module.delivery.enums.ErrorCodeConstants.VCONFIG_NOT_EXISTS; import static cn.iocoder.yudao.module.delivery.enums.ErrorCodeConstants.VCONFIG_NOT_EXISTS;
......
...@@ -13,8 +13,22 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -13,8 +13,22 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface SalesReportMapper { public interface SalesReportMapper {
/*
总值统计
*/
SalesReportResp SalesReportCount(SalesReportReq Req); SalesReportResp SalesReportCount(SalesReportReq Req);
/*
海运统计
*/
SalesReportResp SalesReportCountSea(SalesReportReq Req);
/*
空运统计
*/
SalesReportResp SalesReportCountAir(SalesReportReq Req);
int FirstCustomerCount(SalesReportReq Req); int FirstCustomerCount(SalesReportReq Req);
/* /*
......
...@@ -4,21 +4,46 @@ import cn.iocoder.yudao.module.delivery.entity.SalesReportCusTarget; ...@@ -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.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp; import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import cn.iocoder.yudao.module.delivery.entity.SalesReportRespShow; 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; import java.util.List;
public interface SalesReportService { public interface SalesReportService {
List<SalesReportRespShow> SalesReportCount(SalesReportReq Req); /*
总值统计
*/
SalesReportResp SalesReportCount(SalesReportReq Req)
throws ParseException;
/*
海运统计
*/
SalesReportResp SalesReportCountSea(SalesReportReq Req)
throws ParseException;
/*
空运统计
*/
SalesReportResp SalesReportCountAir(SalesReportReq Req)
throws ParseException;
SalesReportCusTarget FirstCustomerCount(SalesReportReq Req); SalesReportCusTarget FirstCustomerCount(SalesReportReq Req) throws ParseException;
/* /*
统计一段时间内客户成交数目,出重客户 统计一段时间内客户成交数目,出重客户
lanbm 2024-05-09 add 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"?> <?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"> <!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"> <mapper namespace="cn.iocoder.yudao.module.delivery.mapper.SalesReportMapper">
<!--总值统计-->
<select id="SalesReportCount" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportResp"> <select id="SalesReportCount" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportResp">
SELECT ( SELECT (
SELECT sum(sum_volume) SELECT sum(if(transport_id=1,sum_volume,)
FROM ecw_order FROM ecw_order
WHERE is_del = 0 WHERE is_del = 0
AND (transport_id = 1 OR transport_id = 3) AND (transport_id = 1 OR transport_id = 3)
AND create_time BETWEEN '2023-01-01' AND create_time BETWEEN '2023-01-01'
AND '2023-03-31' AND '2023-03-31'
) AS allsumvolume, ) AS curValue,
(SELECT sum(sum_volume) (SELECT sum(sum_volume)
FROM ecw_order FROM ecw_order
WHERE is_del = 0 WHERE is_del = 0
AND transport_id = 1 AND (transport_id = 1 OR transport_id = 3)
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS sumvolume1, AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS tbValue,
(SELECT sum(sum_weight) (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 FROM ecw_order
WHERE is_del = 0 WHERE is_del = 0
AND transport_id = 3 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 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 hbValue
FROM DUAL FROM DUAL
</select> </select>
<!--2024-04-22--> <!--2024-04-22-->
<select id="FirstCustomerCount" resultType="int"> <select id="FirstCustomerCount" resultType="int">
SELECT count(c.customer_id) as s_customer_id SELECT count(c.customer_id) as s_customer_id
......
...@@ -205,15 +205,18 @@ public class ProdCostCalculation { ...@@ -205,15 +205,18 @@ public class ProdCostCalculation {
Long consignorCustomerId, Long consigneeCustomerId, Long consignorCustomerId, Long consigneeCustomerId,
Long consignorCustomerContactsId, Long consigneeCustomerContactsId, Long consignorCustomerContactsId, Long consigneeCustomerContactsId,
Integer transportId, Long lineId, Long channelId) { Integer transportId, Long lineId, Long channelId) {
// 获取所有货币 //获取所有货币
List<CurrencyDO> currencyDOList = currencyService.list(); List<CurrencyDO> currencyDOList = currencyService.list();
if (CollectionUtil.isEmpty(currencyDOList)) { if (CollectionUtil.isEmpty(currencyDOList)) {
throw exception(NOT_FIND_CURRENCY); throw exception(NOT_FIND_CURRENCY);
} }
// // 美元货币ID // // 美元货币ID
Integer usdCurrency = currencyDOList.stream().filter(currencyDO -> StringUtils.equals("$", currencyDO.getFuhao())).findFirst().get().getId(); Integer usdCurrency =
currencyDOList.stream().filter(currencyDO -> StringUtils.equals("$", currencyDO.getFuhao())).findFirst().get().getId();
// 人民币货币ID // 人民币货币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)) { if (CollectionUtil.isEmpty(prodConditionParamList)) {
throw exception(PROD_PARAM_NOT_NULL); throw exception(PROD_PARAM_NOT_NULL);
...@@ -346,22 +349,34 @@ public class ProdCostCalculation { ...@@ -346,22 +349,34 @@ public class ProdCostCalculation {
BigDecimal totalWeight = prodCostDtoList.stream().collect(CollectorsUtil.summingBigDecimal(ProdCostDto::getWeight)); BigDecimal totalWeight = prodCostDtoList.stream().collect(CollectorsUtil.summingBigDecimal(ProdCostDto::getWeight));
costDto.setTotalWeight(totalWeight); costDto.setTotalWeight(totalWeight);
dto.setProdCostDtoList(prodCostDtoList); dto.setProdCostDtoList(prodCostDtoList);
// 计算报价费用 货值:与保价费相关:保价费 = 货值*1.1*0.002*汇率,汇率为人民币换目标货币(默认为美元)的汇率 // 计算报价费用 货值:与保价费相关:保价费 = 货值*1.1*0.002*汇率,
Long insuranceCurrencyId = Objects.nonNull(usdCurrency) ? usdCurrency.longValue() : null; // 汇率为人民币换目标货币(默认为美元)的汇率
Long insuranceCurrencyId =
Objects.nonNull(usdCurrency) ? usdCurrency.longValue() : null;
BigDecimal minInsuranceFee = new BigDecimal("2");// 2美元的最低保费 BigDecimal minInsuranceFee = new BigDecimal("2");// 2美元的最低保费
WarehouseLineDO warehouseLineDO = warehouseLineMapper.selectById(lineId); 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(); insuranceCurrencyId = warehouseLineDO.getCurrencyUnit();
minInsuranceFee = warehouseLineDO.getMinPrice(); minInsuranceFee = warehouseLineDO.getMinPrice();
} }
if (Objects.nonNull(insuranceCurrencyId)) { if (Objects.nonNull(insuranceCurrencyId)) {
ExchangeRateRespDTO exchangeRateRespDTO = currencyApi.getCurrencyRate(rmbCurrency.longValue(), insuranceCurrencyId); ExchangeRateRespDTO exchangeRateRespDTO =
currencyApi.getCurrencyRate(rmbCurrency.longValue(),
insuranceCurrencyId);
FeeDto feeDto = new FeeDto(); FeeDto feeDto = new FeeDto();
if (costDto.getTotalWorth().compareTo(BigDecimal.ZERO) > 0) { if (costDto.getTotalWorth().compareTo(BigDecimal.ZERO) > 0) {
// 因为货值为RMB计算,保价费应换算为目标货币(默认为美元) // 因为货值为RMB计算,保价费应换算为目标货币(默认为美元)
BigDecimal insuranceFee = costDto.getTotalWorth().multiply(new BigDecimal("1.1")) BigDecimal insuranceFee = costDto.getTotalWorth().
.multiply(new BigDecimal("0.002")).multiply(exchangeRateRespDTO.getCurrencyRate()).setScale(0, RoundingMode.HALF_UP); 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); costDto.setInsuranceFee(insuranceFee);
feeDto.setAmount(insuranceFee); feeDto.setAmount(insuranceFee);
} else { } else {
......
...@@ -81,6 +81,7 @@ public class CostDto { ...@@ -81,6 +81,7 @@ public class CostDto {
@ApiModelProperty(value = "总体积") @ApiModelProperty(value = "总体积")
private BigDecimal totalVolume = BigDecimal.ZERO; private BigDecimal totalVolume = BigDecimal.ZERO;
//lanbm 2024-05-14 修改BUG 报价费要按配置参数中的币种来计算
@ApiModelProperty(value = "美元(USD)保价费") @ApiModelProperty(value = "美元(USD)保价费")
private BigDecimal insuranceFee = new BigDecimal("2"); private BigDecimal insuranceFee = new BigDecimal("2");
......
...@@ -49,7 +49,8 @@ public class AppProdLinePriceController { ...@@ -49,7 +49,8 @@ public class AppProdLinePriceController {
*/ */
@PostMapping("/calculation") @PostMapping("/calculation")
@ApiOperation("计算单种运输方式的商品费用(单个商品也做数组传参)") @ApiOperation("计算单种运输方式的商品费用(单个商品也做数组传参)")
public CommonResult<CalculationCostResultDto> calculationProdCost(@Valid @RequestBody ConditionParam param) { public CommonResult<CalculationCostResultDto> calculationProdCost(
@Valid @RequestBody ConditionParam param) {
if (CollectionUtil.isEmpty(param.getProdConditionParamList())){ if (CollectionUtil.isEmpty(param.getProdConditionParamList())){
return error(ORDER_ITEM_PROD_NOT_EXISTS); return error(ORDER_ITEM_PROD_NOT_EXISTS);
} }
...@@ -57,7 +58,8 @@ public class AppProdLinePriceController { ...@@ -57,7 +58,8 @@ public class AppProdLinePriceController {
List<ProdConditionParam> prodConditionParams = prodCostCalculation.obtainProdLineOnePrice(param.getProdConditionParamList(), "", List<ProdConditionParam> prodConditionParams = prodCostCalculation.obtainProdLineOnePrice(param.getProdConditionParamList(), "",
Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1, Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1,
null, param.getTransportId(), param.getLineId(), param.getChannelId(), false); 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, Objects.nonNull(param.getCustomsType()) ? param.getCustomsType() : 1, Objects.nonNull(param.getIsCargoControl()) && param.getIsCargoControl() ? 1 : 0,
null, null, param.getConsignorCustomerId(), param.getConsigneeCustomerId(), param.getConsignorCustomerContactsId(), null, null, param.getConsignorCustomerId(), param.getConsigneeCustomerId(), param.getConsignorCustomerContactsId(),
param.getConsigneeCustomerContactsId(), param.getTransportId(), param.getLineId(), param.getChannelId()); param.getConsigneeCustomerContactsId(), param.getTransportId(), param.getLineId(), param.getChannelId());
......
...@@ -86,6 +86,7 @@ public class ReceiptItemDO extends BaseDO { ...@@ -86,6 +86,7 @@ public class ReceiptItemDO extends BaseDO {
* 核销金额 * 核销金额
*/ */
private java.math.BigDecimal writeOffAmount; private java.math.BigDecimal writeOffAmount;
/** /**
* 流程审核状态 * 流程审核状态
*/ */
......
...@@ -88,6 +88,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -88,6 +88,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
private static final String RECEIPT_NEW_NUMBER = "receipt:new:number"; private static final String RECEIPT_NEW_NUMBER = "receipt:new:number";
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createReceipt(ReceiptCreateReqVO createReqVO) { public Long createReceipt(ReceiptCreateReqVO createReqVO) {
...@@ -412,8 +413,72 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -412,8 +413,72 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
page.setField("er.id"); page.setField("er.id");
IPage<ReceiptBackVO> mpPage = MyBatisUtils.buildPage(page); IPage<ReceiptBackVO> mpPage = MyBatisUtils.buildPage(page);
receiptMapper.getReceiptBackPage(mpPage, query); 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); 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 @Override
......
...@@ -196,6 +196,14 @@ public class ReceiptBackVO { ...@@ -196,6 +196,14 @@ public class ReceiptBackVO {
@ApiModelProperty(value = "财务备注") @ApiModelProperty(value = "财务备注")
private String financeRemark; private String financeRemark;
/*
lanbm 2024-05-14 add
*/
@ExcelProperty("明细状态")
@ApiModelProperty(value = "明细状态")
private String mxStatus;
/* @ApiModelProperty(value = "应收明细列表") /* @ApiModelProperty(value = "应收明细列表")
private List<ReceivableDetail> receivableDetailList; private List<ReceivableDetail> receivableDetailList;
......
...@@ -90,6 +90,7 @@ public class ReceiptController { ...@@ -90,6 +90,7 @@ public class ReceiptController {
@ApiOperation("获得收款单分页") @ApiOperation("获得收款单分页")
//@PreAuthorize("@ss.hasPermission('ecw:receipt:query')") //@PreAuthorize("@ss.hasPermission('ecw:receipt:query')")
public CommonResult<PageResult<ReceiptBackVO>> getReceiptPage(@Valid ReceiptQueryVO query, PageVO page) { public CommonResult<PageResult<ReceiptBackVO>> getReceiptPage(@Valid ReceiptQueryVO query, PageVO page) {
//lanbm 2024-05-14 添加收款单明细状态计算功能
PageResult<ReceiptBackVO> pageResult = receiptService.getReceiptPage(query, page); PageResult<ReceiptBackVO> pageResult = receiptService.getReceiptPage(query, page);
return success(pageResult); 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