From a85ab71180fdcb02b3cae304ebc96bb2ca12423c Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 01 十一月 2024 17:24:14 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserServiceImpl.java | 13 + ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/CodeController.java | 4 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 39 ++- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java | 6 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java | 18 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 9 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java | 5 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java | 5 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java | 40 ++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java | 12 + ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 121 +++++++---- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java | 5 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java | 7 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 23 + ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 60 +++++ ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileNotificationServiceImpl.java | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java | 4 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java | 63 ++--- ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml | 5 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java | 4 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java | 4 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java | 8 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml | 1 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java | 68 ++++++ ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java | 11 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml | 4 34 files changed, 412 insertions(+), 155 deletions(-) diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java index 81b5024..39343ad 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/model/TParkingRecord.java @@ -123,5 +123,7 @@ @TableField("serialnumber") private String serialnumber; + @TableField(exist = false) + private String parkName; } diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java index 7507994..37afe31 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/vo/SiteInfoVO.java @@ -27,7 +27,7 @@ @ApiModelProperty(value = "开通会员预计可省") private BigDecimal money; @ApiModelProperty(value = "额外赠送优惠券X张") - private Integer couponCount; + private Integer couponCount = 0; @ApiModelProperty(value = "超时占位费说明") private String spaceChargeExplain; @ApiModelProperty(value = "添加车辆最高可得积分 车辆信息为空 展示提示语") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java index 20929f8..19ec997 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java @@ -46,6 +46,12 @@ } @Override + public R<Integer> getSalesCountByGoodsIdgetCount(Integer goodId, Integer goodeType, Integer buyType) { + return null; + } + + + @Override public R<List<String>> getCodeByOrderId(String goodsIds) { return R.fail("根据订单ids查询现金购买优惠券订单编号:" + cause.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java index 210327e..02994b0 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java @@ -28,6 +28,8 @@ public R managementGiveVip(@RequestBody TGrantVip grantVip); @GetMapping("/t-exchange-order/getSalesCountByGoodsIds/{goodsIds}") R<List<Integer>> getSalesCountByGoodsId(@PathVariable("goodsIds") String goodsIds); + @GetMapping("/t-exchange-order/getCount") + R<Integer> getSalesCountByGoodsIdgetCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType); /** * 管理后台 根据t_app_coupon订单购买或者兑换优惠券的订单编号 diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java index ebe7621..5a99b2a 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TCoupon.java @@ -122,6 +122,10 @@ @TableField(exist = false) private Integer useCount; + @ApiModelProperty(value = "销量") + @TableField(exist = false) + private Integer salesCount; + } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java index 275a7ff..7326756 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java @@ -10,6 +10,8 @@ import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; +import java.util.List; + /** * 会员服务降级处理 * @@ -41,6 +43,11 @@ } @Override + public R<List<TVip>> getVipList() { + return R.fail("查询会员集合失败:" + throwable.getMessage()); + } + + @Override public R<TVip> getInfo1(Integer id) { return R.fail("根据会员id 获取会员信息:" + throwable.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java index e958ad7..c0a07e8 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; + /** * 会员服务 * @author ruoyi @@ -41,4 +43,7 @@ @PostMapping(value = "/t-app-user/user/give/vip") R giveVip(@RequestBody GiveVipDto giveVipDto); + + @GetMapping(value = "/vip/getVipList") + R<List<TVip>> getVipList(); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserServiceImpl.java index da2a033..879ca16 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserServiceImpl.java @@ -46,17 +46,18 @@ TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) .eq(TAppUser::getPhone, appletUserDecodeData.getPhoneNumber()) .isNull(TAppUser::getWxOpenid) + .eq(TAppUser::getStatus,1) .last("LIMIT 1")); if(Objects.isNull(appUser)){ // 先使用openId和当前手机号进行查询 appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) .eq(TAppUser::getWxOpenid, appletUserDecodeData.getOpenId()) .eq(TAppUser::getPhone, appletUserDecodeData.getPhoneNumber()) + .eq(TAppUser::getStatus,1) .last("LIMIT 1")); if(Objects.isNull(appUser)){ appUser = new TAppUser(); appUser.setPhone(appletUserDecodeData.getPhoneNumber()); - appUser.setInviteUserId(inviteUserId); } } if(Objects.nonNull(appUser.getStatus())){ @@ -71,7 +72,9 @@ break; } } - + if(Objects.nonNull(inviteUserId)){ + appUser.setInviteUserId(inviteUserId); + } appUser.setAvatar(StringUtils.hasLength(appUser.getAvatar())?appUser.getAvatar():"http://221.182.45.100:8090/2024-10-26/logo.png"); appUser.setName(StringUtils.hasLength(appUser.getName())?appUser.getName():RptUtils.around(appletUserDecodeData.getPhoneNumber(),3,4)); appUser.setCity(appletUserDecodeData.getCity()); @@ -90,17 +93,18 @@ TAppUser appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) .eq(TAppUser::getPhone, phone) .isNull(TAppUser::getAliOpenid) + .eq(TAppUser::getStatus,1) .last("LIMIT 1")); if(Objects.isNull(appUser)){ // 先使用openId和当前手机号进行查询 appUser = this.getOne(Wrappers.lambdaQuery(TAppUser.class) .eq(TAppUser::getAliOpenid, response.getOpenId()) .eq(TAppUser::getPhone, phone) + .eq(TAppUser::getStatus,1) .last("LIMIT 1")); if(Objects.isNull(appUser)){ appUser = new TAppUser(); appUser.setPhone(phone); - appUser.setInviteUserId(inviteUserId); } } if(Objects.nonNull(appUser.getStatus())){ @@ -115,6 +119,9 @@ break; } } + if(Objects.nonNull(inviteUserId)){ + appUser.setInviteUserId(inviteUserId); + } appUser.setAliOpenid(response.getOpenId()); appUser.setAvatar(StringUtils.hasLength(appUser.getAvatar())?appUser.getAvatar():"http://221.182.45.100:8090/2024-10-26/logo.png"); appUser.setName(StringUtils.hasLength(appUser.getName())?appUser.getName():RptUtils.around(phone,3,4)); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/CodeController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/CodeController.java index 8a7e076..3a24689 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/CodeController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/CodeController.java @@ -51,7 +51,7 @@ String reqStr = MsgUtil.codeMsg(phone, code); String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); // 记录短信发送 - chargingPileNotificationService.saveData(1,null,null,phone,"验证码:"+code+",用于更换手机号。请勿转发。"); + chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于更换手机号。请勿转发。"); return AjaxResult.success(result); } @@ -70,7 +70,7 @@ String reqStr = MsgUtil.applyCodeMsg(phone, code); String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); // 记录短信发送 - chargingPileNotificationService.saveData(1,null,null,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); + chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); return AjaxResult.success(result); } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java index 171a350..1a0fb15 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java @@ -1,10 +1,16 @@ package com.ruoyi.chargingPile.controller; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.feignClient.ParkingLotClient; import com.ruoyi.chargingPile.api.model.*; @@ -41,6 +47,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -100,7 +107,8 @@ private TokenService tokenService; @Resource private AppUserClient appUserClient; - + @Resource + private AppUserVipDetailClient vipDetailClient; /** * 根据站点id 查询所有充电桩 @@ -132,23 +140,26 @@ if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); - if(null != byId1.getDiscount()){ - siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); - }else{ - // 获取当前登录用户id - Long userId = tokenService.getLoginUserApplet().getUserId(); - // 根据id查询用户信息 - TAppUser appUser = appUserClient.getUserById(userId).getData(); - if(Objects.nonNull(appUser)){ - TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); - if(Objects.nonNull(vip) && vip.getType() == 2){ - siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); - }else { - siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); - } + // 获取当前登录用户id + Long userId = tokenService.getLoginUserApplet().getUserId(); + // 根据id查询用户信息 + TAppUser appUser = appUserClient.getUserById(userId).getData(); + if(Objects.nonNull(appUser)){ +// 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){ + siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); }else { - siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); + siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); } + }else { + siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); } } } @@ -177,25 +188,40 @@ if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); - if(null != byId1.getDiscount()){ - siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); - }else{ - // 获取当前登录用户id - Long userId = tokenService.getLoginUserApplet().getUserId(); - // 根据id查询用户信息 - TAppUser appUser = appUserClient.getUserById(userId).getData(); - if(Objects.nonNull(appUser)){ - TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); - if(Objects.nonNull(vip) && vip.getType() == 2){ - siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); - }else { - siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); - } - }else { - siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); + // 获取当前登录用户id + Long userId = tokenService.getLoginUserApplet().getUserId(); + // 根据id查询用户信息 + TAppUser appUser = appUserClient.getUserById(userId).getData(); + if(Objects.nonNull(appUser)){ +// 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){ + siteInfoVO.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(tAccountingStrategyDetail.getServiceCharge()).add(tAccountingStrategyDetail.getElectrovalence())); + }else{ + siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); } + }else { + siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); } } + } + List<TVip> vips = vipClient.getVipList().getData(); + if(!CollectionUtils.isEmpty(vips)){ + TVip tVip = vips.get(0); + JSONArray objects = JSONArray.parseArray(tVip.getCoupon()); + Integer num = 0; + for (Object object : objects) { + JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); + Integer number1 = jsonObject.getInteger("number"); + num += number1; + } + siteInfoVO.setCouponCount(num); } siteInfoVO.setChargingPileId(one.getId()); siteInfoVO.setName(byId.getName()); @@ -229,17 +255,22 @@ siteList.setPageSize(99999); PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); for (GetSiteListDTO record : list.getRecords()) { - Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); + List<Integer> c1 = new ArrayList<>(); + c1.add(3); + c1.add(4); + c1.add(5); + c1.add(6); + Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count(); record.setC1(count); - Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count(); + Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 1).count(); record.setC2(count1); - Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); + Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); record.setK1(count2); - Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); + Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 2).count(); record.setK2(count3); - Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); + Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); record.setM1(count4); - Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); + Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getSiteId, record.getId()).eq(TChargingGun::getChargeMode, 3).count(); record.setM2(count5); //利用率 @@ -295,14 +326,7 @@ @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"}) public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){ - if (chargingPercentProvinceDto.getDate1()==null){ - LocalDate today = LocalDate.now(); - LocalDate lastMonth = today.minusMonths(1); - LocalDate firstDayOfLastMonth = lastMonth.withDayOfMonth(1); - LocalDate lastDayOfLastMonth =lastMonth.withDayOfMonth(lastMonth.lengthOfMonth()); - chargingPercentProvinceDto.setDate1(firstDayOfLastMonth); - chargingPercentProvinceDto.setDate2(lastDayOfLastMonth); - } + @@ -316,6 +340,9 @@ List<GetSiteListDTO> records = siteService.getSiteList(siteList).getRecords(); List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList()); // 通过时间段获取和充电桩id获取各个充电站的充电订单 + if (chargingPercentProvinceDto.getDate1().equals(chargingPercentProvinceDto.getDate2())){ + chargingPercentProvinceDto.setDate2(chargingPercentProvinceDto.getDate1().plusDays(1)); + } List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData(); // 计算利用率展示 for (ChargingOrderGroup datum : data) { @@ -325,7 +352,7 @@ bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower()); } - long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()) + 1; + long daysBetween = ChronoUnit.DAYS.between(chargingPercentProvinceDto.getDate1(), chargingPercentProvinceDto.getDate2()); BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")).multiply(BigDecimal.valueOf(daysBetween)); //得到利用率 BigDecimal divide = datum.getChargingCapacity().divide(multiply, 0, BigDecimal.ROUND_HALF_UP); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java index 15341dd..5661ba5 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java @@ -191,7 +191,10 @@ dto.setAuditStatus(1); accountingStrategyService.updateById(dto); // 添加明细 - dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); + dto.getAccountingStrategyDetails().forEach(detail -> { + detail.setAccountingStrategyId(dto.getId()); + detail.setId(null); + }); accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java index 8c9284b..5d91a4c 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java @@ -70,7 +70,11 @@ .page(Page.of(query.getPageCurr(), query.getPageSize())); for (TParkingRecord record : page.getRecords()) { + TParkingLot byId = parkingLotService.getById(record.getParkingLotId()); record.setUid(record.getId().toString()); + if (byId!=null) { + record.setParkName(byId.getName()); + } } return R.ok(page); } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java index 57d3f7e..ec6ab63 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java @@ -1,9 +1,13 @@ package com.ruoyi.chargingPile.service.impl; +import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.model.Site; import com.ruoyi.chargingPile.api.model.TAccountingStrategy; import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; @@ -15,6 +19,7 @@ import com.ruoyi.chargingPile.service.ISiteService; import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; import com.ruoyi.chargingPile.service.TChargingGunService; +import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.security.service.TokenService; @@ -52,6 +57,8 @@ private TChargingGunService chargingGunService; @Autowired private AppUserClient appUserClient; + @Resource + private AppUserVipDetailClient vipDetailClient; @Override public List<TAccountingStrategyDetailVO> queryAccountingStrategyDetailByStrategyId(Integer strategyId) { return this.baseMapper.queryAccountingStrategyDetailByStrategyId(strategyId); @@ -72,7 +79,16 @@ TAppUser appUser = appUserClient.getUserById(userId).getData(); if(Objects.nonNull(appUser)){ // 查询会员信息 - 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); + TAccountingStrategyDetailVO accountingStrategyDetailVO; TAccountingStrategyDetailVO accountingStrategyDetailNext; // 获取当前时间段的计费策略明细 diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java index 29d8c4a..2077b20 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyServiceImpl.java @@ -12,6 +12,7 @@ import com.ruoyi.other.api.feignClient.OtherClient; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -58,7 +59,11 @@ .sorted(Comparator.comparing(TAccountingStrategy::getCreateTime).reversed()).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(accountingStrategies)){ TAccountingStrategy tAccountingStrategy = accountingStrategies.get(0); - tAccountingStrategyVO.setAuditStatus(tAccountingStrategy.getAuditStatus()); + if(tAccountingStrategyVO.getAuditStatus() == 4){ + BeanUtils.copyProperties(tAccountingStrategy,tAccountingStrategyVO); + }else { + tAccountingStrategyVO.setAuditStatus(tAccountingStrategy.getAuditStatus()); + } } } pageInfo.setRecords(list); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileNotificationServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileNotificationServiceImpl.java index 008af82..67f62d0 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileNotificationServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileNotificationServiceImpl.java @@ -94,7 +94,12 @@ @Override public void saveData(Integer type,Integer siteId,Integer chargingPileId, String phone, String data) { - this.baseMapper.saveData(siteId,chargingPileId,phone,data); + TChargingPileNotification notification = new TChargingPileNotification(); + notification.setSiteId(siteId); + notification.setChargingPileId(chargingPileId); + notification.setPhone(phone); + notification.setContent(data); + this.save(notification); } } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java index 6095b18..59484da 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java @@ -24,6 +24,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.utils.SecurityUtils; @@ -576,6 +577,13 @@ } } } + //test +// if (status==1||status==7){ +// TFaultMessage one = faultMessageService.lambdaQuery().eq(TFaultMessage::getChargingGunId, gunMonitoring.getId()).orderByDesc(TFaultMessage::getCreateTime).last("limit 1").one(); +// if (one!=null) { +// gunMonitoring.setFaultCause(one.getContent()); +// } +// } } return pageInfo.setRecords(chargingGunMonitoring); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java index dba6fe2..e08be7f 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java @@ -3,6 +3,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.account.api.feignClient.AppUserCarClient; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.TAppUser; @@ -23,10 +24,10 @@ import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.service.TokenService; +import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; import com.ruoyi.order.api.dto.SettlementConfirmAdd; -import com.ruoyi.order.api.model.ChargingListQuery; -import com.ruoyi.order.api.model.TChargingOrder; -import com.ruoyi.order.api.model.TSettlementConfirm; +import com.ruoyi.order.api.model.*; import com.ruoyi.order.api.query.SettlementListQuery; import com.ruoyi.order.api.query.TOrderInvoiceQuery; import com.ruoyi.order.api.vo.ChargingOrderListVO; @@ -37,12 +38,15 @@ import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.order.api.vo.ChargingOrderTimeVO; import com.ruoyi.order.service.*; +import com.ruoyi.other.api.domain.TVip; +import com.ruoyi.other.api.feignClient.VipClient; import com.ruoyi.payment.api.feignClient.AliPaymentClient; import com.ruoyi.payment.api.feignClient.WxPaymentClient; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.poi.ss.usermodel.Workbook; +import org.omg.CORBA.PRIVATE_MEMBER; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -52,6 +56,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigDecimal; +import java.math.RoundingMode; import java.net.URLEncoder; import java.time.format.DateTimeFormatter; import java.util.ArrayList; @@ -75,6 +80,8 @@ private TChargingOrderService chargingOrderService; @Resource private TSettlementConfirmService tSettlementConfirmService; + @Resource + private VipClient vipClient; @PostMapping(value = "/chargingList") @ApiOperation(value = "充电时段统计列表", tags = {"管理后台-财务结算"}) public AjaxResult<ChargingOrderTimeVO> chargingList(@RequestBody ChargingListQuery dto) { @@ -95,6 +102,13 @@ private ChargingGunClient chargingGunClient; @Autowired private AppUserCarClient appUserCarClient; + @Resource + private AccountingStrategyOrderService accountingStrategyOrderService; + @Resource + private TChargingOrderAccountingStrategyService tChargingOrderAccountingStrategyService; + @Resource + private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; + @ApiOperation(value = "充电时段统计-导出", tags = {"管理后台-财务结算"}) @PutMapping("/export") public void export(@RequestBody ChargingListQuery dto) { @@ -125,7 +139,13 @@ tChargingOrderExport.setId(i); tChargingOrderExport.setCode(chargingOrderListVO.getCode()); tChargingOrderExport.setTerminalName(chargingOrderListVO.getTerminalName()); -// tChargingOrderExport.setName(); + // 查询这笔订单的计费策略名称 + List<AccountingStrategyOrder> list = accountingStrategyOrderService.lambdaQuery() + .eq(AccountingStrategyOrder::getChargingOrderId, chargingOrderListVO.getId()) + .list(); + if (!list.isEmpty()){ + tChargingOrderExport.setName(list.get(0).getName()); + } tChargingOrderExport.setOrderClassification("1"); tChargingOrderExport.setStartType("扫码"); tChargingOrderExport.setOne("小程序"); @@ -143,16 +163,48 @@ tChargingOrderExport.setServiceCharge(chargingOrderListVO.getServiceCharge()+""); tChargingOrderExport.setTotal(chargingOrderListVO.getPaymentAmount()+""); tChargingOrderExport.setChargingCapacity(chargingOrderListVO.getElectricity()+""); -// tChargingOrderExport.setElectrovalencePrice(); -// tChargingOrderExport.setServiceChargePrice(); -// tChargingOrderExport.setServiceChargePriceLook(); -// tChargingOrderExport.setCumulativeChargingTime(); + List<TChargingOrderAccountingStrategy> stageCost = tChargingOrderAccountingStrategyService.list( + new LambdaQueryWrapper<TChargingOrderAccountingStrategy>() + .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrderListVO.getId())); + if (!stageCost.isEmpty()){ + // 累加时段电费单价 取平均值 + BigDecimal bigDecimal1 = new BigDecimal("0"); + BigDecimal bigDecimal2 = new BigDecimal("0"); + BigDecimal bigDecimal3 = new BigDecimal("0"); + BigDecimal size = new BigDecimal(stageCost.size()); + + for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : stageCost) { + bigDecimal1 = bigDecimal1.add(tChargingOrderAccountingStrategy.getElectrovalence()); + bigDecimal2 = bigDecimal2.add(tChargingOrderAccountingStrategy.getPeriodServicePrice()); + bigDecimal3 = bigDecimal3.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); + } + BigDecimal divide1 = bigDecimal1.divide(size, 2, RoundingMode.HALF_DOWN); + BigDecimal divide2 = bigDecimal2.divide(size, 2, RoundingMode.HALF_DOWN); + BigDecimal divide3 = bigDecimal3.divide(size, 2, RoundingMode.HALF_DOWN); + tChargingOrderExport.setElectrovalencePrice(divide1+""); + tChargingOrderExport.setServiceChargePrice(divide2+""); + tChargingOrderExport.setServiceChargePriceLook(divide3+""); + } + // 获取充电时间 + UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderListVO.getCode()).getData(); + if (data5!=null){ + if (data5.getTime_remaining()!=null){ + tChargingOrderExport.setCumulativeChargingTime(data5.getCumulative_charging_time()+""); + } + } tChargingOrderExport.setStartSoc(chargingOrderListVO.getStartSoc()); tChargingOrderExport.setEndtSoc(chargingOrderListVO.getEndSoc()); tChargingOrderExport.setIsSoc("否"); tChargingOrderExport.setIsSocType(""); tChargingOrderExport.setIsSocNum("0"); tChargingOrderExport.setUserType("普通个人用户"); + TAppUser data2 = appUserClient.getUserById(chargingOrderListVO.getAppUserId()).getData(); + if (data2!=null&&data2.getVipId()!=null){ + TVip data1 = vipClient.getInfo1(data2.getVipId()).getData(); + if (data1!=null){ + tChargingOrderExport.setVipType(data1.getName()); + } + } // tChargingOrderExport.setVipType(); tChargingOrderExport.setIsPlus(chargingOrderListVO.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0?"是":"否"); if (data3!=null){ diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index efc6208..fe828dd 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -365,17 +365,17 @@ } } // 时段总服务费 - BigDecimal bigDecimal = new BigDecimal("0"); List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list(); - + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) { + String format = tChargingOrderAccountingStrategy.getCreateTime().format(formatter); + tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime()); + tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime()); if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); tChargingOrderAccountingStrategy.setVipDiscount(multiply); } - bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); - if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); @@ -1125,6 +1125,8 @@ } else { siteIds.add(statisticsQueryDto.getSiteId()); } + + List<Map<String,Object>> maps1 = chargingOrderService.queryPower(siteIds); @@ -1186,6 +1188,8 @@ tCharingUserMapVO.setMap(charMap); tCharingUserMapVO.setMap1(charMap1); }else { + + List<Map<String,Object>> map = chargingOrderService.usersByQuery(statisticsQueryDto); @@ -1328,7 +1332,7 @@ List<Map<String,Object>> badTop = orderEvaluateService.badTop(siteIds); //流量分析 - List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds); + List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds,statisticsQueryDto); tCharingUserEvaluateVO.setGoodTop(goodTop); tCharingUserEvaluateVO.setBadTop(badTop); tCharingUserEvaluateVO.setFlow(sourceMap); @@ -1353,8 +1357,48 @@ } //直流可用率 List<Map<String,Object>> equipmentMap1 = chargingOrderService.equipmentUserType1(siteIds,statisticsQueryDto); + for (Map<String, Object> result : equipmentMap1) { + Object percentObj = result.get("percent"); + if (percentObj instanceof String) { + try { + BigDecimal percent = new BigDecimal((String) percentObj); + if (percent.compareTo(BigDecimal.ZERO) < 0) { + result.put("percent", percent.negate().toString()); + } + } catch (NumberFormatException e) { + // 处理转换异常 + result.put("percent", BigDecimal.ZERO); // 或者其他默认值 + } + } else if (percentObj instanceof BigDecimal) { + BigDecimal percent = (BigDecimal) percentObj; + if (percent.compareTo(BigDecimal.ZERO) < 0) { + result.put("percent", percent.negate().toString()); + } + } + } + //交流可用率 List<Map<String,Object>> equipmentMap2= chargingOrderService.equipmentUserType2(siteIds,statisticsQueryDto); + + for (Map<String, Object> result : equipmentMap2) { + Object percentObj = result.get("percent"); + if (percentObj instanceof String) { + try { + BigDecimal percent = new BigDecimal((String) percentObj); + if (percent.compareTo(BigDecimal.ZERO) < 0) { + result.put("percent", percent.negate().toString()); + } + } catch (NumberFormatException e) { + // 处理转换异常 + result.put("percent", BigDecimal.ZERO); // 或者其他默认值 + } + } else if (percentObj instanceof BigDecimal) { + BigDecimal percent = (BigDecimal) percentObj; + if (percent.compareTo(BigDecimal.ZERO) < 0) { + result.put("percent", percent.negate().toString()); + } + } + } //取出直流可用率和交流可用率的percent的平均值保留两位小数 @@ -1455,7 +1499,7 @@ - List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).ge( TChargingOrder::getCreateTime,min).le(BasePojo::getCreateTime,max).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list(); + List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).ge( TChargingOrder::getCreateTime,min).le(BasePojo::getCreateTime,max).eq(TChargingOrder::getStatus,5).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list(); //当日的订单总数 int size = list.size(); //计算list中paymentAmount的总和 @@ -1805,8 +1849,8 @@ EndOfChargePageInfo endOfChargePageInfo = chargingOrderService.getEndOfChargePageInfo(id); return AjaxResult.success(endOfChargePageInfo); } - - + + /** * 获取订单数据 * @param order diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java index e179dab..7d688c5 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TExchangeOrderController.java @@ -237,6 +237,46 @@ } return R.ok(res); } + + @GetMapping("/getCount") + public R<Integer> getCount(@RequestParam("goodId") Integer goodId,@RequestParam("goodeType")Integer goodeType,@RequestParam("buyType")Integer buyType){ + if (buyType==1){ + //现金 + if (goodeType==1){ + //商品 + Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() + .eq("order_type",1) + .eq("goods_id", goodId) + .isNull("refund_status")) + .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + }else { + //优惠券 + Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() + .eq("order_type",2) + .eq("coupon_id", goodId) + .isNull("refund_status")) + .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + } + + }else { + //兑换 + if (goodeType==1){ + Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1) + .ne("status",4).eq("goods_id", goodId)) + .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + }else { + Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",2) + .ne("status",4).eq("coupon_id", goodId)) + .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); + return R.ok(reduce); + } + } + + + } /** * 管理后台 根据t_app_coupon订单ids查询优惠券的订单编号 * @param goodsIds 订单号-商品类型 diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java index 00bbda4..1db4d3a 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java @@ -48,8 +48,8 @@ @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价标签及数量查询") @GetMapping(value = "/getTagCount") - public AjaxResult<List<TEvaluationTagVO>> getTagCount() { - return AjaxResult.ok(orderEvaluateService.getTagCount()); + public AjaxResult<List<TEvaluationTagVO>> getTagCount(@RequestParam(value = "siteId")@ApiParam(value = "站点id")Integer siteId) { + return AjaxResult.ok(orderEvaluateService.getTagCount(siteId)); } @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价分页列表查询") diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java index a1649f7..f7268d3 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java @@ -191,7 +191,7 @@ // todo 根据支付方式 取消订单 byId.setCancellationId(userid); byId.setCancellationTime(LocalDateTime.now()); - byId.setStatus(4); + byId.setStatus(5); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); TShoppingOrderRefund tShoppingOrderRefund = new TShoppingOrderRefund(); tShoppingOrderRefund.setPayTime(byId.getPayTime()); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java index ee99d41..a1322f4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java @@ -110,7 +110,7 @@ List<Map<String, Object>> getLevelEvaluate(@Param("siteIds")List<Integer> siteIds); - List<Map<String, Object>> countBySource(@Param("siteIds")List<Integer> siteIds); + List<Map<String, Object>> countBySource(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> equipmentUserType1(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java index c6ed1b2..13f6333 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java @@ -232,7 +232,7 @@ SettlementTotalVO settlementTotal(String time); - List<Map<String, Object>> countBySource(List<Integer> siteIds); + List<Map<String, Object>> countBySource(List<Integer> siteIds,ChargingStatisticsQueryDto statisticsQueryDto); List<Map<String, Object>> equipmentUserType1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java index 8444a5b..e95295d 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java @@ -31,7 +31,7 @@ * 获取评价标签 * @return */ - List<TEvaluationTagVO> getTagCount(); + List<TEvaluationTagVO> getTagCount(Integer siteId); /** * 充电订单评价分页列表查询 diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java index bb69665..f8ebd3d 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java @@ -101,6 +101,9 @@ BigDecimal refundAmount = new BigDecimal("0"); int orderCount = 0; for (ChargingBillListVO chargingBillListVO : list) { + if (chargingBillListVO.getType()==2){ + continue; + } String temp = ""; String temp1 = ""; switch (chargingBillListVO.getType()){ @@ -250,10 +253,10 @@ } if (data3!=null)tChargingOrder.setUserName(data3.getName()); // 累加实收金额 支付结算金额 - if (tChargingOrder.getOrderAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); + if (tChargingOrder.getChargeAmount()!=null){ + paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); } - // 入账金额 + // 总金额 if (tChargingOrder.getOrderAmount()!=null){ orderAmount = orderAmount.add(tChargingOrder.getOrderAmount()); } @@ -264,7 +267,9 @@ List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { - refundAmount = refundAmount.add(tChargingOrderRefund.getRefundTotalAmount()); + if (tChargingOrderRefund.getRefundStatus()==2){ + refundAmount = refundAmount.add(tChargingOrderRefund.getRefundTotalAmount()); + } } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -272,7 +277,7 @@ } // 累加平台手续费 if (tChargingOrder.getOrderAmount()!=null){ - commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006))); + commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); } // 累加平台分佣 if (tChargingOrder.getSharingAmount()!=null){ @@ -295,18 +300,17 @@ chargingBillVO.setPaymentAmount(BigDecimal.ZERO); } - chargingBillVO.setOrderAmount(chargingBillVO.getPaymentAmount().subtract(chargingBillVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillVO.getRefundAmount()) - .subtract(chargingBillVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillVO.getCommissionAmount()) - .subtract(chargingBillVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillVO.getSharingAmount())); - chargingBillListVO.setPaymentAmount(paymentAmount == null?BigDecimal.ZERO:paymentAmount); - chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount.subtract(refundAmount).subtract(commissionAmount).subtract(sharingAmount)); + chargingBillListVO.setOrderAmount(chargingBillVO.getPaymentAmount().subtract(chargingBillVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillVO.getRefundAmount())); + chargingBillListVO.setPaymentAmount(paymentAmount); + chargingBillListVO.setOrderAmount(orderAmount == null?BigDecimal.ZERO:orderAmount.subtract(sharingAmount).subtract(commissionAmount)); chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:refundAmount); chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); chargingBillListVO.setServiceCharge(serviceCharge == null?BigDecimal.ZERO:serviceCharge); chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount); chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity); - chargingBillListVO.setBillMoney(chargingBillListVO.getPaymentAmount().subtract(chargingBillListVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillListVO.getRefundAmount()) + chargingBillListVO.setBillMoney(chargingBillListVO.getPaymentAmount().subtract(chargingBillListVO.getRefundAmount()==null?BigDecimal.ZERO:chargingBillListVO.getRefundAmount() + .subtract(commissionAmount).subtract(sharingAmount)) .subtract(chargingBillListVO.getCommissionAmount()==null?BigDecimal.ZERO:chargingBillListVO.getCommissionAmount()) .subtract(chargingBillListVO.getSharingAmount()==null?BigDecimal.ZERO:chargingBillListVO.getSharingAmount())); switch (chargingBillListVO.getType()){ @@ -359,11 +363,8 @@ chargingBillVO.setCategory(""); chargingBillVO.setExportList(tChargingOrders); for (TChargingOrder tChargingOrder : tChargingOrders) { - if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ - paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); - - }else if (tChargingOrder.getPaymentAmount()!=null){ - paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); + if (tChargingOrder.getOrderAmount()!=null){ + paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getChargeAmount()); } // 累加订单金额 @@ -377,7 +378,7 @@ List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()) .eq(TChargingOrderRefund::getRefundStatus, 2).list(); for (TChargingOrderRefund tChargingOrderRefund : list2) { - refundAmountTotal =refundAmountTotal.add(tChargingOrder.getRefundAmount()); + refundAmountTotal =refundAmountTotal.add(tChargingOrderRefund.getRefundAmount()); } // 累加累计服务费 if (tChargingOrder.getServiceCharge()!=null){ @@ -407,7 +408,7 @@ } chargingBillVO.setChargingCapacity(chargingCapacityTotal); chargingBillVO.setPaymentAmount(paymentAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); - chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setOrderAmount(paymentAmountTotal.subtract(refundAmountTotal).subtract(commissionAmountTotal).subtract(sharingAmountTotal)); chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setOrderCount(orderCount); @@ -577,8 +578,8 @@ tChargingOrder.setDiscount(tChargingOrder.getCouponDiscountAmount()!=null?tChargingOrder.getCouponDiscountAmount().toString():"0"); UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(tChargingOrder.getCode()).getData(); if (data5!=null){ - if (data5.getTime_remaining()!=null){ - chargingSecond+=data5.getTime_remaining()*60; + if (data5.getCumulative_charging_time()!=null){ + chargingSecond+=data5.getCumulative_charging_time()*60; } Integer cumulativeChargingTime = data5.getCumulative_charging_time(); // 将其转化为xx小时xx分钟xx秒显示 如果是0小时则不展示小时 如果是0分钟则不展示分钟 @@ -610,16 +611,12 @@ } } if (data3!=null)tChargingOrder.setUserName(data3.getName()); - // 累加实收金额 支付金额减去退款金额 - if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); - - }else if (tChargingOrder.getPaymentAmount()!=null){ + if ( tChargingOrder.getPaymentAmount()!=null){ paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); } - // 累加订单金额 + // 总金额 if (tChargingOrder.getOrderAmount()!=null){ - orderAmount = orderAmount.add(tChargingOrder.getOrderAmount()); + orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); } // 累加累计电费 if (tChargingOrder.getElectrovalence()!=null){ @@ -721,18 +718,14 @@ chargingBillListVO.setOrderCount(tChargingOrders.size()); for (TChargingOrder tChargingOrder : tChargingOrders) { // 累加实收金额 支付金额减去退款金额 - if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ - paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); - paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); - - }else if (tChargingOrder.getPaymentAmount()!=null){ + if (tChargingOrder.getPaymentAmount()!=null){ paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); } // 累加订单金额 if (tChargingOrder.getOrderAmount()!=null){ - orderAmount = orderAmount.add(tChargingOrder.getOrderAmount()); - orderAmountTotal = orderAmountTotal.add(tChargingOrder.getOrderAmount()); + orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); + orderAmountTotal = orderAmountTotal.add(tChargingOrder.getPaymentAmount()); } // 累加累计电费 if (tChargingOrder.getElectrovalence()!=null){ @@ -772,7 +765,7 @@ } } chargingBillVO.setChargingCapacity(chargingCapacityTotal); - chargingBillVO.setPaymentAmount(paymentAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); + chargingBillVO.setPaymentAmount(orderAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, RoundingMode.HALF_DOWN)); chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, RoundingMode.HALF_DOWN)); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index e1ec2a8..12127e4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -1209,8 +1209,8 @@ BigDecimal electronicMoney = new BigDecimal("0"); BigDecimal serviceMoney = new BigDecimal("0"); for (ChargingOrderVO chargingOrderVO : list) { - chargingOrderVO.setCommissionAmount(chargingOrderVO.getServiceCharge().multiply(new BigDecimal("0.006"))); - chargingOrderVO.setPlatFormMoney(chargingOrderVO.getServiceCharge().multiply(new BigDecimal("0.006"))); + chargingOrderVO.setCommissionAmount(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); + chargingOrderVO.setPlatFormMoney(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); chargingOrderVO.setUid(chargingOrderVO.getId()+""); TChargingGun data3 = chargingGunClient.getChargingGunById(chargingOrderVO.getChargingGunId()).getData(); TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderVO.getChargingPileId()).getData(); @@ -1402,12 +1402,11 @@ List<ChargingOrderListVO> list = this.baseMapper.chargingList(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); for (ChargingOrderListVO chargingOrderListVO : list) { chargingOrderListVO.setChargingCapacity(chargingOrderListVO.getElectricity()); - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); BigDecimal bigDecimal = new BigDecimal("0.006"); if (chargingOrderListVO.getOrderAmount()!=null){ chargingOrderListVO.setCommissionAmount(chargingOrderListVO.getOrderAmount().multiply(bigDecimal)); } - chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getResidualAmount()==null?chargingOrderListVO.getPaymentAmount():chargingOrderListVO.getPaymentAmount()); + chargingOrderListVO.setPaymentAmount(chargingOrderListVO.getPaymentAmount()); chargingOrderListVO.setUid(chargingOrderListVO.getId()+""); List<Integer> integers = new ArrayList<>(); integers.add(chargingOrderListVO.getSiteId()); @@ -1426,7 +1425,7 @@ UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderListVO.getCode()).getData(); if (data5!=null){ if (data5.getTime_remaining()!=null){ - chargingOrderListVO.setChargingSecond(data5.getTime_remaining()*60L); + chargingOrderListVO.setChargingSecond(data5.getCumulative_charging_time()*60L); } } @@ -1435,8 +1434,8 @@ List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData(); if (data6!=null && !data6.isEmpty()){ // 第一条数据soc为开始 最后一条数据soc为结束soc - chargingOrderListVO.setStartSoc(data6.get(0).getSoc().toString()); - chargingOrderListVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListVO.setEndSoc(data6.get(0).getSoc().toString()); + chargingOrderListVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); } } @@ -1616,9 +1615,7 @@ @Override public ChargingOrderListInfoVO chargingInfo(String uid) { TChargingOrder chargingOrder= this.getById(uid); - ChargingOrderListInfoVO chargingOrderListInfoVO = new ChargingOrderListInfoVO(); - chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); BigDecimal bigDecimal = new BigDecimal("0.006"); if (chargingOrder.getOrderAmount()!=null){ @@ -1667,24 +1664,32 @@ if (uploadRealTimeMonitoringData.getOutput_current()!=null&& uploadRealTimeMonitoringData.getOutput_voltage()!=null){ uploadRealTimeMonitoringData.setPower(uploadRealTimeMonitoringData.getOutput_voltage() - .multiply(uploadRealTimeMonitoringData.getOutput_current())); + .multiply(uploadRealTimeMonitoringData.getOutput_current()).divide(new BigDecimal(1000),2, BigDecimal.ROUND_HALF_UP)); } } if (!data6.isEmpty()){ // 第一条数据soc为开始 最后一条数据soc为结束soc - chargingOrderListInfoVO.setStartSoc(data6.get(0).getSoc().toString()); - chargingOrderListInfoVO.setEndSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListInfoVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); + chargingOrderListInfoVO.setEndSoc(data6.get(0).getSoc().toString()); chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree()); - chargingOrderListInfoVO.setChargingSecond(data6.get(data6.size()-1).getCumulative_charging_time()*60+""); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { uploadRealTimeMonitoringData.setCreateTime(simpleDateFormat.format(uploadRealTimeMonitoringData.getCreate_time())); } } } + chargingOrderListInfoVO.setList(data6); } + // 获取充电时间 + UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); + if (data5!=null){ + if (data5.getTime_remaining()!=null){ + chargingOrderListInfoVO.setChargingSecond(data5.getCumulative_charging_time()*60L+""); + } + } if (chargingOrder.getAppUserCarId()!=null){ List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(chargingOrder.getAppUserCarId())).getData(); @@ -2249,7 +2254,7 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } - if ((tChargingOrder.getRechargeAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ + if ((tChargingOrder.getRechargeAmount().subtract(tChargingOrder.getRefundAmount()).compareTo(payOrderQueryDto.getRefundAmount()))==0){ tChargingOrder.setStatus(5); } @@ -2318,7 +2323,7 @@ if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ return R.fail("退款金额需小于支付金额"); } - if ((tChargingOrder.getPaymentAmount().subtract(payOrderQueryDto.getRefundAmount()).compareTo(tChargingOrder.getPaymentAmount()))==0){ + if ((tChargingOrder.getPaymentAmount().subtract(tChargingOrder.getRefundAmount()).compareTo(payOrderQueryDto.getRefundAmount()))==0){ tChargingOrder.setStatus(5); } @@ -2888,8 +2893,8 @@ } @Override - public List<Map<String, Object>> countBySource(List<Integer> siteIds) { - return this.baseMapper.countBySource(siteIds); + public List<Map<String, Object>> countBySource(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) { + return this.baseMapper.countBySource(siteIds,statisticsQueryDto); } @Override diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java index c9c9f8a..dee224b 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java @@ -131,10 +131,20 @@ @Resource private TOrderEvaluateMapper orderEvaluateMapper; @Override - public List<TEvaluationTagVO> getTagCount() { + public List<TEvaluationTagVO> getTagCount(Integer siteId) { // 查询标签列表 R<List<TEvaluationTagVO>> r = evaluationTagClient.getList(); List<TEvaluationTagVO> tagList = r.getData(); + // 查询站点下的所有订单 + List<TChargingOrder> tChargingOrders = chargingOrderMapper.selectList(Wrappers.lambdaQuery(TChargingOrder.class) + .eq(TChargingOrder::getSiteId, siteId)); + if(CollectionUtils.isEmpty(tChargingOrders)){ + tagList.forEach(e->e.setTagCount(0)); + packageTagCount(0L,"有图",2,tagList); + packageTagCount(0L,"好评",3,tagList); + packageTagCount(0L,"中差评",4,tagList); + return tagList; + } List<Integer> tagIds = tagList.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); // 统计标签使用数量 List<TEvaluationTagVO> counts = orderEvaluateTagMapper.getCountByTagIds(tagIds); diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml index f126021..45f9f74 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml @@ -93,7 +93,7 @@ and t1.status = #{req.status} </if> <if test="req.orderSource != null and req.orderSource != 1 "> - and t1.orderSource = #{req.orderSource} + and t1.order_source = #{req.orderSource} </if> <if test="req.siteId != null "> and t1.site_id = #{req.siteId} @@ -120,8 +120,8 @@ 1 as type, title, `status`, - order_amount, - payment_amount as payment_amount , + recharge_amount as order_amount, + recharge_amount as payment_amount , create_time, end_time, pay_time, @@ -601,10 +601,10 @@ </if> <if test="statisticsQueryDto.dayType ==5"> - AND create_time >= #{statisticsQueryDto.startTime} + AND DATE(create_time) >= #{statisticsQueryDto.startTime} - AND create_time <= #{statisticsQueryDto.endTime} + AND DATE(create_time) <= #{statisticsQueryDto.endTime} </if> @@ -702,10 +702,10 @@ </if> <if test="statisticsQueryDto.dayType ==5"> <if test="statisticsQueryDto.startTime != null"> - AND create_time >= #{statisticsQueryDto.startTime} + AND DATE(create_time) >= #{statisticsQueryDto.startTime} </if> <if test="statisticsQueryDto.endTime != null"> - AND create_time <= #{statisticsQueryDto.endTime} + AND DATE(create_time) <= #{statisticsQueryDto.endTime} </if> </if> GROUP BY @@ -850,7 +850,7 @@ </select> <select id="chargingList" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> - select t1.* ,t1.current as chargingCapacity,t1.recharge_amount as paymentAmount,t1.electricity as chargingCapacity from t_charging_order t1 + select t1.* ,t1.current as chargingCapacity,t1.payment_amount as paymentAmount,t1.electricity as chargingCapacity from t_charging_order t1 where 1=1 <if test="null != req.code and req.code!=''"> and t1.code LIKE CONCAT('%',#{req.code},'%') @@ -940,6 +940,13 @@ #{siteId} </foreach> </if> + <if test="statisticsQueryDto.dayType == 1"> + AND DATE(create_time ) = CURDATE() + </if> + <if test="statisticsQueryDto.dayType != 1"> + and DATE(create_time) >= #{statisticsQueryDto.startTime} + and DATE(create_time) <= #{statisticsQueryDto.endTime} + </if> group by source_name diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml index 75427e3..872f114 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml @@ -84,8 +84,9 @@ select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, create_time, response_time, del_flag from t_order_evaluate - where order_id in - (select order_id + where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} + and order_id in + (select id from t_charging_order where site_id = #{siteId} and del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}) diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml index 31e9d7b..decc40a 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TShoppingOrderMapper.xml @@ -94,7 +94,6 @@ </if> and (t1.vip_discount_amount > 0 or t1.coupon_discount_amount > 0) and t1.recharge_payment_status =2 - and t1.refund_status !=2 AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} </if> </if> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 3ea9ee4..c003b2e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -125,7 +125,7 @@ @GetMapping("/getInfoByType") @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情") - public R getInfoByType(Integer goodType,Integer id) { + public R getInfoByType(Integer goodType,Integer id,Integer type) { if (goodType==1){ TGoods byId = goodsService.getById(id); if (byId==null||byId.getStatus()==2){ @@ -135,7 +135,8 @@ // for (int i = 0; i < list.size(); i++) { // list.get(i).setSalesCount(data.get(i)); // } - + Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(), 1, type).getData(); + byId.setSalesCount(data); return R.ok(byId); } else { @@ -143,7 +144,9 @@ if (byId==null||byId.getStatus()==2){ return R.fail(2,"该商品已不存在"); } - return R.ok(byId); + Integer data = orderClient.getSalesCountByGoodsIdgetCount(byId.getId(),2, type).getData(); + byId.setSalesCount(data); + return R.ok(byId); } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java index 2c4166f..8ebbd2f 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java @@ -93,6 +93,11 @@ return R.ok(vipService.getById(id)); } + @GetMapping(value = "/getVipList") + public R<List<TVip>> getVipList(){ + return R.ok(vipService.lambdaQuery().eq(TVip::getReveal, 1).list()); + } + /** * 远程调用 * @param id diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java index 5f390ad..d5e2f68 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TGoodsServiceImpl.java @@ -78,14 +78,11 @@ pageInfo.setRecords(list); return pageInfo; } - String string = stringBuilder.toString(); - // 订单号加上商品类型 - String res = string+"-"+basePage.getType(); - - List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); - for (int i = 0; i < list.size(); i++) { - list.get(i).setSalesCount(data.get(i)); + for (TGoods tGoods : list) { + Integer data = orderClient.getSalesCountByGoodsIdgetCount(tGoods.getId(), tGoods.getGoodType(), basePage.getType()).getData(); + tGoods.setSalesCount(data); } + pageInfo.setRecords(list); return pageInfo; } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml index c8879ee..4351904 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml @@ -55,13 +55,13 @@ <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> SELECT - id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture + id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture,underlying_sales as underlyingSales FROM t_goods WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type} UNION ALL SELECT - id,name,redeem_points as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture + id,name,redeem_points as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture,0 as underlyingSales FROM t_coupon WHERE `status`= 1 and del_flag = 0 and ways_to_obtain != #{appGoodQuery.type} -- Gitblit v1.7.1