ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TInviteUserServiceImpl.java
@@ -1,16 +1,26 @@ package com.ruoyi.account.service.impl; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserVipDetailClient; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.account.api.model.TAppUserVipDetail; import com.ruoyi.account.api.model.TInviteUser; import com.ruoyi.account.api.vo.GetAppUserVipDetail; import com.ruoyi.account.mapper.TInviteUserMapper; import com.ruoyi.account.service.TAppUserService; import com.ruoyi.account.service.TInviteUserService; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.TIntegralRule; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.api.feignClient.IntegralRuleClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.Objects; /** * <p> @@ -25,9 +35,29 @@ @Autowired private IntegralRuleClient integralRuleClient; @Autowired private TAppUserService appUserService; @Resource private AppUserVipDetailClient vipDetailClient; /** * * @param appUserId 被邀请人 * @param beInvitedAppUserId 邀请人 */ @Override public void saveInviteUser(Long appUserId, Long beInvitedAppUserId) { // 查询用户信息 TAppUser user = appUserService.getById(beInvitedAppUserId); GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); getAppUserVipDetail.setAppUserId(beInvitedAppUserId); getAppUserVipDetail.setVipId(user.getVipId()); R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); TAppUserVipDetail data1 = appUserVipDetail.getData(); String vipJson = data1.getVipJson(); TVip vip = JSON.parseObject(vipJson, TVip.class); // 查询邀请用户获得积分配置 TIntegralRule integralRule = integralRuleClient.getSet().getData(); JSONObject jsonObject = JSONObject.parseObject(integralRule.getInviteUsersToEarnPoints()); @@ -35,7 +65,11 @@ inviteUser.setAppUserId(beInvitedAppUserId); inviteUser.setBeInvitedAppUserId(appUserId); inviteUser.setCreateTime(LocalDateTime.now()); if(Objects.nonNull(vip) && vip.getDoubleIntegration() == 1){ inviteUser.setAward(jsonObject.getInteger("num1")*2); }else { inviteUser.setAward(jsonObject.getInteger("num1")); } this.save(inviteUser); } } ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java
@@ -1,9 +1,13 @@ package com.ruoyi.chargingPile.service.impl; import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.feignClient.AppUserVipDetailClient; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.account.api.model.TAppUserVipDetail; import com.ruoyi.account.api.vo.GetAppUserVipDetail; import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.chargingPile.api.model.TChargingGun; @@ -81,7 +85,8 @@ @Resource private IntegrationClient integrationClient; @Resource private AppUserVipDetailClient vipDetailClient; /** @@ -287,9 +292,9 @@ @Override public PageInfo<SiteVO> pageList(SiteQuery query,Integer isLogin) { TAppUser appUser = null; if(isLogin == 1){ // 获取当前登录用户id Long userId = tokenService.getLoginUserApplet().getUserId(); if(isLogin == 1){ // 根据id查询用户信息 appUser = appUserClient.getUserById(userId).getData(); } @@ -297,7 +302,14 @@ List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ // 查询会员信息 TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); // TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); getAppUserVipDetail.setAppUserId(userId); getAppUserVipDetail.setVipId(appUser.getVipId()); R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); TAppUserVipDetail data1 = appUserVipDetail.getData(); String vipJson = data1.getVipJson(); TVip vip = JSON.parseObject(vipJson, TVip.class); if(Objects.nonNull(vip) && vip.getType() == 2){ list.forEach(item -> { if(Objects.nonNull(vip.getDiscount())){ @@ -387,7 +399,14 @@ List<SiteVO> list = this.baseMapper.getMapSiteList(query); if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ // 查询会员信息 TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); // TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); getAppUserVipDetail.setAppUserId(userId); getAppUserVipDetail.setVipId(appUser.getVipId()); R<TAppUserVipDetail> appUserVipDetail = vipDetailClient.getAppUserVipDetail(getAppUserVipDetail); TAppUserVipDetail data1 = appUserVipDetail.getData(); String vipJson = data1.getVipJson(); TVip vip = JSON.parseObject(vipJson, TVip.class); if(Objects.nonNull(vip) && vip.getType() == 2){ list.forEach(item -> { item.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -1262,8 +1262,19 @@ //车辆用途 List<Map<String, Object>> carMap = chargingOrderService.carUserMethod(); //车辆品牌 List<Map<String, Object>> carBrandMap = chargingOrderService.carUserBrand(); List<String> brands = new ArrayList<>(); for (Map<String, Object> objectMap : carBrandMap) { brands.add(objectMap.get("vehicle_brand").toString()); } Long count = chargingOrderService.countCar(brands); Map<String, Object> others = new HashMap<>(); others.put("vehicle_brand","其他"); others.put("counts",count); carBrandMap.add(others); //本地车数量 Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
@@ -139,4 +139,6 @@ List<Map<String, Object>> needElec1(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); Long countNoTag(); Long countCar(@Param("brands") List<String> brands); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
@@ -277,4 +277,6 @@ * @return */ List<TChargingOrder> getChargingOrder(TChargingOrderVo order); Long countCar(List<String> brands); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -2242,6 +2242,9 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } if ((tChargingOrder.getRechargeAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ tChargingOrder.setStatus(5); } TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); @@ -2308,6 +2311,10 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } if ((tChargingOrder.getPaymentAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ tChargingOrder.setStatus(5); } TShoppingOrderRefund chargingOrderRefund = new TShoppingOrderRefund(); chargingOrderRefund.setShoppingOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); @@ -2358,9 +2365,7 @@ tChargingOrder.setRefundStatus(2); tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); if (payOrderQueryDto.getRefundAmount().compareTo(tChargingOrder.getPaymentAmount())==0){ tChargingOrder.setStatus(5); } shoppingOrderService.updateById(tChargingOrder); shoppingOrderRefundService.save(chargingOrderRefund); @@ -2375,6 +2380,8 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } TVipOrderRefund chargingOrderRefund = new TVipOrderRefund(); chargingOrderRefund.setVipOrderId(tChargingOrder.getId()); chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); @@ -3005,4 +3012,9 @@ } return this.list(queryWrapper.orderByDesc(TChargingOrder::getCreateTime)); } @Override public Long countCar(List<String> brands) { return this.baseMapper.countCar(brands); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java
@@ -187,7 +187,15 @@ break; } } List<Long> appUserIds = list.stream().map(TActivityStatisticslVO::getAppUserId).collect(Collectors.toList()); List<TAppUser> appUsers = appUserClient.getUserByIds(appUserIds).getData(); for (TActivityStatisticslVO tActivityStatisticslVO : list) { TAppUser appUser = appUsers.stream().filter(user -> user.getId().equals(tActivityStatisticslVO.getAppUserId())).findFirst().orElse(null); if(Objects.nonNull(appUser)){ tActivityStatisticslVO.setPhone(appUser.getPhone()); } // 判断享有了哪些类型 switch (tActivityStatisticslVO.getOrderType()){ case 1: ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -126,7 +126,7 @@ end_time, pay_time, refund_status, (order_amount) as final_amount, (recharge_amount-refund_amount) as final_amount, del_flag, app_user_id FROM @@ -372,7 +372,7 @@ </select> <select id="countAll" resultType="java.util.Map"> select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,ROUND(sum(electrovalence+service_charge) * 0.0006, 2) as commission_amount,sum(sharing_amount) as sharing_amount select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,ROUND(sum(electrovalence+service_charge) * 0.006, 2) as commission_amount,sum(sharing_amount) as sharing_amount from t_charging_order where create_time >= #{sixBefore} and del_flag = 0 and recharge_payment_status = 2 </select> @@ -398,7 +398,7 @@ <select id="getDateData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%H:00' ) as time, CAST(SUM(service_charge-coupon_discount_amount) AS DECIMAL(20, 6)) as servicecharge, CAST(SUM(service_charge) AS DECIMAL(20, 6)) as servicecharge, CAST(SUM(charging_capacity) AS DECIMAL(20, 6)) as electrovalence, CAST(SUM(electrovalence) AS DECIMAL(20, 4)) AS paymentAmount, SUM(payment_amount) AS paymoney, @@ -423,7 +423,7 @@ <select id="getWeekData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(service_charge) as servicecharge, SUM(charging_capacity) as electrovalence, SUM(electrovalence) AS paymentAmount, SUM(payment_amount) AS paymoney, @@ -448,7 +448,7 @@ <select id="getMonthData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(service_charge) as servicecharge, SUM(charging_capacity) as electrovalence, SUM(electrovalence) AS paymentAmount, SUM(payment_amount) AS paymoney, @@ -473,7 +473,7 @@ <select id="getYearData" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(service_charge) as servicecharge, SUM(charging_capacity) as electrovalence, SUM(electrovalence) AS paymentAmount, SUM(payment_amount) AS paymoney, @@ -500,7 +500,7 @@ <select id="getByDate" resultType="java.util.Map"> SELECT DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, SUM(service_charge-coupon_discount_amount) as servicecharge, SUM(service_charge) as servicecharge, SUM(charging_capacity) as electrovalence, SUM(electrovalence) AS paymentAmount, SUM(payment_amount) AS paymoney, @@ -629,14 +629,12 @@ SELECT 'today' AS data_type, '1' as type, DATE_FORMAT( create_time, '%Y-%m-%d %H' ) AS time, DATE_FORMAT( create_time, '%H:00' ) AS time, count(DISTINCT app_user_id) AS counts FROM t_charging_order WHERE del_flag = 0 AND recharge_payment_status = 2 AND ISNULL( refund_status ) AND DATE ( create_time ) = CURDATE() GROUP BY time @@ -972,7 +970,7 @@ `charging_pile_order`.`t_charging_order` co LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id WHERE WHERE co.del_flag = 0 and co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type = 4 <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN @@ -1032,7 +1030,7 @@ `charging_pile_order`.`t_charging_order` co LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id WHERE WHERE co.del_flag = 0 and co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type in (2,3) <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN @@ -1254,7 +1252,7 @@ `charging_pile_service`.`t_fault_message` co LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id WHERE co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1 <if test="siteIds != null and siteIds.size() > 0"> and co.site_id IN <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> @@ -1540,4 +1538,13 @@ ) and au.del_flag = 0 </select> <select id="countCar" resultType="java.lang.Long"> select count(1) from charging_pile_account.t_app_user_car where del_flag = 0 and vehicle_brand not in <foreach collection="brands" item="brand" open="(" separator="," close=")"> #{brand} </foreach> </select> </mapper> ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TVipOrderMapper.xml
@@ -78,7 +78,7 @@ </select> <select id="getSumAmout" resultType="java.math.BigDecimal"> SELECT SUM(payment_amount) AS paymentAmount SUM(payment_amount-refund_amount) AS paymentAmount FROM t_vip_order WHERE