Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
| | |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "已充电百分比") |
| | | @TableField(exist = false) |
| | | private Integer soc; |
| | | |
| | | } |
| | |
| | | @NotNull(message = "地址纬度不能为空") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "城市code") |
| | | private String cityCode; |
| | | |
| | | } |
| | |
| | | private Integer fastFreeCount; |
| | | @ApiModelProperty(value = "慢充空闲数量") |
| | | private Integer slowFreeCount; |
| | | @ApiModelProperty(value = "原始电价") |
| | | private BigDecimal electrovalenceOriginal; |
| | | @ApiModelProperty(value = "服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "普通电价") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | |
| | | @ApiModelProperty(value = "服务费折扣") |
| | | private BigDecimal serviceFeeDiscount; |
| | | |
| | | @ApiModelProperty(value = "折扣") |
| | | private BigDecimal discount; |
| | | |
| | | } |
| | |
| | | private BigDecimal low_peak_electricity_rate;// 谷电费费率(精确到五位小数) |
| | | private BigDecimal low_peak_service_rate;// 谷服务费费率(精确到五位小数) |
| | | private BigDecimal loss_ratio;// 计损比例 |
| | | // private DayTimeBase day_time_base; |
| | | private Integer time1;// 0:00~0:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time2;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time3;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | |
| | | public R<List<TEvaluationTagVO>> getTagList(Integer type) { |
| | | return R.fail("获取标签列表:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<List<TEvaluationTagVO>> getList() { |
| | | return R.fail("获取标签列表失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds) { |
| | | return R.fail("根据id集合获取数据失败:" + throwable.getMessage()); |
| | |
| | | */ |
| | | @PostMapping("/t-evaluation-tag/getTagList") |
| | | R<List<TEvaluationTagVO>> getTagList(Integer type); |
| | | |
| | | /** |
| | | * 获取标签列表 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-evaluation-tag/getList") |
| | | R<List<TEvaluationTagVO>> getList(); |
| | | |
| | | |
| | | /** |
| | | * 根据id集合获取数据 |
| | |
| | | select |
| | | user_id AS userId, |
| | | nick_name AS nickName, |
| | | user_name AS userName, |
| | | create_time AS createTime, |
| | | remark AS remark |
| | | from sys_user |
| | |
| | | AND nick_name LIKE concat('%',#{query.nickName},'%') |
| | | </if> |
| | | AND del_flag = '0' |
| | | AND roleType = 1 |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "优惠卷可用数量", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping(value = "/couponCount") |
| | | public R<Long> couponCount() { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | return R.ok(tAppCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, 1).count()); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Long count = tAppCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).ge(TAppCoupon::getEndTime, LocalDateTime.now()).eq(TAppCoupon::getStatus, 1).count(); |
| | | if(Objects.isNull(count)){ |
| | | count = 0L; |
| | | } |
| | | return R.ok(count); |
| | | } |
| | | |
| | | |
| | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | AppUserInfoDto appUserInfoDto = new AppUserInfoDto(); |
| | | TVip data = vipClient.getVipInfoByType(2).getData(); |
| | | appUserInfoDto.setMinPrice(data.getMonthlyCard()); |
| | | if(null != data){ |
| | | appUserInfoDto.setMinPrice(data.getMonthlyCard()); |
| | | } |
| | | |
| | | //判断会员 |
| | | if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){ |
| | |
| | | return AjaxResult.success(siteService.getSiteListGun()); |
| | | } |
| | | |
| | | @PostMapping("/getSiteListParkLot") |
| | | @GetMapping("/getSiteListParkLot") |
| | | @ApiOperation(value = "获取站点列表不分页", tags = {"管理后台-停车场绑定"}) |
| | | public AjaxResult<List<Site>> getSiteListParkLot(){ |
| | | return AjaxResult.success(siteService.getSiteListParkLot()); |
| | |
| | | siteDetailVO.setPartnerName(partner.getName()); |
| | | } |
| | | // 计算距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | // siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // 查询绑定车牌提示文案 |
| | | TParkingLot parkingLot = parkingLotService.getOne(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, query.getSiteId())); |
| | |
| | | Long userId = SecurityUtils.getLoginUser().getUserid(); |
| | | dto.setUserId(userId); |
| | | dto.setAuditStatus(1); |
| | | dto.setId(null); |
| | | dto.setParentId(dto.getId()); |
| | | dto.setId(null); |
| | | accountingStrategyService.save(dto); |
| | | // 添加明细 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = dto.getAccountingStrategyDetails(); |
| | |
| | | String twoUserName = sysUserClient.getSysUser(children.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | if(null != children.getUserId()){ |
| | | String userName = sysUserClient.getSysUser(children.getUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId()))); |
| | | }else { |
| | |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | if(null != children.getUserId()){ |
| | | String userName = sysUserClient.getSysUser(children.getUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id))); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过站点id查询当前时间段计费策略展示 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过枪id查询当前时间段计费策略展示") |
| | | @GetMapping(value = "/queryStrategyByGunIdAndTime") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryStrategyByGunIdAndTime(@RequestParam("gunId") Integer gunId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryStrategyByGunIdAndTime(gunId)); |
| | | } |
| | | |
| | | /** |
| | | * 价格说明金额返回,会员开通金额说明 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "价格说明金额返回,会员开通金额说明") |
| | |
| | | */ |
| | | Boolean isStrategyPriceConsistent(List<TAccountingStrategyDetail> accountingStrategyDetails); |
| | | |
| | | /** |
| | | * 通过枪id查询当前时间段计费策略展示 |
| | | * @param gunId |
| | | * @return |
| | | */ |
| | | List<TAccountingStrategyDetailVO> queryStrategyByGunIdAndTime(Integer gunId); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteDetailVO; |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private TParkingLotService parkingLotService; |
| | | |
| | | |
| | | |
| | |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | list.forEach(item -> { |
| | | item.setVipElectrovalence(vip.getDiscount().multiply(item.getElectrovalence())); |
| | | item.setVipElectrovalence(vip.getDiscount().multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); |
| | | }); |
| | | } |
| | | } |
| | |
| | | ids = new HashSet<>(data); |
| | | } |
| | | } |
| | | // 查询所有的停车场的站点id |
| | | List<TParkingLot> list = parkingLotService.list(); |
| | | List<Integer> siteIds = list.stream().map(TParkingLot::getSiteId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids) && !CollectionUtils.isEmpty(siteIds)){ |
| | | ids.addAll(siteIds); |
| | | } |
| | | return this.baseMapper.getSiteListParkLot(ids); |
| | | } |
| | | |
| | |
| | | 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.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.mapper.TAccountingStrategyDetailMapper; |
| | | import com.ruoyi.chargingPile.mapper.TAccountingStrategyMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Autowired |
| | | private TChargingGunService chargingGunService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Override |
| | |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | if(Objects.nonNull(vip)) { |
| | | if (vip.getType() == 2) { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(vip.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(vip.getDiscount()))); |
| | | } else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | } |
| | | }else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge())); |
| | |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO = list.stream().filter(detail -> DateUtils.string2LocalTime(detail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(detail.getEndTime() + ("23:59:59".equals(detail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()) |
| | | // strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()) |
| | | // .subtract(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount())).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getServiceCharge() |
| | | .subtract(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount())).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | // 查询最高折扣的会员 |
| | | TVip monthlyCardDiscount = vipClient.getVipInfoByType(3).getData(); |
| | | strategyPriceVO.setServiceFeeDiscount(monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | // 查询最高抵扣的会员 |
| | | TVip maximumDeduction = vipClient.getVipInfoByType(1).getData(); |
| | | strategyPriceVO.setMaxDiscountAmount(maximumDeduction.getMaximumDeduction()); |
| | | // 查询最低起步价会员 |
| | | TVip monthlyCard = vipClient.getVipInfoByType(2).getData(); |
| | | strategyPriceVO.setVipStartPrice(monthlyCard.getMonthlyCard()); |
| | | // 查询最高折扣的会员 |
| | | TVip monthlyCardDiscount = vipClient.getVipInfoByType(3).getData(); |
| | | strategyPriceVO.setServiceFeeDiscount(monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | // 模板折扣 |
| | | strategyPriceVO.setDiscount(accountingStrategy.getDiscount()); |
| | | return strategyPriceVO; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Boolean isStrategyPriceConsistent(List<TAccountingStrategyDetail> accountingStrategyDetails) { |
| | | Map<Integer, BigDecimal> phaseToServiceFee = new HashMap<>(); |
| | | Map<Integer, BigDecimal> phaseToCostServiceFee = new HashMap<>(); |
| | | for (TAccountingStrategyDetail detail : accountingStrategyDetails) { |
| | | Integer type = detail.getType(); |
| | | BigDecimal serviceFee = detail.getServiceCharge(); |
| | | BigDecimal costServiceCharge = detail.getCostServiceCharge(); |
| | | |
| | | if (phaseToServiceFee.containsKey(type)) { |
| | | BigDecimal existingFee = phaseToServiceFee.get(type); |
| | | if (!existingFee.equals(serviceFee)) { |
| | | BigDecimal existingCostServiceCharge = phaseToCostServiceFee.get(type); |
| | | if (existingFee.compareTo(serviceFee) != 0) { |
| | | return false; // 发现不一致的服务费 |
| | | } |
| | | if (existingCostServiceCharge.compareTo(costServiceCharge) != 0) { |
| | | return false; // 发现不一致的原价服务费 |
| | | } |
| | | } else { |
| | | phaseToServiceFee.put(type, serviceFee); |
| | | phaseToCostServiceFee.put(type, costServiceCharge); |
| | | } |
| | | } |
| | | return true; // 所有相同阶段的服务费一致 |
| | | } |
| | | |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryStrategyByGunIdAndTime(Integer gunId) { |
| | | TChargingGun chargingGun = chargingGunService.getById(gunId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectById(chargingGun.getAccountingStrategyId()); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | if(Objects.nonNull(appUser)){ |
| | | // 查询会员信息 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO; |
| | | TAccountingStrategyDetailVO accountingStrategyDetailNext; |
| | | // 获取当前时间段的计费策略明细 |
| | | accountingStrategyDetailVO = list.stream().filter(detail -> DateUtils.string2LocalTime(detail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(detail.getEndTime() + ("23:59:59".equals(detail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | // 获取后一次的计费策略明细 |
| | | accountingStrategyDetailVO.setEndTime("23:59:59".equals(accountingStrategyDetailVO.getEndTime())? "00:00":accountingStrategyDetailVO.getEndTime()); |
| | | accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | if(Objects.nonNull(vip)) { |
| | | if (vip.getType() == 2) { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(vip.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(vip.getDiscount()))); |
| | | } else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | } |
| | | }else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge())); |
| | | } |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | | list.add(accountingStrategyDetailNext); |
| | | return list; |
| | | } |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(wrapper); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); |
| | | List<TChargingGun> chargingGunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()); |
| | | for (TChargingGun chargingGun : chargingGunList) { |
| | | if(chargingGun.getStatus().equals(4)){ |
| | | // TODO 查询正在充电的单子的实时记录 |
| | | chargingGun.setSoc(100); |
| | | } |
| | | if(chargingGun.getStatus().equals(5)){ |
| | | chargingGun.setSoc(100); |
| | | } |
| | | } |
| | | item.setChargingGunList(chargingGunList); |
| | | }); |
| | | return chargingPileVOS; |
| | | } |
| | |
| | | ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status, ts.construction_site, ts.img_url, |
| | | ts.lon, ts.lat, ts.address, ts.country_code, ts.phone,ts.guide, ts.service_description, ts.vehicle_description, |
| | | ts.parking_space, ts.rate_description, ts.space_charge_explain, ts.accounting_strategy_id,ts.del_flag,tcg.fastCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence,tcg.superFreeCount,tcg.fastFreeCount,tcg.slowFreeCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence,tasd.serviceCharge,tasd.electrovalenceOriginal,tcg.superFreeCount,tcg.fastFreeCount,tcg.slowFreeCount, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | |
| | | left join ( |
| | | select |
| | | a.accounting_strategy_id, |
| | | a.service_charge AS serviceCharge, |
| | | a.electrovalence AS electrovalenceOriginal, |
| | | (a.electrovalence+a.service_charge) AS electrovalence, |
| | | ((a.electrovalence+a.service_charge)*b.discount) AS vipElectrovalence |
| | | (a.electrovalence + (a.service_charge*b.discount)) AS vipElectrovalence |
| | | from |
| | | t_accounting_strategy_detail a |
| | | left join |
| | |
| | | <where> |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | <if test="null != query.cityCode and '' != query.cityCode"> |
| | | and ts.cityCode = #{query.cityCode} |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | |
| | | </if> |
| | | </select> |
| | | <select id="getDetailById" resultType="com.ruoyi.chargingPile.api.vo.SiteDetailVO"> |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | SELECT id, partner_id, code, `name`, site_type, business_category, status, construction_site, img_url, province, province_code, |
| | | city, city_code, districts, districts_code, lon, lat, address, country_code, phone, service_phone, guide, start_service_time, |
| | | end_service_time, service_description, vehicle_description, parking_space, rate_description, space_charge_explain, |
| | | accounting_strategy_id, establishment_time, sort, remark, create_time, del_flag, mark, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | | POW( |
| | | SIN( |
| | | ( |
| | | #{query.lat} * PI() / 180 - ts.lat * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) + COS(#{query.lat} * PI() / 180) * COS(ts.lat * PI() / 180) * POW( |
| | | SIN( |
| | | ( |
| | | #{query.lon} * PI() / 180 - ts.lon * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) |
| | | ) |
| | | ) * 1000 |
| | | ) AS distance |
| | | FROM t_site WHERE id = #{siteId} AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </select> |
| | | <select id="getSiteListParkLot" resultType="com.ruoyi.chargingPile.api.model.Site"> |
| | | select ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status,tpl.id AS parkingLotId |
| | | select ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status |
| | | from t_site ts |
| | | left join t_parking_lot tpl on (ts.id = tpl.site_id) |
| | | <where> |
| | | <if test="null != ids and ids.size()>0"> |
| | | AND ts.id IN |
| | |
| | | </foreach> |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND tpl.id IS NULL |
| | | </where> |
| | | </select> |
| | | <select id="getSiteListGun" resultType="com.ruoyi.chargingPile.api.model.Site"> |
| | |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | <if test="null != query.cityCode and '' != query.cityCode"> |
| | | and ts.cityCode = #{query.cityCode} |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | | </where> |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * iotda消息监听 |
| | |
| | | String productId = header.getString("product_id"); // 产品id |
| | | String service_id = content.getString("service_id"); |
| | | log.info("服务id:{}",service_id); |
| | | // 写入文件 |
| | | FileWriter writer = new FileWriter("D:/sample.txt",true); |
| | | writer.write("接收到消息中转:"+jsonObject+"\n"); |
| | | writer.write("服务id:"+service_id+"\n"); |
| | | writer.close(); |
| | | SendResult sendResult; |
| | | // 设备消息下发 |
| | | String result; |
| | |
| | | onlineReply.setOnline_result(0); |
| | | result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply)); |
| | | log.info("充电桩登录认证-返回结果:{}",result); |
| | | // 响应硬件 对时设置应答 |
| | | TimingSettingReply timingSettingReplyOnline = new TimingSettingReply(); |
| | | timingSettingReplyOnline.setCharging_pile_code(onlineMessage.getCharging_pile_code()); |
| | | timingSettingReplyOnline.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReplyOnline)); |
| | | break; |
| | | case SendTagConstant.PING: |
| | | PingMessage pingMessage = JSON.parseObject(content.toJSONString(),PingMessage.class); |
| | |
| | | AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(content.toJSONString(),AcquisitionBillingModeMessage.class); |
| | | sendResult = enhanceProduce.acquisitionBillingModeMessage(acquisitionBillingModeMessage); |
| | | // 响应硬件 计费模型请求应答 1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData(); |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code().substring(0,14)).getData(); |
| | | Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails); |
| | | // 价格设置 |
| | | AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply(); |
| | | StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // 时段设置 |
| | | StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData(); |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailByCode(acquisitionBillingModeMessage.getCharging_pile_code().substring(0,14)).getData(); |
| | | acquisitionBillingModeReply.setBilling_model_code(accountingStrategyDetail.getId().toString()); |
| | | acquisitionBillingModeReply.setCharging_pile_code(acquisitionBillingModeMessage.getCharging_pile_code()); |
| | | acquisitionBillingModeReply.setLoss_ratio(BigDecimal.ZERO); |
| | |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "测试",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/test") |
| | | public R test() { |
| | | String orderNum = "2024092646526785213546"; |
| | | String deviceId = "3401231001200202"; |
| | | Long orderId = 2024065544L; |
| | | BigDecimal money = new BigDecimal(50); |
| | | PlatformStartCharging platformStartCharging = new PlatformStartCharging(); |
| | | platformStartCharging.setTransaction_serial_number(orderNum); |
| | | platformStartCharging.setCharging_pile_code(deviceId); |
| | | platformStartCharging.setCharging_gun_code("02"); |
| | | platformStartCharging.setCard_number(orderId.toString()); |
| | | platformStartCharging.setAccount_balance(money); |
| | | String message = iotMessageProduce.sendMessage(platformStartCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_START_CHARGING.getKey(), messageUtil.platformStartCharging(platformStartCharging)); |
| | | System.err.println(platformStartCharging); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "测试",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/stop") |
| | | public R test1() { |
| | | PlatformStopCharging platformStopCharging = new PlatformStopCharging(); |
| | | platformStopCharging.setCharging_pile_code("3401231001200202"); |
| | | platformStopCharging.setCharging_gun_code("02"); |
| | | String message = iotMessageProduce.sendMessage(platformStopCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_STOP_CHARGING.getKey(),messageUtil.platformStopCharging(platformStopCharging)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | } |
| | |
| | | throw new RuntimeException(failure_cause); |
| | | } |
| | | |
| | | // 将枪状态重置为空闲 |
| | | chargingGun.setStatus(2); |
| | | chargingGunClient.updateChargingGunById(chargingGun); |
| | | //计算费用,处理退款 |
| | | endCharge(chargingOrder); |
| | | break; |
| | |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagCount() { |
| | | // 查询标签列表 |
| | | R<List<TEvaluationTagVO>> r = evaluationTagClient.getTagList(null); |
| | | R<List<TEvaluationTagVO>> r = evaluationTagClient.getList(); |
| | | List<TEvaluationTagVO> tagList = r.getData(); |
| | | List<Integer> tagIds = tagList.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); |
| | | // 统计标签使用数量 |
| | |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | |
| | | public AjaxResult<List<TAdvertising>> list(@RequestParam("position") Integer position) { |
| | | return AjaxResult.ok(advertisingService.list(Wrappers.lambdaQuery(TAdvertising.class) |
| | | .eq(TAdvertising::getStatus, AdvertisingStatusEnum.YES.getCode()) |
| | | .eq(TAdvertising::getPosition,position))); |
| | | .eq(TAdvertising::getPosition,position) |
| | | .le(TAdvertising::getStartTime, LocalDateTime.now()) |
| | | .ge(TAdvertising::getEndTime,LocalDateTime.now()))); |
| | | } |
| | | } |
| | | |
| | |
| | | public R<List<TEvaluationTagVO>> getTagList(@RequestParam("type") Integer type) { |
| | | return R.ok(evaluationTagService.getTagList(type)); |
| | | } |
| | | |
| | | @GetMapping("/getList") |
| | | public R<List<TEvaluationTagVO>> getList() { |
| | | return R.ok(evaluationTagService.getList()); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | * @return |
| | | */ |
| | | List<TEvaluationTag> pageList(PageInfo<TEvaluationTag> pageInfo, @Param("name") String name); |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getList(); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | PageInfo<TEvaluationTag> pageList(String name, BasePage basePage); |
| | | /** |
| | | * 查询标签列表 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getList(); |
| | | |
| | | } |
| | |
| | | List<TEvaluationTag> list = this.baseMapper.pageList(pageInfo, name); |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<TEvaluationTagVO> getList() { |
| | | return this.baseMapper.getList(); |
| | | } |
| | | } |
| | |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.other.api.vo.TEvaluationTagVO"> |
| | | select <include refid="Base_Column_List"></include> |
| | | from t_evaluation_tag where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </select> |
| | | </mapper> |