|
@@ -9,6 +9,7 @@ import com.leromro.common.core.domain.R;
|
|
|
import com.leromro.common.core.page.TableDataInfo;
|
|
|
import com.leromro.common.utils.GeoUtils;
|
|
|
import com.leromro.common.utils.SecurityUtils;
|
|
|
+import com.leromro.core.domain.OrderFrozenFunds;
|
|
|
import com.leromro.core.domain.PlatformFinance;
|
|
|
import com.leromro.core.domain.SecondOrder;
|
|
|
import com.leromro.core.domain.dto.ConversationMsgDTO;
|
|
@@ -21,8 +22,12 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 订单主Controller
|
|
@@ -44,6 +49,8 @@ public class volunteerOrderController extends BaseController {
|
|
|
private IPlatformFinanceService platformFinanceService;
|
|
|
@Autowired
|
|
|
private IConversationRecordService conversationRecordService;
|
|
|
+ @Autowired
|
|
|
+ private IOrderFrozenFundsService orderFrozenFundsService;
|
|
|
|
|
|
@ApiOperation("志愿者查询小订单列表")
|
|
|
@GetMapping("/volunteerOrderList")
|
|
@@ -51,7 +58,28 @@ public class volunteerOrderController extends BaseController {
|
|
|
startPage();
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
List<VolunteerOrdersVO> list = secondOrderService.selectOrderList(userId, orderStatus);
|
|
|
- list.forEach(volunteerOrdersVO -> volunteerOrdersVO.setServiceOnePrice(volunteerOrdersVO.getServiceOnePrice().multiply(BigDecimal.valueOf(volunteerOrdersVO.getSingleQuantity())).multiply(new BigDecimal("0.85"))));
|
|
|
+ List<Long> secondOrderIdList = list.stream().map(SecondOrder::getSecondOrderId).collect(Collectors.toList());
|
|
|
+ if(orderStatus.equals(4L)){
|
|
|
+ //如果已经完成
|
|
|
+ List<OrderFrozenFunds> orderFrozenFundsList = orderFrozenFundsService.list(new LambdaQueryWrapper<OrderFrozenFunds>().in(OrderFrozenFunds::getSecondOrderId, secondOrderIdList));
|
|
|
+ // 创建OrderId到OrderFrozenFunds的映射
|
|
|
+ Map<Long, OrderFrozenFunds> fundsMap = orderFrozenFundsList.stream()
|
|
|
+ .collect(Collectors.toMap(OrderFrozenFunds::getSecondOrderId, Function.identity()));
|
|
|
+
|
|
|
+ // 遍历列表并设置serviceOnePrice
|
|
|
+ list.forEach(volunteerOrdersVO -> {
|
|
|
+ OrderFrozenFunds funds = fundsMap.get(volunteerOrdersVO.getSecondOrderId());
|
|
|
+ if(funds != null) {
|
|
|
+ BigDecimal totalAmount = funds.getVolunteerMoney()
|
|
|
+ .add(funds.getScoreMoney())
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
+ volunteerOrdersVO.setServiceOnePrice(totalAmount);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ //如果订单还没有完成 列表上显示的是默认一星的钱数
|
|
|
+ list.forEach(volunteerOrdersVO -> volunteerOrdersVO.setServiceOnePrice(volunteerOrdersVO.getServiceOnePrice().multiply(BigDecimal.valueOf(volunteerOrdersVO.getSingleQuantity())).multiply(new BigDecimal("0.85")).setScale(2, RoundingMode.HALF_UP)));
|
|
|
+ }
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|