Commit 76812eb5 authored by lanbaoming's avatar lanbaoming

2024-06-07提交

parent d8302608
......@@ -230,7 +230,8 @@ public class FileConfigServiceImpl implements FileConfigService {
this.validateFileConfigExists(id);
// 上传文件
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg");
return fileClientFactory.getFileClient(id).upload(content,
IdUtil.fastSimpleUUID() + ".jpg");
}
@Override
......
......@@ -67,7 +67,7 @@ public class FileServiceImpl implements FileService {
Assert.notNull(client, "客户端(master) 不能为空");
String url = client.upload(content, path);
// 保存到数据库
//保存到数据库
FileDO file = new FileDO();
file.setConfigId(client.getId());
file.setPath(path);
......
package cn.iocoder.yudao.module.order.dal.dataobject.order;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@TableName("z_test")
@Data
public class zTest {
private Long id;
private String testname;
private Date createdate;
}
package cn.iocoder.yudao.module.order.dal.mysql.order;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.order.dal.dataobject.order.zTest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ZTestMapper2 extends AbstractMapper<zTest> {
}
......@@ -82,45 +82,66 @@ public class ProductPriceExceptionHandleListener {
//找出这些订单的未处理的未报价异常
List<OrderExceptionDO> exceptionDOList =
orderExceptionService.list(new LambdaQueryWrapper<OrderExceptionDO>()
.eq(OrderExceptionDO::getOrderExceptionType,OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION.getKey())
.eq(OrderExceptionDO::getOrderExceptionType, OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION.getKey())
.in(OrderExceptionDO::getOrderItemId, orderItemIdSet)
.ne(OrderExceptionDO::getOrderExceptionStatus, 2)
);
if (CollectionUtil.isNotEmpty(exceptionDOList)) {
for (OrderExceptionDO orderExceptionDO : exceptionDOList) {
//修改这些订单的未报价异常为已处理
// OrderExceptionResultHandlerVo orderExceptionResultHandlerVo = new OrderExceptionResultHandlerVo();
// orderExceptionResultHandlerVo.setOrderExceptionId(orderExceptionDO.getId());
// orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED);
// orderExceptionResultHandlerVo.setHandlerId(Constant.SYSTEM_USER_ADMIN_ID); //admin
// orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理");
// orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo);
orderBusinessService.handleOrderNoQuote(
orderExceptionDO.getOrderId());
orderExceptionDO.getOrderId(),productPriceDO);
//修改这些订单的未报价异常为已处理
/*
if (productPriceDO.getNeedOrderInquiry() == 1) {
//lanbm 2024-06-06 把以前的注释开启
OrderExceptionResultHandlerVo orderExceptionResultHandlerVo =
new OrderExceptionResultHandlerVo();
orderExceptionResultHandlerVo.setOrderExceptionId(
orderExceptionDO.getId());
orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(
OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED);
orderExceptionResultHandlerVo.setHandlerId(
Constant.SYSTEM_USER_ADMIN_ID);
orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理");
orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo);
//end lanbm 2024-06-06 把以前的注释开启
}*/
}
}
//只要有价格就处理清关费未报价异常
// if (productPriceDO.getPriceType() == 0) {
//if (productPriceDO.getPriceType() == 0) {
//找出这些订单的未处理的未报价清关费异常
List<OrderExceptionDO> clearanceExceptionDOList = orderExceptionService.list(new LambdaQueryWrapper<OrderExceptionDO>()
.eq(OrderExceptionDO::getOrderExceptionType, OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey())
List<OrderExceptionDO> clearanceExceptionDOList =
orderExceptionService.list(
new LambdaQueryWrapper<OrderExceptionDO>()
.eq(OrderExceptionDO::getOrderExceptionType,
OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey())
.in(OrderExceptionDO::getOrderItemId, orderItemIdSet)
.ne(OrderExceptionDO::getOrderExceptionStatus, 2)
.ne(OrderExceptionDO::getOrderExceptionStatus,
2)
);
for (OrderExceptionDO orderExceptionDO : clearanceExceptionDOList) {
//修改这些订单的未报价异常为已处理
// OrderExceptionResultHandlerVo orderExceptionResultHandlerVo = new OrderExceptionResultHandlerVo();
// orderExceptionResultHandlerVo.setOrderExceptionId(orderExceptionDO.getId());
// orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(OrderExceptionResult.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION_RESULT.PROCESSED);
// orderExceptionResultHandlerVo.setHandlerId(Constant.SYSTEM_USER_ADMIN_ID); //admin
// orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理");
// orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo);
//订单ID
orderBusinessService.handleOrderNoQuote(
orderExceptionDO.getOrderId());
}
// }
orderExceptionDO.getOrderId(),productPriceDO);
//修改这些订单的未报价异常为已处理
/*
if (productPriceDO.getNeedOrderInquiry() == 1) {
//lanbm 2024-06-06 把以前的注释开启
OrderExceptionResultHandlerVo orderExceptionResultHandlerVo =
new OrderExceptionResultHandlerVo();
orderExceptionResultHandlerVo.setOrderExceptionId(orderExceptionDO.getId());
orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(OrderExceptionResult.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION_RESULT.PROCESSED);
orderExceptionResultHandlerVo.setHandlerId(Constant.SYSTEM_USER_ADMIN_ID); //admin
orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理");
orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo);
//end lanbm 2024-06-06 把以前的注释开启
}*/
}
}
......
......@@ -45,7 +45,8 @@ public class ExceptionOrderStatisticsExcelExportListener {
* @param event 编号记录
*/
@EventListener(ExceptionOrderStatisticsExcelExportEvent.class)
public void exceptionOrderStatisticsExcelExportEvent(ExceptionOrderStatisticsExcelExportEvent event) {
public void exceptionOrderStatisticsExcelExportEvent(
ExceptionOrderStatisticsExcelExportEvent event) {
if (StringUtils.isNotBlank(event.getRequestParams())){
try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATA_FORMAT);
......@@ -72,8 +73,8 @@ public class ExceptionOrderStatisticsExcelExportListener {
event.setFileName(fileDO.getPath());
event.setUrl(fileDO.getUrl());
event.setFileId(fileDO.getId());
}catch (Exception e){
// TODO 测试阶段打印堆栈错误信息,便于分析原因
e.printStackTrace();
event.setResult(e.getMessage());
}
......
......@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.order.enums.OrderSeaTimeEnum;
import cn.iocoder.yudao.module.order.param.OrderChangePriceParam;
import cn.iocoder.yudao.module.order.param.OrderControlLogParam;
import cn.iocoder.yudao.module.order.vo.order.*;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceDO;
import java.math.BigDecimal;
import java.util.Collection;
......@@ -33,6 +34,10 @@ public interface OrderBusinessService extends IService<OrderDO> {
*/
void handleOrderNoQuote(Long orderId);
/*
lanbm 2024-06-06 添加的函数
*/
void handleOrderNoQuote(Long orderId, ProductPriceDO productPriceDO);
/**
* 切换线路、渠道处理不可出渠道异常(注:此接口不会标记处理过不可出异常,会切换线路id或渠道id后重新判定,请在处理完异常后再调用)
......@@ -131,7 +136,6 @@ public interface OrderBusinessService extends IService<OrderDO> {
void handleOrderPickleType(Long orderId, Integer pickleType);
/**
* 空运订单价格刷新(待入仓、入仓中、已入仓-待出订单进行没日单价重定更新)
*
......@@ -140,7 +144,6 @@ public interface OrderBusinessService extends IService<OrderDO> {
void airOrderPriceRefresh(OrderDO orderDO);
/**
* 根据参数生成订单号,这里获取最新的订单编号,并保存记录
*
......@@ -171,6 +174,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
* @param type 1 生成应收 2 修改价格时同步更新应收(未生成应收不予执行)
*/
boolean addOrderReceivable(OrderDO orderDO, Integer type);
/**
* 添加订单动态日志
*
......@@ -279,6 +283,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
* @param now 业务系统同一创建时间
*/
void addOrderTimeLog(Integer status, OrderDO orderDO, Integer type, Date businessTime, Date now);
/**
* 更新不阻塞流程的订单异常信息
*
......@@ -293,6 +298,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
void updateOrderCustomer(List<String> orderNumbers);
void addOrderCustomerService(OrderDO order, int customerType);
/**
* 手动更新订单价格(谨慎执行)
*
......@@ -324,6 +330,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
* @param note 备注 {@link ApplyInfoVO 的详情集合} 不要传空字符串
*/
void addOrderOperateLog(Long orderId, String msg, String note);
/**
* 添加订单操作日志
*
......
......@@ -1241,6 +1241,11 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
hasPrice = allPrice != null && allPrice.floatValue() > 0;
}
//lanbm 2024-06-06 处理单询价问题添加的逻辑点。
if (productPriceDO.getNeedOrderInquiry() == 1) {
hasPrice = true;
}
//没有价格信息不继续后面的处理
if (!hasPrice) continue;
......
......@@ -156,7 +156,10 @@ public class ShipmentAirLoadExcelExportListener {
// 不存在则创建一个目录
fileDir.mkdirs();
}
String fileName = event.getUserId().toString().concat(StrUtil.DASHED).concat(event.getUserType().toString()).concat(StrUtil.DASHED).concat(nowTime).concat("shipment_preload.xlsx");
String fileName = event.getUserId().toString().
concat(StrUtil.DASHED).concat(event.getUserType().
toString()).concat(StrUtil.DASHED).
concat(nowTime).concat("shipment_preload.xlsx");
InputStream inputStream = null;
inputStream = this.getClass().getClassLoader().getResourceAsStream(ueProperties.getTemplatesUrl() + "/airLoad.xlsx");
JSONObject jsonObject = JSONObject.parseObject(event.getRequestParams());
......@@ -230,14 +233,19 @@ public class ShipmentAirLoadExcelExportListener {
Map<String,Integer> mergePkgCountMap = new LinkedHashMap<>();
int colorIndex = 0;
//以订单ID分组
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap = goodsItemList.stream().filter(item -> item.getSecId().longValue()==part.longValue() && StringUtils.isNotBlank(item.getWarehouseInInfo()))
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,LinkedHashMap::new,Collectors.toList()));
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap =
goodsItemList.stream().filter(item -> item.getSecId().longValue()==part.longValue() &&
StringUtils.isNotBlank(item.getWarehouseInInfo()))
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,
LinkedHashMap::new,Collectors.toList()));
for (Map.Entry<Long, List<BoxPreloadGoodsBackVO>> entry : orderMap.entrySet()) {
Long orderId = entry.getKey();
Long pkgId = entry.getValue().get(0).getPkgId();
OrderBackInfoDto orderInfo = orderQueryService.info(orderId);
OrderDO orderDO = orderService.selectOne(OrderDO::getOrderId, orderId);
List<OrderWarehouseInBackItemVO> orderWarehouseInBackItemVOS = orderWarehouseInService.getOrderWarehouseInListOrderByInTime(orderId);
List<OrderWarehouseInBackItemVO> orderWarehouseInBackItemVOS =
orderWarehouseInService.getOrderWarehouseInListOrderByInTime(orderId);
for (OrderWarehouseInBackItemVO item : orderWarehouseInBackItemVOS) {
int andIncrement = colorRowNum.getAndIncrement();
if (StringUtils.isNotBlank(item.getOrderWarehouseInDetails())) {
......@@ -278,7 +286,8 @@ public class ShipmentAirLoadExcelExportListener {
preloadDto.setBoxGauge(item.getBoxGauge());
preloadDto.setSumVolume(item.getVolume());
preloadDto.setSumWeight(item.getWeight());
List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getOrderId, orderId);
List<BoxPkgOrderDO> boxPkgOrderDOS =
boxPkgOrderService.selectList(BoxPkgOrderDO::getOrderId, orderId);
if (CollectionUtil.isNotEmpty(boxPkgOrderDOS)) {
preloadDto.setMergePkgNum(1);
BoxMergePkgDO boxMergePkg = boxMergePkgService.getBoxMergePkg(boxPkgOrderDOS.get(0).getPkgId());
......@@ -326,7 +335,8 @@ public class ShipmentAirLoadExcelExportListener {
}
if (CollectionUtil.isNotEmpty(item.getOrderWarehouseInDetailsVOList())) {
mergeCount = mergeCount + item.getOrderWarehouseInDetailsVOList().size();
List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList = item.getOrderWarehouseInDetailsVOList();
List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList =
item.getOrderWarehouseInDetailsVOList();
for (int j = 0; j < orderWarehouseInDetailsVOList.size(); j++) {
OrderWarehouseInDetailsVO orderWarehouseInDetailsVO = orderWarehouseInDetailsVOList.get(j);
int andIncrement1 = colorRowNum.getAndIncrement();
......
......@@ -251,7 +251,8 @@ public class ShipmentLoadExcelExportListener {
//以订单ID分组
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap =
goodsItemList.stream().filter(item -> item.getSecId().longValue() == part.longValue() &&
goodsItemList.stream().filter(item -> item.getSecId().longValue() ==
part.longValue() &&
StringUtils.isNotBlank(item.getWarehouseInInfo()))
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,
LinkedHashMap::new, Collectors.toList()));
......
......@@ -261,7 +261,13 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
// }
// }
// headMap.put("description",boxLadingBillDO.getGoodsDesc()+"\r\n"+stringBuffer.toString());
headMap.put("description", boxLadingBillDO.getGoodsDesc());
//lanbm 2024-06-06 添加保存数量和单位
String sDes=boxLadingBillDO.getPackageNum()+boxLadingBillDO.getPackageUnit();
sDes+="\r\n"+boxLadingBillDO.getGoodsDesc();
headMap.put("description",sDes);
//headMap.put("description", boxLadingBillDO.getGoodsDesc());
//end lanbm 2024-06-06 添加保存数量和单位
headMap.put("weight", boxLadingBillDO.getKgs() == null ? "" : String.valueOf(boxLadingBillDO.getKgs().doubleValue()));
headMap.put("volume", boxLadingBillDO.getCbm() == null ? "" : String.valueOf(boxLadingBillDO.getCbm().doubleValue()));
headMap.put("boxNo", boxLadingBillDO.getContainerSealNo());
......
......@@ -178,7 +178,8 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
}
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
BoxMergePkgDO boxMergePkgDO =
boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
vo.setPkgId(boxMergePkgDO.getId()) ;
List<BoxPkgOrderDO> pkgOrderDO = boxPkgOrderMapper.selectList(new LambdaQueryWrapperX<BoxPkgOrderDO>().eq(BoxPkgOrderDO::getOrderId,orderId).eq(BoxPkgOrderDO::getPkgId,boxMergePkgDO.getId()));
if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法
......
......@@ -209,7 +209,8 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
Long shipmentId = preloadGoodsDOList.get(0).getShipmentId();
makeBillOfLading.setShipmentId(shipmentId);
LadingTemplateDO ladingTemplateByLineId = ladingTemplateService.getLadingTemplateByLineId(info.getLineId());
LadingTemplateDO ladingTemplateByLineId =
ladingTemplateService.getLadingTemplateByLineId(info.getLineId());
if (ladingTemplateByLineId == null) {
throw exception(LADING_TEMPLATE_NOT_SET);
}
......@@ -436,10 +437,12 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
orderInfoMap.put("consigneePhone", "+" + info.getConsigneeVO().getCountryCode() + info.getConsigneeVO().getPhone());
orderInfoMap.put("consignor", info.getConsignorVO().getName());
orderInfoMap.put("consignorPhone", "+" + info.getConsignorVO().getCountryCode() + info.getConsignorVO().getPhone());
if (info.getDrawee() == 1) { //订单付款人为发货人
if (info.getDrawee() == 1) {
//订单付款人为发货人
String shipperName = getShipperNameAndConsignee(info, 1, orderInfoMap);
orderInfoMap.put("consignor", shipperName);
} else if (info.getDrawee() == 2) { //订单付款人为收货人
} else if (info.getDrawee() == 2) {
//订单付款人为收货人
String consigneeName = getShipperNameAndConsignee(info, 2, orderInfoMap);
orderInfoMap.put("consignee", consigneeName);
}
......
......@@ -187,7 +187,8 @@ public class BoxPreloadGoodsBackVO {
private WarehouseInInfoVO getWarehouseInInfoVO() {
if(warehouseInInfoVO != null) return warehouseInInfoVO;
if(StringUtils.isNotEmpty(this.warehouseInInfo)) {
warehouseInInfoVO = JSONObject.parseObject(this.warehouseInInfo, WarehouseInInfoVO.class);
warehouseInInfoVO = JSONObject.parseObject(this.warehouseInInfo,
WarehouseInInfoVO.class);
}
return warehouseInInfoVO;
}
......
......@@ -163,7 +163,6 @@ public class ReceiptDO extends BaseDO {
*/
private Integer openInvoice;
/**
* 状态:0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票
*/
......
......@@ -78,6 +78,7 @@ public class ReceiptItemDO extends BaseDO {
* 状态0待核销,1已核销
*/
private Integer status;
/**
* 核销货币id
*/
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.OrderNumberLogEvent;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.code.CodeUtils;
import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
......@@ -26,6 +27,7 @@ import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptAppr
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptAccount.ReceiptAccountMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum;
import cn.iocoder.yudao.module.wealth.service.receiptAccount.ReceiptAccountService;
......@@ -48,6 +50,7 @@ import javax.annotation.Resource;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -67,9 +70,13 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
private ReceiptMapper receiptMapper;
@Resource
private ReceivableService receivableService;
@Resource
private ReceiptAccountService receiptAccountService;
@Resource
private ReceiptAccountMapper receiptAccountMapper;
@Resource
private ReceiptItemMapper receiptItemMapper;
@Autowired
......@@ -86,6 +93,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
@Resource
CurrencyApi currencyApi;
private static final String RECEIPT_NEW_NUMBER = "receipt:new:number";
......@@ -430,7 +438,8 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
}
@Override
public PageResult<ReceiptBackVO> getReceiptPage(ReceiptQueryVO query, PageVO page) {
public PageResult<ReceiptBackVO> getReceiptPage(ReceiptQueryVO query,
PageVO page) {
page.setField("er.id");
IPage<ReceiptBackVO> mpPage = MyBatisUtils.buildPage(page);
receiptMapper.getReceiptBackPage(mpPage, query);
......@@ -441,21 +450,173 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
.map(ReceiptBackVO::getId)
.collect(Collectors.toList());
//根据List获取本页中所有的明细信息
LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper =
new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(ReceiptItemDO::getReceiptId, idList);
//所有收款单的明细
List<ReceiptItemDO> listItem =
receiptItemMapper.selectList(lambdaQueryWrapper);
LambdaQueryWrapper<ReceiptAccountDO> lambdaQueryWrapper2 =
new LambdaQueryWrapper<>();
lambdaQueryWrapper2.in(ReceiptAccountDO::getReceiptId, idList);
List<ReceiptAccountDO> ReceiptAccountList =
receiptAccountMapper.selectList(lambdaQueryWrapper2);
Map<Integer, CurrencyRespDTO> currencyMap = currencyApi.getAllCurrency();
for (ReceiptBackVO r : mpPage.getRecords()
) {
String sR = getReceiptMxStatus(listItem, r.getId());
r.setMxStatus(sR);
//应收
String s1 = getYSShow(ReceiptAccountList, r.getId(), currencyMap);
r.setYsShow(s1);
//实收
String s2 = getSSShow(listItem, r.getId(), currencyMap);
r.setSsShow(s2);
//核销比例
r.setHxBiLi(getHxBili(ReceiptAccountList,
listItem, r.getId()));
}
return PageResult.of(mpPage);
}
private String getPercentage(BigDecimal part, BigDecimal total) {
BigDecimal percentage = part.divide(total, 5,
BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
// 输出百分比
String sR = format(percentage) + "%";
return sR;
}
private String format(BigDecimal value) {
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumFractionDigits(2);
numberFormat.setMaximumFractionDigits(2);
return numberFormat.format(value.doubleValue());
}
/*
获取核销比例 lanbm 2024-06-06 add
*/
private String getHxBili(List<ReceiptAccountDO> ReceiptAccountList,
List<ReceiptItemDO> listItemList,
long ReceiptId) {
String sR = "0";
if (CollectionUtil.isEmpty(ReceiptAccountList))
return sR;
if (CollectionUtil.isEmpty(listItemList)) {
return sR;
}
List<ReceiptAccountDO> ReceiptAccountList1 =
ReceiptAccountList.stream().filter(i -> i.getReceiptId() == ReceiptId).
collect(Collectors.toList());
if (CollectionUtil.isEmpty(ReceiptAccountList1)) return sR;
BigDecimal bTotal = new BigDecimal(0);
BigDecimal bPart = new BigDecimal(0);
for (ReceiptAccountDO do1 : ReceiptAccountList1
) {
bTotal = bTotal.add(do1.getWriteOffAmount());
}
//总值为0,直接返回空
if (bTotal.compareTo(BigDecimal.ZERO) == 0) {
return sR;
}
//已核销状态记录
List<ReceiptItemDO> list =
listItemList.stream().filter(i -> i.getReceiptId() == ReceiptId
&& i.getStatus() != 0).collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) {
//核销金额为0 核销比例为空
return sR;
}
for (ReceiptItemDO do2 : list
) {
bPart = bPart.add(do2.getWriteOffAmount());
}
//计算百分比
sR = getPercentage(bPart, bTotal);
return sR;
}
/*
lanbm 2024-06-06 add
应收款
*/
private String getYSShow(List<ReceiptAccountDO> ReceiptAccountList,
long ReceiptId,
Map<Integer, CurrencyRespDTO> currencyMap) {
String sR = "";
if (CollectionUtil.isEmpty(ReceiptAccountList)) {
return sR;
}
List<ReceiptAccountDO> ReceiptAccountList1 =
ReceiptAccountList.stream().filter(i -> i.getReceiptId() == ReceiptId).
collect(Collectors.toList());
if (CollectionUtil.isEmpty(ReceiptAccountList1))
return sR;
for (ReceiptAccountDO do1 : ReceiptAccountList1
) {
BigDecimal b1 = do1.getReceivableAmount();
String s1 = b1.toString();
String s2 = "";
//获取币种
if (do1.getCurrencyId() != null) {
int n1 = Integer.parseInt(do1.getCurrencyId().toString());
s2 = currencyMap.get(n1).getTitleZh();
}
sR += s1 + s2 + "\r\n";
}
return sR;
}
/*
lanbm 2024-06-06 add
实收金额
*/
private String getSSShow(List<ReceiptItemDO> listItemList,
long ReceiptId,
Map<Integer, CurrencyRespDTO> currencyMap) {
String sR = "";
if (CollectionUtil.isEmpty(listItemList)) {
return sR;
}
List<ReceiptItemDO> list =
listItemList.stream().filter(i -> i.getReceiptId() == ReceiptId).
collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) return sR;
//根据币种分组求和
Map<Long, BigDecimal> dataMap =
list.stream().filter(t -> t.getCurrencyId() != null)
.collect(Collectors.groupingBy(ReceiptItemDO::getCurrencyId,
CollectorsUtil.summingBigDecimal(ReceiptItemDO::getAmount)));
//遍历币种信息
for (Map.Entry<Long, BigDecimal> entry : dataMap.entrySet()) {
String key = entry.getKey().toString();
String s1 = entry.getValue().toString();
String s2 = "";
//获取币种
int n1 = Integer.parseInt(key);
s2 = currencyMap.get(n1).getTitleZh();
sR += s1 + s2 + "\r\n";
}
return sR;
}
/*
lanbm 2024-05-13 计算收款单明细状态
收款单主表
......
package cn.iocoder.yudao.module.wealth.service.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.io.FileModel;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.BankReceiptDetailsMapper;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/*
lanbm 2024-05-18 add
......@@ -25,6 +32,11 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
@Resource
private BankReceiptDetailsMapper bankReceiptDetailsMapper;
/*
lanbm 2024-05-17 add
*/
@Autowired
private AdminUserService adminUserService;
/*
获取分页数据
......@@ -35,12 +47,55 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
int start = (req.getPageNo() - 1) * req.getPageSize();
req.setStart(start);
List<AdminUserDO> ListUser = adminUserService.getUsersList();
Map<Long, String> userMap =
ListUser.stream().collect(
Collectors.toMap((AdminUserDO::getId), AdminUserDO::getNickname));
List<ReceiptItemResp> list =
bankReceiptDetailsMapper.getBankReceiptDetailsList(req);
for (ReceiptItemResp r : list
) {
if (r.getCreator() == null || r.getCreator().length() == 0)
r.setCreator("");
else {
Long l = Long.parseLong(r.getCreator());
r.setCreator(userMap.get(l));
}
r.setAttrList(getFileList(r.getAttr()));
}
return new PageResult<>(list, total, mpPage.getSize(),
req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
/*
组装附件信息 lanbm 2024-06-07 add
*/
private List<FileModel> getFileList(String sFileStr) {
if (sFileStr == null || sFileStr.length() == 0) {
return null;
} else {
String[] l = sFileStr.split(",");
List<FileModel> l1 = new ArrayList<>();
for (String f : l
) {
FileModel m = new FileModel();
m.setName(getFileName(f));
m.setUrl(f);
l1.add(m);
}
return l1;
}
}
/*
分解Url路径 lanbm 2024-06-07 add
*/
public String getFileName(String s) {
//String s="https://jiedao-test1.oss-cn-shenzhen.aliyuncs.com/2024/05/31/66592b5b556179746796617e.jpg";
int l = s.lastIndexOf('/');
String n = s.substring(l + 1);
return n;
}
}
......@@ -110,10 +110,16 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receiptItemMapper.updateById(updateObj);
}
/*
状态:0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票
收款单状态
*/
@Override
public void deleteReceiptItem(Long id) {
// 校验存在
ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(id);
ReceiptItemDO receiptItemDO =
receiptItemMapper.selectById(id);
if (null == receiptItemDO) {
throw exception(RECEIPT_ITEM_NOT_EXISTS);
}
......@@ -121,8 +127,10 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receiptItemMapper.deleteById(id);
//判断当前收款单下还有没有收款明细
if (null != receiptItemDO.getReceiptId()) {
LambdaQueryWrapper<ReceiptItemDO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ReceiptItemDO::getReceiptId, receiptItemDO.getReceiptId());
LambdaQueryWrapper<ReceiptItemDO> queryWrapper =
new LambdaQueryWrapper<>();
queryWrapper.eq(ReceiptItemDO::getReceiptId,
receiptItemDO.getReceiptId());
long count = this.count(queryWrapper);
if (count == 0) {
ReceivableDO updateReceivableDO = new ReceivableDO();
......@@ -131,6 +139,14 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.eq("receipt_id", receiptItemDO.getReceiptId());
this.receivableService.update(updateReceivableDO, updateWrapper);
//lanbm 2024-06-07 添加的逻辑点
//当银行收款明细为0是要改变收款单的状态为 待收款
ReceiptDO update = new ReceiptDO();
update.setId(receiptItemDO.getReceiptId());
update.setState(1);
receiptService.updateById(update);
//end lanbm 2024-06-07 添加的逻辑点
}
}
......
......@@ -220,6 +220,21 @@ public class ReceiptBackVO {
*/
private String tidanNo;
/*
应收金额
*/
private String ysShow;
/*
实数金额 lanbm 2024-06-06 add
*/
private String ssShow;
/*
核销比例 lanbm 2024-06-06 add
*/
private String hxBiLi;
/* @ApiModelProperty(value = "应收明细列表")
......
......@@ -47,6 +47,13 @@ public class ReceiptItemReq extends PageParam {
private String sDate3;
private String eDate3;
/*
实收日期 lanbm 2024-06-07 add
*/
private String sDate4;
private String eDate4;
/*
创建人
*/
......
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.framework.common.util.io.FileModel;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
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;
......@@ -70,6 +74,7 @@ public class ReceiptItemResp {
* 附件多个,分隔
*/
private String attr;
private List<FileModel> attrList;
/**
* 状态0待核销,1已核销
*/
......@@ -112,4 +117,30 @@ public class ReceiptItemResp {
*/
private String tidanNo;
/*
创建人
*/
private String creator;
/*
创建时间
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "创建时间")
private Date createTime;
/*
提交审批时间 lanbm 2024-06-07
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date createTimeBpm;
/*
审批通过时间 lanbm 2024-06-07
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTimeBpm;
}
......@@ -5,10 +5,12 @@
<select id="getBankReceiptDetailsList"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp">
SELECT p.*,m.receipt_no,m.order_id,
r.order_no,r.tidan_no
r.order_no,r.tidan_no,a.create_time as create_time_bpm,
a.update_time as update_time_bpm
from ecw_receipt_item p
left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
left join ecw_order r on r.order_id=m.order_id and r.deleted=0
left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
<include refid="WherePage"/>
ORDER BY m.receipt_no desc,p.create_time asc limit #{start}, #{pageSize}
</select>
......@@ -33,17 +35,19 @@
<!--收款明细提交审批日期-->
<if test="sDate2 != null and sDate2 != '' and
eDate2 != null and eDate2 != ''">
AND m.bmp_id in
(select bmp_id from ecw_receipt_approval where create_time
BETWEEN #{sDate2} and #{eDate2})
AND a.create_time BETWEEN #{sDate2} and #{eDate2})
</if>
<!--收款明细提交审批通过日期-->
<if test="sDate3 != null and sDate3 != '' and
eDate3 != null and eDate3 != ''">
AND m.bmp_id in
(select bmp_id from ecw_receipt_approval where update_time
BETWEEN #{sDate3} and #{eDate3})
AND a.update_time BETWEEN #{sDate3} and #{eDate3}
</if>
<!--实收日期 lanbm 2024-06-07 add-->
<if test="sDate4 != null and sDate4 != '' and
eDate4 != null and eDate4 != ''">
AND p.amount_date BETWEEN #{sDate4} and #{eDate4}
</if>
<!--收款明细创建人-->
......@@ -59,6 +63,7 @@
from ecw_receipt_item p
left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
left join ecw_order r on r.order_id=m.order_id and r.deleted=0
left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
<include refid="WherePage"/>
</select>
......
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