| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | |
| | | import com.doumee.dao.web.request.*; |
| | | import com.doumee.dao.web.request.goods.*; |
| | | import com.doumee.dao.web.response.HomeInfoResponse; |
| | | import com.doumee.dao.web.response.MailConfigResponse; |
| | | import com.doumee.dao.web.response.MyPageResponse; |
| | | import com.doumee.dao.web.response.goods.*; |
| | | import com.doumee.service.business.AreasService; |
| | |
| | | .eq(MemberCoupon::getId,orderPayConfirmResponse.getMemberCoupon().getId()) |
| | | ); |
| | | } |
| | | goodsorder.setReturnCustomerIntegral(getBackIntegral(goodsorder.getPrice(),Constants.ONE)); |
| | | goodsorder.setReturnMemberIntegral(getBackIntegral(goodsorder.getPrice(),Constants.ZERO)); |
| | | goodsorderMapper.insert(goodsorder); |
| | | List<OrderGoodsCalculateResponse> goodsCalculateList = orderPayConfirmResponse.getGoodsCalculateList(); |
| | | if(CollectionUtils.isEmpty(goodsCalculateList)){ |
| | |
| | | //邮费金额 |
| | | if(Objects.nonNull(request.getReceiveType())){ |
| | | if(Constants.equalsInteger(request.getReceiveType(),Constants.ZERO)){ |
| | | MailConfigResponse mailConfigResponse = systemDictDataBiz.getMailConfig(); |
| | | if(Objects.nonNull(request.getAddressId())){ |
| | | Addr addr = addrMapper.selectById(request.getAddressId()); |
| | | if(Objects.isNull(addr)){ |
| | |
| | | Labels labels = labelsMapper.selectById(areas.getYunFeeId()); |
| | | if(Objects.nonNull(labels)&&StringUtils.isNotBlank(labels.getParam())){ |
| | | //{weight0:10,fee0:10,weight1:10,fee1:10},{首重:10,首重运费:10,续重:10,续重费:10} |
| | | |
| | | mailConfigResponse = JSONObject.parseObject(labels.getParam(),MailConfigResponse.class); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //TODO 根据收货地址 查询运费配置 |
| | | |
| | | |
| | | |
| | | //根据收货地址 查询运费配置 |
| | | //计算商品信息总重量 |
| | | BigDecimal totalWeight = goodsCalculateList.stream().map(i-> |
| | | i.getWeight().multiply(new BigDecimal(i.getGoodsNum().toString())) |
| | | ).reduce(BigDecimal.ZERO,BigDecimal::add); |
| | | //TODO 暂时无运费金额 |
| | | mailAmount = BigDecimal.ZERO; |
| | | |
| | | if(totalWeight.compareTo(mailConfigResponse.getWeight0())>=Constants.ZERO){ |
| | | mailAmount = mailConfigResponse.getFee0(); |
| | | }else{ |
| | | //超重重量 |
| | | BigDecimal overWeight = totalWeight.subtract(mailConfigResponse.getWeight0()); |
| | | if (overWeight.compareTo(mailConfigResponse.getWeight1()) >= Constants.ZERO) { |
| | | mailAmount = mailConfigResponse.getFee0().add( |
| | | mailConfigResponse.getFee1() |
| | | .multiply(overWeight.divide(mailConfigResponse.getWeight1(),2,RoundingMode.HALF_UP))); |
| | | }else{ |
| | | mailAmount = mailConfigResponse.getFee0().add(mailConfigResponse.getFee1()); |
| | | } |
| | | } |
| | | amount = amount.add(mailAmount); |
| | | } |
| | | } |