no message
This commit is contained in:
parent
4f984ab2e7
commit
ecd9a76eeb
|
|
@ -559,7 +559,10 @@ public class OrderDetailController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!CollectionUtils.isEmpty(financialChangeRecords)){
|
if(!CollectionUtils.isEmpty(financialChangeRecords)){
|
||||||
BigDecimal totalAdd = financialChangeRecords.stream().map(FinancialChangeRecord::getChangeMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal totalAdd = financialChangeRecords.stream()
|
||||||
|
.filter(record -> record.getPayStatus() == 1) // 筛选 paystatus == 1 的记录
|
||||||
|
.map(FinancialChangeRecord::getChangeMoney) // 提取 changeMoney
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add); // 计算总和
|
||||||
Long goodsStandardId = orderStandardList.get(0).getGoodsStandardId();
|
Long goodsStandardId = orderStandardList.get(0).getGoodsStandardId();
|
||||||
GoodsStandard standard = goodsStandardService.selectById(goodsStandardId);
|
GoodsStandard standard = goodsStandardService.selectById(goodsStandardId);
|
||||||
// 第四级规格
|
// 第四级规格
|
||||||
|
|
@ -610,7 +613,18 @@ public class OrderDetailController extends BaseController {
|
||||||
}
|
}
|
||||||
// 上门师傅应得加价的报酬
|
// 上门师傅应得加价的报酬
|
||||||
BigDecimal workerFee = totalAdd.subtract(platformFee).subtract(masterFee).subtract(customerFee);
|
BigDecimal workerFee = totalAdd.subtract(platformFee).subtract(masterFee).subtract(customerFee);
|
||||||
orderListResponse.setPayAddMoney(orderListResponse.getPayMoney());
|
OrderAttachmentRecord orderAttachmentRecord=new OrderAttachmentRecord();
|
||||||
|
orderAttachmentRecord.setOrderDetailId(detail.getId());
|
||||||
|
List<OrderAttachmentRecord> orderAttachmentRecords=orderAttachmentRecordService.selectOrderAttachmentRecordList(orderAttachmentRecord);
|
||||||
|
//配件费的实际获取金额计算费率
|
||||||
|
BigDecimal rate = BigDecimal.valueOf(0.99);
|
||||||
|
BigDecimal attachmentMoney = orderAttachmentRecords.stream()
|
||||||
|
.filter(record -> StringUtils.isNotEmpty(record.getPaymentId()))
|
||||||
|
.map(OrderAttachmentRecord::getAttachMoney)
|
||||||
|
.map(attachMoney ->attachMoney.multiply(rate).setScale(2, RoundingMode.DOWN))
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
logger.info("加价的金额{}配件费{}总服务金额为{}",workerFee,attachmentMoney,orderListResponse.getPayMoney().add(workerFee).add(attachmentMoney));
|
||||||
|
orderListResponse.setPayAddMoney(orderListResponse.getPayMoney().add(workerFee).add(attachmentMoney));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AjaxResult.success(orderListResponse);
|
return AjaxResult.success(orderListResponse);
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,13 @@
|
||||||
package com.ghy.web.controller.order;
|
package com.ghy.web.controller.order;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import cn.hutool.db.sql.Order;
|
|
||||||
import com.ghy.common.adapay.model.AdapayStatusEnum;
|
|
||||||
import com.ghy.common.adapay.model.PayParam;
|
|
||||||
import com.ghy.common.annotation.Log;
|
import com.ghy.common.annotation.Log;
|
||||||
import com.ghy.common.constant.UserConstants;
|
import com.ghy.common.constant.UserConstants;
|
||||||
import com.ghy.common.core.controller.BaseController;
|
import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
import com.ghy.common.core.domain.entity.SysUser;
|
import com.ghy.common.core.domain.entity.SysUser;
|
||||||
import com.ghy.common.core.page.PageDomain;
|
|
||||||
import com.ghy.common.core.page.TableDataInfo;
|
import com.ghy.common.core.page.TableDataInfo;
|
||||||
import com.ghy.common.core.page.TableSupport;
|
|
||||||
import com.ghy.common.enums.*;
|
import com.ghy.common.enums.*;
|
||||||
import com.ghy.common.json.JSONObject;
|
|
||||||
import com.ghy.common.utils.*;
|
import com.ghy.common.utils.*;
|
||||||
import com.ghy.common.utils.poi.ExcelUtil;
|
import com.ghy.common.utils.poi.ExcelUtil;
|
||||||
import com.ghy.customer.domain.Customer;
|
import com.ghy.customer.domain.Customer;
|
||||||
|
|
@ -31,7 +24,6 @@ import com.ghy.order.service.*;
|
||||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||||
import com.ghy.payment.domain.FinancialDetail;
|
import com.ghy.payment.domain.FinancialDetail;
|
||||||
import com.ghy.payment.domain.FinancialMaster;
|
import com.ghy.payment.domain.FinancialMaster;
|
||||||
import com.ghy.payment.domain.PaymentRelation;
|
|
||||||
import com.ghy.payment.service.FinancialChangeRecordService;
|
import com.ghy.payment.service.FinancialChangeRecordService;
|
||||||
import com.ghy.payment.service.FinancialDetailService;
|
import com.ghy.payment.service.FinancialDetailService;
|
||||||
import com.ghy.payment.service.FinancialMasterService;
|
import com.ghy.payment.service.FinancialMasterService;
|
||||||
|
|
@ -48,9 +40,6 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
@ -64,7 +53,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -819,21 +807,37 @@ public class OrderMasterController extends BaseController {
|
||||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
|
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
|
||||||
BigDecimal totalPayMoney = financialMaster.getPayMoney();
|
BigDecimal totalPayMoney = financialMaster.getPayMoney();
|
||||||
BigDecimal totalChangeMoney = new BigDecimal(0);
|
BigDecimal totalChangeMoney = new BigDecimal(0);
|
||||||
|
BigDecimal paymentMoney = BigDecimal.ZERO;
|
||||||
|
if (financialMaster.getPayStatus()==1){
|
||||||
|
paymentMoney=paymentMoney.add(financialMaster.getTotalMoney());
|
||||||
|
}
|
||||||
|
List<FinancialChangeRecord> financialChangeRecords=financialChangeRecordService.selectByMasterId(orderMaster.getId());
|
||||||
|
BigDecimal changePaymentMoney =financialChangeRecords.stream()
|
||||||
|
.filter(record->record.getPayStatus()==1)
|
||||||
|
.map(FinancialChangeRecord::getChangeMoney)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
paymentMoney=paymentMoney.add(changePaymentMoney);
|
||||||
|
logger.info("加价费已支付{}加价列表{}主单id为{}",changePaymentMoney,financialChangeRecords,orderMaster.getId());
|
||||||
|
|
||||||
for (OrderDetail detail : detailList) {
|
for (OrderDetail detail : detailList) {
|
||||||
// 查询子单加价记录
|
// 查询子单加价记录
|
||||||
FinancialChangeRecord record = financialChangeRecordService.selectNotPayRecordByDetailId(detail.getId());
|
FinancialChangeRecord record = financialChangeRecordService.selectNotPayRecordByDetailId(detail.getId());
|
||||||
|
|
||||||
if (record != null) {
|
if (record != null) {
|
||||||
totalChangeMoney = totalChangeMoney.add(record.getChangeMoney());
|
totalChangeMoney = totalChangeMoney.add(record.getChangeMoney());
|
||||||
}
|
}
|
||||||
OrderAttachmentRecord param = new OrderAttachmentRecord();
|
OrderAttachmentRecord param = new OrderAttachmentRecord();
|
||||||
param.setOrderDetailId(detail.getId());
|
param.setOrderDetailId(detail.getId());
|
||||||
List<OrderAttachmentRecord> orderAttachmentRecordList = orderAttachmentRecordService.selectOrderAttachmentRecordList(param);
|
List<OrderAttachmentRecord> orderAttachmentRecordList = orderAttachmentRecordService.selectOrderAttachmentRecordList(param);
|
||||||
logger.info("列表中子单的id{},获取到的加价列表{}",detail.getId(),orderAttachmentRecordList);
|
|
||||||
for (OrderAttachmentRecord orderAttachmentRecord:orderAttachmentRecordList){
|
for (OrderAttachmentRecord orderAttachmentRecord:orderAttachmentRecordList){
|
||||||
totalChangeMoney = totalChangeMoney.add(orderAttachmentRecord.getAttachMoney());
|
if (StringUtils.isEmpty(orderAttachmentRecord.getPaymentId())){
|
||||||
|
totalChangeMoney = totalChangeMoney.add(orderAttachmentRecord.getAttachMoney());
|
||||||
|
}else{
|
||||||
|
paymentMoney = paymentMoney.add(orderAttachmentRecord.getAttachMoney());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("列表中加价的金额{}",totalPayMoney);
|
logger.info("列表中已支付的金额{}已支付的加价金额{}",paymentMoney,changePaymentMoney);
|
||||||
// 地址信息
|
// 地址信息
|
||||||
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(master.getAddressId());
|
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(master.getAddressId());
|
||||||
SysArea sysArea;
|
SysArea sysArea;
|
||||||
|
|
@ -862,6 +866,7 @@ public class OrderMasterController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑返回属性
|
// 编辑返回属性
|
||||||
|
orderListResponse.setPaymentMoney(paymentMoney);
|
||||||
orderListResponse.setGoodsBrand(master.getGoodsBrand());
|
orderListResponse.setGoodsBrand(master.getGoodsBrand());
|
||||||
orderListResponse.setGoodsSpecification(master.getGoodsSpecification());
|
orderListResponse.setGoodsSpecification(master.getGoodsSpecification());
|
||||||
orderListResponse.setOrderMasterId(master.getId());
|
orderListResponse.setOrderMasterId(master.getId());
|
||||||
|
|
@ -1144,7 +1149,7 @@ public class OrderMasterController extends BaseController {
|
||||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(orderMaster.getId());
|
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(orderMaster.getId());
|
||||||
// 计算总额
|
// 计算总额
|
||||||
BigDecimal totalPayMoney = financialMaster.getPayMoney();
|
BigDecimal totalPayMoney = financialMaster.getPayMoney();
|
||||||
|
BigDecimal leaderMoney= BigDecimal.ZERO;
|
||||||
for (OrderDetail orderDetail : orderDetailList) {
|
for (OrderDetail orderDetail : orderDetailList) {
|
||||||
List<OrderStandard> standardList = new ArrayList<>();
|
List<OrderStandard> standardList = new ArrayList<>();
|
||||||
// 子单施工师傅信息
|
// 子单施工师傅信息
|
||||||
|
|
@ -1205,6 +1210,9 @@ public class OrderMasterController extends BaseController {
|
||||||
attachmentMoney= attachmentMoney.add(orderAttachmentRecords.get(0).getAttachMoney());
|
attachmentMoney= attachmentMoney.add(orderAttachmentRecords.get(0).getAttachMoney());
|
||||||
financialChangeRecord.setAttachmentMoney(attachmentMoney);
|
financialChangeRecord.setAttachmentMoney(attachmentMoney);
|
||||||
}
|
}
|
||||||
|
if (financialChangeRecord.getPayStatus()==1){
|
||||||
|
leaderMoney=leaderMoney.add(financialChangeRecord.getLeaderMoney());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (OrderAttachmentRecord orderAttachmentRecord:orderAttachmentRecordList){
|
for (OrderAttachmentRecord orderAttachmentRecord:orderAttachmentRecordList){
|
||||||
addMoneyTotal= addMoneyTotal.add(orderAttachmentRecord.getAttachMoney());
|
addMoneyTotal= addMoneyTotal.add(orderAttachmentRecord.getAttachMoney());
|
||||||
|
|
@ -1345,7 +1353,9 @@ public class OrderMasterController extends BaseController {
|
||||||
for (FinancialDetail financialDetail : financialDetailList) {
|
for (FinancialDetail financialDetail : financialDetailList) {
|
||||||
finalRecvMoney = finalRecvMoney.add(financialDetail.getPayMoney());
|
finalRecvMoney = finalRecvMoney.add(financialDetail.getPayMoney());
|
||||||
}
|
}
|
||||||
|
BigDecimal serverMoney =financialMaster.getServerMoney();
|
||||||
|
serverMoney=serverMoney.add(leaderMoney);
|
||||||
|
logger.info("大师傅的服务金额{}大师傅的分成{}",serverMoney,leaderMoney);
|
||||||
// 编辑返回属性
|
// 编辑返回属性
|
||||||
orderListResponse.setOrderMasterId(orderMaster.getId());
|
orderListResponse.setOrderMasterId(orderMaster.getId());
|
||||||
orderListResponse.setOrderMasterCode(orderMaster.getCode());
|
orderListResponse.setOrderMasterCode(orderMaster.getCode());
|
||||||
|
|
@ -1365,7 +1375,7 @@ public class OrderMasterController extends BaseController {
|
||||||
orderListResponse.setStandardList(standardList);
|
orderListResponse.setStandardList(standardList);
|
||||||
orderListResponse.setAddress(completeAddress);
|
orderListResponse.setAddress(completeAddress);
|
||||||
orderListResponse.setServerTime(orderMaster.getRevTime());
|
orderListResponse.setServerTime(orderMaster.getRevTime());
|
||||||
orderListResponse.setServerMoney(financialMaster.getServerMoney());
|
orderListResponse.setServerMoney(serverMoney);
|
||||||
orderListResponse.setExpectTimeStart(orderMaster.getExpectTimeStart());
|
orderListResponse.setExpectTimeStart(orderMaster.getExpectTimeStart());
|
||||||
orderListResponse.setExpectTimeEnd(orderMaster.getExpectTimeEnd());
|
orderListResponse.setExpectTimeEnd(orderMaster.getExpectTimeEnd());
|
||||||
orderListResponse.setExpectTimeStartFront(orderMaster.getExpectTimeStart());
|
orderListResponse.setExpectTimeStartFront(orderMaster.getExpectTimeStart());
|
||||||
|
|
@ -1383,7 +1393,6 @@ public class OrderMasterController extends BaseController {
|
||||||
orderListResponse.setMasterCompanyName(masterCompanyName);
|
orderListResponse.setMasterCompanyName(masterCompanyName);
|
||||||
orderListResponse.setMasterWorkerPhone(masterWorker == null ? "" : masterWorker.getPhone());
|
orderListResponse.setMasterWorkerPhone(masterWorker == null ? "" : masterWorker.getPhone());
|
||||||
orderListResponse.setMasterWorkerName(masterWorkerName);
|
orderListResponse.setMasterWorkerName(masterWorkerName);
|
||||||
logger.info("主单id{},主单数据{},省名字{},街道id{},是否有值{}",request.getId(),orderMaster,orderMaster.getProvinceName(),customerAddress.getStreetId(),StringUtils.isNotEmpty(orderMaster.getProvinceName()));
|
|
||||||
if (StringUtils.isNotEmpty(orderMaster.getProvinceName())){
|
if (StringUtils.isNotEmpty(orderMaster.getProvinceName())){
|
||||||
orderListResponse.setProvinceId(orderMaster.getProvinceId());
|
orderListResponse.setProvinceId(orderMaster.getProvinceId());
|
||||||
orderListResponse.setCityId(orderMaster.getCityId());
|
orderListResponse.setCityId(orderMaster.getCityId());
|
||||||
|
|
@ -1400,7 +1409,6 @@ public class OrderMasterController extends BaseController {
|
||||||
if (!StringUtils.isEmpty(customerAddress.getStreetId()+"")){
|
if (!StringUtils.isEmpty(customerAddress.getStreetId()+"")){
|
||||||
String addressSysArea=sysArea.getMergerName();
|
String addressSysArea=sysArea.getMergerName();
|
||||||
String[] array = addressSysArea.split(",");
|
String[] array = addressSysArea.split(",");
|
||||||
logger.info("单个订单查询到的地址{}",array);
|
|
||||||
orderListResponse.setProvinceName(array[0]);
|
orderListResponse.setProvinceName(array[0]);
|
||||||
orderListResponse.setCityName(array[1]);
|
orderListResponse.setCityName(array[1]);
|
||||||
orderListResponse.setCountryName(array[2]);
|
orderListResponse.setCountryName(array[2]);
|
||||||
|
|
|
||||||
|
|
@ -206,4 +206,6 @@ public class OrderListResponse {
|
||||||
private BigDecimal addMoney;
|
private BigDecimal addMoney;
|
||||||
|
|
||||||
private String addMoneyRemark;
|
private String addMoneyRemark;
|
||||||
|
|
||||||
|
private BigDecimal paymentMoney;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue