feature:批量勾选订单合并明细行

release
gaorl 2 years ago
parent 40e844ff2b
commit 9073c01da9
  1. 15
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/controller/OrderInfoController.java
  2. 5
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/OrderInfoService.java
  3. 30
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/OrderInfoServiceImpl.java

@ -500,4 +500,19 @@ public class OrderInfoController {
}
}
@ApiOperation(value = "批量订单明细合并", notes = "订单信息管理-批量订单明细合并")
@PostMapping("/batchMegerOrderItem")
@SysLog(operation = "批量订单明细合并", operationDesc = "订单明细合并", key = "批量订单明细合并")
public R batchMegerOrderItem(@RequestBody String param){
log.info("批量订单明细合并",param);
List<JSONObject> jsonObjects = JSONObject.parseArray(param).toJavaList(JSONObject.class);
try {
return orderInfoService.batchMegerOrderItem(jsonObjects);
} catch (Exception e) {
log.error(e.getMessage());
return R.error("系统异常");
}
}
}

@ -1,6 +1,7 @@
package com.dxhy.order.consumer.modules.order.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.order.consumer.model.page.PageRequestVO;
import com.dxhy.order.exception.OrderReceiveException;
import com.dxhy.order.model.*;
@ -219,7 +220,9 @@ public interface OrderInfoService {
R updateOrderItem(String orderInfoId,String entId,List<String> itemList);
@Transactional
R mergeOrderItem(String entId,String orderInfoId,List<String> itemList);
R mergeOrderItem(String entId,String orderInfoId,List<String> itemList) throws Exception;
R batchMegerOrderItem(List<JSONObject> jsonObjects);
/**

@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.dxhy.base.constant.OrderSeparationException;
import com.dxhy.base.constant.TaxSeparateConfig;
import com.dxhy.base.utils.PriceTaxSeparationUtilNew;
@ -1855,16 +1856,21 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
@Override
public R mergeOrderItem(String entId, String orderInfoId,List<String> itemList){
public R mergeOrderItem(String entId, String orderInfoId,List<String> itemList) throws Exception{
List<OrderItemInfo> orderItemInfos = orderItemInfoMapper.selectAllByOrderId(Arrays.asList(orderInfoId), null);
if(ObjectUtil.isNull(orderItemInfos)){
return R.error("根据订单号未查询到明细行信息");
}
List<OrderItemInfo> collect = orderItemInfos.stream().filter(t -> itemList.contains(t.getId()) && StringUtils.isNotBlank(t.getSpbm())).collect(Collectors.toList());
List<OrderItemInfo> collect = null;
if(itemList != null){
collect = orderItemInfos.stream().filter(t -> itemList.contains(t.getId()) && StringUtils.isNotBlank(t.getSpbm())).collect(Collectors.toList());
if(ObjectUtil.isNull(orderItemInfos)){
return R.error("税收编码为空的不允许合并,请先更新税收编码");
}
}else{
collect = orderItemInfos;
}
Map<String, List<OrderItemInfo>> collect1 = collect.stream().collect(Collectors.groupingBy(t -> t.getFphxz() + t.getXmmc() + t.getXmdw() + t.getGgxh() + t.getSl() + t.getSpbm()));
List<OrderItemInfo> orderItemInfoList = new ArrayList<>();
List<String> deleteItem = new ArrayList<>();
@ -1928,6 +1934,26 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return R.ok();
}
@Override
public R batchMegerOrderItem(List<JSONObject> jsonObjects){
for (JSONObject t : jsonObjects) {
String orderInfoId = t.getString("orderInfoId");
String entId = t.getString("entId");
String ddh = t.getString("ddh");
try {
R r = mergeOrderItem(orderInfoId, entId, null);
if(!ConfigureConstant.STRING_0000.equals(r.getCode())){
return R.error("结算单号{}明细行合并失败",ddh);
}
} catch (Exception e) {
log.error("批量合并报错orderInfoId:{},entId:{},报错信息:{}",orderInfoId,entId,e.getMessage());
return R.error("结算单号{}明细行合并失败",ddh);
}
}
return R.ok();
}
@Override
@Transactional(readOnly = true)
public Boolean checkInvoiceRemarksFlag(String xfnsrsbh, String ghfId) {

Loading…
Cancel
Save