Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserTagFallbackFactory.java
# ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
| | |
| | | return R.fail("修改用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R change(PointChangeDto points) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R changeDown(PointChangeDto points) { |
| | |
| | | @PostMapping("/t-app-user/user/updateAppUser") |
| | | R updateAppUser(@RequestBody TAppUser appUser); |
| | | |
| | | @PostMapping("/t-app-user/user/points/change") |
| | | R change(@RequestBody PointChangeDto points); |
| | | // @PostMapping("/t-app-user/user/points/change") |
| | | // R change(@RequestBody PointChangeDto points); |
| | | @PostMapping("/t-app-user/user/points/change/down") |
| | | R changeDown(@RequestBody PointChangeDto points); |
| | | |
| | |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "对应跳转订单号") |
| | | @TableField("order_code") |
| | | private String orderCode; |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<SiteInfoVO> getSiteInfoByNumber1(String number) { |
| | | return R.fail("通过桩编号获取电站信息失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TChargingPile> getChargingPileById(Integer id) { |
| | | return R.fail(throwable.getMessage()); |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | @PostMapping(value = "/t-accounting-strategy/getServiceMoney") |
| | | R<BigDecimal> getServiceMoney(@RequestParam("param") String param); |
| | | |
| | | @PostMapping("/site/getSiteInfoByNumber") |
| | | @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"}) |
| | | @GetMapping("/site/getSiteInfoByNumber") |
| | | R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number); |
| | | |
| | | @PostMapping("/site/getSiteInfoByNumber1") |
| | | R<SiteInfoVO> getSiteInfoByNumber1(@RequestParam("number") String number); |
| | | |
| | | |
| | | @PostMapping("/t-charging-pile/getChargingPileById/{id}") |
| | | R<TChargingPile> getChargingPileById(@PathVariable("id") Integer id); |
| | |
| | | private String spaceChargeExplain; |
| | | @ApiModelProperty(value = "添加车辆最高可得积分 车辆信息为空 展示提示语") |
| | | private Integer integral; |
| | | @ApiModelProperty(value = "充电模式(1=超级快充,2=快充,3=慢充") |
| | | private Integer chargeMode; |
| | | |
| | | @ApiModelProperty(value = "上次选择车辆logo") |
| | | private String carLogo; |
| | |
| | | public R<String> platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate) { |
| | | return R.fail("远程更新调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> setupBillingModel1(String deviceId) { |
| | | return R.fail("远程更新硬件:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> exchangeCreate(ExchangeDto exchangeDto) { |
| | | public R<ExchangeBackDto> exchangeCreate(ExchangeDto exchangeDto) { |
| | | return R.fail("创建订单" + cause.getMessage()); |
| | | } |
| | | |
| | |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | |
| | | public R<Long> getExchangeById(@RequestParam("goodId") Integer goodId,@RequestParam("userId") Long userId,@RequestParam("goodType") Integer goodType); |
| | | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | public R<ExchangeBackDto> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-vip-order//addVipOrder") |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder vipOrder); |
| | | @PostMapping("/t-shopping-order/create") |
| | |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | @ApiModelProperty(value = "退款成功时间") |
| | | @TableField("refund_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime refundTime; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "支付时间") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime payTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField(exist = false) |
| | | private String orderId; |
| | | @TableField(exist = false) |
| | | private String userId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExchangeBackDto { |
| | | private Long id; |
| | | private String code; |
| | | } |
| | |
| | | private Integer points; |
| | | private String remark; |
| | | private Integer type; |
| | | private String code; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "通过充电枪id和预付金额获取电站详情", tags = {"小程序-扫一扫"}) |
| | | @GetMapping(value = "/scan/siteInfo") |
| | | @PostMapping(value = "/scan/siteInfo") |
| | | public AjaxResult<SiteInfoVO> siteInfo(Integer id, BigDecimal money) { |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(id).getData(); |
| | | TChargingPile chargingPile = chargingPileClient.getChargingPileById(chargingGun.getChargingPileId()).getData(); |
| | | SiteInfoVO data = chargingPileClient.getSiteInfoByNumber(chargingPile.getNumber().toString()).getData(); |
| | | SiteInfoVO data = chargingPileClient.getSiteInfoByNumber1(chargingPile.getCode().toString()).getData(); |
| | | data.setChargingGunId(id); |
| | | data.setChargeMode(chargingGun.getChargeMode()); |
| | | List<TAppUserCar> cars = appUserCarService.list(new QueryWrapper<TAppUserCar>() |
| | | .eq("app_user_id",tokenService.getLoginUserApplet().getUserId()) |
| | | .orderByDesc("create_time")); |
| | |
| | | @DeleteMapping(value = "/unit/delete") |
| | | @Log(title = "【单位管理】删除单位", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | public R add(@RequestParam String ids) { |
| | | List<TAppUser> list = appUserService.lambdaQuery().in(TAppUser::getCompanyId, Arrays.asList(ids.split(","))).list(); |
| | | if (!list.isEmpty()){ |
| | | return R.fail("当前单位已存在用户,无法删除!"); |
| | | } |
| | | String[] split = ids.split(","); |
| | | for (String s : split) { |
| | | otherClient.unitDelete(Integer.valueOf(s)); |
| | |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCompanyId() != null, TAppUser::getCompanyId, userListQueryDto.getCompanyId()) |
| | | .like(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .eq(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getStatus() != null, TAppUser::getStatus, userListQueryDto.getStatus()) |
| | | .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId()) |
| | |
| | | if (userListQueryDto.getUserTagId() != null){ |
| | | userIds = appUserTagService.lambdaQuery().eq(TAppUserTag::getUserTagId, userListQueryDto.getUserTagId()).list().stream().map(TAppUserTag::getAppUserId).collect(Collectors.toList()); |
| | | } |
| | | LocalDateTime end1 = null; |
| | | LocalDateTime end2 = null ; |
| | | if (userListQueryDto.getVipEndTime1()!=null) { |
| | | end1 = LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime1()); |
| | | } |
| | | if (userListQueryDto.getVipEndTime2()!=null){ |
| | | end2 = LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime2()); |
| | | } |
| | | //列表查询 |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .ge(TAppUser::getVipEndTime, LocalDateTime.now()) |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCompanyId() != null, TAppUser::getCompanyId, userListQueryDto.getCompanyId()) |
| | | .eq(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getStatus() != null, TAppUser::getStatus, userListQueryDto.getStatus()) |
| | | .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId()) |
| | | .ge(userListQueryDto.getVipEndTime1() != null, TAppUser::getVipEndTime, userListQueryDto.getVipEndTime1() == null ? null : LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime1())) |
| | | .le(userListQueryDto.getVipEndTime2() != null, TAppUser::getVipEndTime, userListQueryDto.getVipEndTime2() == null ? null : LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime2())) |
| | | .ge(userListQueryDto.getVipEndTime1() != null, TAppUser::getVipEndTime, end1 ) |
| | | .le(userListQueryDto.getVipEndTime2() != null, TAppUser::getVipEndTime, end2) |
| | | .in(!userIds.isEmpty(), TAppUser::getId, userIds) |
| | | .page(Page.of(userListQueryDto.getPageCurr(), userListQueryDto.getPageSize())); |
| | | if (page.getRecords().isEmpty()){ |
| | |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | List<TAppUser> list = appUserService.lambdaQuery().eq(TAppUser::getPhone, tAppUser.getPhone()).list(); |
| | | if (!list.isEmpty()){ |
| | | return R.fail("该手机号已注册"); |
| | | } |
| | | } |
| | | appUserService.saveOrUpdate(tAppUser); |
| | | return R.ok(); |
| | |
| | | @GetMapping(value = "/user/detail/{id}") |
| | | public R<UserDetailDto> userDetail(@PathVariable Long id) { |
| | | TAppUser user = appUserService.getById(id); |
| | | UserDetailDto userDetailDto = new UserDetailDto(); |
| | | BeanUtils.copyProperties(user,userDetailDto); |
| | | if (user.getVipId()!=null) { |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(Arrays.asList(user.getVipId())); |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(Collections.singletonList(user.getVipId())); |
| | | if (user.getVipEndTime()!=null&&user.getVipEndTime().isAfter(LocalDateTime.now())) { |
| | | //匹配vipMap的值 |
| | | user.setVipName(vipMap.getData().get(user.getVipId())); |
| | | } |
| | | |
| | | |
| | | UserDetailDto userDetailDto = new UserDetailDto(); |
| | | BeanUtils.copyProperties(user,userDetailDto); |
| | | |
| | | //获取累计充电数量 |
| | | R<Long> useOrderCount = chargingOrderClient.useOrderCount(user.getId()); |
| | | userDetailDto.setOrderCount(useOrderCount.getData()); |
| | |
| | | userDetailDto.setTagName(tagMap.getData().values() |
| | | .stream() |
| | | .collect(Collectors.joining(","))); |
| | | |
| | | |
| | | |
| | | return R.ok(userDetailDto); |
| | | } |
| | | |
| | |
| | | Long count = signService.lambdaQuery().eq(TAppUserSign::getAppUserId,userId).eq(TAppUserSign::getSignDay, LocalDate.now()).count(); |
| | | appUserInfoDto.setIsSign(count>0?1:0); |
| | | //获取当前拥有的优惠卷数量 |
| | | Long coupons = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).eq(TAppCoupon::getStatus, 1).count(); |
| | | Long coupons = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).ge(TAppCoupon::getEndTime, LocalDateTime.now()).eq(TAppCoupon::getStatus, 1).count(); |
| | | appUserInfoDto.setCouponNum(Math.toIntExact(coupons)); |
| | | //当前绑定的车辆 |
| | | List<TAppUserCar> list = carService.lambdaQuery().eq(TAppUserCar::getAppUserId, userId).list(); |
| | |
| | | signService.updateById(appUserSign); |
| | | } |
| | | } |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points,1,userId,"每日签到","JF"); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points,1,userId,"每日签到","JF",""); |
| | | byId.setPoints(byId.getPoints()+points); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | |
| | | |
| | | |
| | | //积分变化记录用 |
| | | @PostMapping(value = "/user/points/change") |
| | | public R change(@RequestBody PointChangeDto points) { |
| | | TAppUser byId = appUserService.getById(points.getUserId()); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF"); |
| | | byId.setPoints(byId.getPoints()+points.getPoints()); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | // @PostMapping(value = "/user/points/change") |
| | | // public R change(@RequestBody PointChangeDto points) { |
| | | // TAppUser byId = appUserService.getById(points.getUserId()); |
| | | // pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF"); |
| | | // byId.setPoints(byId.getPoints()+points.getPoints()); |
| | | // appUserService.updateById(byId); |
| | | // return R.ok(); |
| | | // } |
| | | |
| | | @PostMapping(value = "/user/points/change/down") |
| | | public R changeDown(@RequestBody PointChangeDto points) { |
| | | TAppUser byId = appUserService.getById(points.getUserId()); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()-points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF"); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()-points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF",points.getCode()); |
| | | byId.setPoints(byId.getPoints()-points.getPoints()); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | |
| | | } |
| | | |
| | | //增加积分记录 |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),""); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"",""); |
| | | byId.setPoints(byId.getPoints()+point); |
| | | byId.setFirstAdd(1); |
| | | |
| | |
| | | public R delete(String ids) { |
| | | //拿到单位列表 |
| | | String[] split = ids.split(","); |
| | | |
| | | List<TAppUserTag> list = appUserTagService.lambdaQuery().in(TAppUserTag::getUserTagId).list(); |
| | | if (!list.isEmpty()){ |
| | | return R.fail("当前标签已有用户获取,无法删除"); |
| | | } |
| | | for (String id : split) { |
| | | otherClient.deleteTag(Integer.valueOf(id)); |
| | | } |
| | |
| | | @ApiOperation(value = "生效会员列表", tags = {"小程序-个人中心"}) |
| | | public R<List<TAppUserVipDetail>> getVipUseDetail(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<TAppUserVipDetail> list = appUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, userId).last(" and now() between start_time and end_time order by start_time desc").list(); |
| | | List<TAppUserVipDetail> list = appUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, userId).last(" and now() between start_time and end_time order by start_time asc").list(); |
| | | |
| | | for (TAppUserVipDetail tAppUserVipDetail : list) { |
| | | if(null != tAppUserVipDetail.getVipId()){ |
| | |
| | | public class PointDetailUtil { |
| | | @Resource |
| | | private TAppUserIntegralChangeService appUserIntegralChangeService; |
| | | public void addDetail(Integer old,Integer now,Integer type,Long userId,String extension,String code){ |
| | | public void addDetail(Integer old,Integer now,Integer type,Long userId,String extension,String code,String orderCode){ |
| | | |
| | | TAppUserIntegralChange tAppUserIntegralChange= new TAppUserIntegralChange(); |
| | | tAppUserIntegralChange.setCode(OrderCodeUtil.getOrderCode(code)); |
| | |
| | | tAppUserIntegralChange.setCurrentIntegral(now); |
| | | tAppUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | tAppUserIntegralChange.setExtension(extension); |
| | | tAppUserIntegralChange.setOrderCode(orderCode); |
| | | appUserIntegralChangeService.save(tAppUserIntegralChange); |
| | | |
| | | |
| | |
| | | @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"}) |
| | | public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){ |
| | | SiteInfoVO siteInfoVO = new SiteInfoVO(); |
| | | String chargingPileCode = number.substring(0, number.length() - 2); |
| | | String chargingGunCode = number.substring(number.length() - 2); |
| | | TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getCode, chargingPileCode).one(); |
| | | TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, chargingGunCode).eq(TChargingGun::getChargingPileId, one.getId())); |
| | | Site byId = siteService.getById(one.getSiteId()); |
| | | TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId()); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list(); |
| | | for (TAccountingStrategyDetail tAccountingStrategyDetail : list) { |
| | | // 当前时间属于那个阶段 取哪个阶段的电价 |
| | | if(LocalTime.now().isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && LocalTime.now().isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){ |
| | | siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | } |
| | | siteInfoVO.setChargingGunId(chargingGun.getId()); |
| | | siteInfoVO.setChargingPileId(one.getId()); |
| | | siteInfoVO.setName(byId.getName()); |
| | | siteInfoVO.setNumber(one.getNumber().toString()); |
| | | siteInfoVO.setSpaceChargeExplain(byId.getSpaceChargeExplain()); |
| | | return R.ok(siteInfoVO); |
| | | } |
| | | /** |
| | | * 通过桩编号获取电站信息 遠程調用 |
| | | * @param number |
| | | * @return |
| | | */ |
| | | @PostMapping("/getSiteInfoByNumber1") |
| | | public R<SiteInfoVO> getSiteInfoByNumber1(@RequestParam("number") String number){ |
| | | SiteInfoVO siteInfoVO = new SiteInfoVO(); |
| | | TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getCode, number).one(); |
| | | Site byId = siteService.getById(one.getSiteId()); |
| | | TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId()); |
| | |
| | | siteInfoVO.setSpaceChargeExplain(byId.getSpaceChargeExplain()); |
| | | return R.ok(siteInfoVO); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getSiteList") |
| | | @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"}) |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Resource |
| | | @Autowired |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | |
| | | |
| | | return AjaxResult.ok(accountingStrategyService.pageList(query)); |
| | | } |
| | | @Resource |
| | | private IntegrationClient integrationClient; |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "审核") |
| | | @PostMapping(value = "/auth/pass") |
| | |
| | | } |
| | | |
| | | //硬件 |
| | | List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, byId.getSiteId()).list(); |
| | | for (TChargingPile tChargingPile : list) { |
| | | integrationClient.setupBillingModel1(tChargingPile.getCode()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | return R.ok(message); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "远程重启",tags = {"硬件接口"}) |
| | | @PostMapping(value = "/platformRestart") |
| | | public R platformRestart(String deviceId) { |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/work/shop") |
| | | @PostMapping(value = "/work/shop") |
| | | @ApiOperation(value = "购物收入", tags = {"后台-工作台"}) |
| | | public R workShop(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | //count近6个月的数据 |
| | |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | if (statisticsQueryDto.getDayType()==1) { |
| | | List<Map<String,Object>> charMap = chargingOrderService.getHourType(siteIds,statisticsQueryDto); |
| | | List<Map<String,Object>> charMap1 = chargingOrderService.getHourType(siteIds,statisticsQueryDto); |
| | | List<Map<String, Object>> charMap = new ArrayList<>(); |
| | | // 生成从 "00:00" 到 "23:00" 的时间数据 |
| | | for (int hour = 0; hour < 24; hour++) { |
| | | String time = String.format("%02d:00", hour); |
| | | Map<String, Object> mapWithTimeValue = findMapWithTimeValue(charMap1, time); |
| | | if (mapWithTimeValue!=null){ |
| | | charMap.add(mapWithTimeValue); |
| | | }else { |
| | | Map<String, Object> timeMap = new HashMap<>(); |
| | | timeMap.put("time", time); // 初始化值为 null |
| | | timeMap.put("electrovalence", 0); |
| | | timeMap.put("orderCount", 0); |
| | | timeMap.put("servicecharge", 0); |
| | | timeMap.put("electricity", 0); |
| | | charMap.add(timeMap); |
| | | } |
| | | } |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | List<Map<String,Object>> charMap = chargingOrderService.getDateType(siteIds,statisticsQueryDto); |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> charMap = chargingOrderService.getMonthType(siteIds,statisticsQueryDto); |
| | | } |
| | | return R.ok(charMap); |
| | | |
| | | } |
| | | return R.ok(); |
| | | |
| | | |
| | | } |
| | | |
| | | private static Map<String, Object> findMapWithTimeValue(List<Map<String, Object>> charMap1,String timeValue) { |
| | | for (Map<String, Object> map : charMap1) { |
| | | if (map.containsKey("time") && map.get("time").equals(timeValue)) { |
| | | return map; |
| | | } |
| | | } |
| | | return null; // 如果没有找到,返回 null |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/use") |
| | |
| | | @Resource |
| | | private TOrderInvoiceService invoiceService; |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/shopOrder") |
| | | @GetMapping(value = "/work/shopOrder") |
| | | @ApiOperation(value = "购物订单统计", tags = {"管理后台-工作台"}) |
| | | public R shopOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | public R shopOrder() { |
| | | Long count = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 1).count(); |
| | | Long count1 = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 2).count(); |
| | | List<Long> counts = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/invoice") |
| | | @GetMapping(value = "/work/invoice") |
| | | @ApiOperation(value = "开票统计", tags = {"管理后台-工作台"}) |
| | | public R invoice(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | public R invoice() { |
| | | Long count = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 1).count(); |
| | | Long count1 = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 3).count(); |
| | | List<Long> counts = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/users/count") |
| | | @GetMapping(value = "/work/users/count") |
| | | @ApiOperation(value = "用户数量", tags = {"管理后台-工作台"}) |
| | | public R usersCount(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | public R usersCount() { |
| | | List<Map<String,Object>> userMap = chargingOrderService.countAllUserData(); |
| | | return R.ok(userMap); |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | } |
| | | |
| | | @PostMapping("/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | public R<ExchangeBackDto> exchangeCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | TExchangeOrder tExchangeOrder = new TExchangeOrder(); |
| | | tExchangeOrder.setCode(OrderCodeUtil.getOrderCode("DH")); |
| | | tExchangeOrder.setAppUserId(exchangeDto.getUserId()); |
| | |
| | | tExchangeOrder.setCreateTime(LocalDateTime.now()); |
| | | tExchangeOrder.setDelFlag(false); |
| | | exchangeOrderService.save(tExchangeOrder); |
| | | return R.ok(tExchangeOrder.getId()); |
| | | ExchangeBackDto exchangeBackDto = new ExchangeBackDto(); |
| | | exchangeBackDto.setId(tExchangeOrder.getId()); |
| | | exchangeBackDto.setCode(tExchangeOrder.getCode()); |
| | | return R.ok(exchangeBackDto); |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.order.api.query.ShoppingOrderQuery; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | |
| | | byId.setReceivingAddress(data.getAddress()); |
| | | } |
| | | } |
| | | if (byId.getOrderType()==1){ |
| | | TGoods data = goodsClient.getGoodsById(byId.getGoodsId()).getData(); |
| | | if (data!=null){ |
| | | byId.setName(data.getName()); |
| | | } |
| | | }else { |
| | | TCoupon data = couponClient.getCouponById1(byId.getCouponId()).getData(); |
| | | if (data!=null){ |
| | | byId.setName(data.getName()); |
| | | } |
| | | } |
| | | return AjaxResult.success(byId); |
| | | } |
| | | |
| | |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setTransaction_id(tChargingOrder.getRechargeSerialNumber()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setTransaction_id(tChargingOrder.getSerialNumber()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | |
| | | model.setTransaction_id(shoppingOrder.getSerialNumber()); |
| | | model.setOut_refund_no(shoppingOrderRefund.getRefundCode()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(refundAmount.multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(shoppingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | |
| | | </if> |
| | | </select> |
| | | <select id="payOrderQuery" resultType="com.ruoyi.order.dto.PayOrderDto"> |
| | | SELECT * FROM (SELECT |
| | | SELECT o.*,i.phone FROM (SELECT |
| | | id, |
| | | `code`, |
| | | 1 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | del_flag, |
| | | app_user_id |
| | | FROM |
| | | charging_pile_order.t_charging_order |
| | | where recharge_payment_status = 2 |
| | |
| | | `code`, |
| | | 2 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | del_flag, |
| | | app_user_id |
| | | FROM |
| | | charging_pile_order.t_shopping_order |
| | | where payment_status = 2 |
| | |
| | | `code`, |
| | | 3 as type, |
| | | title, |
| | | phone, |
| | | payment_status AS `status`, |
| | | order_amount, |
| | | payment_amount , |
| | |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | del_flag, |
| | | app_user_id |
| | | |
| | | FROM |
| | | charging_pile_order.t_vip_order |
| | |
| | | `code`, |
| | | 4 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount , |
| | | order_amount as payment_amount, |
| | |
| | | out_parking_time as pay_time, |
| | | null as refund_status, |
| | | 0 as final_amount, |
| | | 0 as del_flag |
| | | 0 as del_flag, |
| | | app_user_id |
| | | FROM |
| | | charging_pile_service.t_parking_record ) o |
| | | LEFT JOIN `charging_pile_account`.`t_app_user` i on o.app_user_id = i.id |
| | | <where> |
| | | o.del_flag = 0 |
| | | <if test="data.code != null and data.code != ''"> |
| | |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="data.isRefund == 1"> |
| | | AND o.refund_status is not null |
| | | </if> |
| | | <if test="data.isRefund == 1"> |
| | | AND o.refund_status is null |
| | | </if> |
| | | |
| | | </where> |
| | | ORDER BY o.create_time desc |
| | | |
| | |
| | | re.refund_remark, |
| | | co.recharge_serial_number as serail_number, |
| | | co.payment_amount, |
| | | co.pay_time |
| | | co.create_time as pay_time, |
| | | co.id as order_id, |
| | | co.app_user_id as user_id |
| | | FROM t_charging_order_refund re |
| | | LEFT JOIN t_charging_order co ON re.charging_order_id = co.id |
| | | UNION ALL |
| | |
| | | re.refund_remark, |
| | | so.serial_number, |
| | | so.payment_amount, |
| | | so.pay_time |
| | | so.create_time as pay_time, |
| | | so.id as order_id, |
| | | so.app_user_id as user_id |
| | | FROM t_shopping_order_refund re |
| | | LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id |
| | | UNION ALL |
| | |
| | | vr.refund_remark, |
| | | vo.serial_number, |
| | | vo.payment_amount, |
| | | vo.pay_time |
| | | vo.create_time as pay_time, |
| | | vo.id as order_id, |
| | | vo.app_user_id as user_id |
| | | FROM t_vip_order_refund vr |
| | | LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id |
| | | |
| | |
| | | AND o.refund_code LIKE CONCAT('%',#{data.refundCode},'%') |
| | | </if> |
| | | </where> |
| | | |
| | | order by o.refund_time desc |
| | | |
| | | </select> |
| | | <select id="chargingOrderGroup" resultType="com.ruoyi.common.core.dto.ChargingOrderGroup"> |
| | |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | , '%Y-%m-%d %H' ) as time, |
| | | , '%H:00' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | SUM(electricity) as electricity, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | |
| | | , '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | count(1) as orderCount |
| | | count(1) as orderCount, |
| | | SUM(electricity) as electricity |
| | | FROM |
| | | t_charging_order |
| | | |
| | | WHERE del_flag = 0 and recharge_payment_status = 2 and DATE( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | |
| | | , '%Y-%m' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | count(1) as orderCount |
| | | count(1) as orderCount, |
| | | SUM(electricity) as electricity |
| | | FROM |
| | | t_charging_order |
| | | |
| | |
| | | payment_amount |
| | | FROM |
| | | t_shopping_order |
| | | <where> |
| | | WHERE del_flag = 0 and payment_status = 2 and ISNULL(refund_status) and status!=4 |
| | | WHERE del_flag = 0 and payment_status = 2 and ISNULL(refund_status) and status!=4 and |
| | | |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | |
| | | |
| | | </where> |
| | | |
| | | |
| | | ) AS subquery |
| | | GROUP BY |
| | | DATE_FORMAT( subquery.create_time, '%Y-%m-%d' ); |
| | | DATE_FORMAT( subquery.create_time, '%Y-%m-%d' ) |
| | | |
| | | |
| | | </select> |
| | |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | | Page<TCompany> page = companyService.lambdaQuery() |
| | | .orderByDesc(TCompany::getCreateTime) |
| | | .like(unitListQueryDto.getCompanyName() != null && unitListQueryDto.getCompanyName().isEmpty(), TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .like(unitListQueryDto.getCompanyName() != null && unitListQueryDto.getCompanyName()!="", TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .page(Page.of(unitListQueryDto.getPageCurr(), unitListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | } |
| | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.AppGoodQuery; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | @ApiOperation(tags = {"小程序-" + |
| | | "兑换商城"},value = "积分兑换商品") |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") |
| | | @PostMapping(value = "/app/shop") |
| | | public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | | //检查当前用户积分是否够 |
| | |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) { |
| | | return AjaxResult.error("当前用户已兑换"+count+"张"); |
| | | }else { |
| | | //减少库存 |
| | | good.setInventory(good.getInventory()-exchangeDto.getNum()); |
| | | } |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | |
| | | point = coupon.getRedeemPoints(); |
| | | |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | } |
| | | if (user.getPoints()<point){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | }else { |
| | | coupon.setInventoryQuantity(coupon.getInventoryQuantity()-exchangeDto.getNum()); |
| | | } |
| | | |
| | | |
| | | } |
| | | exchangeDto.setPoint(point); |
| | | exchangeDto.setUserId(userId); |
| | | //生成积分兑换成功的订单 |
| | | R<Long> longR = orderClient.exchangeCreate(exchangeDto); |
| | | R<ExchangeBackDto> longR = orderClient.exchangeCreate(exchangeDto); |
| | | if (exchangeDto.getGoodType()==2) { |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | |
| | |
| | | pointChangeDto.setPoints(point); |
| | | pointChangeDto.setRemark(longR.getData().toString()); |
| | | pointChangeDto.setType(6); |
| | | pointChangeDto.setCode(longR.getData().getCode()); |
| | | appUserClient.changeDown(pointChangeDto); |
| | | return AjaxResult.success(); |
| | | |
| | |
| | | public R<Page<TUserTag>> page(@RequestBody TagListQueryDto tagListQueryDto) { |
| | | Page<TUserTag> page = tUserTagService.lambdaQuery() |
| | | .orderByDesc(TUserTag::getCreateTime) |
| | | .like(tagListQueryDto.getTagName()!=null&& tagListQueryDto.getTagName().isEmpty(), TUserTag::getName, tagListQueryDto.getTagName()) |
| | | .like(tagListQueryDto.getTagName()!=null&& tagListQueryDto.getTagName()!="", TUserTag::getName, tagListQueryDto.getTagName()) |
| | | .page(Page.of(tagListQueryDto.getPageCurr(), tagListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |