Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
| | |
| | | @ApiModelProperty(value = "开通会员预计可省") |
| | | private BigDecimal money; |
| | | @ApiModelProperty(value = "额外赠送优惠券X张") |
| | | private Integer couponCount; |
| | | private Integer couponCount = 0; |
| | | @ApiModelProperty(value = "超时占位费说明") |
| | | private String spaceChargeExplain; |
| | | @ApiModelProperty(value = "添加车辆最高可得积分 车辆信息为空 展示提示语") |
New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.integration.api.feignClient.BmsDemandAndChargerExportationClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class BmsDemandAndChargerExportationFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<BmsDemandAndChargerExportationClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(BmsDemandAndChargerExportationFallbackFactory.class); |
| | | |
| | | @Override |
| | | public BmsDemandAndChargerExportationClient create(Throwable throwable) { |
| | | log.error("调用充电桩实时监测数据失败:{}", throwable.getMessage()); |
| | | return new BmsDemandAndChargerExportationClient() { |
| | | |
| | | @Override |
| | | public R<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { |
| | | return R.fail("获取充电中bms数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.factory.BmsDemandAndChargerExportationFallbackFactory; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/1 16:06 |
| | | */ |
| | | @FeignClient(contextId = "BmsDemandAndChargerExportationClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = BmsDemandAndChargerExportationFallbackFactory.class) |
| | | public interface BmsDemandAndChargerExportationClient { |
| | | |
| | | |
| | | /** |
| | | * 获取充电中bms数据 |
| | | * @param orderCode |
| | | * @return |
| | | */ |
| | | @PostMapping("/bmsDemandAndChargerExportation/getBmsDemandAndChargerExportation") |
| | | R<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(@RequestParam("orderCode") String orderCode); |
| | | |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 会员服务降级处理 |
| | | * |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TVip>> getVipList() { |
| | | return R.fail("查询会员集合失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TVip> getInfo1(Integer id) { |
| | | return R.fail("根据会员id 获取会员信息:" + throwable.getMessage()); |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 会员服务 |
| | | * @author ruoyi |
| | |
| | | |
| | | @PostMapping(value = "/t-app-user/user/give/vip") |
| | | R giveVip(@RequestBody GiveVipDto giveVipDto); |
| | | |
| | | @GetMapping(value = "/vip/getVipList") |
| | | R<List<TVip>> getVipList(); |
| | | } |
| | |
| | | @ApiModelProperty(value = "站点名称") |
| | | @TableField(exist = false) |
| | | private List<String> siteNames; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private Long number; |
| | | |
| | | |
| | | public SysRole() |
| | | { |
| | | |
| | |
| | | this.siteNames = siteNames; |
| | | } |
| | | |
| | | public Long getNumber() { |
| | | return number; |
| | | } |
| | | |
| | | public void setNumber(Long number) { |
| | | this.number = number; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | List<String> collect = sites.stream().map(Site::getName).collect(Collectors.toList()); |
| | | record.setSiteNames(collect); |
| | | } |
| | | long count = sysUserRoleService.count(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getRoleId, record.getRoleId())); |
| | | record.setNumber(count); |
| | | } |
| | | return AjaxResult.success(page); |
| | | } |
| | |
| | | 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())){ |
| | |
| | | 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()); |
| | |
| | | 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())){ |
| | |
| | | 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)); |
| | |
| | | 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()); |
| | | TInviteUser inviteUser = new TInviteUser(); |
| | | inviteUser.setAppUserId(beInvitedAppUserId); |
| | | inviteUser.setBeInvitedAppUserId(appUserId); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | | if(Objects.nonNull(vip) && vip.getDoubleIntegration() == 1){ |
| | | inviteUser.setAward(jsonObject.getInteger("num1")*2); |
| | | if(Objects.nonNull(data1)){ |
| | | String vipJson = data1.getVipJson(); |
| | | TVip vip = JSON.parseObject(vipJson, TVip.class); |
| | | if(Objects.nonNull(vip) && vip.getDoubleIntegration() == 1){ |
| | | inviteUser.setAward(jsonObject.getInteger("num1")*2); |
| | | }else { |
| | | inviteUser.setAward(jsonObject.getInteger("num1")); |
| | | } |
| | | }else { |
| | | inviteUser.setAward(jsonObject.getInteger("num1")); |
| | | } |
| | | inviteUser.setAppUserId(beInvitedAppUserId); |
| | | inviteUser.setBeInvitedAppUserId(appUserId); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | | this.save(inviteUser); |
| | | } |
| | | } |
| | |
| | | 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.*; |
| | |
| | | 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.*; |
| | | |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private AppUserVipDetailClient vipDetailClient; |
| | | |
| | | /** |
| | | * 根据站点id 查询所有充电桩 |
| | |
| | | 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(); |
| | | // 获取当前登录用户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(); |
| | | if(Objects.nonNull(data1)){ |
| | | 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()); |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | }else { |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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(); |
| | | // 获取当前登录用户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(); |
| | | if(Objects.nonNull(data1)){ |
| | | 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()); |
| | | }else{ |
| | | siteInfoVO.setVipElectrovalence((tAccountingStrategyDetail.getServiceCharge().multiply(byId1.getDiscount()).add(tAccountingStrategyDetail.getElectrovalence())).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | }else { |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().add(tAccountingStrategyDetail.getServiceCharge()).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()); |
| | | siteInfoVO.setNumber(one.getNumber().toString()); |
| | |
| | | if(orders.size() > 0){ |
| | | TChargingOrder chargingOrder = orders.get(0); |
| | | TChargingGun tChargingGun1 = new TChargingGun(); |
| | | if(Arrays.asList(1, 2).contains(chargingOrder.getStatus())){ |
| | | if(Arrays.asList(1, 2, 5).contains(chargingOrder.getStatus())){ |
| | | tChargingGun1.setStatus(3); |
| | | } |
| | | if(Arrays.asList(3).contains(chargingOrder.getStatus())){ |
| | |
| | | } |
| | | tChargingGun1.setId(tChargingGun.getId()); |
| | | chargingGunService.updateById(tChargingGun1); |
| | | }else{ |
| | | TChargingGun tChargingGun1 = new TChargingGun(); |
| | | tChargingGun1.setId(tChargingGun.getId()); |
| | | tChargingGun1.setStatus(3); |
| | | chargingGunService.updateById(tChargingGun1); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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())){ |
| | | item.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); |
| | | } |
| | | }); |
| | | if(Objects.nonNull(data1)){ |
| | | 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())){ |
| | | item.setVipElectrovalence(vip.getDiscount().divide(new BigDecimal(10)).multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | |
| | | 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())); |
| | | }); |
| | | if(Objects.nonNull(data1)){ |
| | | 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())); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private TChargingGunService chargingGunService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private AppUserVipDetailClient vipDetailClient; |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryAccountingStrategyDetailByStrategyId(Integer strategyId) { |
| | | return this.baseMapper.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | |
| | | 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(); |
| | | TVip vip = null; |
| | | if(Objects.nonNull(data1)){ |
| | | String vipJson = data1.getVipJson(); |
| | | vip = JSON.parseObject(vipJson, TVip.class); |
| | | } |
| | | |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO; |
| | | TAccountingStrategyDetailVO accountingStrategyDetailNext; |
| | | // 获取当前时间段的计费策略明细 |
| | |
| | | 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; |
| | |
| | | if(status == 5 || status == 6){ |
| | | gunMonitoring.setStatus(3); |
| | | } |
| | | if(status == 4){ |
| | | if(status == 4 || status == 7){ |
| | | Integer id = gunMonitoring.getId(); |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(id).getData(); |
| | | if(null != chargingOrder){ |
| | |
| | | } |
| | | } |
| | | } |
| | | //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); |
| | | } |
| | |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setName(data.getName()); |
| | | parkingRecord.setParkingLotId(data.getId()); |
| | | parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEnterDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getEnterDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-ddTHH:mm:ss.SSSZ")); |
| | | parse.plusDays(8); |
| | | parkingRecord.setInParkingTime(parse); |
| | | parkingRecord.setStatus(1); |
| | | parkingRecord.setCreateTime(LocalDateTime.now()); |
| | | parkingRecord.setSerialnumber(order.getId()); |
| | |
| | | query.setLicensePlate(order.getPlate()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ofPattern("yyyy-MM-ddTHH:mm:ss.SSSZ")); |
| | | parse.plusDays(8); |
| | | parkingRecord.setOutParkingTime(parse); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getReceivable())); |
| | | parkingRecord.setPayment(new BigDecimal(order.getPayment())); |
| | |
| | | TParkingLot data = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setName(data.getName()); |
| | | parkingRecord.setParkingLotId(data.getId()); |
| | | parkingRecord.setInParkingTime(LocalDateTime.parse(order.getEntertime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getEntertime(), DateTimeFormatter.ofPattern("yyyy-MM-ddTHH:mm:ss.SSSZ")); |
| | | parse.plusDays(8); |
| | | parkingRecord.setInParkingTime(parse); |
| | | parkingRecord.setStatus(1); |
| | | parkingRecord.setCreateTime(LocalDateTime.now()); |
| | | parkingRecord.setSerialnumber(order.getId()); |
| | |
| | | query.setLicensePlate(order.getPlatenumber()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.parse(order.getLeavetime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getLeavetime(), DateTimeFormatter.ofPattern("yyyy-MM-ddTHH:mm:ss.SSSZ")); |
| | | parse.plusDays(8); |
| | | parkingRecord.setOutParkingTime(parse); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getMoney())); |
| | | parkingRecord.setPayment(new BigDecimal(order.getMoney())); |
New file |
| | |
| | | package com.ruoyi.integration.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/1 15:52 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/bmsDemandAndChargerExportation") |
| | | public class BmsDemandAndChargerExportationController { |
| | | |
| | | @Resource |
| | | private BmsDemandAndChargerExportationService bmsDemandAndChargerExportationService; |
| | | |
| | | /** |
| | | * 获取充电中bms数据 |
| | | * @param orderCode |
| | | * @return |
| | | */ |
| | | @PostMapping("/getBmsDemandAndChargerExportation") |
| | | public R<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(@RequestParam("orderCode") String orderCode){ |
| | | List<BmsDemandAndChargerExportation> bmsDemandAndChargerExportation = bmsDemandAndChargerExportationService.getBmsDemandAndChargerExportation(orderCode); |
| | | if(bmsDemandAndChargerExportation.size() > 0){ |
| | | BmsDemandAndChargerExportation uploadRealTimeMonitoringData = bmsDemandAndChargerExportation.get(0); |
| | | return R.ok(uploadRealTimeMonitoringData); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BmsDemandAndChargerExportationService extends BaseService<BmsDemandAndChargerExportation> { |
| | | |
| | | |
| | | /** |
| | | * 获取bms数据 |
| | | * @param orderCode |
| | | * @return |
| | | */ |
| | | List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; |
| | | import com.ruoyi.integration.mongodb.service.BmsDemandAndChargerExportationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | public List<BmsDemandAndChargerExportation> findAll() { |
| | | return mongoTemplate.findAll(BmsDemandAndChargerExportation.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { |
| | | Query query = new Query(); |
| | | if(StringUtils.isNotEmpty(orderCode)){ |
| | | query.addCriteria(Criteria.where("transaction_serial_number").is(orderCode)); |
| | | } |
| | | List<BmsDemandAndChargerExportation> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by(Sort.Order.desc("create_time"))) |
| | | , BmsDemandAndChargerExportation.class); |
| | | return uploadRealTimeMonitoringData; |
| | | } |
| | | } |
| | |
| | | payOrderInfoDto.setPayTime(byId.getCreateTime()); |
| | | payOrderInfoDto.setRefundAmount(byId.getRefundAmount()); |
| | | payOrderInfoDto.setRechargeAmount(byId.getRechargeAmount()); |
| | | payOrderInfoDto.setFinalAmount(byId.getRechargeAmount().subtract(byId.getRefundAmount())); |
| | | return R.ok(payOrderInfoDto); |
| | | case 2: |
| | | TShoppingOrder byId1 = shoppingOrderService.getById(orderId); |
| | |
| | | payOrderInfoDto1.setPayTime(byId1.getCreateTime()); |
| | | payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount()); |
| | | payOrderInfoDto1.setRechargeAmount(byId1.getPaymentAmount()); |
| | | payOrderInfoDto1.setFinalAmount(byId1.getPaymentAmount().subtract(byId1.getRefundAmount())); |
| | | return R.ok(payOrderInfoDto1); |
| | | case 3: |
| | | TVipOrder byId2 = vipOrderService.getById(orderId); |
| | |
| | | payOrderInfoDto2.setPayTime(byId2.getCreateTime()); |
| | | payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount()); |
| | | payOrderInfoDto2.setRechargeAmount(byId2.getPaymentAmount()); |
| | | payOrderInfoDto2.setFinalAmount(byId2.getPaymentAmount().subtract(byId2.getRefundAmount())); |
| | | return R.ok(payOrderInfoDto2); |
| | | //todo luo 停车场订单 |
| | | // case 4: |
| | |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | |
| | | |
| | | List<Map<String,Object>> maps1 = chargingOrderService.queryPower(siteIds); |
| | | |
| | | |
| | |
| | | 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); |
| | |
| | | } |
| | | //直流可用率 |
| | | 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的平均值保留两位小数 |
| | | |
| | |
| | | |
| | | |
| | | |
| | | 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的总和 |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @ApiModelProperty("退款金额") |
| | | private BigDecimal refundAmount; |
| | | private BigDecimal rechargeAmount; |
| | | private BigDecimal finalAmount; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | 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); |
| | | |
| | |
| | | |
| | | 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); |
| | | |
| | |
| | | |
| | | @Resource |
| | | private SecurityDetectionClient securityDetectionClient; |
| | | |
| | | @Resource |
| | | private BmsDemandAndChargerExportationClient bmsDemandAndChargerExportationClient; |
| | | |
| | | //计数器 |
| | | private Map<String, Integer> counter_map = new HashMap<>(); |
| | |
| | | appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChange.setOrderCode(chargingOrder.getCode()); |
| | | appUserIntegralChange.setExtension(chargingOrder.getId().toString()); |
| | | appUserIntegralChange.setExtension(appUser.getId().toString()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | |
| | | appUser1.setPoints(appUser1.getPoints() + num1); |
| | |
| | | chargingOrder.setChargingCapacity(query.getCharging_degree()); |
| | | chargingOrder.setElectricity(query.getCharging_degree()); |
| | | chargingOrder.setTotalElectricity(new BigDecimal(100 - query.getSoc())); |
| | | BmsDemandAndChargerExportation data = bmsDemandAndChargerExportationClient.getBmsDemandAndChargerExportation(chargingOrder.getCode()).getData(); |
| | | if(null != data){ |
| | | chargingOrder.setNeedElec(data.getBms_current_requirements()); |
| | | } |
| | | this.updateById(chargingOrder); |
| | | } |
| | | } |
| | |
| | | serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()).setScale(2, RoundingMode.DOWN); |
| | | } |
| | | chargingOrderAccountingStrategy.setChargingCapacity(sharp_peak_charge); |
| | | chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge); |
| | | chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice); |
| | | chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount); |
| | | chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setCreateTime(LocalDateTime.now()); |
| | | chargingOrderAccountingStrategyService.save(chargingOrderAccountingStrategy); |
| | | |
| | | periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc); |
| | | periodServicePrice_total = periodServicePrice_total.add(originalServicePrice); |
| | | total = total.add(electrovalenc.add(originalServicePrice)); |
| | | periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc.setScale(2, RoundingMode.DOWN)); |
| | | periodServicePrice_total = periodServicePrice_total.add(originalServicePrice.setScale(2, RoundingMode.DOWN)); |
| | | total = total.add(electrovalenc.add(originalServicePrice.setScale(2, RoundingMode.DOWN))); |
| | | } |
| | | |
| | | |
| | |
| | | if(null == chargingOrder.getEndMode()){ |
| | | order.setEndMode(1); |
| | | } |
| | | order.setResidualAmount(rechargeAmount.subtract(total)); |
| | | order.setResidualAmount(rechargeAmount.subtract(total).setScale(2, RoundingMode.DOWN)); |
| | | order.setStartTime(LocalDateTime.parse(vo.getStart_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setEndTime(LocalDateTime.parse(vo.getEnd_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setStatus(5); |
| | | order.setOrderAmount(orderAmount); |
| | | order.setVipDiscountAmount(discountAmount); |
| | | order.setElectrovalence(periodElectricPrice_total); |
| | | order.setOrderAmount(orderAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setVipDiscountAmount(discountAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.DOWN)); |
| | | order.setChargingCapacity(vo.getTotal_electricity()); |
| | | order.setElectricity(vo.getTotal_electricity()); |
| | | |
| | |
| | | } |
| | | |
| | | order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.DOWN)); |
| | | order.setPaymentAmount(payAmount); |
| | | order.setRefundAmount(refundAmount); |
| | | order.setPaymentAmount(payAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setRefundAmount(refundAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setRefundStatus(1); |
| | | this.updateById(order); |
| | | chargingOrder = this.getById(order.getId()); |
| | |
| | | BigDecimal periodServicePrice = chargingOrderAccountingStrategy.getPeriodServicePrice(); |
| | | BigDecimal multiply = couponDiscountAmount.multiply(periodServicePrice.divide(reduce, new MathContext(4, RoundingMode.HALF_EVEN))); |
| | | periodServicePrice = periodServicePrice.subtract(multiply); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice); |
| | | chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply.setScale(2, RoundingMode.DOWN)); |
| | | } |
| | | chargingOrderAccountingStrategyService.updateBatchById(list); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @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 |
| | |
| | | if(null != order.getAppUserId()){ |
| | | queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId()); |
| | | } |
| | | if(null != order.getAppUserId()){ |
| | | queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId()); |
| | | } |
| | | if(null != order.getStatusList()){ |
| | | queryWrapper.in(TChargingOrder::getAppUserId, order.getStatusList()); |
| | | queryWrapper.in(TChargingOrder::getStatus, order.getStatusList()); |
| | | } |
| | | if(null != order.getEndMode()){ |
| | | queryWrapper.eq(TChargingOrder::getEndMode, order.getEndMode()); |
| | |
| | | 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, |
| | |
| | | </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> |
| | | |
| | |
| | | #{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 |
| | | |
| | | |
| | |
| | | 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 |
| | |
| | | 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,0 as underlyingSales |
| | | 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} |
| | | WHERE |
| | | `status` = 1 |
| | | AND del_flag = 0 and ways_to_obtain != #{appGoodQuery.type} |
| | | AND ( |
| | | validity_period_mode != 1 |
| | | OR (validity_period_mode = 1 AND end_time >= NOW()) |
| | | ) |
| | | ORDER BY |
| | | CASE |
| | | |
| | | WHEN `inventory` = 0 THEN |
| | | 0 ELSE 1 |
| | | WHEN `inventory` = 0 THEN 0 |
| | | ELSE 1 |
| | | END DESC, |
| | | `redeemPoints` ASC |
| | | </select> |