mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 12:35:07 +08:00
Merge branch 'dev-new' into dev-new-rabbitmq
# Conflicts: # jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/TempController.java # jsowell-admin/src/test/java/SpringBootTestController.java
This commit is contained in:
@@ -77,6 +77,7 @@ import com.jsowell.thirdparty.common.NotificationService;
|
||||
import com.jsowell.thirdparty.huawei.HuaWeiService;
|
||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||
import com.jsowell.thirdparty.platform.util.Encodes;
|
||||
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
||||
@@ -93,6 +94,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -273,6 +275,9 @@ public class SpringBootTestController {
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Qualifier("zhongDianLianPlatformServiceImpl")
|
||||
private ThirdPartyPlatformService platformLogic;
|
||||
|
||||
@Test
|
||||
public void sendRabbitMqTest() {
|
||||
OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
|
||||
@@ -310,6 +315,14 @@ public class SpringBootTestController {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryStationStatus() {
|
||||
QueryStationInfoDTO dto = new QueryStationInfoDTO();
|
||||
dto.setStationIds(Lists.newArrayList("19"));
|
||||
Map<String, String> map = platformLogic.queryStationStatus(dto);
|
||||
System.out.println(map);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void batchSelectConnectorList() {
|
||||
ArrayList<String> stationIds = Lists.newArrayList("19", "2", "14");
|
||||
@@ -511,15 +524,15 @@ public class SpringBootTestController {
|
||||
|
||||
@Test
|
||||
public void queryBillingPriceTest() {
|
||||
String stationId = "19";
|
||||
String stationId = "1";
|
||||
// List<BillingPriceVO> billingPriceVOS = pileBillingTemplateService.queryBillingPriceOld(stationId);
|
||||
// System.out.println("老版:" + JSON.toJSONString(billingPriceVOS));
|
||||
//
|
||||
// List<BillingPriceVO> billingPriceVOS1 = pileBillingTemplateService.queryBillingPrice(stationId);
|
||||
// System.out.println("新版:" + JSON.toJSONString(billingPriceVOS1));
|
||||
List<BillingPriceVO> billingPriceVOS1 = pileBillingTemplateService.queryBillingPrice(stationId);
|
||||
System.out.println("新版:" + JSON.toJSONString(billingPriceVOS1));
|
||||
|
||||
CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(stationId);
|
||||
System.out.println("currentTimePriceDetails:" + JSON.toJSONString(currentTimePriceDetails));
|
||||
// CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(stationId);
|
||||
// System.out.println("currentTimePriceDetails:" + JSON.toJSONString(currentTimePriceDetails));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -571,75 +584,6 @@ public class SpringBootTestController {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDiscount() {
|
||||
OrderBasicInfo orderBasicInfo = new OrderBasicInfo();
|
||||
orderBasicInfo.setMemberId("12345678");
|
||||
orderBasicInfo.setMerchantId("1");
|
||||
orderBasicInfo.setStationId("19");
|
||||
orderBasicInfo.setPayAmount(new BigDecimal("200"));
|
||||
|
||||
OrderDetail orderDetail = new OrderDetail();
|
||||
orderDetail.setTotalElectricityAmount(new BigDecimal("3"));
|
||||
orderDetail.setTotalServiceAmount(new BigDecimal("0.18"));
|
||||
|
||||
|
||||
String memberId = orderBasicInfo.getMemberId(); // 会员id
|
||||
String merchantId = orderBasicInfo.getMerchantId(); // 运营商id
|
||||
String stationId = orderBasicInfo.getStationId(); // 站点id
|
||||
|
||||
// 电费折扣金额
|
||||
BigDecimal discountElectricityAmount = BigDecimal.ZERO;
|
||||
// 服务费折扣金额
|
||||
BigDecimal discountServiceAmount = BigDecimal.ZERO;
|
||||
|
||||
BigDecimal afterServiceAmountDiscount = BigDecimal.ZERO;
|
||||
BigDecimal afterElectricityAmountDiscount = BigDecimal.ZERO;
|
||||
|
||||
// 查询会员在此站点会员折扣
|
||||
MemberDiscountVO memberDiscountVO = memberGroupService.queryMemberDiscount(merchantId, stationId, memberId);
|
||||
if (memberDiscountVO != null) {
|
||||
BigDecimal discount = memberDiscountVO.getDiscount(); // 折扣率
|
||||
String groupType = memberDiscountVO.getGroupType(); // 类型(1-服务费折扣,2-电费折扣 ,3-电费和服务费一起折扣)
|
||||
BigDecimal totalElectricityAmount = orderDetail.getTotalElectricityAmount(); // 电费
|
||||
BigDecimal totalServiceAmount = orderDetail.getTotalServiceAmount(); // 服务费
|
||||
|
||||
afterServiceAmountDiscount = totalServiceAmount;
|
||||
afterElectricityAmountDiscount = totalElectricityAmount;
|
||||
if (Constants.ONE.equals(groupType)) {
|
||||
afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||||
discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
|
||||
} else if (Constants.TWO.equals(groupType)) {
|
||||
afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||||
discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
|
||||
} else {
|
||||
// BigDecimal afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(2, RoundingMode.DOWN);
|
||||
// discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
|
||||
// BigDecimal afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(2, RoundingMode.DOWN);
|
||||
// discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
|
||||
afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||||
afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||||
|
||||
discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
|
||||
discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
|
||||
}
|
||||
}
|
||||
// 订单折扣金额
|
||||
BigDecimal discountAmount = discountServiceAmount.add(discountElectricityAmount);
|
||||
orderBasicInfo.setDiscountAmount(discountAmount);
|
||||
// 更新退款金额 = 退款金额 - 折扣金额
|
||||
// BigDecimal refundAmount = orderBasicInfo.getRefundAmount().subtract(discountAmount);
|
||||
|
||||
// 总消费金额 = 折扣后电费 + 折扣后服务费
|
||||
BigDecimal totalConsumeAmount = afterServiceAmountDiscount.add(afterElectricityAmountDiscount);
|
||||
// 更新退款金额
|
||||
BigDecimal refundAmount = orderBasicInfo.getPayAmount().subtract(totalConsumeAmount).setScale(2, RoundingMode.DOWN);
|
||||
orderBasicInfo.setRefundAmount(refundAmount);
|
||||
|
||||
orderDetail.setDiscountElectricityAmount(discountElectricityAmount);
|
||||
orderDetail.setDiscountServiceAmount(discountServiceAmount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryPaymentByOrderNoTest() {
|
||||
String orderNo = "C88850447008_20240415083226";
|
||||
|
||||
Reference in New Issue
Block a user