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;
}
......
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());
......
......@@ -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