Commit 0a16888e authored by lanbaoming's avatar lanbaoming

2024-05-16提交

parent 7ce16d14
......@@ -23,8 +23,9 @@ public class BpmOrdeFreeApplyResultListener extends BpmProcessInstanceResultEven
@Override
protected void onEvent(BpmProcessInstanceResultEvent event) {
//订单费用申请回调函数 lanbm 2024-05-15 添加注释
log.info("------------------费用审核回调--------------------------{},{}" , event.getBusinessKey(), event.getResult());
//lanbm 2024-05-16 处理报应收款不存在的BUG
orderFeeApplicationService.updateFeeApproveResult(event.getBusinessKey(), event.getResult());
}
......
......@@ -127,7 +127,6 @@ public class CustomerAnalysisControl {
PageResult<CustomerAnalysisResp> pageResult =
customerAnalysisService.GetDataResult(query);
return success(pageResult);
}
......@@ -143,7 +142,7 @@ public class CustomerAnalysisControl {
customerAnalysisService.GetDataListResult(query);
List<CustomerAnalysisExcelResp> listExel =
CustomerAnalysis.INSTANCE.convertList(list);
// 导出 Excel
//导出 Excel
ExcelUtils.write(response, "客户分析报表.xls", "客户分析报表",
CustomerAnalysisExcelResp.class, listExel);
}
......
......@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.delivery.entity.*;
import cn.iocoder.yudao.module.delivery.entity.bar.CustomerReportBar;
import cn.iocoder.yudao.module.delivery.entity.bar.SalesReportBar;
import cn.iocoder.yudao.module.delivery.entity.bar.series;
import cn.iocoder.yudao.module.delivery.entity.bar.yAxis;
import cn.iocoder.yudao.module.delivery.service.SalesReportService;
......@@ -70,6 +71,7 @@ public class SalesReportControl {
@PostMapping("/SalesReportCount")
public CommonResult<List<SalesReportResp>> SalesReportCount(@RequestBody SalesReportReq Req) throws ParseException {
List<SalesReportResp> list = new ArrayList<>();
Req=salesReportService.getReq(Req);
SalesReportResp r0 = salesReportService.SalesReportCount(Req);
SalesReportResp r1 = salesReportService.SalesReportCountSea(Req);
SalesReportResp r3 = salesReportService.SalesReportCountAir(Req);
......@@ -93,11 +95,10 @@ public class SalesReportControl {
获取销售分析图表数据
*/
@GetMapping("/getEChartData")
public CommonResult<CustomerReportBar>
public CommonResult<SalesReportBar>
getEChartData(@Valid SalesReportReq query) throws ParseException {
CustomerReportBar customerReportBar =
salesReportService.getCustomerReportBar(query);
return success(customerReportBar);
SalesReportBar ReportBar = salesReportService.getCustomerReportBar(query);
return success(ReportBar);
}
......
......@@ -49,13 +49,27 @@ public class SalesReportReq {
*/
private String sDate;
private String sDuiBiDate;
/*
环比日期
*/
private String sHuanBiDate;
private Date dS;
private Date dE;
private Date dTbS;
private Date dTbE;
private Date dHbS;
private Date dHbE;
/*
结束日期
*/
private String eDate;
private String eDuiBiDate;
/*
环比日期
*/
private String eHuanBiDate;
}
......@@ -15,6 +15,10 @@ import java.math.BigDecimal;
@NoArgsConstructor
@AllArgsConstructor
public class SalesReportResp {
/*
统计月份
*/
private String strMonth;
/*
当前值
......
package cn.iocoder.yudao.module.delivery.entity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@ApiModel("管理后台 -销售看板查询结果")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalesReportRespAll {
/*
统计月份
*/
private String strMonth;
/*
当前值
*/
private BigDecimal curValue;
private BigDecimal curValue1;
private BigDecimal curValue3;
/*
同比值
*/
private BigDecimal tbValue;
private String tbShow;
/*
海运同比
*/
private BigDecimal tbValue1;
private String tbShow1;
/*
空运同比
*/
private BigDecimal tbValue3;
private String tbShow3;
/*
环比值 总值
*/
private BigDecimal hbValue;
private String hbShow;
/*
海运环比
*/
private BigDecimal hbValue1;
private String hbShow1;
/*
空运环比
*/
private BigDecimal hbValue3;
private String hbShow3;
}
package cn.iocoder.yudao.module.delivery.entity.bar;
import cn.iocoder.yudao.module.delivery.entity.CustomerReportResp;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......
package cn.iocoder.yudao.module.delivery.entity.bar;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import cn.iocoder.yudao.module.delivery.entity.SalesReportRespAll;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalesReportBar {
private yAxis objyAxis;
private List<series> obSseries;
/*
总值,海运,空运统计值合并
*/
private List<SalesReportRespAll> salesReportRespAll;
/*
记录总数 lanbm 2024-04-14 add
*/
private long total;
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.module.delivery.entity.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import cn.iocoder.yudao.module.delivery.entity.SalesReportRespAll;
import org.apache.ibatis.annotations.Mapper;
/**
......@@ -18,6 +19,9 @@ public interface SalesReportMapper {
*/
SalesReportResp SalesReportCount(SalesReportReq Req);
SalesReportRespAll SalesReportCountAll(SalesReportReq Req);
/*
海运统计
*/
......
......@@ -304,6 +304,7 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
//计算控货占比
r = calKH(r, false);
}
//计算提货率
r = calPick(r, false);
}
return pageResult;
......@@ -679,11 +680,14 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
}
/*
lanbm 2024-05-15 修改提货率计算保留小数点的BUG
*/
private String getIntPercentage(int number, int divisor) {
// 计算百分比
double percentage = number / (double) divisor;
// 格式化输出百分比
String formatted = String.format("%.2f%%", percentage);
String formatted = String.format("%.2f%%", percentage*100);
return formatted;
}
......
......@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.delivery.service.Impl;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.delivery.entity.*;
import cn.iocoder.yudao.module.delivery.entity.bar.CustomerReportBar;
import cn.iocoder.yudao.module.delivery.entity.bar.SalesReportBar;
import cn.iocoder.yudao.module.delivery.entity.bar.series;
import cn.iocoder.yudao.module.delivery.entity.bar.yAxis;
import cn.iocoder.yudao.module.delivery.mapper.EmployeeMapper;
......@@ -32,8 +33,135 @@ public class SalesReportImpl implements SalesReportService {
@Autowired
private SalesReportMapper salesReportMapper;
public SalesReportRespAll SalesReportCountAll(SalesReportReq Req) {
SalesReportRespAll r = null;
r = salesReportMapper.SalesReportCountAll(Req);
if (r == null) {
r = new SalesReportRespAll();
r.setCurValue(new BigDecimal(0));
r.setCurValue1(new BigDecimal(0));
r.setCurValue3(new BigDecimal(0));
//同比
r.setTbValue(new BigDecimal(0));
r.setTbValue1(new BigDecimal(0));
r.setTbValue3(new BigDecimal(0));
//环比
r.setHbValue(new BigDecimal(0));
r.setHbValue1(new BigDecimal(0));
r.setHbValue3(new BigDecimal(0));
r.setTbShow("0");
r.setHbShow("0");
} else {
if (r.getCurValue() == null ||
r.getCurValue().compareTo(BigDecimal.ZERO) == 0) {
r.setCurValue(new BigDecimal(0));
}
if (r.getCurValue1() == null ||
r.getCurValue1().compareTo(BigDecimal.ZERO) == 0) {
r.setCurValue1(new BigDecimal(0));
}
if (r.getCurValue3() == null ||
r.getCurValue3().compareTo(BigDecimal.ZERO) == 0) {
r.setCurValue3(new BigDecimal(0));
}
//同比
if (r.getTbValue() == null ||
r.getTbValue().compareTo(BigDecimal.ZERO) == 0) {
r.setTbValue(new BigDecimal(0));
}
if (r.getTbValue1() == null ||
r.getTbValue1().compareTo(BigDecimal.ZERO) == 0) {
r.setTbValue1(new BigDecimal(0));
}
if (r.getTbValue3() == null ||
r.getTbValue3().compareTo(BigDecimal.ZERO) == 0) {
r.setTbValue3(new BigDecimal(0));
}
//环比
if (r.getHbValue() == null ||
r.getHbValue().compareTo(BigDecimal.ZERO) == 0) {
r.setHbValue(new BigDecimal(0));
}
if (r.getHbValue1() == null ||
r.getHbValue1().compareTo(BigDecimal.ZERO) == 0) {
r.setHbValue1(new BigDecimal(0));
}
if (r.getHbValue3() == null ||
r.getHbValue3().compareTo(BigDecimal.ZERO) == 0) {
r.setHbValue3(new BigDecimal(0));
}
//计算同比
String sTemp = "";
if (r.getTbValue().compareTo(BigDecimal.ZERO) == 0) {
sTemp = "同期值为0";
} else {
sTemp = getPercentage(r.getCurValue().subtract(r.getTbValue()),
r.getTbValue());
}
r.setTbShow(sTemp);
//海运
if (r.getTbValue1().compareTo(BigDecimal.ZERO) == 0) {
sTemp = "同期值为0";
} else {
sTemp = getPercentage(r.getCurValue1().subtract(r.getTbValue1()),
r.getTbValue1());
}
r.setTbShow1(sTemp);
//空运
if (r.getTbValue3().compareTo(BigDecimal.ZERO) == 0) {
sTemp = "同期值为0";
} else {
sTemp = getPercentage(r.getCurValue3().subtract(r.getTbValue3()),
r.getTbValue3());
}
r.setTbShow3(sTemp);
//计算环比
if (r.getHbValue().compareTo(BigDecimal.ZERO) == 0) {
sTemp = "上期值为0";
} else {
sTemp = getPercentage(r.getCurValue().subtract(r.getHbValue()),
r.getHbValue());
}
r.setHbShow(sTemp);
//海运同比
if (r.getHbValue1().compareTo(BigDecimal.ZERO) == 0) {
sTemp = "上期期值为0";
} else {
sTemp = getPercentage(r.getCurValue1().subtract(r.getHbValue1()),
r.getHbValue1());
}
r.setHbShow1(sTemp);
//空运环比
if (r.getHbValue3().compareTo(BigDecimal.ZERO) == 0) {
sTemp = "上期期值为0";
} else {
sTemp = getPercentage(r.getCurValue3().subtract(r.getHbValue3()),
r.getHbValue3());
}
r.setHbShow3(sTemp);
}
return r;
}
public SalesReportResp SalesReportCount(SalesReportReq Req) throws ParseException {
Req = getReq(Req);
//String jsonStr = JsonUtils.toJsonString(Req);
//JsonUtils.SaveLog(jsonStr);
......@@ -42,6 +170,14 @@ public class SalesReportImpl implements SalesReportService {
//对比数据
SalesReportReq ReqLast = getReqTb(Req);
SalesReportResp Resp = salesReportMapper.SalesReportCount(ReqCur);
if (Resp == null) {
Resp = new SalesReportResp();
Resp.setCurValue(new BigDecimal(0));
Resp.setTbShow("");
Resp.setHbShow("");
return Resp;
}
//总值
if (Resp.getCurValue() == null ||
Resp.getCurValue().compareTo(BigDecimal.ZERO) == 0) {
......@@ -78,6 +214,7 @@ public class SalesReportImpl implements SalesReportService {
sTemp = getPercentage(Resp.getCurValue().subtract(Resp.getHbValue()),
Resp.getHbValue());
}
Resp.setHbShow(sTemp);
return Resp;
}
......@@ -85,9 +222,16 @@ public class SalesReportImpl implements SalesReportService {
海运统计
*/
public SalesReportResp SalesReportCountSea(SalesReportReq Req) throws ParseException {
Req = getReq(Req);
SalesReportResp Resp = salesReportMapper.SalesReportCountSea(Req);
if (Resp == null) {
Resp = new SalesReportResp();
Resp.setCurValue(new BigDecimal(0));
Resp.setTbShow("");
Resp.setHbShow("");
return Resp;
}
if (Resp.getCurValue() == null ||
Resp.getCurValue().compareTo(BigDecimal.ZERO) == 0) {
Resp.setCurValue(new BigDecimal(0));
......@@ -123,6 +267,7 @@ public class SalesReportImpl implements SalesReportService {
sTemp = getPercentage(Resp.getCurValue().subtract(Resp.getHbValue()),
Resp.getHbValue());
}
Resp.setHbShow(sTemp);
return Resp;
}
......@@ -131,9 +276,15 @@ public class SalesReportImpl implements SalesReportService {
空运统计
*/
public SalesReportResp SalesReportCountAir(SalesReportReq Req) throws ParseException {
Req = getReq(Req);
SalesReportResp Resp = salesReportMapper.SalesReportCountAir(Req);
if (Resp == null) {
Resp = new SalesReportResp();
Resp.setCurValue(new BigDecimal(0));
Resp.setTbShow("");
Resp.setHbShow("");
return Resp;
}
//当期值
if (Resp.getCurValue() == null ||
Resp.getCurValue().compareTo(BigDecimal.ZERO) == 0) {
......@@ -291,7 +442,7 @@ public class SalesReportImpl implements SalesReportService {
/*
对查询日期做初始化处理 lanbm 2024-05-09 add
*/
private SalesReportReq getReq(SalesReportReq Req) throws ParseException {
public SalesReportReq getReq(SalesReportReq Req) throws ParseException {
int y = getCurYear();
if (Req.getDuibiYear() == null) {
Req.setDuibiYear(String.valueOf(y - 1));
......@@ -341,10 +492,19 @@ public class SalesReportImpl implements SalesReportService {
Date date1 = format.parse(Req.getSDate());
Date date2 = format.parse(Req.getEDate());
//当前日期
Req.setDS(date1);
Req.setDE(date2);
Req.setSumMonth(lc);
//对比日期
Date date11 = format.parse(Req.getSDuiBiDate());
Date date22 = format.parse(Req.getEDuiBiDate());
Req.setDTbS(date11);
Req.setDTbE(date22);
//环比日期
return Req;
}
......@@ -370,11 +530,7 @@ public class SalesReportImpl implements SalesReportService {
return monthsDiff;
}
public CustomerReportBar getCustomerReportBar(SalesReportReq Req) throws ParseException {
Req = getReq(Req);
CustomerReportBar customerReportBar = new CustomerReportBar();
yAxis y = new yAxis();
private List<String> getY_list(SalesReportReq Req) {
List<String> l = new ArrayList<>();
//日期格式化
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
......@@ -387,25 +543,193 @@ public class SalesReportImpl implements SalesReportService {
dd.add(Calendar.MONTH, 1);
tmp = dd.getTime();
}
y.setData(l);
customerReportBar.setObjyAxis(y);
return l;
}
List<series> sl = new ArrayList<>();
/*
获取统计数据List
lanbm 2024-05-15 add
*/
private List<String> getListTotal(SalesReportReq Req, int n,
SalesReportBar salesReportBar) {
List<String> s1L = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar dd = Calendar.getInstance();
//总V值
series s1 = new series();
Date tmp = Req.getDS();
//循环按月份统计数据
dd.setTime(Req.getDS());
//计算同比的日历变量
Calendar dTb = Calendar.getInstance();
dTb.setTime(Req.getDTbS());
Date tmpTb = Req.getDTbS();
//计算环比的日期变量
Calendar dHb = Calendar.getInstance();
List<SalesReportResp> resultList = new ArrayList<>();
while (tmp.getTime() < Req.getDE().getTime()) {
//月份开始日期
String s = sdf.format(tmp);
String sMonthName = s.substring(0, 7);
Req.setSDate(s);
String[] parts = s.split("-");
int lastDay = getLastDay(Integer.parseInt(parts[0]),
Integer.parseInt(parts[1]));
String e = s.substring(0, 7) + "-" + String.valueOf(lastDay);
Req.setEDate(e);
String sTb = sdf.format(tmpTb);
Req.setSDuiBiDate(sTb);
String[] parts2 = sTb.split("-");
int lastDayTb = getLastDay(Integer.parseInt(parts2[0]),
Integer.parseInt(parts2[1]));
String eTb = s.substring(0, 7) + "-" + String.valueOf(lastDayTb);
Req.setEDuiBiDate(eTb);
Req.setSHuanBiDate(sTb);
Req.setEHuanBiDate(eTb);
SalesReportResp r = null;
if (n == 0) {
// r = salesReportMapper.SalesReportCount(Req);
} else if (n == 1)
r = salesReportMapper.SalesReportCountSea(Req);
else if (n == 3)
r = salesReportMapper.SalesReportCountAir(Req);
//月份名称
r.setStrMonth(sMonthName);
resultList.add(r);
if (r == null) {
s1L.add("0");
} else {
if (r.getCurValue() == null) {
s1L.add("0");
} else {
s1L.add(r.getCurValue().toString());
}
}
dd.add(Calendar.MONTH, 1);
tmp = dd.getTime();
dTb.add(Calendar.MONTH, 1);
tmpTb = dTb.getTime();
}
return s1L;
}
private List<SalesReportRespAll> getReportDataList(SalesReportReq Req) {
List<String> s1L = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar dd = Calendar.getInstance();
Date tmp = Req.getDS();
//循环按月份统计数据
dd.setTime(Req.getDS());
tmp = Req.getDS();
//计算同比的日历变量
Calendar dTb = Calendar.getInstance();
dTb.setTime(Req.getDTbS());
Date tmpTb = Req.getDTbS();
List<SalesReportRespAll> resultList = new ArrayList<>();
while (tmp.getTime() < Req.getDE().getTime()) {
//月份开始日期
String s = sdf.format(tmp);
String sMonthName = s.substring(0, 7);
Req.setSDate(s);
String[] parts = s.split("-");
int lastDay = getLastDay(Integer.parseInt(parts[0]),
Integer.parseInt(parts[1]));
String e = s.substring(0, 7) + "-" + String.valueOf(lastDay);
Req.setEDate(e);
String sTb = sdf.format(tmpTb);
Req.setSDuiBiDate(sTb);
String[] parts2 = sTb.split("-");
int lastDayTb = getLastDay(Integer.parseInt(parts2[0]),
Integer.parseInt(parts2[1]));
String eTb = s.substring(0, 7) + "-" + String.valueOf(lastDayTb);
Req.setEDuiBiDate(eTb);
//根据当前月份计算环比月份
String sHb=getHbSDate(tmp);
String eHb=getHbEDate(sHb);
Req.setSHuanBiDate(sHb);
Req.setEHuanBiDate(eHb);
SalesReportRespAll r = null;
r = SalesReportCountAll(Req);
//月份名称
r.setStrMonth(sMonthName);
resultList.add(r);
SalesReportResp r= salesReportMapper.SalesReportCount(Req);
s1L.add(r.getCurValue().toString());
dd.add(Calendar.MONTH, 1);
tmp = dd.getTime();
dTb.add(Calendar.MONTH, 1);
tmpTb = dTb.getTime();
}
return resultList;
}
/*
lanbm 2024-05-16 add
*/
private String getHbSDate(Date dCurDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//计算环比的日期变量
Calendar dHb = Calendar.getInstance();
dHb.setTime(dCurDate);
dHb.add(Calendar.MONTH, -1);
Date tmpHb = dHb.getTime();
String sHb = sdf.format(tmpHb);
return sHb;
}
/*
lanbm 2024-05-16 add
*/
private String getHbEDate(String sDate) {
String[] parts2 = sDate.split("-");
int lastDayTb = getLastDay(Integer.parseInt(parts2[0]),
Integer.parseInt(parts2[1]));
String eHb = sDate.substring(0, 7) + "-" + String.valueOf(lastDayTb);
return eHb;
}
public SalesReportBar getCustomerReportBar(SalesReportReq Req)
throws ParseException {
Req = getReq(Req);
SalesReportBar salesReportBar = new SalesReportBar();
yAxis y = new yAxis();
List<String> l = getY_list(Req);
y.setData(l);
salesReportBar.setObjyAxis(y);
List<series> sl = new ArrayList<>();
List<SalesReportRespAll> resultList = getReportDataList(Req);
//总V值
series s1 = new series();
List<String> s1L = new ArrayList<>();
for (SalesReportRespAll a : resultList
) {
if (a.getCurValue() == null) {
a.setCurValue(new BigDecimal(0));
}
s1L.add(a.getCurValue().toString());
}
s1.setData(s1L);
sl.add(s1);
......@@ -413,16 +737,12 @@ public class SalesReportImpl implements SalesReportService {
//海运
series s2 = new series();
List<String> s2L = new ArrayList<>();
dd.setTime(Req.getDS());
tmp = Req.getDS();
while (tmp.getTime() < Req.getDE().getTime()) {
String s = sdf.format(tmp);
SalesReportResp r= salesReportMapper.SalesReportCountSea(Req);
s2L.add(r.getCurValue().toString());
dd.add(Calendar.MONTH, 1);
tmp = dd.getTime();
for (SalesReportRespAll a : resultList
) {
if (a.getCurValue1() == null) {
a.setCurValue1(new BigDecimal(0));
}
s2L.add(a.getCurValue1().toString());
}
s2.setData(s2L);
sl.add(s2);
......@@ -430,22 +750,19 @@ public class SalesReportImpl implements SalesReportService {
//空运
series s3 = new series();
List<String> s3L = new ArrayList<>();
dd.setTime(Req.getDS());
tmp = Req.getDS();
while (tmp.getTime() < Req.getDE().getTime()) {
String s = sdf.format(tmp);
SalesReportResp r= salesReportMapper.SalesReportCountAir(Req);
s3L.add(r.getCurValue().toString());
dd.add(Calendar.MONTH, 1);
tmp = dd.getTime();
for (SalesReportRespAll a : resultList
) {
if (a.getCurValue3() == null) {
a.setCurValue3(new BigDecimal(0));
}
s3L.add(a.getCurValue3().toString());
}
s3.setData(s3L);
sl.add(s3);
customerReportBar.setObSseries(sl);
return customerReportBar;
salesReportBar.setSalesReportRespAll(resultList);
salesReportBar.setObSseries(sl);
return salesReportBar;
}
......
package cn.iocoder.yudao.module.delivery.service;
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.*;
import cn.iocoder.yudao.module.delivery.entity.bar.CustomerReportBar;
import cn.iocoder.yudao.module.delivery.entity.bar.SalesReportBar;
import java.text.ParseException;
import java.util.List;
public interface SalesReportService {
SalesReportRespAll SalesReportCountAll(SalesReportReq Req);
/*
总值统计
*/
......@@ -43,7 +43,8 @@ public interface SalesReportService {
获取统计图表数据
lanbm 2024-05-14 add
*/
CustomerReportBar getCustomerReportBar(SalesReportReq Req) throws ParseException;
SalesReportBar getCustomerReportBar(SalesReportReq Req) throws ParseException;
SalesReportReq getReq(SalesReportReq Req) throws ParseException;
}
......@@ -6,10 +6,6 @@
from ecw_vz
where id = #{id}
</delete>
<!--2024-04-22-->
</mapper>
......@@ -2,25 +2,78 @@
<!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 id="SalesReportCountAll" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportRespAll">
SELECT (
SELECT sum(if(transport_id=1,sum_volume,)
SELECT sum(if(transport_id = 1, sum_volume, 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 curValue,
(SELECT sum(sum_volume)
AND rucang_time BETWEEN #{sDate} AND #{eDate}
) AS curValue,
(SELECT sum(if(transport_id = 1, sum_volume, sum_weight))
FROM ecw_order
WHERE is_del = 0
AND (transport_id = 1 OR transport_id = 3)
AND rucang_time BETWEEN #{sDuiBiDate} AND #{eDuiBiDate}) AS tbValue,
(SELECT sum(if(transport_id = 1, sum_volume, 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 tbValue,
AND rucang_time BETWEEN #{sHuanBiDate} AND #{eHuanBiDate}) AS hbValue,
(
SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND rucang_time BETWEEN #{sDate} AND #{eDate}
) AS curValue1,
(SELECT sum(sum_volume)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND rucang_time BETWEEN #{sDuiBiDate} AND #{eDuiBiDate}) AS tbValue1,
(SELECT round(sum(sum_volume) / (SELECT vz FROM ecw_vz WHERE fuhao = 'M3' LIMIT 1), 2)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND rucang_time BETWEEN #{sHuanBiDate} AND #{eHuanBiDate}) AS hbValue1,
(SELECT round(sum(sum_weight) / (SELECT vz FROM ecw_vz WHERE fuhao = 'KG' LIMIT 1), 2)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 3
AND rucang_time BETWEEN #{sDate} AND #{eDate}
) AS curValue3,
(SELECT sum(sum_weight)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 3
AND rucang_time BETWEEN #{sDuiBiDate} AND #{eDuiBiDate}) AS tbValue3,
(SELECT sum(sum_weight)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 3
AND rucang_time BETWEEN #{sHuanBiDate} AND #{eHuanBiDate}) AS hbValue3
FROM DUAL
</select>
<select id="SalesReportCount" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportResp">
SELECT (
SELECT sum(if(transport_id = 1, sum_volume, sum_weight))
FROM ecw_order
WHERE is_del = 0
AND (transport_id = 1 OR transport_id = 3)
AND rucang_time BETWEEN #{sDate} AND #{eDate}
) AS curValue,
(SELECT sum(if(transport_id = 1, sum_volume, sum_weight))
FROM ecw_order
WHERE is_del = 0
AND (transport_id = 1 OR transport_id = 3)
AND rucang_time BETWEEN #{sDuiBiDate} AND #{eDuiBiDate}) AS tbValue,
(SELECT sum(if(transport_id = 1, sum_volume, 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
AND rucang_time BETWEEN #{sHuanBiDate} AND #{eHuanBiDate}) AS hbValue
FROM DUAL
</select>
......@@ -31,42 +84,41 @@
FROM ecw_order
WHERE is_del = 0
AND transport_id = 1
AND create_time BETWEEN '2023-01-01'
AND '2023-03-31'
) AS curValue,
AND rucang_time BETWEEN #{sDate} AND #{eDate}
) 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,
AND rucang_time BETWEEN #{sDuiBiDate} AND #{eDuiBiDate}) 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
AND rucang_time BETWEEN #{sHuanBiDate} AND #{eHuanBiDate}) AS hbValue
FROM DUAL
</select>
<!--空运统计-->
<select id="SalesReportCountAir" resultType="cn.iocoder.yudao.module.delivery.entity.SalesReportResp">
SELECT (
SELECT sum(sum_w)
SELECT sum(sum_weight)
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)
AND rucang_time BETWEEN #{sDate} AND #{eDate}
) AS curValue,
(SELECT sum(sum_weight)
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)
AND rucang_time BETWEEN #{sDuiBiDate} AND #{eDuiBiDate}) AS tbValue,
(SELECT sum(sum_weight)
FROM ecw_order
WHERE is_del = 0
AND transport_id = 3
AND create_time BETWEEN '2023-01-01' AND '2023-03-31') AS hbValue
AND rucang_time BETWEEN #{sHuanBiDate} AND #{eHuanBiDate}) AS hbValue
FROM DUAL
</select>
......@@ -79,7 +131,7 @@
where cc.is_new = 0
and a.is_del = 0
and a.status > 0
and a.create_time BETWEEN '2023-01-01' AND '2023-01-31'
and a.rucang_time BETWEEN #{sDate} AND #{eDate}
and a.drawee = 2
</select>
......
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.controller.admin.user.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -52,12 +53,16 @@ public class UserBackVO {
private String loginIp;
@ExcelProperty("最后登录时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
//lanbm 2024-05-15 修改显示BUG
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "最后登录时间")
private Date loginDate;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
//lanbm 2024-05-15 修改显示BUG
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
......
......@@ -259,7 +259,8 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFeeApproveResult(String id, int result) {
OrderFeeApplicationDO orderFeeApplicationDO = feeApplicationMapper.selectById(id);
OrderFeeApplicationDO orderFeeApplicationDO =
feeApplicationMapper.selectById(id);
if (orderFeeApplicationDO != null) {
orderFeeApplicationDO.setStatus(result);
feeApplicationMapper.updateById(orderFeeApplicationDO);
......@@ -268,8 +269,22 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
OrderBackVO order = orderQueryService.getOrder(orderFeeApplicationDO.getOrderId());
//生成应收
DictDataRespDTO dictDto = DictFrameworkUtils.getDictDataFromCache("receivable_fee_type", String.valueOf(orderFeeApplicationDO.getFeeType()));
if (orderFeeApplicationDO.getReceivableId() != null && orderFeeApplicationDO.getReceivableId() > 0) {
//lanbm 2024-05-16 修复应收款记录不存在的BUG,
//添加应收款记录是否存在的判断
ReceivableDO rDo = null;
if (orderFeeApplicationDO.getReceivableId() != null &&
orderFeeApplicationDO.getReceivableId() > 0) {
long idTemp = (long) orderFeeApplicationDO.getReceivableId();
rDo = receivableService.getReceivable(idTemp);
}
//end lanbm 2024-05-16 修复应收款记录不存在的BUG
if (orderFeeApplicationDO.getReceivableId() != null &&
orderFeeApplicationDO.getReceivableId() > 0 &&
rDo != null) {
ReceivableDO receivableDO = new ReceivableDO();
//orderFeeApplicationDO 审批信息关联的应收款ID
//lanbm 2024-05-15 添加的注释
receivableDO.setId(Long.valueOf(orderFeeApplicationDO.getReceivableId()));
receivableDO.setTitleZh(dictDto.getLabel());
receivableDO.setTitleEn(dictDto.getLabelEn());
......@@ -286,9 +301,11 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
receivableDO.setFeeSource(2);
receivableDO.setAuthor(orderFeeApplicationDO.getApplicationAuthor());
receivableDO.setRemark(orderFeeApplicationDO.getRemarks());
//应收款此处报应收款不存在的BUG
receivableService.updateReceivableById(receivableDO);
} else {
ReceivableCreateReqVO receivableCreateReqVO = new ReceivableCreateReqVO();
ReceivableCreateReqVO receivableCreateReqVO =
new ReceivableCreateReqVO();
receivableCreateReqVO.setTitleZh(dictDto.getLabel());
receivableCreateReqVO.setTitleEn(dictDto.getLabelEn());
receivableCreateReqVO.setOrderId(orderFeeApplicationDO.getOrderId());
......@@ -304,9 +321,12 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
receivableCreateReqVO.setFeeSource(2);
receivableCreateReqVO.setAuthor(orderFeeApplicationDO.getApplicationAuthor());
receivableCreateReqVO.setRemark(orderFeeApplicationDO.getRemarks());
Long receivableId = receivableService.createReceivable(receivableCreateReqVO);
//把创建的应收款信息关联到审批主表中
orderFeeApplicationDO.setReceivableId(receivableId.intValue());
}
feeApplicationMapper.updateById(orderFeeApplicationDO);
FeeDto feeDto = new FeeDto();
feeDto.setFeeType(orderFeeApplicationDO.getFeeType());
......
......@@ -879,7 +879,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
//起飞
BoxAirFlyDO boxAirFlyDO = boxAirFlyService.getOne(new LambdaQueryWrapperX<BoxAirFlyDO>().eq(BoxAirFlyDO::getShipmentId, id).last(" limit 1"));
BoxAirFlyDO boxAirFlyDO = boxAirFlyService.getOne(new LambdaQueryWrapperX<BoxAirFlyDO>().
eq(BoxAirFlyDO::getShipmentId, id).last(" limit 1"));
long abnormalCount = abnormalList.stream()
.filter(t -> t.getOpStep().equals(AbnormalStepAirEnum.FLYING.getStep()))
.count();
......@@ -897,7 +898,10 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
boxAirFlyBackVO.setShowAbnormal(showAbnormal && !flyingHasAbnormal);
}
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getShipmentId, id).orderByDesc(BaseDO::getCreateTime).last(" limit 1"));
BoxMergePkgDO boxMergePkgDO =
boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().
eq(BoxMergePkgDO::getShipmentId, id).
orderByDesc(BaseDO::getCreateTime).last(" limit 1"));
if (boxMergePkgDO != null) {
BoxMergePkgBackVO boxMergePkgBackVO = BoxMergePkgConvert.INSTANCE.convert(boxMergePkgDO);
boxMergePkgBackVO.setOperator(getUserName(boxMergePkgDO.getCreator()));
......@@ -905,7 +909,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
//出货
BoxAirShipmentDO boxAirShipmentDO = boxAirShipmentService.getAirShipmentByShipmentId(id);
BoxAirShipmentDO boxAirShipmentDO =
boxAirShipmentService.getAirShipmentByShipmentId(id);
if (boxAirShipmentDO != null) {
BoxAirShipmentBackVO boxAirShipmentBackVO = BoxAirShipmentConvert.INSTANCE.convert(boxAirShipmentDO);
boxBackVO.setBoxAirShipmentBackVO(boxAirShipmentBackVO);
......@@ -913,23 +918,26 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
//出货审核
BoxApprovalDO airShipmentApprovalDO = boxApprovalService.getOne(new LambdaQueryWrapperX<BoxApprovalDO>()
.eq(BoxApprovalDO::getShipmentId, id)
.eq(BoxApprovalDO::getApprovalType, BoxApprovalTypeEnum.AIR_SHIPMENT.getType())
.orderByDesc(BoxApprovalDO::getId)
.last("limit 1")
);
BoxApprovalDO airShipmentApprovalDO =
boxApprovalService.getOne(new LambdaQueryWrapperX<BoxApprovalDO>()
.eq(BoxApprovalDO::getShipmentId, id)
.eq(BoxApprovalDO::getApprovalType, BoxApprovalTypeEnum.AIR_SHIPMENT.getType())
.orderByDesc(BoxApprovalDO::getId)
.last("limit 1")
);
if (airShipmentApprovalDO != null) {
boxBackVO.setAirShipmentApprovalInfo(BoxApprovalConvert.INSTANCE.convert(airShipmentApprovalDO));
}
//出货反审
BoxApprovalDO airShipmentBackApprovalDO = boxApprovalService.getOne(new LambdaQueryWrapperX<BoxApprovalDO>()
.eq(BoxApprovalDO::getShipmentId, id)
.eq(BoxApprovalDO::getApprovalType, BoxApprovalTypeEnum.AIR_SHIPMENT_BACK.getType())
.orderByDesc(BoxApprovalDO::getId)
.last("limit 1")
);
BoxApprovalDO airShipmentBackApprovalDO =
boxApprovalService.getOne(
new LambdaQueryWrapperX<BoxApprovalDO>()
.eq(BoxApprovalDO::getShipmentId, id)
.eq(BoxApprovalDO::getApprovalType, BoxApprovalTypeEnum.AIR_SHIPMENT_BACK.getType())
.orderByDesc(BoxApprovalDO::getId)
.last("limit 1")
);
if (airShipmentBackApprovalDO != null) {
boxBackVO.setAirShipmentBackApprovalInfo(BoxApprovalConvert.INSTANCE.convert(airShipmentBackApprovalDO));
}
......@@ -946,20 +954,27 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
boxBackVO.setRealNum(getRealNum(id));
//删单退场
BoxApprovalDO deleteExitApproval = boxApprovalService.getOne(new LambdaQueryWrapperX<BoxApprovalDO>()
.eq(BoxApprovalDO::getShipmentId, id)
.eq(BoxApprovalDO::getApprovalType, BoxApprovalTypeEnum.DELETE_EXIT.getType())
.orderByDesc(BoxApprovalDO::getId)
.last("limit 1")
);
BoxApprovalDO deleteExitApproval =
boxApprovalService.getOne(
new LambdaQueryWrapperX<BoxApprovalDO>()
.eq(BoxApprovalDO::getShipmentId, id)
.eq(BoxApprovalDO::getApprovalType, BoxApprovalTypeEnum.DELETE_EXIT.getType())
.orderByDesc(BoxApprovalDO::getId)
.last("limit 1")
);
if (deleteExitApproval != null) {
boxBackVO.setCustomsDeleteExitApprovalInfo(BoxApprovalConvert.INSTANCE.convert(deleteExitApproval));
}
//到港
BoxArrivalAirDO boxArrivalAirDO = boxArrivalAirService.getOne(new LambdaQueryWrapper<BoxArrivalAirDO>()
.eq(BoxArrivalAirDO::getShipmentId, id)
);
//lanbm 2024-05-15 修改有多条记录是报错的BUG
BoxArrivalAirDO boxArrivalAirDO =
boxArrivalAirService.getOne(
new LambdaQueryWrapper<BoxArrivalAirDO>()
.eq(BoxArrivalAirDO::getShipmentId, id)
.orderByDesc(BoxArrivalAirDO::getId)
.last("limit 1")
);
abnormalCount = abnormalList.stream()
.filter(t -> t.getOpStep().equals(AbnormalStepAirEnum.ARRIVAL.getStep()))
.count();
......@@ -2001,7 +2016,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
@Override
public void checkOrderTagNum(Long id,Integer type) {
public void checkOrderTagNum(Long id, Integer type) {
if (type == 0) {
List<BoxPreloadGoodsDO> boxPreloadGoodsDOS = boxPreloadGoodsService.selectList(BoxPreloadGoodsDO::getShipmentId, id);
List<Long> orderIds = boxPreloadGoodsDOS.stream().map(BoxPreloadGoodsDO::getOrderId).distinct().collect(Collectors.toList());
......@@ -2018,7 +2033,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
});
if (CollectionUtil.isNotEmpty(orderNoList)) {
throw exception(ORDER_INSTALL_NOT_MATCH,StringUtils.join(orderNoList,","));
throw exception(ORDER_INSTALL_NOT_MATCH, StringUtils.join(orderNoList, ","));
}
} else if (type == 1) {
List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId, id);
......@@ -2036,7 +2051,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
});
if (CollectionUtil.isNotEmpty(orderNoList)) {
throw exception(ORDER_INSTALL_NOT_MATCH,StringUtils.join(orderNoList,","));
throw exception(ORDER_INSTALL_NOT_MATCH, StringUtils.join(orderNoList, ","));
}
}
}
......@@ -2163,18 +2178,18 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
);
int tallyStatus = 0;
BoxTallyDO boxTallyDO = boxTallyMap.get(orderId);
if(installNum == orderDO.getSumNum().longValue()) {
if (installNum == orderDO.getSumNum().longValue()) {
//已理货
tallyStatus = 1;
if(boxTallyDO == null) {
if (boxTallyDO == null) {
boxTallyDO = new BoxTallyDO();
boxTallyDO.setShipmentId(shipmentId);
boxTallyDO.setOrderId(orderId);
}
}
if(boxTallyDO != null) {
if (boxTallyDO != null) {
boxTallyDO.setTallyStatus(tallyStatus);
if(tallyStatus == 1) {
if (tallyStatus == 1) {
boxTallyDO.setTallyTime(new Date());
}
updateList.add(boxTallyDO);
......@@ -2369,9 +2384,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
BoxCabinetUnloadDO boxCabinetUnloadDO =
boxCabinetUnloadService.getOne(
new LambdaQueryWrapperX<BoxCabinetUnloadDO>()
.eq(BoxCabinetUnloadDO::getShipmentId, shipmentId)
.last("limit 1")
);
.eq(BoxCabinetUnloadDO::getShipmentId, shipmentId)
.last("limit 1")
);
if (boxCabinetUnloadDO != null) {
boxBackVO.setDcDate(boxCabinetUnloadDO.getUlWarehouseTime());
}
......@@ -2550,8 +2565,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
if (TransportTypeEnum.AIR.getType().equals(boxBaseBackVO.getTransportType())) {
for (BoxLoadSectionBackVO backVO : boxLoadDetailBackVO) {
List<BoxLoadOrderVO> loadOrderList = backVO.getSectionOrderList();
if(CollectionUtil.isNotEmpty(loadOrderList)) {
loadOrderList.sort(Comparator.comparing(BoxLoadOrderVO::getPkgNum,Comparator.nullsLast(String::compareTo)));
if (CollectionUtil.isNotEmpty(loadOrderList)) {
loadOrderList.sort(Comparator.comparing(BoxLoadOrderVO::getPkgNum, Comparator.nullsLast(String::compareTo)));
}
}
}
......@@ -2823,7 +2838,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId, boxMergePkgDO.getId());
if (CollectionUtil.isNotEmpty(boxPkgOrderDOS)) {
List<Long> orderIds = boxPkgOrderDOS.stream().map(BoxPkgOrderDO::getOrderId).collect(Collectors.toList());
boxLoadInfoService.deleteLoadInfo(createReqVO.getShipmentId(),orderIds);
boxLoadInfoService.deleteLoadInfo(createReqVO.getShipmentId(), orderIds);
return;
}
}
......@@ -3019,7 +3034,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
//已经完成理货则不再进行业务处理
boxDO.setTyStatus(TyStatueEnum.HAS_TALLY.getTyStatus());
if (boxDO.getTransportType().equals(TransportTypeEnum.AIR.getType())) {
checkOrderTagNum(shipmentId,0);
checkOrderTagNum(shipmentId, 0);
//空运,修改订单状态
updateOrderStatusByShipmentId(shipmentId, OrderStatusEnum.SHIPMENT.getValue(), null, BoxAirStatusEnum.TALLY_COMPLETE.getStatus(), null, null);
}
......@@ -4804,7 +4819,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.in(MakeBillOfLadingDO::getOrderId, orderIdCollection)
.eq(MakeBillOfLadingDO::getStatus, BpmProcessInstanceResultEnum.PROCESS.getResult())
);
if(CollectionUtil.isNotEmpty(processingList)) {
if (CollectionUtil.isNotEmpty(processingList)) {
processingList.forEach(t -> makeBillOfLadingService.cancel(t.getId()));
}
//删除提单
......@@ -5008,7 +5023,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
@Override
public void backOrderLog(String transportType, String selfNo) {
if(transportType.equals(TransportTypeEnum.AIR.getType())) {
if (transportType.equals(TransportTypeEnum.AIR.getType())) {
orderTimeService.sortingReverseReviewDeleteOrderTime(selfNo);
} else {
orderTimeService.preReverseReviewDeleteOrderTime(selfNo);
......@@ -5017,7 +5032,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
@Override
public void backOrderLog(String transportType, Collection<Long> orderIds) {
if(transportType.equals(TransportTypeEnum.AIR.getType())) {
if (transportType.equals(TransportTypeEnum.AIR.getType())) {
for (Long orderId : orderIds) {
orderTimeService.sortingReverseReviewDeleteOrderTime(orderId);
}
......@@ -5031,14 +5046,14 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
@Override
public void lockOrderPrice(Long shipmentId) {
Set<Long> orderIds = boxPreloadGoodsService.getShipOrderIdList(shipmentId);
if(CollectionUtil.isEmpty(orderIds)) return;
if (CollectionUtil.isEmpty(orderIds)) return;
orderService.finishOrderSorting(null, orderIds);
}
@Override
public void unlockOrderPrice(Long shipmentId) {
Set<Long> orderIds = boxPreloadGoodsService.getShipOrderIdList(shipmentId);
if(CollectionUtil.isEmpty(orderIds)) return;
if (CollectionUtil.isEmpty(orderIds)) return;
orderService.finishOrderSortingReverseReviewUnlock(null, orderIds);
}
......@@ -5057,8 +5072,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
List<OrderDO> orderDOS = orderService.selectList(OrderDO::getOrderId, orderIds);
int orderSumNum = orderDOS.stream().mapToInt(OrderDO::getSumNum).sum();
Long loadCount = boxLoadInfoService.selectCount(new LambdaQueryWrapper<BoxLoadInfoDO>()
.eq(BoxLoadInfoDO::getShipmentId,shipmentId)
.in(BoxLoadInfoDO::getOrderId,orderIds)
.eq(BoxLoadInfoDO::getShipmentId, shipmentId)
.in(BoxLoadInfoDO::getOrderId, orderIds)
);
if (loadCount.intValue() == orderSumNum) {
realNum = realNum + 1;
......@@ -5082,7 +5097,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
@Override
public void clearUnloadCabinet(Long shipmentId) {
boxLoadInfoService.update(null, new LambdaUpdateWrapper<BoxLoadInfoDO>()
.eq(BoxLoadInfoDO::getShipmentId, shipmentId)
.eq(BoxLoadInfoDO::getShipmentId, shipmentId)
.set(BoxLoadInfoDO::getIsUnload, 0)
);
}
......
......@@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.shipment.service.boxCost;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -9,6 +11,7 @@ import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxCostDO;
import cn.iocoder.yudao.module.shipment.vo.boxCost.BoxCostCreateReqVO;
import cn.iocoder.yudao.module.shipment.vo.boxCost.BoxCostQueryVO;
import cn.iocoder.yudao.module.shipment.vo.boxCost.BoxCostUpdateReqVO;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 费用登记 Service 接口
......@@ -64,4 +67,6 @@ public interface BoxCostService extends IService<BoxCostDO> {
* @return 费用登记列表
*/
List<BoxCostDO> getBoxCostList(BoxCostQueryVO query);
}
package cn.iocoder.yudao.module.shipment.vo.boxCost;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.math.BigDecimal;
......@@ -8,6 +9,7 @@ import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
......@@ -46,20 +48,48 @@ public class BoxCostBackVO {
@ApiModelProperty(value = "金额单位ID")
private Long priceUnit;
/*
lanbm 2024-05-16 add
*/
@ExcelProperty("币种")
@ApiModelProperty(value = "币种")
private String priceUnitName;
@ExcelProperty("备注")
@ApiModelProperty(value = "备注")
private String remarks;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
private String creator;
@ApiModelProperty(value = "实付金额")
private BigDecimal payPrice;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "实付金额币种")
private String payPriceBz;
/*
付款单单号 lanbm 2024-05-16 add
*/
@ExcelProperty("付款单单号")
private String payableNo;
/*
付款单费用明细ID lanbm 2024-05-16 add
*/
private long payableId;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "实付时间", required = true)
private Date payTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTime;
private String updater;
}
......@@ -167,6 +167,7 @@ public class BoxController {
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermission('shipment:box:query')")
public CommonResult<BoxBackVO> getBoxDetail(@RequestParam("id") Long id) {
//lanbm 2024-05-15 修改查询到港记录有多条记录报异常的BUG
BoxBackVO boxBackVO = boxService.getBoxDetail(id);
return success(boxBackVO);
}
......
package cn.iocoder.yudao.module.shipment.controller.admin;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.currency.CurrencyDO;
import cn.iocoder.yudao.module.ecw.service.currency.CurrencyService;
import cn.iocoder.yudao.module.shipment.convert.BoxCostConvert;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxCostDO;
import cn.iocoder.yudao.module.shipment.service.boxCost.BoxCostService;
......@@ -10,13 +13,18 @@ import cn.iocoder.yudao.module.shipment.vo.boxCost.BoxCostBackVO;
import cn.iocoder.yudao.module.shipment.vo.boxCost.BoxCostCreateReqVO;
import cn.iocoder.yudao.module.shipment.vo.boxCost.BoxCostQueryVO;
import cn.iocoder.yudao.module.shipment.vo.boxCost.BoxCostUpdateReqVO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.module.wealth.dal.dataobject.payable.PayableDO;
import cn.iocoder.yudao.module.wealth.service.payable.PayableService;
import io.swagger.models.auth.In;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
......@@ -26,10 +34,16 @@ import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.wealth.enums.ErrorCodeConstants.RECEIVABLE_NOT_EXISTS;
@Validated
@RestController
......@@ -43,6 +57,15 @@ public class BoxCostController {
@Resource
private PayableService payableService;
/*
lanbm 2024-05-16 add
*/
@Resource
private CurrencyService currencyService;
@Resource
private AdminUserService adminUserService;
@PostMapping("/create")
@ApiOperation("创建费用登记, use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-cost:create')")
......@@ -76,34 +99,74 @@ public class BoxCostController {
return success(BoxCostConvert.INSTANCE.convert(boxCost));
}
/*
lanbm 2024-05-16 add
*/
@GetMapping("/getPaymentId")
@ApiOperation("根据付款明细获取主表ID")
public CommonResult<Long> getPaymentId(@RequestParam("id") Long id) {
PayableDO payableDO = payableService.getPayable(id);
if (payableDO == null) {
return error(new ErrorCode(1,"费用记录不存在"));
}
if (payableDO.getPaymentId()==null||payableDO.getPaymentId() == 0) {
return error(new ErrorCode(2,"付款单信息还未生成。"));
}
return success(payableDO.getPaymentId());
}
@GetMapping("/list")
@ApiOperation("获得费用登记列表, use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-cost:query')")
//@PreAuthorize("@ss.hasPermission('ecw:box-cost:query')")
public CommonResult<List<BoxCostBackVO>> getBoxCostList(@Valid BoxCostQueryVO query) {
List<BoxCostDO> list = boxCostService.getBoxCostList(query);
List<BoxCostBackVO> costList = BoxCostConvert.INSTANCE.convertList(list);
List<BoxCostBackVO> costList = BoxCostConvert.INSTANCE.convertList(list);
//lanbm 2024-05-16 添加币种信息
List<CurrencyDO> listCurrency = currencyService.getCurrencyList();
//List 转 Map
Map<Integer, String> currencyMap =
listCurrency.stream().collect(
Collectors.toMap((CurrencyDO::getId), CurrencyDO::getFuhao));
//找到对应的核销记录
// Map<Long, List<>>
if(CollectionUtil.isNotEmpty(costList)) {
if (CollectionUtil.isNotEmpty(costList)) {
List<Long> idList = costList.stream()
.map(BoxCostBackVO::getId)
.collect(Collectors.toList());
List<PayableDO> payableList = payableService.list(new LambdaQueryWrapperX<PayableDO>()
.in(PayableDO::getShippingFeeId, idList)
List<PayableDO> payableList = payableService.list(
new LambdaQueryWrapperX<PayableDO>()
.in(PayableDO::getShippingFeeId, idList)
);
if(CollectionUtil.isNotEmpty(payableList)) {
if (CollectionUtil.isNotEmpty(payableList)) {
Map<Long, PayableDO> payableMap = payableList.stream()
.collect(Collectors.toMap(PayableDO::getShippingFeeId, t -> t));
for (BoxCostBackVO boxCostBackVO : costList) {
PayableDO payableDO = payableMap.get(boxCostBackVO.getId());
if(payableDO != null) {
if (payableDO != null) {
//lanbm 2024-05-16 添加实付金额币种
Integer i = Integer.parseInt(boxCostBackVO.getPriceUnit().toString());
String sBz = currencyMap.get(i);
boxCostBackVO.setPayPriceBz(sBz);
boxCostBackVO.setPayPrice(payableDO.getTotal());
boxCostBackVO.setPayTime(payableDO.getUpdateTime());
//lanbm 2024-05-16 添加付款单单号
boxCostBackVO.setPayableNo(payableDO.getPayableNo());
boxCostBackVO.setPayableId(payableDO.getId());
}
}
}
for (BoxCostBackVO boxCostBackVO : costList) {
//lanbm 2024-05-16 添加币种显示 要注意map中key的数据类型
Integer i = Integer.parseInt(boxCostBackVO.getPriceUnit().toString());
String sName = currencyMap.get(i);
boxCostBackVO.setPriceUnitName(sName);
}
}
return success(costList);
}
......@@ -121,7 +184,7 @@ public class BoxCostController {
@PreAuthorize("@ss.hasPermission('ecw:box-cost:export')")
@OperateLog(type = EXPORT)
public void exportBoxCostExcel(@Valid BoxCostQueryVO query,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<BoxCostDO> list = boxCostService.getBoxCostList(query);
// 导出 Excel
List<BoxCostBackVO> datas = BoxCostConvert.INSTANCE.convertList(list);
......
......@@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
* member 系统,使用 1-004-000-000 段
*/
public interface ErrorCodeConstants {
//lanbm 2024-05-15 处理过此异常
ErrorCode RECEIVABLE_NOT_EXISTS = new ErrorCode(1004520001, "wealth.receivable_not_exists");
ErrorCode RECEIPT_NOT_EXISTS = new ErrorCode(1004520002, "wealth.receipt_not_exists");
......
......@@ -69,7 +69,8 @@ public class FinanceReceiptApproveService {
if (null == receiptApprovalDO.getReceiptId()) {
throw exception(RECEIPT_NOT_FOUND);
}
ReceiptDO receiptDO = receiptMapper.selectById(receiptApprovalDO.getReceiptId());
ReceiptDO receiptDO =
receiptMapper.selectById(receiptApprovalDO.getReceiptId());
if (null == receiptDO) {
throw exception(RECEIPT_NOT_FOUND);
}
......@@ -91,6 +92,7 @@ public class FinanceReceiptApproveService {
}
updateReceipt.setComment(comment);
receiptMapper.updateById(updateReceipt);
} else if (StrUtil.equals(WorkFlowEmus.FINANCE_RECEIPT_APPROVE_NO.getKey(), bmpKey)) {
//收款单反审核
if (null == receiptApprovalDO.getReceiptId()) {
......
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