Commit 830dfa2d authored by jiaorz's avatar jiaorz

发票

parent 10405431
......@@ -24,6 +24,11 @@ public class OrderPageVO extends BaseOrder {
//更换还车公司记录
List<BookRecordUpdateLog> bookRecordUpdateLogs;
/**
* 订单最终支付金额:扣除所有费用之后
*/
private BigDecimal orderRealAmount;
/**
* 用户名
*/
......
......@@ -4,8 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
......@@ -31,7 +31,6 @@ import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.VehicleItemDTO;
import com.xxfc.platform.order.pojo.price.CancelStartedVO;
import com.xxfc.platform.order.pojo.price.CostDetailExtend;
import com.xxfc.platform.order.pojo.price.DelayAddPriceVO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
......@@ -39,9 +38,11 @@ import com.xxfc.platform.universal.vo.OrderRefundVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang3.StringUtils;
import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.math.RoundingMode;
......@@ -792,4 +793,36 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
log.error(StrUtil.format("退款异常{},订单号为:{}", ex.getMessage(), baseOrder.getNo()), ex);
}
}
public List<OrderAccount> getByOrderId(Integer orderId) {
Example example = new Example(OrderAccount.class);
example.createCriteria().andEqualTo("orderId", orderId).andGreaterThan("accountType", 200);
return mapper.selectByExample(example);
}
public BigDecimal getAllOrderCost(Integer orderId) {
List<OrderAccount> list = getByOrderId(orderId);
BigDecimal bigDecimal = new BigDecimal("0");
if (list != null && list.size() > 0) {
list.parallelStream().forEach(result -> {
if(StringUtils.isNotBlank(result.getAccountDetail())) {
JSONObject jsonObject = JSONObject.parseObject(result.getAccountDetail());
log.info("获取订单的费用金额:", jsonObject.toJSONString());
if (jsonObject != null) {
JSONArray jsonArray = jsonObject.getJSONArray("deductions");
if(jsonArray != null && jsonArray.size() > 0) {
for (int i =0; i<jsonArray.size(); i++) {
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
if (jsonObject1 != null) {
bigDecimal.add(new BigDecimal(jsonObject1.getString("amount")));
}
}
log.info("获取订单的费用金额: {}", bigDecimal);
}
}
}
});
}
return bigDecimal;
}
}
\ No newline at end of file
......@@ -173,6 +173,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes
PageDataVO<OrderPageVO> pages = PageDataVO.pageInfo(query, () -> baseOrderBiz.pageByParm(query.getSuper()));
pages.getData().parallelStream().forEach(data -> {
data.setQrcodeStr(qrcodePrefix);
data.setOrderRealAmount(orderAccountBiz.getAllOrderCost(data.getId()));
});
return new ObjectRestResponse<>().data(pages);
}
......@@ -489,4 +490,6 @@ public class BaseOrderController extends CommonBaseController implements UserRes
return baseOrderBiz.updateBaseOrder(baseOrder);
}
}
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