Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
141个文件已修改
5个文件已删除
53个文件已添加
| | |
| | | .idea |
| | | |
| | | target |
| | | |
| | | *.yaml |
| | | *.yml |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("发放优惠券-选择人员列表DTO") |
| | | public class ChoiceUserListQueryDto extends BasePage { |
| | | @ApiModelProperty(value = "用户手机号") |
| | | String userPhone; |
| | | @ApiModelProperty(value = "市code") |
| | | String cityCode; |
| | | @ApiModelProperty(value = "省code") |
| | | String provinceCode; |
| | | @ApiModelProperty(value = "用户标签ids 多个逗号分隔") |
| | | String userTagId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("管理后台发放优惠券DTO") |
| | | public class GrantCouponDto { |
| | | @ApiModelProperty("用户ids 逗号分隔") |
| | | private String userIds; |
| | | @ApiModelProperty("优惠券id") |
| | | private Integer couponId; |
| | | @ApiModelProperty("发放方式 1积分 2现金") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty("结束时间 前端忽略") |
| | | private LocalDateTime endTime; |
| | | } |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserListQueryDto extends BasePage { |
| | | private String userPhone; |
| | | private String cityCode; |
| | | private Integer status; |
| | | private Integer userTagId; |
| | | private Integer vipTypeId; |
| | | private Integer companyId; |
| | | @ApiModelProperty(value = "用户手机号") |
| | | String userPhone; |
| | | @ApiModelProperty(value = "所在地code") |
| | | String cityCode; |
| | | @ApiModelProperty(value = "状态 1正常2冻结 3注销") |
| | | Integer status; |
| | | @ApiModelProperty(value = "用户标签id") |
| | | Integer userTagId; |
| | | @ApiModelProperty(value = "会员类型id") |
| | | Integer vipTypeId; |
| | | @ApiModelProperty(value = "单位id") |
| | | Integer companyId; |
| | | } |
| | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public R<Integer> getUseCountByCouponId(Integer couponId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<PageInfo<ExchangeRecordVO>> getExchangeRecordByCouponId(ExchangeRecordGoodsQuery couponId) { |
| | | return R.fail("根据优惠券id查询领取记录:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 门店服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class AppUserCarFallbackFactory implements FallbackFactory<AppUserCarClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AppUserCarFallbackFactory.class); |
| | | |
| | | @Override |
| | | public AppUserCarClient create(Throwable throwable) { |
| | | log.error("用户车辆服务调用失败:{}", throwable.getMessage()); |
| | | return new AppUserCarClient() { |
| | | |
| | | @Override |
| | | public R<List<TAppUserCar>> getCarByIds(List<Integer> carIds) { |
| | | return R.fail("根据用户车辆id查询车辆信息失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 门店服务降级处理 |
| | |
| | | log.error("账户服务调用失败:{}", throwable.getMessage()); |
| | | return new AppUserClient() { |
| | | |
| | | @Override |
| | | public R<List<Long>> getUserIdsByPhone(String phone) { |
| | | return R.fail("根据手机号查询用户ids失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUser> getUserById(Long id) { |
| | | return R.fail("根据id查询用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> getUserByIds(List<Long> appUserIds) { |
| | | return R.fail("根据用户id查询用户信息失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.account.api.factory.AppCouponFallbackFactory; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * 用户服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "AppCouponClient", value = ServiceNameConstants.CONTRACT_ACCOUNT, fallbackFactory = AppCouponFallbackFactory.class) |
| | | @FeignClient(contextId = "AppCouponClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppCouponFallbackFactory.class) |
| | | public interface AppCouponClient { |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/t-app-coupon/getUseCountByCouponId") |
| | | public R<Integer> getUseCountByCouponId(Integer couponId); |
| | | /** |
| | | * 后台远程调用 根据优惠券id 查询领取记录 |
| | | * @param couponId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-app-coupon/getExchangeRecordByCouponId") |
| | | R<PageInfo<ExchangeRecordVO>> getExchangeRecordByCouponId(@RequestBody ExchangeRecordGoodsQuery couponId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.AppUserCarFallbackFactory; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户车辆服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "AppUserCarClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppUserCarFallbackFactory.class) |
| | | public interface AppUserCarClient { |
| | | |
| | | /** |
| | | * 根据用户车辆id查询车辆信息 |
| | | * @param carIds 车辆id集合 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Integer> carIds); |
| | | } |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.account.api.factory.AppUserFallbackFactory; |
| | | 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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "AppUserClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = AppUserFallbackFactory.class) |
| | | @FeignClient(contextId = "AppUserClient", value = ServiceNameConstants.ACCOUNT_SERVICE, fallbackFactory = AppUserFallbackFactory.class) |
| | | public interface AppUserClient { |
| | | @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"}) |
| | | @PostMapping(value = "/t-app-user/user/getUserIdsByPhone") |
| | | public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone); |
| | | |
| | | /** |
| | | * 根据用户id查询用户信息 |
| | | * @param appUserIds 用户id集合 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user/user/getUserByIds") |
| | | public R<List<TAppUser>> getUserByIds(@RequestBody List<Long> appUserIds); |
| | | |
| | | |
| | | /** |
| | | * 根据id获取用户 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/user/getUserById") |
| | | R<TAppUser> getUserById(Long id); |
| | | } |
| | |
| | | @ApiModel("管理后台 优惠券兑换记录列表返回VO") |
| | | public class ExchangeRecordVO { |
| | | @ApiModelProperty(value = "获得时间") |
| | | private String createTime; |
| | | private String createTime1; |
| | | @ApiModelProperty(value = "获得时间 前端忽略") |
| | | private LocalDateTime createTime; |
| | | @ApiModelProperty(value = "获得用户") |
| | | private String phone; |
| | | @ApiModelProperty(value = "优惠金额") |
| | |
| | | private String orderId; |
| | | @ApiModelProperty(value = " 前端忽略 获取方式 1=积分兑换 2现金购买") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty(value = " 是否删除0否1是") |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Integer couponId; |
| | | @ApiModelProperty(value = " 是否删除0否1是 前端忽略") |
| | | private Integer delFlag; |
| | | @ApiModelProperty(value = "三方支付流水号 前端忽略") |
| | | private String serialNumber; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/9 10:30 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class GetPermissionConfigurationDTO { |
| | | @ApiModelProperty(value = "备注") |
| | | private String permissionRemarks; |
| | | @ApiModelProperty(value = "权限菜单") |
| | | private Map<String, Object> menu; |
| | | } |
| | |
| | | private Integer accountingStrategyId; |
| | | @ApiModelProperty("计费策略类型(1=平台添加,2=自定义策略)") |
| | | private Integer accountingStrategyType; |
| | | @ApiModelProperty(value = "计费策略权限") |
| | | private boolean authAccountingStrategy = true; |
| | | @ApiModelProperty(value = "合作商权限") |
| | | private boolean authPartner = true; |
| | | @ApiModelProperty(value = "编辑权限") |
| | | private boolean authUpdate = true; |
| | | @ApiModelProperty(value = "删除权限") |
| | | private boolean authDelete = true; |
| | | } |
| | |
| | | private String equipmentType; |
| | | @ApiModelProperty(value = "额定功率") |
| | | private BigDecimal ratedPower; |
| | | @ApiModelProperty(value = "查看权限") |
| | | private boolean authQueryInfo = true; |
| | | @ApiModelProperty(value = "编辑权限") |
| | | private boolean authUpdate = true; |
| | | @ApiModelProperty(value = "删除权限") |
| | | private boolean authDelete = true; |
| | | @ApiModelProperty(value = "新增接口权限") |
| | | private boolean authAddChargingGun = true; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | |
| | | log.error("充电桩调用失败:{}", throwable.getMessage()); |
| | | return new ChargingPileClient() { |
| | | |
| | | @Override |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id获取充电桩列表失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 停车场服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class ParkingLotFallbackFactory implements FallbackFactory<ParkingLotClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ParkingLotFallbackFactory.class); |
| | | |
| | | @Override |
| | | public ParkingLotClient create(Throwable throwable) { |
| | | log.error("停车场调用失败:{}", throwable.getMessage()); |
| | | return new ParkingLotClient() { |
| | | |
| | | @Override |
| | | public R<TParkingLot> getLotBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id查询停车场信息调用失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SiteFallbackFactory implements FallbackFactory<SiteClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SiteFallbackFactory.class); |
| | | |
| | | @Override |
| | | public SiteClient create(Throwable throwable) { |
| | | log.error("站点调用失败:{}", throwable.getMessage()); |
| | | return new SiteClient() { |
| | | |
| | | @Override |
| | | public R<List<Site>> getSiteByIds(List<Integer> ids) { |
| | | return R.fail("根据id集合获取站点数据调用失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ChargingPileFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 充电桩服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "ChargingPileClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = ChargingPileFallbackFactory.class) |
| | | @FeignClient(contextId = "ChargingPileClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = ChargingPileFallbackFactory.class) |
| | | public interface ChargingPileClient { |
| | | |
| | | /** |
| | | * 管理后台-通过站点id获取充电桩列表 不分页 |
| | | */ |
| | | @ApiOperation(value = "管理后台-通过站点id获取充电桩列表 不分页") |
| | | @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId") |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | 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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 停车场服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "ParkingLotClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = ParkingLotFallbackFactory.class) |
| | | public interface ParkingLotClient { |
| | | |
| | | /** |
| | | * 通过站点id查询停车场信息 |
| | | */ |
| | | @GetMapping(value = "/t-parking-lot/getLotBySiteId") |
| | | public R<TParkingLot> getLotBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.SiteFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/10 14:38 |
| | | */ |
| | | @FeignClient(contextId = "SiteClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = SiteFallbackFactory.class) |
| | | public interface SiteClient { |
| | | |
| | | /** |
| | | * 根据id集合获取数据 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @PostMapping("/site/getSiteByIds") |
| | | R<List<Site>> getSiteByIds(@RequestBody List<Integer> ids); |
| | | } |
| | |
| | | @TableField("password") |
| | | @ApiModelProperty(value = "登录密码", required = true) |
| | | private String password; |
| | | /** |
| | | * 权限备注 |
| | | */ |
| | | @TableField("permission_remarks") |
| | | private String permissionRemarks; |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "用电地址") |
| | | @NotBlank(message = "用电地址不能为空") |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | | |
| | | @ApiModelProperty(value = "站点名称") |
| | | @TableField(exist = false) |
| | | private String siteName; |
| | | |
| | | @ApiModelProperty(value = "充电桩id") |
| | | @TableField("charging_pile_id") |
| | | private Integer chargingPileId; |
| | | |
| | | @ApiModelProperty(value = "通知电话") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "通知内容") |
| | | @TableField("content") |
| | | private String content; |
| | |
| | | @TableField("is_cache") |
| | | private Integer isCache; |
| | | |
| | | @ApiModelProperty(value = "菜单类型(M目录 C菜单 F按钮)") |
| | | @ApiModelProperty(value = "菜单类型(M目录 C菜单 F按钮 D数据)") |
| | | @TableField("menu_type") |
| | | private String menuType; |
| | | |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.query; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/9 11:13 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class SetPermissionConfiguration { |
| | | @ApiModelProperty(value = "备注") |
| | | private String permissionRemarks; |
| | | @ApiModelProperty(value = "权限菜单id数组", required = true) |
| | | private List<Integer> menuId; |
| | | @ApiModelProperty(value = "站点id", required = true) |
| | | private Integer siteId; |
| | | @ApiModelProperty(value = "合作商id", required = true) |
| | | private Integer partnerId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.query; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteDetailQuery对象",description = "站点详情查询条件") |
| | | public class SiteDetailQuery implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "站点id") |
| | | @NotNull(message = "站点id不能为空") |
| | | private Integer siteId; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @NotBlank(message = "地址经度不能为空") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @NotBlank(message = "地址纬度不能为空") |
| | | private String lat; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "ChargingGunCountVO对象",description = "充电枪数量VO") |
| | | public class ChargingGunCountVO extends Site { |
| | | |
| | | @ApiModelProperty(value = "充电枪在线数量") |
| | | private Integer freeCount; |
| | | @ApiModelProperty(value = "充电枪总数数量") |
| | | private Integer totalCount; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteDetailVO对象",description = "站点详情VO") |
| | | public class SiteDetailVO extends Site { |
| | | |
| | | @ApiModelProperty(value = "绑定车牌提示文案") |
| | | private String bindCarTips; |
| | | @ApiModelProperty(value = "距离") |
| | | private double distance; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "StrategyPriceVO对象",description = "价格说明金额返回,会员开通金额说明") |
| | | public class StrategyPriceVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "优惠金额") |
| | | private BigDecimal discountAmount; |
| | | |
| | | @ApiModelProperty(value = "最高优惠金额") |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | @ApiModelProperty(value = "会员起步价") |
| | | private BigDecimal vipStartPrice; |
| | | |
| | | @ApiModelProperty(value = "服务费折扣") |
| | | private BigDecimal serviceFeeDiscount; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "策略名称") |
| | | private String strategyName; |
| | | |
| | | @ApiModelProperty(value = "编辑权限") |
| | | private boolean authUpdate = true; |
| | | |
| | | @ApiModelProperty(value = "删除权限") |
| | | private boolean authDelete = true; |
| | | |
| | | @ApiModelProperty(value = "查看费率权限") |
| | | private boolean authViewRates = true; |
| | | |
| | | @ApiModelProperty(value = "编辑权限") |
| | | private boolean authDownloadQRCode = true; |
| | | |
| | | @ApiModelProperty(value = "编辑权限") |
| | | private boolean authQueryInfo = true; |
| | | |
| | | @ApiModelProperty(value = "编辑权限") |
| | | private boolean authEndCharge = true; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TChargingPileVO对象",description = "充电桩信息") |
| | | public class TChargingPileVO implements Serializable { |
| | | @ApiModelProperty(value = "充电桩id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "设备编号") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "充电设备名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "桩号") |
| | | private Integer number; |
| | | |
| | | @ApiModelProperty(value = "充电枪信息列表") |
| | | private List<TChargingGun> chargingGunList; |
| | | |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.ChargingPileFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.SiteFallbackFactory |
| | |
| | | * 充电订单服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "ChargingPileClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = ChargingPileFallbackFactory.class) |
| | | @FeignClient(contextId = "ChargingPileClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = ChargingPileFallbackFactory.class) |
| | | public interface ChargingPileClient { |
| | | |
| | | |
| | |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<List<Integer>> getSalesCountByGoodsId(String goodsIds) { |
| | | return null; |
| | | return R.fail("根据商品订单ids查询销量:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<String>> getCodeByOrderId(String goodsIds) { |
| | | return R.fail("根据订单ids查询现金购买优惠券订单编号:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { |
| | | return R.fail("查询活动费用统计失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | * 充电订单服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class) |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class) |
| | | public interface ChargingOrderClient { |
| | | @PostMapping(value = "/t-charging-order/useOrderCount") |
| | | R<Long> useOrderCount(@RequestParam Long userId); |
| | |
| | | * 充电订单服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = ExchangeOrderFallbackFactory.class) |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ExchangeOrderFallbackFactory.class) |
| | | public interface ExchangeOrderClient { |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * 后台订单服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "OrderClient", value = ServiceNameConstants.CONTRACT_ORDER, fallbackFactory = OrderFallbackFactory.class) |
| | | @FeignClient(contextId = "OrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = OrderFallbackFactory.class) |
| | | public interface OrderClient { |
| | | |
| | | @PostMapping("/t-exchange-order/getSalesCountByGoodsIds") |
| | | R<List<Integer>> getSalesCountByGoodsId(String goodsIds); |
| | | |
| | | /** |
| | | * 管理后台 根据t_app_coupon订单购买或者兑换优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-exchange-order/getCodeByOrderId") |
| | | public R<List<String>> getCodeByOrderId(String goodsIds); |
| | | /** |
| | | * 管理后台 活动费用统计 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-exchange-order/activityStatistics") |
| | | public R<TActivityVO> activityStatistics(@RequestBody TActivityStatisticsQuery dto); |
| | | } |
| | |
| | | @TableField("app_user_car_id") |
| | | private Integer appUserCarId; |
| | | |
| | | @ApiModelProperty(value = "站点 id") |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | | |
| | | @ApiModelProperty(value = "停车场id") |
| | | @TableField("parking_lot_id") |
| | | private Integer parkingLotId; |
New file |
| | |
| | | package com.ruoyi.order.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_grant_vip") |
| | | @ApiModel(value="TGrantVip对象", description="") |
| | | public class TGrantVip extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "购买的会员id") |
| | | @TableField("vip_id") |
| | | private Integer vipId; |
| | | @ApiModelProperty(value = "购买的会员id") |
| | | @TableField("vip_id") |
| | | private BigDecimal orderAmount; |
| | | } |
| | |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "充电车辆 id") |
| | | @TableField("app_user_car_id") |
| | | private Integer appUserCarId; |
| | | |
| | | @ApiModelProperty(value = "评分") |
| | | @TableField("mark") |
| | | private Integer mark; |
New file |
| | |
| | | package com.ruoyi.order.api.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "管理后台-活动费用统计Query") |
| | | public class TActivityStatisticsQuery extends BasePage { |
| | | @ApiModelProperty(value = "用户电话") |
| | | private String phone; |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String code; |
| | | @ApiModelProperty(value = "参与类型1优惠券 2会员抵扣 3会员活动 4赠送会员") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "订单类型1充电订单 2商品订单 3会员订单 4赠送会员") |
| | | private Integer orderType; |
| | | @ApiModelProperty(value = "电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty(value = "消费时间开始(2020-01-02 00:00)") |
| | | private String startTime; |
| | | @ApiModelProperty(value = "消费时间结束(2020-01-02 00:00)") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty(value = "用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | @ApiModelProperty(value = "充电桩ids 前端忽略") |
| | | private List<Integer> chargingPileIds; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOrderEvaluateQuery对象",description = "订单评价查询条件") |
| | | public class TOrderEvaluateQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "站点id") |
| | | private Integer siteId; |
| | | |
| | | @ApiModelProperty(value = "订单id集合 前端忽略") |
| | | private List<Long> orderIds; |
| | | |
| | | @ApiModelProperty(value = "标签类型 1=最新 2=有图 3=好评 4=中差评 5=其他") |
| | | private Integer tagType; |
| | | |
| | | @ApiModelProperty(value = "标签id 标签类型为5时传输此字段") |
| | | private Integer tagId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SiteDetailEvaluateVO对象",description = "站点详情订单评价") |
| | | public class SiteDetailEvaluateVO extends TOrderEvaluate { |
| | | |
| | | @ApiModelProperty(value = "好评率") |
| | | private BigDecimal reviewRate; |
| | | |
| | | @ApiModelProperty(value = "评价数") |
| | | private Integer evaluateCount; |
| | | |
| | | @ApiModelProperty(value = "评价列表取三条") |
| | | private List<TOrderEvaluateVO> orderEvaluateVOS; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.ser.Serializers; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.order.api.model.*; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "管理后台活动费用统计分页列表", description = "管理后台活动费用统计分页列表") |
| | | public class TActivityStatisticslVO extends BasePojo { |
| | | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "参与类型 优惠券 会员抵扣 会员活动 赠送会员") |
| | | private String type; |
| | | |
| | | @ApiModelProperty(value = "订单类型 充电订单 商品订单 会员订单 赠送会员") |
| | | private Integer orderType; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String code; |
| | | @ApiModelProperty(value = "应付/价值") |
| | | private BigDecimal orderAmount; |
| | | @ApiModelProperty(value = "优惠券抵扣") |
| | | private BigDecimal couponDiscountAmount; |
| | | @ApiModelProperty(value = "会员抵扣") |
| | | private BigDecimal vipDiscountAmount; |
| | | @ApiModelProperty(value = "实付") |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private String time; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal total; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal coupon; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal vipActivity; |
| | | @ApiModelProperty(value = "消费时间") |
| | | private BigDecimal grantVip; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOrderAppealVO对象", description = "订单申诉VO对象") |
| | | public class TActivityVO { |
| | | @ApiModelProperty(value = "分页列表") |
| | | private PageInfo<TActivityStatisticslVO> list; |
| | | @ApiModelProperty(value = "优惠总额") |
| | | private BigDecimal total; |
| | | @ApiModelProperty(value = "优惠券总额") |
| | | private BigDecimal coupon; |
| | | @ApiModelProperty(value = "会员抵扣总额") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "会员活动") |
| | | private BigDecimal vipActivity; |
| | | @ApiModelProperty(value = "赠送会员") |
| | | private BigDecimal grantVip; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOrderEvaluateVO对象",description = "订单评价") |
| | | public class TOrderEvaluateVO extends TOrderEvaluate { |
| | | |
| | | @ApiModelProperty(value = "用户") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "头像") |
| | | private String avatar; |
| | | |
| | | @ApiModelProperty(value = "车辆品牌名称") |
| | | private String carName; |
| | | |
| | | @ApiModelProperty(value = "评价标签列表") |
| | | private List<TOrderEvaluateTag> orderEvaluateTags; |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "公司名称") |
| | | @NotBlank(message = "公司名称不能为空") |
| | | @TableField("company_name") |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "汽车数量") |
| | | @NotNull(message = "汽车数量不能为空") |
| | | @TableField("vehicles_number") |
| | | private Integer vehiclesNumber; |
| | | |
| | | @ApiModelProperty(value = "联系人姓名") |
| | | @NotBlank(message = "联系人姓名不能为空") |
| | | @TableField("contact_name") |
| | | private String contactName; |
| | | |
| | | @ApiModelProperty(value = "联系人电话") |
| | | @NotBlank(message = "联系人电话不能为空") |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiModelProperty(value = "月卡价格") |
| | | @TableField("monthly_card") |
| | | private Double monthlyCard; |
| | | private BigDecimal monthlyCard; |
| | | |
| | | @ApiModelProperty(value = "月卡显示(0=否,1=是)") |
| | | @TableField("monthly_card_reveal") |
| | |
| | | |
| | | @ApiModelProperty(value = "月卡折扣") |
| | | @TableField("monthly_card_discount") |
| | | private Double monthlyCardDiscount; |
| | | private BigDecimal monthlyCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣开始时间") |
| | | @TableField("monthly_card_discount_start") |
| | |
| | | |
| | | @ApiModelProperty(value = "季卡价格") |
| | | @TableField("season_card") |
| | | private Double seasonCard; |
| | | private BigDecimal seasonCard; |
| | | |
| | | @ApiModelProperty(value = "季卡显示(0=否,1=是)") |
| | | @TableField("season_card_reveal") |
| | |
| | | |
| | | @ApiModelProperty(value = "季卡折扣") |
| | | @TableField("season_card_discount") |
| | | private Double seasonCardDiscount; |
| | | private BigDecimal seasonCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣开始时间") |
| | | @TableField("season_card_discount_start") |
| | |
| | | |
| | | @ApiModelProperty(value = "年卡价格") |
| | | @TableField("annual_card") |
| | | private Double annualCard; |
| | | private BigDecimal annualCard; |
| | | |
| | | @ApiModelProperty(value = "年卡显示(0=否,1=是)") |
| | | @TableField("annual_card_reveal") |
| | |
| | | |
| | | @ApiModelProperty(value = "年卡折扣") |
| | | @TableField("annual_card_discount") |
| | | private Double annualCardDiscount; |
| | | private BigDecimal annualCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣开始时间") |
| | | @TableField("annual_card_discount_start") |
| | |
| | | |
| | | @ApiModelProperty(value = "最高抵扣金额") |
| | | @TableField("maximum_deduction") |
| | | private Double maximumDeduction; |
| | | private BigDecimal maximumDeduction; |
| | | |
| | | @ApiModelProperty(value = "抵扣类型(1=服务费)") |
| | | @TableField("deduction_type") |
| | |
| | | return R.fail("删除单位失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TCompany> unitDetail(Integer id) { |
| | | return R.fail("查询单位失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Page<TUserTag>> queryTagPage(TagListQueryDto unitListQueryDto) { |
| | | return R.fail("查询标签:" + throwable.getMessage()); |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TRoleSite; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商品服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class RoleSiteFallbackFactory implements FallbackFactory<RoleSiteClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(RoleSiteFallbackFactory.class); |
| | | |
| | | @Override |
| | | public RoleSiteClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new RoleSiteClient() { |
| | | |
| | | @Override |
| | | public R<List<Integer>> getSiteIds(Long roleId) { |
| | | return R.fail("获取角色站点失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R addRoleSite(List<TRoleSite> roleSites) { |
| | | return R.fail("添加角色站点失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R delRoleSite(Long roleId) { |
| | | return R.fail("删除角色站点失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.TEvaluationTagClient; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 评价标签服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class TEvaluationTagFallbackFactory implements FallbackFactory<TEvaluationTagClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(TEvaluationTagFallbackFactory.class); |
| | | |
| | | @Override |
| | | public TEvaluationTagClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new TEvaluationTagClient() { |
| | | |
| | | @Override |
| | | public R<List<TEvaluationTagVO>> getTagList(Integer type) { |
| | | return R.fail("获取标签列表:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds) { |
| | | return R.fail("根据id集合获取数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商品服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class UserSiteFallbackFactory implements FallbackFactory<UserSiteClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(UserSiteFallbackFactory.class); |
| | | |
| | | @Override |
| | | public UserSiteClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new UserSiteClient() { |
| | | |
| | | @Override |
| | | public R<List<Integer>> getSiteIds(Long userId) { |
| | | return R.fail("获取用户站点失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R addUserSite(List<TUserSite> userSite) { |
| | | return R.fail("添加用户站点失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R delUserSite(Long userId) { |
| | | return R.fail("删除用户站点失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 会员服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class VipFallbackFactory implements FallbackFactory<VipClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(VipFallbackFactory.class); |
| | | |
| | | @Override |
| | | public VipClient create(Throwable throwable) { |
| | | log.error("会员调用失败:{}", throwable.getMessage()); |
| | | return new VipClient() { |
| | | |
| | | @Override |
| | | public R<TVip> getVipInfoByType(Integer type) { |
| | | return R.fail("获取最高抵扣、最低起步价,最高折扣的会员失败:" + throwable.getMessage()); |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | * 商品服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "UnitClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = OtherFallbackFactory.class) |
| | | @FeignClient(contextId = "UnitClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = OtherFallbackFactory.class) |
| | | public interface OtherClient { |
| | | //单位分页 |
| | | @PostMapping(value = "/t-company/unit/page") |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TRoleSite; |
| | | import com.ruoyi.other.api.factory.RoleSiteFallbackFactory; |
| | | import com.ruoyi.other.api.factory.UserSiteFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/9 18:14 |
| | | */ |
| | | @FeignClient(contextId = "RoleSiteClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = RoleSiteFallbackFactory.class) |
| | | public interface RoleSiteClient { |
| | | |
| | | |
| | | /** |
| | | * 根据角色id获取可访问的站点数据 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-role-site/getSiteIds") |
| | | R<List<Integer>> getSiteIds(Long roleId); |
| | | |
| | | |
| | | /** |
| | | * 添加角色站点数据 |
| | | * @param roleSites |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-role-site/addRoleSite") |
| | | R addRoleSite(List<TRoleSite> roleSites); |
| | | |
| | | /** |
| | | * 删除角色站点数据 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/t-role-site/delRoleSite") |
| | | R delRoleSite(Long roleId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.factory.RoleSiteFallbackFactory; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/9 18:14 |
| | | */ |
| | | @FeignClient(contextId = "TEvaluationTagClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = RoleSiteFallbackFactory.class) |
| | | public interface TEvaluationTagClient { |
| | | |
| | | |
| | | /** |
| | | * 获取标签列表 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-evaluation-tag/getTagList") |
| | | R<List<TEvaluationTagVO>> getTagList(Integer type); |
| | | |
| | | |
| | | /** |
| | | * 根据id集合获取数据 |
| | | * @param tagIds |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-evaluation-tag/getListByIds") |
| | | R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.api.factory.UserSiteFallbackFactory; |
| | | import org.apache.ibatis.annotations.Delete; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/9 18:14 |
| | | */ |
| | | @FeignClient(contextId = "UserSiteClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = UserSiteFallbackFactory.class) |
| | | public interface UserSiteClient { |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取可访问的站点数据 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-user-site/getSiteIds") |
| | | R<List<Integer>> getSiteIds(Long userId); |
| | | |
| | | |
| | | /** |
| | | * 添加用户站点关系数据 |
| | | * @param userSite |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-user-site/getSiteIds") |
| | | R addUserSite(List<TUserSite> userSite); |
| | | |
| | | |
| | | /** |
| | | * 删除用户站点数据 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/t-user-site/delUserSite") |
| | | R delUserSite(Long userId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.factory.VipFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * 会员服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "VipClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = VipFallbackFactory.class) |
| | | public interface VipClient { |
| | | |
| | | /** |
| | | * 获取最高抵扣、最低起步价,最高折扣的会员 |
| | | * @param type 1=最高抵扣、2=最低起步价,3=最高折扣 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/vip/getVipInfoByType") |
| | | R<TVip> getVipInfoByType(@RequestParam Integer type); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.vo; |
| | | |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TEvaluationTagVO对象", description = "评价标签") |
| | | public class TEvaluationTagVO extends TEvaluationTag{ |
| | | |
| | | @ApiModelProperty(value = "评价标签数量") |
| | | private Integer tagCount; |
| | | |
| | | } |
| | |
| | | com.ruoyi.other.api.factory.GoodsFallbackFactory |
| | | com.ruoyi.other.api.factory.OtherFallbackFactory |
| | | com.ruoyi.other.api.factory.UserSiteFallbackFactory |
| | | com.ruoyi.other.api.factory.RoleSiteFallbackFactory |
| | |
| | | * 充电订单服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.CONTRACT_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class) |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.PAYMENT_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class) |
| | | public interface ChargingOrderClient { |
| | | |
| | | |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-modules-system</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | @PostMapping("/operlog") |
| | | public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception; |
| | | |
| | | /** |
| | | * 保存访问记录 |
| | | * |
| | | * @param sysLogininfor 访问实体 |
| | | * @param source 请求来源 |
| | | * @return 结果 |
| | | */ |
| | | @PostMapping("/logininfor") |
| | | public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | } |
| | |
| | | package com.ruoyi.system.api.domain; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import com.ruoyi.common.core.annotation.Excel.ColumnType; |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysOperLog extends BaseEntity |
| | | { |
| | | public class SysOperLog extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 日志主键 */ |
| | | /** |
| | | * 日志主键 |
| | | */ |
| | | @Excel(name = "操作序号", cellType = ColumnType.NUMERIC) |
| | | private Long operId; |
| | | |
| | | /** 操作模块 */ |
| | | /** |
| | | * 操作模块 |
| | | */ |
| | | @Excel(name = "操作模块") |
| | | private String title; |
| | | |
| | | /** 业务类型(0其它 1新增 2修改 3删除) */ |
| | | /** |
| | | * 业务类型(0其它 1新增 2修改 3删除) |
| | | */ |
| | | @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据") |
| | | private Integer businessType; |
| | | |
| | | /** 业务类型数组 */ |
| | | /** |
| | | * 业务类型数组 |
| | | */ |
| | | private Integer[] businessTypes; |
| | | |
| | | /** 请求方法 */ |
| | | /** |
| | | * 请求方法 |
| | | */ |
| | | @Excel(name = "请求方法") |
| | | private String method; |
| | | |
| | | /** 请求方式 */ |
| | | /** |
| | | * 请求方式 |
| | | */ |
| | | @Excel(name = "请求方式") |
| | | private String requestMethod; |
| | | |
| | | /** 操作类别(0其它 1后台用户 2手机端用户) */ |
| | | /** |
| | | * 操作类别(0其它 1后台用户 2手机端用户) |
| | | */ |
| | | @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") |
| | | private Integer operatorType; |
| | | |
| | | /** 操作人员 */ |
| | | /** |
| | | * 操作人员 |
| | | */ |
| | | @Excel(name = "操作人员") |
| | | private String operName; |
| | | |
| | | /** 部门名称 */ |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | @Excel(name = "部门名称") |
| | | private String deptName; |
| | | |
| | | /** 请求url */ |
| | | /** |
| | | * 请求url |
| | | */ |
| | | @Excel(name = "请求地址") |
| | | private String operUrl; |
| | | |
| | | /** 操作地址 */ |
| | | /** |
| | | * 操作地址 |
| | | */ |
| | | @Excel(name = "操作地址") |
| | | private String operIp; |
| | | |
| | | /** 请求参数 */ |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @Excel(name = "请求参数") |
| | | private String operParam; |
| | | |
| | | /** 返回参数 */ |
| | | /** |
| | | * 返回参数 |
| | | */ |
| | | @Excel(name = "返回参数") |
| | | private String jsonResult; |
| | | |
| | | /** 操作状态(0正常 1异常) */ |
| | | /** |
| | | * 操作状态(0正常 1异常) |
| | | */ |
| | | @Excel(name = "状态", readConverterExp = "0=正常,1=异常") |
| | | private Integer status; |
| | | |
| | | /** 错误消息 */ |
| | | /** |
| | | * 错误消息 |
| | | */ |
| | | @Excel(name = "错误消息") |
| | | private String errorMsg; |
| | | |
| | | /** 操作时间 */ |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date operTime; |
| | | |
| | | /** 消耗时间 */ |
| | | /** |
| | | * 消耗时间 |
| | | */ |
| | | @Excel(name = "消耗时间", suffix = "毫秒") |
| | | private Long costTime; |
| | | |
| | | public Long getOperId() |
| | | { |
| | | public Long getOperId() { |
| | | return operId; |
| | | } |
| | | |
| | | public void setOperId(Long operId) |
| | | { |
| | | public void setOperId(Long operId) { |
| | | this.operId = operId; |
| | | } |
| | | |
| | | public String getTitle() |
| | | { |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) |
| | | { |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public Integer getBusinessType() |
| | | { |
| | | public Integer getBusinessType() { |
| | | return businessType; |
| | | } |
| | | |
| | | public void setBusinessType(Integer businessType) |
| | | { |
| | | public void setBusinessType(Integer businessType) { |
| | | this.businessType = businessType; |
| | | } |
| | | |
| | | public Integer[] getBusinessTypes() |
| | | { |
| | | public Integer[] getBusinessTypes() { |
| | | return businessTypes; |
| | | } |
| | | |
| | | public void setBusinessTypes(Integer[] businessTypes) |
| | | { |
| | | public void setBusinessTypes(Integer[] businessTypes) { |
| | | this.businessTypes = businessTypes; |
| | | } |
| | | |
| | | public String getMethod() |
| | | { |
| | | public String getMethod() { |
| | | return method; |
| | | } |
| | | |
| | | public void setMethod(String method) |
| | | { |
| | | public void setMethod(String method) { |
| | | this.method = method; |
| | | } |
| | | |
| | | public String getRequestMethod() |
| | | { |
| | | public String getRequestMethod() { |
| | | return requestMethod; |
| | | } |
| | | |
| | | public void setRequestMethod(String requestMethod) |
| | | { |
| | | public void setRequestMethod(String requestMethod) { |
| | | this.requestMethod = requestMethod; |
| | | } |
| | | |
| | | public Integer getOperatorType() |
| | | { |
| | | public Integer getOperatorType() { |
| | | return operatorType; |
| | | } |
| | | |
| | | public void setOperatorType(Integer operatorType) |
| | | { |
| | | public void setOperatorType(Integer operatorType) { |
| | | this.operatorType = operatorType; |
| | | } |
| | | |
| | | public String getOperName() |
| | | { |
| | | public String getOperName() { |
| | | return operName; |
| | | } |
| | | |
| | | public void setOperName(String operName) |
| | | { |
| | | public void setOperName(String operName) { |
| | | this.operName = operName; |
| | | } |
| | | |
| | | public String getDeptName() |
| | | { |
| | | public String getDeptName() { |
| | | return deptName; |
| | | } |
| | | |
| | | public void setDeptName(String deptName) |
| | | { |
| | | public void setDeptName(String deptName) { |
| | | this.deptName = deptName; |
| | | } |
| | | |
| | | public String getOperUrl() |
| | | { |
| | | public String getOperUrl() { |
| | | return operUrl; |
| | | } |
| | | |
| | | public void setOperUrl(String operUrl) |
| | | { |
| | | public void setOperUrl(String operUrl) { |
| | | this.operUrl = operUrl; |
| | | } |
| | | |
| | | public String getOperIp() |
| | | { |
| | | public String getOperIp() { |
| | | return operIp; |
| | | } |
| | | |
| | | public void setOperIp(String operIp) |
| | | { |
| | | public void setOperIp(String operIp) { |
| | | this.operIp = operIp; |
| | | } |
| | | |
| | | public String getOperParam() |
| | | { |
| | | public String getOperParam() { |
| | | return operParam; |
| | | } |
| | | |
| | | public void setOperParam(String operParam) |
| | | { |
| | | public void setOperParam(String operParam) { |
| | | this.operParam = operParam; |
| | | } |
| | | |
| | | public String getJsonResult() |
| | | { |
| | | public String getJsonResult() { |
| | | return jsonResult; |
| | | } |
| | | |
| | | public void setJsonResult(String jsonResult) |
| | | { |
| | | public void setJsonResult(String jsonResult) { |
| | | this.jsonResult = jsonResult; |
| | | } |
| | | |
| | | public Integer getStatus() |
| | | { |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) |
| | | { |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getErrorMsg() |
| | | { |
| | | public String getErrorMsg() { |
| | | return errorMsg; |
| | | } |
| | | |
| | | public void setErrorMsg(String errorMsg) |
| | | { |
| | | public void setErrorMsg(String errorMsg) { |
| | | this.errorMsg = errorMsg; |
| | | } |
| | | |
| | | public Date getOperTime() |
| | | { |
| | | public Date getOperTime() { |
| | | return operTime; |
| | | } |
| | | |
| | | public void setOperTime(Date operTime) |
| | | { |
| | | public void setOperTime(Date operTime) { |
| | | this.operTime = operTime; |
| | | } |
| | | |
| | | public Long getCostTime() |
| | | { |
| | | public Long getCostTime() { |
| | | return costTime; |
| | | } |
| | | |
| | | public void setCostTime(Long costTime) |
| | | { |
| | | public void setCostTime(Long costTime) { |
| | | this.costTime = costTime; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.api.domain; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | |
| | | /** 角色菜单权限 */ |
| | | @TableField(exist = false) |
| | | private Set<String> permissions; |
| | | |
| | | /** 车辆数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限 */ |
| | | private Integer carDataAuth; |
| | | |
| | | /** 车务数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限 */ |
| | | private Integer carTrainOperAuth; |
| | | |
| | | /** 合同数据权限:1=所有数据 2=仅自己负责的合同 3=无数据权限 */ |
| | | private Integer contractDataAuth; |
| | | |
| | | /** 公司id */ |
| | | private Integer companyId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "站点名称") |
| | | @TableField(exist = false) |
| | | private List<String> siteNames; |
| | | |
| | | public SysRole() |
| | | { |
| | |
| | | public SysRole(Long roleId) |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | public Integer getCarDataAuth() { |
| | | return carDataAuth; |
| | | } |
| | | |
| | | public void setCarDataAuth(Integer carDataAuth) { |
| | | this.carDataAuth = carDataAuth; |
| | | } |
| | | |
| | | public Integer getCarTrainOperAuth() { |
| | | return carTrainOperAuth; |
| | | } |
| | | |
| | | public void setCarTrainOperAuth(Integer carTrainOperAuth) { |
| | | this.carTrainOperAuth = carTrainOperAuth; |
| | | } |
| | | |
| | | public Integer getContractDataAuth() { |
| | | return contractDataAuth; |
| | | } |
| | | |
| | | public void setContractDataAuth(Integer contractDataAuth) { |
| | | this.contractDataAuth = contractDataAuth; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Long getRoleId() |
| | |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public List<String> getSiteNames() { |
| | | return siteNames; |
| | | } |
| | | |
| | | public void setSiteNames(List<String> siteNames) { |
| | | this.siteNames = siteNames; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | |
| | | /** 用户头像 */ |
| | | private String avatar; |
| | | /** |
| | | * 登录账号 |
| | | */ |
| | | @TableField("account") |
| | | private String account; |
| | | |
| | | /** 密码 */ |
| | | @NotBlank(message = "密码不能为空") |
| | |
| | | /** |
| | | * 角色类型 1=平台 2=公司 3=门店 4=修理厂 |
| | | */ |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=公司 3=门店 4=修理厂") |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=合作商") |
| | | private Integer roleType; |
| | | |
| | | @Excel(name = "密码修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "充电站") |
| | | @TableField(exist = false) |
| | | private List<String> siteNames; |
| | | |
| | | @ApiModelProperty(value = "充电站id", required = true) |
| | | @TableField(exist = false) |
| | | private List<Integer> siteIds; |
| | | |
| | | @ApiModelProperty(value = "角色") |
| | | @TableField(exist = false) |
| | | private List<String> roleNames; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public String getRemark() { |
| | |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | } |
| | | |
| | | public void setAccount(String account) { |
| | | this.account = account; |
| | | } |
| | | |
| | | public String getPassword() |
| | | { |
| | | return password; |
| | |
| | | { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | |
| | | public List<String> getSiteNames() { |
| | | return siteNames; |
| | | } |
| | | |
| | | public void setSiteNames(List<String> siteNames) { |
| | | this.siteNames = siteNames; |
| | | } |
| | | |
| | | public List<String> getRoleNames() { |
| | | return roleNames; |
| | | } |
| | | |
| | | public List<Integer> getSiteIds() { |
| | | return siteIds; |
| | | } |
| | | |
| | | public void setSiteIds(List<Integer> siteIds) { |
| | | this.siteIds = siteIds; |
| | | } |
| | | |
| | | public void setRoleNames(List<String> roleNames) { |
| | | this.roleNames = roleNames; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class); |
| | | |
| | | @Override |
| | | public RemoteLogService create(Throwable throwable) |
| | | { |
| | | public RemoteLogService create(Throwable throwable) { |
| | | log.error("日志服务调用失败:{}", throwable.getMessage()); |
| | | return new RemoteLogService() |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source) |
| | | { |
| | | return null; |
| | | } |
| | | }; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysLoginLogClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.*; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class SysLoginLogFallbackFactory implements FallbackFactory<SysLoginLogClient> { |
| | | @Override |
| | | public SysLoginLogClient create(Throwable cause) { |
| | | return new SysLoginLogClient(){ |
| | | |
| | | |
| | | @Override |
| | | public R saveLoginLog(SysLoginLog loginLog) { |
| | | return R.fail("添加登录日志失败!" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<SysUser> queryUserByAccount(String account) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<SysUser> queryUserByUserName(String userName) { |
| | | return R.fail("通过账号查询用户失败:" + cause.getMessage()); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public R resetPassword(SysUser user) { |
| | | return null; |
| | | return R.fail("重置用户密码失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.factory.SysLoginLogFallbackFactory; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 16:30 |
| | | */ |
| | | @FeignClient(contextId = "SysLoginLogClient", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = SysLoginLogFallbackFactory.class) |
| | | public interface SysLoginLogClient { |
| | | |
| | | |
| | | /** |
| | | * 添加登陆日志 |
| | | * @param loginLog |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveLoginLog") |
| | | R saveLoginLog(@RequestBody SysLoginLog loginLog); |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/user/queryUserByPhone") |
| | | R<SysUser> queryUserByPhone(@RequestBody String phone); |
| | | |
| | | |
| | | /** |
| | | * 根据账号获取用户数据 |
| | | * @param account |
| | | * @return |
| | | */ |
| | | @PostMapping("/user/queryUserByAccount") |
| | | R<SysUser> queryUserByAccount(@RequestBody String account); |
| | | |
| | | /** |
| | | * 通过账号查询用户 |
| | |
| | | com.ruoyi.system.api.factory.RemoteFileFallbackFactory |
| | | com.ruoyi.system.api.factory.SysUserFallbackFactory |
| | | com.ruoyi.system.api.factory.SysRoleFallbackFactory |
| | | com.ruoyi.system.api.factory.SysLoginLogFallbackFactory |
| | |
| | | package com.ruoyi.auth.controller; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.system.api.RemoteUserService; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysLoginLogClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.NetworkInterface; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private SysLoginService sysLoginService; |
| | | @Autowired |
| | | @Resource |
| | | private SysUserClient userClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("login") |
| | | public R<?> login(@RequestBody LoginBody form) |
| | | { |
| | | public R<?> login(@RequestBody LoginBody form, HttpServletRequest request) { |
| | | // 用户登录 |
| | | LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); |
| | | LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(), request); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("token",tokenService.createToken(userInfo)); |
| | | List<SysRole> roles = userInfo.getSysUser().getRoles(); |
| | |
| | | sysUser.setLoginDate(new Date()); |
| | | System.out.println("修改用户登录时间"+sysUser); |
| | | userClient.updateSysUser(sysUser); |
| | | // 获取登录token |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @DeleteMapping("logout") |
| | | public R<?> logout(HttpServletRequest request) |
| | | { |
| | | public R<?> logout(HttpServletRequest request) { |
| | | String token = SecurityUtils.getToken(request); |
| | | if (StringUtils.isNotEmpty(token)) |
| | | { |
| | |
| | | // 删除用户缓存记录 |
| | | AuthUtil.logoutByToken(token); |
| | | // 记录用户退出日志 |
| | | sysLoginService.logout(username); |
| | | sysLoginService.logout(username, request); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping("register") |
| | | public R<?> register(@RequestBody RegisterBody registerBody) |
| | | public R<?> register(@RequestBody RegisterBody registerBody, HttpServletRequest request) |
| | | { |
| | | // 用户注册 |
| | | sysLoginService.register(registerBody.getUsername(), registerBody.getPassword()); |
| | | sysLoginService.register(registerBody.getUsername(), registerBody.getPassword(), request); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.auth.service; |
| | | |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | |
| | | import com.ruoyi.system.api.RemoteUserService; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 登录校验方法 |
| | |
| | | /** |
| | | * 登录 |
| | | */ |
| | | public LoginUser login(String username, String password) |
| | | public LoginUser login(String username, String password, HttpServletRequest request) { |
| | | // 查询用户信息 |
| | | R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER); |
| | | |
| | | if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) |
| | | { |
| | | recordLogService.recordLogininfor(request, null, username, Constants.LOGIN_FAIL_STATUS, "登录用户不存在"); |
| | | throw new ServiceException("登录用户:" + username + " 不存在"); |
| | | } |
| | | LoginUser userInfo = userResult.getData(); |
| | | SysUser user = userResult.getData().getSysUser(); |
| | | |
| | | // 用户名或密码为空 错误 |
| | | if (StringUtils.isAnyBlank(username, password)) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写"); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户/密码必须填写"); |
| | | throw new ServiceException("用户/密码必须填写"); |
| | | } |
| | | // 密码如果不在指定范围内 错误 |
| | | if (password.length() < UserConstants.PASSWORD_MIN_LENGTH |
| | | || password.length() > UserConstants.PASSWORD_MAX_LENGTH) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围"); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户密码不在指定范围"); |
| | | throw new ServiceException("用户密码不在指定范围"); |
| | | } |
| | | // 用户名不在指定范围内 错误 |
| | | if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围"); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户名不在指定范围"); |
| | | throw new ServiceException("用户名不在指定范围"); |
| | | } |
| | | // IP黑名单校验 |
| | | String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); |
| | | if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾,访问IP已被列入系统黑名单"); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "很遗憾,访问IP已被列入系统黑名单"); |
| | | throw new ServiceException("很遗憾,访问IP已被列入系统黑名单"); |
| | | } |
| | | // 查询用户信息 |
| | | R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER); |
| | | |
| | | if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在"); |
| | | throw new ServiceException("登录用户:" + username + " 不存在"); |
| | | } |
| | | |
| | | if (R.FAIL == userResult.getCode()) |
| | |
| | | throw new ServiceException(userResult.getMsg()); |
| | | } |
| | | |
| | | LoginUser userInfo = userResult.getData(); |
| | | SysUser user = userResult.getData().getSysUser(); |
| | | |
| | | if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除"); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "对不起,您的账号已被删除"); |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); |
| | | } |
| | | if (UserStatus.DISABLE.getCode().equals(user.getStatus())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员"); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, "用户已停用,请联系管理员"); |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | } |
| | | passwordService.validate(user, password); |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功"); |
| | | passwordService.validate(user, password, request); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "登录成功"); |
| | | return userInfo; |
| | | } |
| | | |
| | | public void logout(String loginName) |
| | | public void logout(String loginName, HttpServletRequest request) |
| | | { |
| | | recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功"); |
| | | recordLogService.recordLogininfor(request, null, loginName, Constants.LOGIN_SUCCESS_STATUS, "退出成功"); |
| | | } |
| | | |
| | | /** |
| | | * 注册 |
| | | */ |
| | | public void register(String username, String password) |
| | | public void register(String username, String password, HttpServletRequest request) |
| | | { |
| | | // 用户名或密码为空 错误 |
| | | if (StringUtils.isAnyBlank(username, password)) |
| | |
| | | { |
| | | throw new ServiceException(registerResult.getMsg()); |
| | | } |
| | | recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功"); |
| | | recordLogService.recordLogininfor(request, sysUser.getUserId().intValue(), username, Constants.LOGIN_SUCCESS_STATUS, "注册成功"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 登录密码方法 |
| | | * |
| | |
| | | return CacheConstants.PWD_ERR_CNT_KEY + username; |
| | | } |
| | | |
| | | public void validate(SysUser user, String password) |
| | | public void validate(SysUser user, String password, HttpServletRequest request) |
| | | { |
| | | String username = user.getUserName(); |
| | | |
| | |
| | | if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) |
| | | { |
| | | String errMsg = String.format("密码输入错误%s次,帐户锁定%s分钟", maxRetryCount, lockTime); |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL,errMsg); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS,errMsg); |
| | | throw new ServiceException(errMsg); |
| | | } |
| | | |
| | | if (!matches(user, password)) |
| | | { |
| | | retryCount = retryCount + 1; |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount)); |
| | | recordLogService.recordLogininfor(request, user.getUserId().intValue(), username, Constants.LOGIN_FAIL_STATUS, String.format("密码输入错误%s次", retryCount)); |
| | | redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
| | | throw new ServiceException("密码错误"); |
| | | } |
| | |
| | | package com.ruoyi.auth.service; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.ruoyi.system.api.feignClient.SysLoginLogClient; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.stereotype.Component; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.ip.IpUtils; |
| | | import com.ruoyi.system.api.RemoteLogService; |
| | | import com.ruoyi.system.api.domain.SysLogininfor; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 记录日志方法 |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SysRecordLogService |
| | | { |
| | | @Autowired |
| | | private RemoteLogService remoteLogService; |
| | | public class SysRecordLogService { |
| | | @Resource |
| | | private SysLoginLogClient sysLoginLogClient; |
| | | |
| | | /** |
| | | * 记录登录信息 |
| | |
| | | * @param message 消息内容 |
| | | * @return |
| | | */ |
| | | public void recordLogininfor(String username, String status, String message) |
| | | { |
| | | SysLogininfor logininfor = new SysLogininfor(); |
| | | logininfor.setUserName(username); |
| | | logininfor.setIpaddr(IpUtils.getIpAddr()); |
| | | logininfor.setMsg(message); |
| | | // 日志状态 |
| | | if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) |
| | | { |
| | | logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS); |
| | | public void recordLogininfor(HttpServletRequest request, Integer userId, String username, String status, String message) { |
| | | Map<String, String> headerData = getHeaderData(request); |
| | | //添加登录日志 |
| | | SysLoginLog loginLog = new SysLoginLog(); |
| | | loginLog.setUserId(userId); |
| | | loginLog.setUsername(username); |
| | | loginLog.setIpAddress(headerData.get("ip")); |
| | | loginLog.setAddress("");// todo 待完善 https://www.juhe.cn/docs/api/id/1 |
| | | loginLog.setBrowserType(headerData.get("browser")); |
| | | loginLog.setOperatingSystem(headerData.get("os")); |
| | | loginLog.setLoginTime(LocalDateTime.now()); |
| | | loginLog.setLoginStatus(Integer.valueOf(status)); |
| | | loginLog.setMessage(message); |
| | | sysLoginLogClient.saveLoginLog(loginLog); |
| | | } |
| | | else if (Constants.LOGIN_FAIL.equals(status)) |
| | | { |
| | | logininfor.setStatus(Constants.LOGIN_FAIL_STATUS); |
| | | |
| | | |
| | | public Map<String, String> getHeaderData(HttpServletRequest request) { |
| | | //Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0 |
| | | String browserDetails = request.getHeader("User-Agent"); |
| | | String userAgent = browserDetails; |
| | | String user = userAgent.toLowerCase(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | String os = ""; |
| | | String browser = ""; |
| | | if (userAgent.toLowerCase().indexOf("windows") >= 0) { |
| | | os = "Windows"; |
| | | } else if (userAgent.toLowerCase().indexOf("mac") >= 0) { |
| | | os = "Mac"; |
| | | } else if (userAgent.toLowerCase().indexOf("x11") >= 0) { |
| | | os = "Unix"; |
| | | } else if (userAgent.toLowerCase().indexOf("android") >= 0) { |
| | | os = "Android"; |
| | | } else if (userAgent.toLowerCase().indexOf("iphone") >= 0) { |
| | | os = "IPhone"; |
| | | } else { |
| | | os = "UnKnown, More-Info: " + userAgent; |
| | | } |
| | | remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER); |
| | | if (user.contains("edge")) { |
| | | browser = (userAgent.substring(userAgent.indexOf("Edge")).split(" ")[0]).replace("/", "-"); |
| | | } else if (user.contains("msie")) { |
| | | String substring = userAgent.substring(userAgent.indexOf("MSIE")).split(";")[0]; |
| | | browser = substring.split(" ")[0].replace("MSIE", "IE") + "-" + substring.split(" ")[1]; |
| | | } else if (user.contains("safari") && user.contains("version")) { |
| | | browser = (userAgent.substring(userAgent.indexOf("Safari")).split(" ")[0]).split("/")[0] |
| | | + "-" + (userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1]; |
| | | } else if (user.contains("opr") || user.contains("opera")) { |
| | | if (user.contains("opera")) { |
| | | browser = (userAgent.substring(userAgent.indexOf("Opera")).split(" ")[0]).split("/")[0] |
| | | + "-" + (userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1]; |
| | | } else if (user.contains("opr")) { |
| | | browser = ((userAgent.substring(userAgent.indexOf("OPR")).split(" ")[0]).replace("/", "-")) |
| | | .replace("OPR", "Opera"); |
| | | } |
| | | |
| | | } else if (user.contains("chrome")) { |
| | | browser = (userAgent.substring(userAgent.indexOf("Chrome")).split(" ")[0]).replace("/", "-"); |
| | | } else if ((user.indexOf("mozilla/7.0") > -1) || (user.indexOf("netscape6") != -1) || |
| | | (user.indexOf("mozilla/4.7") != -1) || (user.indexOf("mozilla/4.78") != -1) || |
| | | (user.indexOf("mozilla/4.08") != -1) || (user.indexOf("mozilla/3") != -1)) { |
| | | browser = "Netscape-?"; |
| | | |
| | | } else if (user.contains("firefox")) { |
| | | browser = (userAgent.substring(userAgent.indexOf("Firefox")).split(" ")[0]).replace("/", "-"); |
| | | } else if (user.contains("rv")) { |
| | | String IEVersion = (userAgent.substring(userAgent.indexOf("rv")).split(" ")[0]).replace("rv:", "-"); |
| | | browser = "IE" + IEVersion.substring(0, IEVersion.length() - 1); |
| | | } else { |
| | | browser = "UnKnown, More-Info: " + userAgent; |
| | | } |
| | | |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) { |
| | | // 多次反向代理后会有多个ip值,第一个ip才是真实ip |
| | | if (ip.indexOf(",") != -1) { |
| | | ip = ip.split(",")[0]; |
| | | } |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("HTTP_CLIENT_IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("HTTP_X_FORWARDED_FOR"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("X-Real-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | map.put("os", os); |
| | | map.put("browser", browser); |
| | | map.put("ip", ip); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | <version>2.8.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.gavaghan</groupId> |
| | | <artifactId>geodesy</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | * 文件服务的serviceid |
| | | */ |
| | | public static final String FILE_SERVICE = "ruoyi-file"; |
| | | /** |
| | | * 后台服务的serviceid |
| | | */ |
| | | public static final String MANAGEMENT_SERVICE = "ruoyi-management"; |
| | | |
| | | /** |
| | | * 车辆服务的serviceid |
| | | */ |
| | | public static final String VEHICLE_SERVICE = "ruoyi-vehicle"; |
| | | |
| | | /** |
| | | * 车辆合同的serviceid |
| | | */ |
| | | public static final String CONTRACT_SERVICE = "ruoyi-contract"; |
| | | public static final String CONTRACT_ORDER = "ruoyi-order"; |
| | | public static final String CONTRACT_ACCOUNT = "ruoyi-account"; |
| | | public static final String ACCOUNT_SERVICE = "ruoyi-account"; |
| | | public static final String CHARGINGPILE_SERVICE = "ruoyi-chargingPile"; |
| | | public static final String OTHER_SERVICE = "ruoyi-other"; |
| | | public static final String ORDER_SERVICE = "ruoyi-order"; |
| | | public static final String INTEGRATION_SERVICE = "ruoyi-integration"; |
| | | public static final String PAYMENT_SERVICE = "ruoyi-payment"; |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ChargingGunModeEnum { |
| | | |
| | | |
| | | SUPER_SUFFICIENT(1, "超级快充"), |
| | | FAST_SUFFICIENT(2, "快充"), |
| | | SLOW_SUFFICIENT(3, "慢充"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ChargingGunModeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ChargingGunModeEnum fromCode(Integer code) { |
| | | ChargingGunModeEnum[] resultTypes = ChargingGunModeEnum.values(); |
| | | for (ChargingGunModeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ChargingGunStatusEnum { |
| | | |
| | | |
| | | OFFLINE(1, "离线"), |
| | | IDLE(2, "空闲"), |
| | | OCCUPATION_UNCHARGED(3, "占用(未充电)"), |
| | | OCCUPATION_CHARGING(4, "占用(充电中)"), |
| | | OCCUPATION_FULL(5, "占用(已充满)"), |
| | | OCCUPATION_LOCK(6, "占用(预约锁定)"), |
| | | FAULT(7, "故障"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ChargingGunStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ChargingGunStatusEnum fromCode(Integer code) { |
| | | ChargingGunStatusEnum[] resultTypes = ChargingGunStatusEnum.values(); |
| | | for (ChargingGunStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GeodeticCurve; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计算两个金纬度坐标之间的直线距离 |
| | | */ |
| | | public class GeodesyUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取直线距离 |
| | | * @param fromLonLat |
| | | * @param toLonLat |
| | | * @return |
| | | */ |
| | | public static Map<String, Double> getDistance(String fromLonLat, String toLonLat){ |
| | | Map<String, Double> map = null; |
| | | if(StringUtils.isNotEmpty(fromLonLat) && StringUtils.isNotEmpty(toLonLat)){ |
| | | map = new HashMap<>(); |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80); |
| | | double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67); |
| | | double ANS = getDistanceMeter(source, target, Ellipsoid.ANS); |
| | | double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72); |
| | | double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858); |
| | | double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880); |
| | | // System.out.println("Sphere坐标系计算结果:"+Sphere + "米"); |
| | | // System.out.println("WGS84坐标系计算结果:"+WGS84 + "米"); |
| | | // System.out.println("GRS80坐标系计算结果:"+GRS80 + "米"); |
| | | // System.out.println("GRS67坐标系计算结果:"+GRS67 + "米"); |
| | | // System.out.println("ANS坐标系计算结果:"+ANS + "米"); |
| | | // System.out.println("WGS72坐标系计算结果:"+WGS72 + "米"); |
| | | // System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米"); |
| | | // System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米"); |
| | | map.put("Sphere", Sphere); |
| | | map.put("WGS84", WGS84); |
| | | map.put("GRS80", GRS80); |
| | | map.put("GRS67", GRS67); |
| | | map.put("ANS", ANS); |
| | | map.put("WGS72", WGS72); |
| | | map.put("Clarke1858", Clarke1858); |
| | | map.put("Clarke1880", Clarke1880); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ |
| | | //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 |
| | | GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); |
| | | return geoCurve.getEllipsoidalDistance(); |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | GeodesyUtil geodesyUtil = new GeodesyUtil(); |
| | | Map<String, Double> distance = geodesyUtil.getDistance("115.481028,39.989643", "114.465302,40.004717"); |
| | | System.err.println(distance); |
| | | } |
| | | } |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BaseEntity implements Serializable |
| | | { |
| | | public class BaseEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 搜索值 */ |
| | | /** |
| | | * 搜索值 |
| | | */ |
| | | @JsonIgnore |
| | | @TableField(exist = false) |
| | | private String searchValue; |
| | | |
| | | /** 创建者 */ |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @ApiModelProperty(value = "记录创建人,前端忽略") |
| | | @TableField(value = "create_by", fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** 创建时间 */ |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | |
| | | /** 更新者 */ |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @ApiModelProperty(value = "记录修改人,前端忽略") |
| | | //@JsonIgnore |
| | | @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** 更新时间 */ |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField("update_time") |
| | | private Date updateTime; |
| | | |
| | | /** 是否删除 1未删除 0已删除 */ |
| | | /** |
| | | * 是否删除 1未删除 0已删除 |
| | | */ |
| | | @TableLogic |
| | | @Excel(name = "是否删除 0未删除 1已删除") |
| | | @TableField(exist = false) |
| | | private Boolean disabled; |
| | | |
| | | /** 备注 */ |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** 请求参数 */ |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params; |
| | |
| | | this.disabled = disabled; |
| | | } |
| | | |
| | | public String getSearchValue() |
| | | { |
| | | public String getSearchValue() { |
| | | return searchValue; |
| | | } |
| | | |
| | | public void setSearchValue(String searchValue) |
| | | { |
| | | public void setSearchValue(String searchValue) { |
| | | this.searchValue = searchValue; |
| | | } |
| | | |
| | | public String getCreateBy() |
| | | { |
| | | public String getCreateBy() { |
| | | return createBy; |
| | | } |
| | | |
| | | public void setCreateBy(String createBy) |
| | | { |
| | | public void setCreateBy(String createBy) { |
| | | this.createBy = createBy; |
| | | } |
| | | |
| | | public Date getCreateTime() |
| | | { |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) |
| | | { |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getUpdateBy() |
| | | { |
| | | public String getUpdateBy() { |
| | | return updateBy; |
| | | } |
| | | |
| | | public void setUpdateBy(String updateBy) |
| | | { |
| | | public void setUpdateBy(String updateBy) { |
| | | this.updateBy = updateBy; |
| | | } |
| | | |
| | | public Date getUpdateTime() |
| | | { |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) |
| | | { |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getRemark() |
| | | { |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) |
| | | { |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Map<String, Object> getParams() |
| | | { |
| | | if (params == null) |
| | | { |
| | | public Map<String, Object> getParams() { |
| | | if (params == null) { |
| | | params = new HashMap<>(); |
| | | } |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(Map<String, Object> params) |
| | | { |
| | | public void setParams(Map<String, Object> params) { |
| | | this.params = params; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.api.RemoteLogService; |
| | | import com.ruoyi.system.api.domain.SysOperLog; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 异步调用日志服务 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class AsyncLogService |
| | | { |
| | | @Autowired |
| | | public class AsyncLogService { |
| | | @Resource |
| | | private RemoteLogService remoteLogService; |
| | | |
| | | /** |
| | | * 保存系统日志记录 |
| | | */ |
| | | @Async |
| | | public void saveSysLog(SysOperLog sysOperLog) throws Exception |
| | | { |
| | | public void saveSysLog(SysOperLog sysOperLog) throws Exception { |
| | | remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.gateway.filter; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.cloud.gateway.filter.GatewayFilterChain; |
| | | import org.springframework.cloud.gateway.filter.GlobalFilter; |
| | | import org.springframework.core.Ordered; |
| | | import org.springframework.core.io.buffer.DataBuffer; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.server.reactive.ServerHttpRequest; |
| | | import org.springframework.http.server.reactive.ServerHttpRequestDecorator; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.server.ServerWebExchange; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.gateway.config.properties.IgnoreWhiteProperties; |
| | | import io.jsonwebtoken.Claims; |
| | | import reactor.core.publisher.Flux; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | | /** |
| | | * 网关鉴权 |
| | |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | @Value("${security.sign}") |
| | | private boolean parameter_signature; |
| | | |
| | | |
| | | @Override |
| | |
| | | String username = JwtUtils.getUserName(claims); |
| | | if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) { |
| | | return unauthorizedResponse(exchange, "令牌验证失败"); |
| | | } |
| | | if(parameter_signature){ |
| | | String sign = request.getHeaders().getFirst(TokenConstants.SING); |
| | | String nonce_str = request.getHeaders().getFirst(TokenConstants.NONCE_STR); |
| | | if(StringUtils.isEmpty(sign) || StringUtils.isEmpty(nonce_str)){ |
| | | log.error("[鉴权签名异常处理]请求路径:{}", exchange.getRequest().getPath()); |
| | | return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "签名校验失败", HttpStatus.BAD_REQUEST); |
| | | } |
| | | } |
| | | |
| | | // 设置用户信息到请求 |
| | |
| | | return token; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() |
| | | { |
| | | return -200; |
| | | return -300; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.gateway.filter; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.constant.HttpStatus; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.html.EscapeUtil; |
| | | import com.ruoyi.gateway.config.properties.XssProperties; |
| | | import io.netty.buffer.ByteBufAllocator; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.cloud.gateway.filter.GatewayFilterChain; |
| | | import org.springframework.cloud.gateway.filter.GlobalFilter; |
| | | import org.springframework.core.Ordered; |
| | | import org.springframework.core.io.buffer.*; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.server.reactive.ServerHttpRequest; |
| | | import org.springframework.http.server.reactive.ServerHttpRequestDecorator; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.server.ServerWebExchange; |
| | | import reactor.core.publisher.Flux; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | | /** |
| | | * 跨站脚本过滤器 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class RequestParamGlobalFilter implements GlobalFilter, Ordered { |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { |
| | | ServerHttpRequestDecorator httpRequestDecorator = requestDecorator(exchange); |
| | | return chain.filter(exchange.mutate().request(httpRequestDecorator).build()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private ServerHttpRequestDecorator requestDecorator(ServerWebExchange exchange) { |
| | | ServerHttpRequestDecorator serverHttpRequestDecorator = new ServerHttpRequestDecorator(exchange.getRequest()) { |
| | | @Override |
| | | public Flux<DataBuffer> getBody() { |
| | | Flux<DataBuffer> body = super.getBody(); |
| | | return body.buffer().map(dataBuffers -> { |
| | | DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory(); |
| | | DataBuffer join = dataBufferFactory.join(dataBuffers); |
| | | byte[] content = new byte[join.readableByteCount()]; |
| | | join.read(content); |
| | | DataBufferUtils.release(join); |
| | | String bodyStr = new String(content, StandardCharsets.UTF_8); |
| | | // 转成字节 |
| | | byte[] bytes = bodyStr.getBytes(); |
| | | NettyDataBufferFactory nettyDataBufferFactory = new NettyDataBufferFactory(ByteBufAllocator.DEFAULT); |
| | | DataBuffer buffer = nettyDataBufferFactory.allocateBuffer(bytes.length); |
| | | buffer.write(bytes); |
| | | return buffer; |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public HttpHeaders getHeaders() { |
| | | HttpHeaders httpHeaders = new HttpHeaders(); |
| | | httpHeaders.putAll(super.getHeaders()); |
| | | // 由于修改了请求体的body,导致content-length长度不确定,因此需要删除原先的content-length |
| | | httpHeaders.remove(HttpHeaders.CONTENT_LENGTH); |
| | | httpHeaders.set(HttpHeaders.TRANSFER_ENCODING, "chunked"); |
| | | return httpHeaders; |
| | | } |
| | | |
| | | }; |
| | | return serverHttpRequestDecorator; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() |
| | | { |
| | | return HIGHEST_PRECEDENCE; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.gateway.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.HttpStatus; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.gateway.config.properties.IgnoreWhiteProperties; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.cloud.gateway.filter.GatewayFilterChain; |
| | | import org.springframework.cloud.gateway.filter.GlobalFilter; |
| | | import org.springframework.core.Ordered; |
| | | import org.springframework.core.io.buffer.DataBuffer; |
| | | import org.springframework.core.io.buffer.DataBufferUtils; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.server.reactive.ServerHttpRequest; |
| | | import org.springframework.http.server.reactive.ServerHttpRequestDecorator; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.server.ServerWebExchange; |
| | | import reactor.core.publisher.Flux; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | | /** |
| | | * 网关鉴权 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SignFilter implements GlobalFilter, Ordered { |
| | | private static final Logger log = LoggerFactory.getLogger(SignFilter.class); |
| | | |
| | | // 排除过滤的 uri 地址,nacos自行添加 |
| | | @Autowired |
| | | private IgnoreWhiteProperties ignoreWhite; |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | @Value("${security.sign}") |
| | | private boolean parameter_signature; |
| | | |
| | | |
| | | @Override |
| | | public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { |
| | | ServerHttpRequest request = exchange.getRequest(); |
| | | ServerHttpRequest.Builder mutate = request.mutate(); |
| | | |
| | | HttpMethod method = request.getMethod(); |
| | | if(method != HttpMethod.POST){ |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | | } |
| | | String sing = request.getHeaders().getFirst(TokenConstants.SING); |
| | | String nonce_str = request.getHeaders().getFirst(TokenConstants.NONCE_STR); |
| | | // if (parameter_signature && StringUtils.isEmpty(sing)) { |
| | | // return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | // } |
| | | // if (parameter_signature && StringUtils.isEmpty(nonce_str)) { |
| | | // return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | // } |
| | | if(parameter_signature){ |
| | | return authSign(exchange, chain, sing, nonce_str); |
| | | } |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | | } |
| | | |
| | | |
| | | |
| | | private Mono<Void> unauthorizedResponse(ServerWebExchange exchange, String msg) { |
| | | log.error("[签名异常处理]请求路径:{}", exchange.getRequest().getPath()); |
| | | return ServletUtils.webFluxResponseWriter(exchange.getResponse(), msg, HttpStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 校验签名 |
| | | * @return |
| | | */ |
| | | private Mono<Void> authSign(ServerWebExchange exchange, GatewayFilterChain chain, String sing, String nonce_str){ |
| | | return DataBufferUtils.join(exchange.getRequest().getBody()) |
| | | .flatMap(dataBuffer -> { |
| | | byte[] bytes = new byte[dataBuffer.readableByteCount()]; |
| | | dataBuffer.read(bytes); |
| | | String bodyString = new String(bytes, StandardCharsets.UTF_8); |
| | | log.info("请求参数:{}", bodyString); |
| | | if(!authSign(JSON.parseObject(bodyString), sing, nonce_str)){ |
| | | return unauthorizedResponse(exchange, "签名验证失败!"); |
| | | } |
| | | DataBufferUtils.release(dataBuffer); |
| | | Flux<DataBuffer> cachedFlux = Flux.defer(() -> { |
| | | DataBuffer buffer = exchange.getResponse().bufferFactory() |
| | | .wrap(bytes); |
| | | return Mono.just(buffer); |
| | | }); |
| | | ServerHttpRequest mutatedRequest = new ServerHttpRequestDecorator(exchange.getRequest()) { |
| | | @Override |
| | | public Flux<DataBuffer> getBody() { |
| | | return cachedFlux; |
| | | } |
| | | }; |
| | | return chain.filter(exchange.mutate().request(mutatedRequest) |
| | | .build()); |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 签名校验 |
| | | * @return |
| | | */ |
| | | private boolean authSign(JSONObject jsonStr, String sign, String nonce_str) { |
| | | String signUrlEncode = localSignUrl(jsonStr, nonce_str); |
| | | signUrlEncode = signUrlEncode.replaceAll("& #40;", "\\(") |
| | | .replaceAll("& #41;", "\\)") |
| | | .replaceAll("\\+", " "); |
| | | if(sign.equals(signUrlEncode)){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 组装签名路径 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | public static String localSignUrl(JSONObject params, String key) { |
| | | List<String> keySet = new ArrayList<>(params.keySet()); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(keySet, new Comparator<String>() { |
| | | @Override |
| | | public int compare(String o1, String o2) { |
| | | return o1.compareTo(o2); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String k : keySet) { |
| | | String v = params.getString(k); |
| | | if(StringUtils.isNotEmpty(v)){ |
| | | sb.append(k + "=" + v + "&"); |
| | | } |
| | | } |
| | | String signUrl = sb.substring(0, sb.length() - 1); |
| | | return signUrlEncode(signUrl, key); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 签名字符串加密 |
| | | * @param signUrl |
| | | * @param encryptKey |
| | | * @return |
| | | */ |
| | | public static String signUrlEncode(String signUrl, String encryptKey) { |
| | | byte[] signByte = new byte[0]; |
| | | try { |
| | | signByte = HMACSHA1.HmacSHA1Encrypt(signUrl, encryptKey); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | String localSign = Base64.encodeBase64String(signByte); |
| | | return localSign; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() |
| | | { |
| | | return -200; |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private XssProperties xss; |
| | | |
| | | @Value("${security.sign}") |
| | | private boolean parameter_signature; |
| | | |
| | | @Override |
| | | public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) |
| | | { |
| | | public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { |
| | | ServerHttpRequest request = exchange.getRequest(); |
| | | // xss开关未开启 或 通过nacos关闭,不过滤 |
| | | if (!xss.getEnabled()) |
| | | { |
| | | if (!xss.getEnabled()) { |
| | | return chain.filter(exchange); |
| | | } |
| | | // GET DELETE 不过滤 |
| | | HttpMethod method = request.getMethod(); |
| | | if (method == null || method == HttpMethod.GET || method == HttpMethod.DELETE) |
| | | { |
| | | if (method == null || method == HttpMethod.GET || method == HttpMethod.DELETE) { |
| | | return chain.filter(exchange); |
| | | } |
| | | // 非json类型,不过滤 |
| | | if (!isJsonRequest(exchange)) |
| | | { |
| | | if (!isJsonRequest(exchange)) { |
| | | return chain.filter(exchange); |
| | | } |
| | | // excludeUrls 不过滤 |
| | | String url = request.getURI().getPath(); |
| | | if (StringUtils.matches(url, xss.getExcludeUrls())) |
| | | { |
| | | if (StringUtils.matches(url, xss.getExcludeUrls())) { |
| | | return chain.filter(exchange); |
| | | } |
| | | ServerHttpRequestDecorator httpRequestDecorator = requestDecorator(exchange); |
| | | if(parameter_signature && !authSign(httpRequestDecorator)){ |
| | | log.error("[鉴权签名异常处理]请求路径:{}", exchange.getRequest().getPath()); |
| | | return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "签名校验失败", HttpStatus.BAD_REQUEST); |
| | | } |
| | | return chain.filter(exchange.mutate().request(httpRequestDecorator).build()); |
| | | |
| | | } |
| | | |
| | | private ServerHttpRequestDecorator requestDecorator(ServerWebExchange exchange) |
| | | { |
| | | ServerHttpRequestDecorator serverHttpRequestDecorator = new ServerHttpRequestDecorator(exchange.getRequest()) |
| | | { |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private ServerHttpRequestDecorator requestDecorator(ServerWebExchange exchange) { |
| | | ServerHttpRequestDecorator serverHttpRequestDecorator = new ServerHttpRequestDecorator(exchange.getRequest()) { |
| | | @Override |
| | | public Flux<DataBuffer> getBody() |
| | | { |
| | | public Flux<DataBuffer> getBody() { |
| | | Flux<DataBuffer> body = super.getBody(); |
| | | return body.buffer().map(dataBuffers -> { |
| | | DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public HttpHeaders getHeaders() |
| | | { |
| | | public HttpHeaders getHeaders() { |
| | | HttpHeaders httpHeaders = new HttpHeaders(); |
| | | httpHeaders.putAll(super.getHeaders()); |
| | | // 由于修改了请求体的body,导致content-length长度不确定,因此需要删除原先的content-length |
| | |
| | | * |
| | | * @param exchange HTTP请求 |
| | | */ |
| | | public boolean isJsonRequest(ServerWebExchange exchange) |
| | | { |
| | | public boolean isJsonRequest(ServerWebExchange exchange) { |
| | | String header = exchange.getRequest().getHeaders().getFirst(HttpHeaders.CONTENT_TYPE); |
| | | return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 签名校验 |
| | | * @param httpRequestDecorator |
| | | * @return |
| | | */ |
| | | private boolean authSign(ServerHttpRequestDecorator httpRequestDecorator) { |
| | | HttpHeaders headers = httpRequestDecorator.getHeaders(); |
| | | AtomicReference<JSONObject> jsonObject = new AtomicReference<>(new JSONObject()); |
| | | httpRequestDecorator.getBody().buffer().map(dataBuffers -> { |
| | | DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory(); |
| | | DataBuffer join = dataBufferFactory.join(dataBuffers); |
| | | byte[] content = new byte[join.readableByteCount()]; |
| | | join.read(content); |
| | | DataBufferUtils.release(join); |
| | | String bodyStr = new String(content, StandardCharsets.UTF_8); |
| | | jsonObject.set(JSON.parseObject(bodyStr)); |
| | | |
| | | // 防xss攻击过滤 |
| | | bodyStr = EscapeUtil.clean(bodyStr); |
| | | // 转成字节 |
| | | byte[] bytes = bodyStr.getBytes(); |
| | | NettyDataBufferFactory nettyDataBufferFactory = new NettyDataBufferFactory(ByteBufAllocator.DEFAULT); |
| | | DataBuffer buffer = nettyDataBufferFactory.allocateBuffer(bytes.length); |
| | | buffer.write(bytes); |
| | | return buffer; |
| | | }); |
| | | JSONObject params = jsonObject.get(); |
| | | String sign = headers.getFirst(TokenConstants.SING); |
| | | if(StringUtils.isEmpty(sign)){ |
| | | return false; |
| | | } |
| | | String nonce_str = headers.getFirst(TokenConstants.NONCE_STR); |
| | | if(StringUtils.isEmpty(nonce_str)){ |
| | | return false; |
| | | } |
| | | |
| | | String signUrlEncode = localSignUrl(params, nonce_str); |
| | | signUrlEncode = signUrlEncode.replaceAll("& #40;", "\\(") |
| | | .replaceAll("& #41;", "\\)") |
| | | .replaceAll("\\+", " "); |
| | | if(sign.equals(signUrlEncode)){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 组装签名路径 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | public static String localSignUrl(JSONObject params, String key) { |
| | | List<String> keySet = new ArrayList<>(params.keySet()); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(keySet, new Comparator<String>() { |
| | | @Override |
| | | public int compare(String o1, String o2) { |
| | | return o1.compareTo(o2); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String k : keySet) { |
| | | String v = params.getString(k); |
| | | if(StringUtils.isNotEmpty(v)){ |
| | | sb.append(k + "=" + v + "&"); |
| | | } |
| | | } |
| | | String signUrl = sb.substring(0, sb.length() - 1); |
| | | return signUrlEncode(signUrl, key); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 签名字符串加密 |
| | | * @param signUrl |
| | | * @param encryptKey |
| | | * @return |
| | | */ |
| | | public static String signUrlEncode(String signUrl, String encryptKey) { |
| | | byte[] signByte = new byte[0]; |
| | | try { |
| | | signByte = HMACSHA1.HmacSHA1Encrypt(signUrl, encryptKey); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | String localSign = Base64.encodeBase64String(signByte); |
| | | return localSign; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.seata</groupId> |
| | | <artifactId>seata-all</artifactId> |
| | | <version>1.6.1</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
New file |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import com.ruoyi.system.service.ISysLoginLogService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 15:48 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sysLoginLog") |
| | | public class SysLoginLogController { |
| | | |
| | | |
| | | @Resource |
| | | private ISysLoginLogService sysLoginLogService; |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | |
| | | @GetMapping("/pageList") |
| | | @ApiOperation(value = "获取登录日志列表", tags = {"管理后台-登录日志"}) |
| | | public AjaxResult<PageInfo<SysLoginLog>> pageList(String name, BasePage basePage){ |
| | | PageInfo<SysLoginLog> pageInfo = sysLoginLogService.pageList(name, basePage); |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addLoginLog") |
| | | @ApiOperation(value = "添加登录日志", tags = {"管理后台-登录日志"}) |
| | | public AjaxResult addLoginLog(@RequestBody SysLoginLog loginLog){ |
| | | return sysLoginLogService.addLoginLog(loginLog); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加登陆日志 |
| | | * @param loginLog |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveLoginLog") |
| | | public R saveLoginLog(@RequestBody SysLoginLog loginLog){ |
| | | loginLog.setCreateTime(LocalDateTime.now()); |
| | | loginLog.setDelFlag(0); |
| | | sysLoginLogService.save(loginLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.query.SysOperLogQuery; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/operlog") |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | public class SysOperlogController extends BaseController { |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | |
| | | // @RequiresPermissions("system:operlog:list") |
| | | // @GetMapping("/list") |
| | | // public TableDataInfo list(SysOperLog operLog) |
| | | // { |
| | | // startPage(); |
| | | // List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | // return getDataTable(list); |
| | | // } |
| | | |
| | | @ApiOperation(value = "当前车辆操作日志查询") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysOperLogQuery query) |
| | | { |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取操作日志列表", tags = {"管理后台-操作日志"}) |
| | | public AjaxResult<PageInfo<SysOperLog>> list(SysOperLogQuery query) { |
| | | PageInfo<SysOperLog> pageInfo = new PageInfo(query.getPageCurr(), query.getPageSize()); |
| | | LambdaQueryWrapper<SysOperLog> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.like(SysOperLog::getTitle,"车辆管理"); |
| | | wrapper.ne(SysOperLog::getBusinessType,1); |
| | | List<SysOperLog> list = operLogService.list(wrapper); |
| | | Iterator<SysOperLog> iterator = list.iterator(); |
| | | while (iterator.hasNext()){ |
| | | SysOperLog sysOperLog = iterator.next(); |
| | | String operParam = sysOperLog.getOperParam(); |
| | | JSONObject jsonObject = JSONObject.parseObject(operParam); |
| | | String carId = jsonObject.getString("carId"); |
| | | if(StringUtils.isNotEmpty(carId) && Objects.nonNull(query.getCarId()) && !carId.equals(String.valueOf(query.getCarId()))){ |
| | | iterator.remove(); |
| | | if(StringUtils.isNotEmpty(query.getOperName())){ |
| | | wrapper.like(SysOperLog::getOperName, query.getOperName()); |
| | | } |
| | | if(StringUtils.isNotEmpty(query.getTitle())){ |
| | | wrapper.like(SysOperLog::getTitle, query.getTitle()); |
| | | } |
| | | return AjaxResult.success(list); |
| | | if(null != query.getStatus()){ |
| | | wrapper.eq(SysOperLog::getStatus, query.getStatus()); |
| | | } |
| | | if(null != query.getStartTime() && null != query.getEndTime()){ |
| | | wrapper.between(SysOperLog::getOperTime, query.getStartTime(), query.getEndTime()); |
| | | } |
| | | PageInfo<SysOperLog> page = operLogService.page(pageInfo, wrapper); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:operlog:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysOperLog operLog) |
| | | { |
| | | public void export(HttpServletResponse response, SysOperLog operLog) { |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); |
| | | util.exportExcel(response, list, "操作日志"); |
| | |
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE) |
| | | @RequiresPermissions("system:operlog:remove") |
| | | @DeleteMapping("/{operIds}") |
| | | public AjaxResult remove(@PathVariable Long[] operIds) |
| | | { |
| | | public AjaxResult remove(@PathVariable Long[] operIds) { |
| | | return toAjax(operLogService.deleteOperLogByIds(operIds)); |
| | | } |
| | | |
| | | @RequiresPermissions("system:operlog:remove") |
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | public AjaxResult clean() { |
| | | operLogService.cleanOperLog(); |
| | | return success(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysOperLog operLog) |
| | | { |
| | | public AjaxResult add(@RequestBody SysOperLog operLog) { |
| | | return toAjax(operLogService.insertOperlog(operLog)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TRoleSite; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.system.api.model.GetSysRoleByIds; |
| | | import com.ruoyi.system.domain.SysMenus; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Api(tags = "角色模块") |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | @Autowired |
| | | @Resource |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysDeptService deptService; |
| | | |
| | | @Resource |
| | | private SysRoleMenuMapper sysRoleMenuMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysUserRoleService sysUserRoleService; |
| | | |
| | | |
| | | @Resource |
| | | private SysMenuMapper menuMapper; |
| | | |
| | | @ApiOperation("获取所有角色信息根据公司id") |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-系统用户管理"}) |
| | | @GetMapping("/list") |
| | | public AjaxResult list(Integer companyId) |
| | | { |
| | | SysRole role = new SysRole(); |
| | | role.setCompanyId(companyId); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | public AjaxResult list() { |
| | | List<SysRole> list = roleService.list(new LambdaQueryWrapper<SysRole>().eq(SysRole::getDelFlag, 0).eq(SysRole::getStatus, 0)); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("获取所有角色信息根据公司id--分页") |
| | | @ResponseBody |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Integer companyId,int pageNumber,int pageSize) |
| | | { |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(pageNumber, pageSize); |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult listPage(String name, BasePage basePage) { |
| | | PageInfo<SysRole> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getStatus, 0).eq(SysRole::getDelFlag, 0); |
| | | if(StringUtils.isNotEmpty(name)){ |
| | | wrapper.like(SysRole::getRoleName, name); |
| | | } |
| | | |
| | | PageInfo<SysRole> page = roleService.page(pageInfo, new LambdaQueryWrapper<SysRole>().eq(SysRole::getCompanyId, companyId).ne(SysRole::getRoleId,20)); |
| | | PageInfo<SysRole> page = roleService.page(pageInfo, wrapper.orderByDesc(SysRole::getCreateTime)); |
| | | for (SysRole record : page.getRecords()) { |
| | | List<Integer> data = roleSiteClient.getSiteIds(record.getRoleId()).getData(); |
| | | List<Site> sites = siteClient.getSiteByIds(data).getData(); |
| | | List<String> collect = sites.stream().map(Site::getName).collect(Collectors.toList()); |
| | | record.setSiteNames(collect); |
| | | } |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("角色启用停用") |
| | | @GetMapping("/roleStart") |
| | | public AjaxResult roleStart(Long roleId) |
| | | { |
| | | SysRole role = roleService.selectRoleById(roleId); |
| | | if(role.getStatus().equals("1")){ |
| | | role.setStatus("0"); |
| | | }else { |
| | | role.setStatus("1"); |
| | | } |
| | | return AjaxResult.success(roleService.updateRole(role)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("添加角色") |
| | | @ResponseBody |
| | | @PostMapping("/roleAdd") |
| | | @ApiOperation(value = "添加角色", tags = {"管理后台-角色管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult roleAdd(@Validated @RequestBody RoleAddDto dto) |
| | | { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleName(dto.getRoleName()); |
| | | long count = roleService.count(Wrappers.lambdaQuery(SysRole.class) |
| | | .eq(SysRole::getRoleName,dto.getRoleName()) |
| | | .eq(SysRole::getCompanyId,dto.getCompanyId())); |
| | | .eq(SysRole::getRoleName,dto.getRoleName())); |
| | | if(count>0){ |
| | | return AjaxResult.error("角色已存在,请重新输入"); |
| | | } |
| | |
| | | } |
| | | role.setMenuIds(dto.getMenuIds().toArray((new Long[dto.getMenuIds().size()]))); |
| | | // 添加角色 |
| | | role.setCompanyId(dto.getCompanyId()); |
| | | role.setCarDataAuth(dto.getCarDataAuth()); |
| | | role.setCarTrainOperAuth(dto.getCarTrainOperAuth()); |
| | | role.setContractDataAuth(dto.getContractDataAuth()); |
| | | role.setRemark(dto.getRemark()); |
| | | role.setCreateBy(SecurityUtils.getUsername()); |
| | | role.setCreateTime(new Date()); |
| | | roleService.insertRole(role); |
| | | // ArrayList<SysRoleMenu> sysRoleMenus = new ArrayList<>(); |
| | | // List<Long> menuIds = dto.getMenuIds(); |
| | | // for (Long menuId : menuIds) { |
| | | // SysRoleMenu sysRoleMenu = new SysRoleMenu(); |
| | | // sysRoleMenu.setMenuId(menuId); |
| | | // sysRoleMenu.setRoleId(role.getRoleId()); |
| | | // sysRoleMenus.add(sysRoleMenu); |
| | | // } |
| | | // sysRoleMenuMapper.batchRoleMenu(sysRoleMenus); |
| | | //添加站点权限 |
| | | List<TRoleSite> roleSites = new ArrayList<>(); |
| | | for (Integer siteId : dto.getSiteIds()) { |
| | | TRoleSite roleSite = new TRoleSite(); |
| | | roleSite.setRoleId(role.getRoleId().intValue()); |
| | | roleSite.setSiteId(siteId); |
| | | roleSites.add(roleSite); |
| | | } |
| | | roleSiteClient.addRoleSite(roleSites); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("角色详情") |
| | | @GetMapping("/roleInfo") |
| | | public AjaxResult roleInfo( @RequestParam Long id) |
| | | { |
| | | @ApiOperation(value = "角色详情", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult roleInfo( @RequestParam Long id) { |
| | | SysRole role = roleService.selectRoleById(id); |
| | | RoleInfoVo roleInfoVo = new RoleInfoVo(); |
| | | roleInfoVo.setRoleId(role.getRoleId()); |
| | | roleInfoVo.setCarDataAuth(role.getCarDataAuth()); |
| | | roleInfoVo.setCarTrainOperAuth(role.getCarTrainOperAuth()); |
| | | roleInfoVo.setContractDataAuth(role.getContractDataAuth()); |
| | | roleInfoVo.setRoleName(role.getRoleName()); |
| | | // 获取当前角色的菜单id |
| | | List<Long> menusId = sysRoleMenuMapper.selectList(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, id)).stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList()); |
| | |
| | | List<SysMenus> collect = s2.stream().filter(e -> e.getParentId().equals(menus.getMenuId())).collect(Collectors.toList()); |
| | | menus.setChildren(collect); |
| | | } |
| | | |
| | | roleInfoVo.setMenus(menusId); |
| | | roleInfoVo.setRemark(role.getRemark()); |
| | | List<Integer> siteIds = roleSiteClient.getSiteIds(role.getRoleId()).getData(); |
| | | List<Site> sites = siteClient.getSiteByIds(siteIds).getData(); |
| | | List<String> siteNames = sites.stream().map(Site::getName).collect(Collectors.toList()); |
| | | roleInfoVo.setSiteNames(siteNames); |
| | | roleInfoVo.setSiteIds(siteIds); |
| | | return AjaxResult.success(roleInfoVo); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("用户获取权限菜单") |
| | | @GetMapping("/roleInfoFromUserId") |
| | | public AjaxResult roleInfoFromUserId( @RequestParam Long userId) |
| | | { |
| | | SysUserRole one = sysUserRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | Long id =one.getRoleId(); |
| | | // 获取当前角色的菜单id |
| | | List<Long> menusId = sysRoleMenuMapper.selectList(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, id)).stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList()); |
| | | if(menusId.size()==0){ |
| | | return AjaxResult.success(new ArrayList<>()); |
| | | } |
| | | if(id!=1){ |
| | | menusId = menusId.stream().filter(e->e!=1074 && e!=1075 && e!=1193 && e!=1194).collect(Collectors.toList()); |
| | | } |
| | | //获取当前的权限菜单 |
| | | List<SysMenus> all = menuMapper.getAllInIds(menusId); |
| | | // 第三级 |
| | | List<SysMenus> s3 = all.stream().filter(e -> e.getMenuType().equals("F")).collect(Collectors.toList()); |
| | | // 第二级 |
| | | List<SysMenus> s2 = all.stream().filter(e -> e.getMenuType().equals("C")).collect(Collectors.toList()); |
| | | // 第一级 |
| | | List<SysMenus> s1 = all.stream().filter(e -> e.getMenuType().equals("M")).collect(Collectors.toList()); |
| | | |
| | | for (SysMenus menus : s2) { |
| | | List<SysMenus> collect = s3.stream().filter(e -> e.getParentId().equals(menus.getMenuId())).collect(Collectors.toList()); |
| | | menus.setChildren(collect); |
| | | } |
| | | |
| | | for (SysMenus menus : s1) { |
| | | List<SysMenus> collect = s2.stream().filter(e -> e.getParentId().equals(menus.getMenuId())).collect(Collectors.toList()); |
| | | menus.setChildren(collect); |
| | | } |
| | | |
| | | return AjaxResult.success(s1); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation("编辑角色") |
| | | @PostMapping("/roleUpdate") |
| | | public AjaxResult roleUpdate(@Validated @RequestBody RoleUpdateDto dto) |
| | | { |
| | | @ApiOperation(value = "编辑角色", tags = {"管理后台-角色管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult roleUpdate(@Validated @RequestBody RoleUpdateDto dto) { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleName(dto.getRoleName()); |
| | | SysRole one = roleService.getOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getRoleId, dto.getRoleId())); |
| | | List<SysRole> sysRoles = roleService.isExitUpdate(dto.getRoleName(),dto.getRoleId(),one.getCompanyId()); |
| | | if(sysRoles.size()>0){ |
| | | SysRole one = roleService.getOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getRoleName, dto.getRoleName())); |
| | | if(null != one && !one.getRoleId().equals(dto.getRoleId())){ |
| | | return AjaxResult.error("角色已存在,请重新输入"); |
| | | } |
| | | // 编辑角色 |
| | | role.setCarDataAuth(dto.getCarDataAuth()); |
| | | role.setCarTrainOperAuth(dto.getCarTrainOperAuth()); |
| | | role.setContractDataAuth(dto.getContractDataAuth()); |
| | | role.setRemark(dto.getRemark()); |
| | | role.setUpdateBy(SecurityUtils.getUsername()); |
| | | role.setUpdateTime(new Date()); |
| | | role.setRoleId(dto.getRoleId()); |
| | |
| | | sysRoleMenus.add(sysRoleMenu); |
| | | } |
| | | sysRoleMenuMapper.batchRoleMenu(sysRoleMenus); |
| | | //删除旧站点数据 |
| | | roleSiteClient.delRoleSite(dto.getRoleId()); |
| | | //添加站点权限 |
| | | List<TRoleSite> roleSites = new ArrayList<>(); |
| | | for (Integer siteId : dto.getSiteIds()) { |
| | | TRoleSite roleSite = new TRoleSite(); |
| | | roleSite.setRoleId(role.getRoleId().intValue()); |
| | | roleSite.setSiteId(siteId); |
| | | roleSites.add(roleSite); |
| | | } |
| | | roleSiteClient.addRoleSite(roleSites); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:role:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysRole role) |
| | | { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | util.exportExcel(response, list, "角色数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据角色编号获取详细信息 |
| | | */ |
| | | @RequiresPermissions("system:role:query") |
| | | @GetMapping(value = "/{roleId}") |
| | | public AjaxResult getInfo(@PathVariable Long roleId) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return success(roleService.selectRoleById(roleId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增角色 |
| | | */ |
| | | @RequiresPermissions("system:role:add") |
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysRole role) |
| | | { |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setCreateBy(SecurityUtils.getUsername()); |
| | | return toAjax(roleService.insertRole(role)); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改保存角色 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(roleService.updateRole(role)); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存数据权限 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public AjaxResult dataScope(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | return toAjax(roleService.authDataScope(role)); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | role.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(roleService.updateRoleStatus(role)); |
| | | } |
| | | |
| | | /** |
| | | * 删除角色 |
| | |
| | | @RequiresPermissions("system:role:remove") |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) |
| | | { |
| | | @ApiOperation(value = "删除角色", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) { |
| | | return toAjax(roleService.deleteRoleByIds(roleIds)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 停用角色 |
| | | */ |
| | | @RequiresPermissions("system:role:stop") |
| | | @Log(title = "角色管理", businessType = BusinessType.STOP) |
| | | @PutMapping("/stop") |
| | | public AjaxResult stop(@RequestBody Long roleId) |
| | | { |
| | | SysRole sysRole = roleService.selectRoleById(roleId); |
| | | if(sysRole.getStatus().equals("0")){ |
| | | sysRole.setStatus("1"); |
| | | }else { |
| | | sysRole.setStatus("0"); |
| | | } |
| | | return toAjax(roleService.updateRole(sysRole)); |
| | | } |
| | | |
| | | /** |
| | | * 获取角色选择框列表 |
| | | */ |
| | | @RequiresPermissions("system:role:query") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | return success(roleService.selectRoleAll()); |
| | | } |
| | | /** |
| | | * 查询已分配用户角色列表 |
| | | */ |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权用户 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | return toAjax(roleService.deleteAuthUser(userRole)); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择用户授权 |
| | | */ |
| | | @RequiresPermissions("system:role:edit") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | | /** |
| | | * 获取对应角色部门树列表 |
| | |
| | | import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.domain.dto.IndexDto; |
| | | import com.ruoyi.system.domain.vo.UserRoleVO; |
| | | import com.ruoyi.system.api.model.*; |
| | |
| | | import com.ruoyi.system.domain.dto.AddCompanyUserDto; |
| | | import com.ruoyi.system.domain.vo.CompanyUserVo; |
| | | import com.ruoyi.system.domain.vo.TCompanyToUserVo; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | import com.ruoyi.system.service.*; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | @RequestMapping("/user") |
| | | @Api(tags = "用户信息") |
| | | public class SysUserController extends BaseController { |
| | | @Autowired |
| | | @Resource |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysDeptService deptService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysPostService postService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysPermissionService permissionService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysConfigService configService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysUserRoleService userRoleService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysUserRoleService sysUserRoleService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation("管理员列表") |
| | | public AjaxResult list(String phonenumber, int pageNumber, int pageSize) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(pageNumber, pageSize); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, phonenumber); |
| | | @ApiOperation(value = "获取系统用户列表", tags = {"管理后台-系统用户管理", "管理后台-角色管理"}) |
| | | public AjaxResult list(GetSysUserList getSysUserList) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(getSysUserList.getPageCurr(), getSysUserList.getPageSize()); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, getSysUserList); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ApiOperation("添加管理员") |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) { |
| | | @ApiOperation(value = "添加系统用户", tags = {"管理后台-系统用户管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult add(@RequestBody SysUser user) { |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | | return error("手机号已开通账号"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) { |
| | | return error("登录账号重复"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setRoleType(1); |
| | | int i = userService.insertUser(user); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(user.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | int i1 = userRoleService.insertSysUserRole(sysUserRole); |
| | | return AjaxResult.success(i1); |
| | | userRoleService.insertSysUserRole(sysUserRole); |
| | | List<Integer> siteIds = user.getSiteIds(); |
| | | List<TUserSite> userSites = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | TUserSite userSite = new TUserSite(); |
| | | userSite.setUserId(user.getUserId().intValue()); |
| | | userSite.setSiteId(siteId); |
| | | userSites.add(userSite); |
| | | } |
| | | userSiteClient.addUserSite(userSites); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/verifyUserNameRepeat/{username}") |
| | | @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult verifyUserNameRepeat(@PathVariable String username){ |
| | | SysUser user = new SysUser(); |
| | | user.setUserName(username); |
| | | if (StringUtils.isNotEmpty(username) && !userService.checkUserNameUnique(user)) { |
| | | return error("账号不可重复"); |
| | | } |
| | | return success(); |
| | | } |
| | | |
| | | @GetMapping("/getRoleSiteName/{roleId}") |
| | | @ApiOperation(value = "获取角色对应的站点名称", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult<List<String>> getRoleSiteName(@PathVariable Integer roleId){ |
| | | List<Integer> ids = roleSiteClient.getSiteIds(roleId.longValue()).getData(); |
| | | List<Site> data = siteClient.getSiteByIds(ids).getData(); |
| | | List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); |
| | | return AjaxResult.success(siteNames); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @ApiOperation("管理员详情") |
| | | @GetMapping(value = {"/", "/{userId}"}) |
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { |
| | | @ApiOperation(value = "获取用户详情", tags = {"管理后台-系统用户管理"}) |
| | | @GetMapping("/getInfo/{userId}") |
| | | public AjaxResult getInfo(@PathVariable Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | |
| | | ajax.put("posts", postService.selectPostAll()); |
| | | if (StringUtils.isNotNull(userId)) { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | List<Integer> siteIds = userSiteClient.getSiteIds(userId).getData(); |
| | | sysUser.setSiteIds(siteIds); |
| | | List<Site> data = siteClient.getSiteByIds(siteIds).getData(); |
| | | List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); |
| | | sysUser.setSiteNames(siteNames); |
| | | ajax.put(AjaxResult.DATA_TAG, sysUser); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | @ApiOperation("编辑管理员") |
| | | @ApiOperation(value = "编辑系统用户", tags = {"管理后台-系统用户管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && (Objects.nonNull(sysUser) && !user.getUserId().equals(sysUser.getUserId()) )) { |
| | | return error("手机号已开通账号"); |
| | | } |
| | | sysUser = userService.getOne(Wrappers.lambdaQuery(SysUser.class) |
| | | .eq(SysUser::getUserName, user.getUserName()) |
| | | .eq(SysUser::getDelFlag,0) |
| | | .last("LIMIT 1")); |
| | | if (StringUtils.isNotEmpty(user.getUserName()) && (Objects.nonNull(sysUser) && !user.getUserId().equals(sysUser.getUserId()) )) { |
| | | return error("登录账号重复"); |
| | | } |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | if (user.getPassword() != null && !"".equals(user.getPassword())) { |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | |
| | | user.setPassword(null); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | user.setUpdateTime(new Date()); |
| | | return toAjax(userService.updateUser(user)); |
| | | userService.updateUser(user); |
| | | |
| | | //删除旧的站点数据后添加新的 |
| | | userSiteClient.delUserSite(user.getUserId()); |
| | | List<Integer> siteIds = user.getSiteIds(); |
| | | List<TUserSite> userSites = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | TUserSite userSite = new TUserSite(); |
| | | userSite.setUserId(user.getUserId().intValue()); |
| | | userSite.setSiteId(siteId); |
| | | userSites.add(userSite); |
| | | } |
| | | userSiteClient.addUserSite(userSites); |
| | | return success(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | @ApiOperation("删除管理员") |
| | | @ApiOperation(value = "删除系统用户", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | return error("当前用户不能删除"); |
| | |
| | | } |
| | | |
| | | |
| | | @Log(title = "账号管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addCompanyUser") |
| | | @ApiOperation("账号管理--添加账号") |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public AjaxResult addCompanyUser(@Validated @RequestBody AddCompanyUserDto dto) { |
| | | SysUser user = dto.getSysUser(); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | | return error("手机号已存在,请重新输入"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setRoleType(3); |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | | } |
| | | int i = userService.insertUser(user); |
| | | if (i > 0) { |
| | | // 添加role |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(dto.getRoleId()); |
| | | sysUserRole.setUserId(dto.getSysUser().getUserId()); |
| | | userRoleService.insertSysUserRole(sysUserRole); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @Log(title = "账号管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/companyUserInfo") |
| | | @ApiOperation("账号管理--账号详情") |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public AjaxResult companyUserInfo(@RequestParam Long userId) { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | SysUserRole sysUserRole = userRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |
| | | CompanyUserVo companyUserVo = new CompanyUserVo(); |
| | | companyUserVo.setRoleId(sysUserRole.getRoleId()); |
| | | companyUserVo.setSysUser(sysUser); |
| | | return AjaxResult.success(companyUserVo); |
| | | } |
| | | |
| | | @Log(title = "账号管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/updateCompanyUser") |
| | | @ApiOperation("账号管理--修改账号") |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public AjaxResult updateCompanyUser(@Validated @RequestBody AddCompanyUserDto dto) { |
| | | SysUser user = dto.getSysUser(); |
| | | |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | | return error("手机号已存在,请重新输入"); |
| | | } |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | | } |
| | | if (user.getPassword() != null && !"".equals(user.getPassword())) { |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | } |
| | | user.setRoleType(1); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | user.setUpdateTime(new Date()); |
| | | int i = userService.updateUser(user); |
| | | // if (i > 0) { |
| | | // 原来的role |
| | | SysUserRole one = userRoleService.getOne(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, dto.getSysUser().getUserId())); |
| | | one.setRoleId(dto.getRoleId()); |
| | | //更新新的role |
| | | userRoleService.updateSysUserRole(one); |
| | | // } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/shopUserStart") |
| | | @ApiOperation("账号管理--停用/启用") |
| | | public AjaxResult shopUserStart(Long userId) { |
| | | @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult shopUserStart(@RequestParam("userId") Long userId, @RequestParam("remark") String remark) { |
| | | if (userId == null) { |
| | | return AjaxResult.error("userId不能为空"); |
| | | } |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | if (sysUser.getStatus().equals("0")) { |
| | | sysUser.setStatus("1"); |
| | | sysUser.setRemark(remark); |
| | | } else { |
| | | sysUser.setStatus("0"); |
| | | sysUser.setRemark(""); |
| | | } |
| | | return toAjax(userService.updateUser(sysUser)); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private ISysUserRoleService iSysUserRoleService; |
| | | |
| | | |
| | | @PostMapping("/getUserList") |
| | |
| | | } |
| | | |
| | | @PostMapping("/updateSysUser") |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Boolean> updateSysUser(@RequestBody SysUser sysUser) { |
| | | try { |
| | | sysUser.setUpdateBy(SecurityUtils.getUsername()); |
| | |
| | | } |
| | | |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:user:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysUser user) { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.exportExcel(response, list, "用户数据"); |
| | | } |
| | | |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.importTemplateExcel(response, "用户数据"); |
| | | } |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | @RequiresPermissions("system:user:import") |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | List<SysUser> userList = util.importExcel(file.getInputStream()); |
| | | String operName = SecurityUtils.getUsername(); |
| | | String message = userService.importUser(userList, updateSupport, operName); |
| | | return success(message); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前用户信息 |
| | | */ |
| | |
| | | /** |
| | | * 注册用户信息 |
| | | */ |
| | | @InnerAuth |
| | | @PostMapping("/register") |
| | | public R<Boolean> register(@RequestBody SysUser sysUser) { |
| | | String username = sysUser.getUserName(); |
| | |
| | | @RequiresPermissions("system:user:edit") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | @ApiOperation(value = "重置密码", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | |
| | | return R.ok(user); |
| | | } |
| | | |
| | | /** |
| | | * 根据账号获取用户数据 |
| | | * @param account |
| | | * @return |
| | | */ |
| | | @PostMapping("/queryUserByAccount") |
| | | public R<SysUser> queryUserByAccount(@RequestBody String account){ |
| | | SysUser user = userService.getOne(Wrappers.lambdaQuery(SysUser.class) |
| | | .eq(SysUser::getAccount, account) |
| | | .eq(SysUser::getDelFlag, "0")); |
| | | return R.ok(user); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过账号查询用户 |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/addSysUser") |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addSysUser(@RequestBody SysUser user){ |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { |
| | | throw new RuntimeException("手机号已开通账号"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getAccount()) && !userService.checkAccountUnique(user)) { |
| | | if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) { |
| | | throw new RuntimeException("登录账号已存在"); |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
New file |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 15:38 |
| | | */ |
| | | @Data |
| | | @TableName("sys_login_log") |
| | | @ApiModel |
| | | public class SysLoginLog { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "数据id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("user_id") |
| | | private Integer userId; |
| | | /** |
| | | * 登录账号 |
| | | */ |
| | | @TableField("username") |
| | | @ApiModelProperty(value = "用户账号") |
| | | private String username; |
| | | /** |
| | | * 登录IP地址 |
| | | */ |
| | | @TableField("ip_address") |
| | | @ApiModelProperty(value = "登录IP地址") |
| | | private String ipAddress; |
| | | /** |
| | | * 登录地址 |
| | | */ |
| | | @TableField("address") |
| | | @ApiModelProperty(value = "登录地址") |
| | | private String address; |
| | | /** |
| | | * 浏览器类型 |
| | | */ |
| | | @TableField("browser_type") |
| | | @ApiModelProperty(value = "浏览器类型") |
| | | private String browserType; |
| | | /** |
| | | * 操作系统 |
| | | */ |
| | | @TableField("operating_system") |
| | | @ApiModelProperty(value = "操作系统") |
| | | private String operatingSystem; |
| | | /** |
| | | * 登录时间 |
| | | */ |
| | | @TableField("login_time") |
| | | @ApiModelProperty(value = "登录时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime loginTime; |
| | | /** |
| | | * 登录状态(1=成功,2=失败) |
| | | */ |
| | | @TableField("login_status") |
| | | private Integer loginStatus; |
| | | /** |
| | | * 提示消息 |
| | | */ |
| | | @TableField("message") |
| | | private String message; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | /** |
| | | * 删除状态(0=否,1=是) |
| | | */ |
| | | @TableField("del_flag") |
| | | private Integer delFlag; |
| | | } |
| | |
| | | |
| | | @Data |
| | | public class RoleAddDto { |
| | | @ApiModelProperty("角色名称") |
| | | @ApiModelProperty(value = "角色名称", required = true) |
| | | @NotBlank(message = "角色名称不能为空") |
| | | private String roleName; |
| | | @ApiModelProperty("车辆数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carDataAuth; |
| | | @ApiModelProperty("车务数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carTrainOperAuth; |
| | | @ApiModelProperty("合同数据权限:1=所有数据 2=仅自己负责的合同 3=无数据权限") |
| | | private Integer contractDataAuth; |
| | | @ApiModelProperty("公司id") |
| | | @NotNull(message = "公司id不能为空") |
| | | private Integer companyId; |
| | | @ApiModelProperty("菜单id") |
| | | @ApiModelProperty(value = "站点id", required = true) |
| | | private List<Integer> siteIds; |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | @ApiModelProperty(value = "菜单id", required = true) |
| | | @NotNull(message = "菜单id不能为空") |
| | | private List<Long> menuIds; |
| | | } |
| | |
| | | public class RoleUpdateDto { |
| | | @ApiModelProperty("角色id") |
| | | private Long roleId; |
| | | @ApiModelProperty("角色名称") |
| | | @ApiModelProperty(value = "角色名称",required = true) |
| | | @NotBlank(message = "角色名称不能为空") |
| | | private String roleName; |
| | | @ApiModelProperty("车辆数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carDataAuth; |
| | | @ApiModelProperty("车务数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carTrainOperAuth; |
| | | @ApiModelProperty("合同数据权限:1=所有数据 2=仅自己负责的合同 3=无数据权限") |
| | | private Integer contractDataAuth; |
| | | @ApiModelProperty("菜单id") |
| | | @ApiModelProperty(value = "站点id", required = true) |
| | | private List<Integer> siteIds; |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | @ApiModelProperty(value = "菜单id", required = true) |
| | | private List<Long> menuIds; |
| | | } |
| | |
| | | |
| | | private String roleName; |
| | | |
| | | @ApiModelProperty("车辆数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carDataAuth; |
| | | @ApiModelProperty("车务数据权限:1=所有数据 2=已租 3=未租 4=已租(仅自己负责的合同) 5=无数据权限") |
| | | private Integer carTrainOperAuth; |
| | | @ApiModelProperty("合同数据权限:1=所有数据 2=仅自己负责的合同 3=无数据权限") |
| | | private Integer contractDataAuth; |
| | | |
| | | @ApiModelProperty("菜单id") |
| | | private List<Long> menus; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | | @ApiModelProperty("站点id") |
| | | private List<Integer> siteIds; |
| | | @ApiModelProperty(value = "站点名称") |
| | | private List<String> siteNames; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 15:44 |
| | | */ |
| | | public interface SysLoginLogMapper extends BaseMapper<SysLoginLog> { |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param pageInfo |
| | | * @param name |
| | | * @return |
| | | */ |
| | | List<SysLoginLog> pageList(PageInfo<SysLoginLog> pageInfo, @Param("name") String name); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | |
| | |
| | | */ |
| | | public SysUser checkPhoneUnique(String phonenumber); |
| | | |
| | | /** |
| | | * 校验登录账号是否唯一 |
| | | * @param account 登录账号 |
| | | * @return |
| | | */ |
| | | SysUser checkAccountUnique(String account); |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public SysUser checkEmailUnique(String email); |
| | | |
| | | PageInfo<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("phonenumber") String phonenumber); |
| | | List<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("req") GetSysUserList getSysUserList); |
| | | |
| | | PageInfo<SysUser> getAllList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("ids") List<Integer> collect); |
| | | |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/10 14:10 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class GetSysUserList extends BasePage { |
| | | @ApiModelProperty(value = "人员搜索") |
| | | private String search; |
| | | @ApiModelProperty(value = "充电站id") |
| | | private Integer siteId; |
| | | @ApiModelProperty(value = "角色id") |
| | | private List<Integer> roleIds; |
| | | @ApiModelProperty(value = "账户状态(0=正常,1=禁用)") |
| | | private Integer status; |
| | | } |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel(value = "当前车辆查询操作日志") |
| | | @ApiModel() |
| | | public class SysOperLogQuery extends BasePage { |
| | | |
| | | |
| | | @ApiModelProperty(value = "车辆id") |
| | | private Integer carId; |
| | | @ApiModelProperty(value = "操作人员") |
| | | private String operName; |
| | | @ApiModelProperty(value = "操作标题") |
| | | private String title; |
| | | @ApiModelProperty(value = "状态(0=正常,1=异常)") |
| | | private Integer status; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "操作开始时间", notes = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "操作结束时间", notes = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 15:47 |
| | | */ |
| | | public interface ISysLoginLogService extends IService<SysLoginLog> { |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param name |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | PageInfo<SysLoginLog> pageList(String name, BasePage basePage); |
| | | |
| | | |
| | | /** |
| | | * 添加登录日志 |
| | | * @param loginLog |
| | | * @return |
| | | */ |
| | | AjaxResult addLoginLog(SysLoginLog loginLog); |
| | | } |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ISysOperLogService extends IService<SysOperLog> |
| | | { |
| | | public interface ISysOperLogService extends IService<SysOperLog> { |
| | | /** |
| | | * 新增操作日志 |
| | | * |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | |
| | | /** |
| | | * 用户 业务层 |
| | |
| | | * @return 结果 |
| | | */ |
| | | public boolean checkPhoneUnique(SysUser user); |
| | | |
| | | boolean checkAccountUnique(SysUser user); |
| | | |
| | | /** |
| | | * 校验email是否唯一 |
| | |
| | | */ |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | | |
| | | PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String phonenumber); |
| | | PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, GetSysUserList getSysUserList); |
| | | |
| | | |
| | | PageInfo<SysUser> getAllList(PageInfo<SysUser> pageInfo, List<Integer> collect); |
New file |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import com.ruoyi.system.mapper.SysLoginLogMapper; |
| | | import com.ruoyi.system.service.ISysLoginLogService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 15:47 |
| | | */ |
| | | @Service |
| | | public class SysLoginLogServiceImpl extends ServiceImpl<SysLoginLogMapper, SysLoginLog> implements ISysLoginLogService { |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param name |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageInfo<SysLoginLog> pageList(String name, BasePage basePage) { |
| | | PageInfo<SysLoginLog> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<SysLoginLog> list = this.baseMapper.pageList(pageInfo, name); |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加登录日志 |
| | | * @param loginLog |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult addLoginLog(SysLoginLog loginLog) { |
| | | String username = loginLog.getUsername(); |
| | | SysUser sysUser = sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, username).eq(SysUser::getDelFlag, 0)); |
| | | if(null == sysUser){ |
| | | return AjaxResult.error("用户账号无效"); |
| | | } |
| | | loginLog.setUserId(sysUser.getUserId().intValue()); |
| | | loginLog.setCreateTime(LocalDateTime.now()); |
| | | loginLog.setDelFlag(0); |
| | | this.save(loginLog); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysOperLogServiceImpl implements ISysOperLogService |
| | | { |
| | | public class SysOperLogServiceImpl implements ISysOperLogService { |
| | | @Autowired |
| | | private SysOperLogMapper operLogMapper; |
| | | |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertOperlog(SysOperLog operLog) |
| | | { |
| | | public int insertOperlog(SysOperLog operLog) { |
| | | return operLogMapper.insertOperlog(operLog); |
| | | } |
| | | |
| | |
| | | * @return 操作日志集合 |
| | | */ |
| | | @Override |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog) |
| | | { |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog) { |
| | | return operLogMapper.selectOperLogList(operLog); |
| | | } |
| | | |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteOperLogByIds(Long[] operIds) |
| | | { |
| | | public int deleteOperLogByIds(Long[] operIds) { |
| | | return operLogMapper.deleteOperLogByIds(operIds); |
| | | } |
| | | |
| | |
| | | * @return 操作日志对象 |
| | | */ |
| | | @Override |
| | | public SysOperLog selectOperLogById(Long operId) |
| | | { |
| | | public SysOperLog selectOperLogById(Long operId) { |
| | | return operLogMapper.selectOperLogById(operId); |
| | | } |
| | | |
| | |
| | | * 清空操作日志 |
| | | */ |
| | | @Override |
| | | public void cleanOperLog() |
| | | { |
| | | public void cleanOperLog() { |
| | | operLogMapper.cleanOperLog(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleByIds(Long[] roleIds) |
| | | { |
| | | public int deleteRoleByIds(Long[] roleIds) { |
| | | for (Long roleId : roleIds) |
| | | { |
| | | checkRoleAllowed(new SysRole(roleId)); |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Validator; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.domain.SysUserPost; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysUserMapper userMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysRoleMapper roleMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysPostMapper postMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysUserRoleMapper userRoleMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private SysUserPostMapper userPostMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ISysConfigService configService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | protected Validator validator; |
| | | |
| | | @Resource |
| | | private ISysUserRoleService sysUserRoleService; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean checkAccountUnique(SysUser user) { |
| | | SysUser info = userMapper.checkAccountUnique(user.getAccount()); |
| | | if (StringUtils.isNotNull(info) ) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 校验email是否唯一 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String phonenumber) { |
| | | return this.baseMapper.getList(pageInfo,phonenumber); |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, GetSysUserList getSysUserList) { |
| | | List<SysUser> list = this.baseMapper.getList(pageInfo, getSysUserList); |
| | | for (SysUser sysUser : list) { |
| | | List<SysUserRole> list1 = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUser.getUserId())); |
| | | List<Integer> data1 = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | for (SysUserRole sysUserRole : list1) { |
| | | List<Integer> data = roleSiteClient.getSiteIds(sysUserRole.getRoleId()).getData(); |
| | | data1.addAll(data); |
| | | } |
| | | Set<Integer> siteIds = new HashSet<>(data1); |
| | | List<Site> data = siteClient.getSiteByIds(siteIds.stream().collect(Collectors.toList())).getData(); |
| | | List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); |
| | | sysUser.setSiteNames(siteNames); |
| | | |
| | | Set<Long> collect = list1.stream().map(SysUserRole::getRoleId).collect(Collectors.toSet()); |
| | | List<SysRole> sysRoles = roleMapper.selectBatchIds(collect); |
| | | List<String> roleNames = sysRoles.stream().map(SysRole::getRoleName).collect(Collectors.toList()); |
| | | sysUser.setRoleNames(roleNames); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.SysLoginLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.SysLoginLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="user_name" property="username" /> |
| | | <result column="ip_address" property="ipAddress"/> |
| | | <result column="address" property="address"/> |
| | | <result column="browser_type" property="browserType"/> |
| | | <result column="operating_system" property="operatingSystem"/> |
| | | <result column="login_time" property="loginTime"/> |
| | | <result column="login_status" property="loginStatus"/> |
| | | <result column="message" property="message"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="del_flag" property="delFlag"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="pageList" resultMap="BaseResultMap"> |
| | | select |
| | | a.*, |
| | | b.user_name |
| | | from sys_login_log a |
| | | left join sys_user b on (a.user_id = b.user_id) |
| | | where a.del_flag = 0 |
| | | <if test="null != name and '' != name"> |
| | | and b.user_name like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | <result property="phonenumber" column="phonenumber" /> |
| | | <result property="sex" column="sex" /> |
| | | <result property="avatar" column="avatar" /> |
| | | <result property="account" column="account" /> |
| | | <result property="password" column="password" /> |
| | | <result property="status" column="status" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | |
| | | select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1 |
| | | </select> |
| | | |
| | | |
| | | <select id="checkAccountUnique" resultMap="SysUserResult"> |
| | | select user_id, account from sys_user where account = #{account} and del_flag = '0' limit 1 |
| | | </select> |
| | | |
| | | <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,nick_name nickName,login_date loginDate,create_time createTime,user_id userId from sys_user where 1=1 |
| | | <if test="phonenumber !=null and phonenumber !=''"> |
| | | and phonenumber like concat("%", #{phonenumber},"%") |
| | | <if test="req.search !=null and req.search !=''"> |
| | | and (phonenumber like concat("%", #{phonenumber},"%") or nick_name like concat("%", #{phonenumber},"%")) |
| | | </if> |
| | | <if test="null != req.siteId"> |
| | | and user_id in (select user_id from t_user_site where site_id = #{req.siteId}) |
| | | and user_id in (select user_id from sys_user_role where role_id in (select role_id from t_role_site where site_id = #{req.siteId})) |
| | | </if> |
| | | <if test="null != req.roleIds and req.roleIds.size() > 0"> |
| | | and user_id in (select user_id from sys_user_role where role_id in |
| | | <foreach collection="req.roleIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | <if test="null != req.status"> |
| | | and status = #{req.status} |
| | | </if> |
| | | and del_flag = '0' and roleType =1 |
| | | order by create_time desc |
| | |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.account.api.dto.GrantCouponDto; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/getExchangeRecordByCouponId") |
| | | public R<PageInfo<ExchangeRecordVO>> getUseCountByCouponId(ExchangeRecordGoodsQuery couponId){ |
| | | public R<PageInfo<ExchangeRecordVO>> getExchangeRecordByCouponId(@RequestBody ExchangeRecordGoodsQuery couponId){ |
| | | return R.ok(tAppCouponService.pagelist(couponId)); |
| | | } |
| | | |
| | | /** |
| | | * 后台远程调用 给用户发放优惠券 |
| | | */ |
| | | @PostMapping("/grantCoupon") |
| | | public R getExchangeRecordByCouponId(@RequestBody GrantCouponDto dto){ |
| | | List<TAppCoupon> res = new ArrayList<>(); |
| | | for (String s : dto.getUserIds().split(",")) { |
| | | TAppCoupon tAppCoupon = new TAppCoupon(); |
| | | tAppCoupon.setAppUserId(Long.valueOf(s)); |
| | | tAppCoupon.setCouponId(dto.getCouponId()); |
| | | tAppCoupon.setEndTime(dto.getEndTime()); |
| | | tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); |
| | | tAppCoupon.setStatus(1); |
| | | res.add(tAppCoupon); |
| | | } |
| | | tAppCouponService.saveBatch(res); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-app-user-car") |
| | | public class TAppUserCarController { |
| | | |
| | | @Autowired |
| | | private TAppUserCarService appUserCarService; |
| | | |
| | | /** |
| | | * 根据用户车辆id查询车辆信息 |
| | | * @param carIds |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Integer> carIds){ |
| | | return R.ok(appUserCarService.list(Wrappers.lambdaQuery(TAppUserCar.class).in(TAppUserCar::getId,carIds))); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.*; |
| | | import com.ruoyi.account.api.model.*; |
| | |
| | | |
| | | @Resource |
| | | private ExchangeOrderClient exchangeOrderClient; |
| | | |
| | | @ApiOperation(value = "管理后台-根据手机号查询用户ids", tags = {"管理后台-活动费用统计"}) |
| | | @PostMapping(value = "/user/getUserIdsByPhone") |
| | | public R<List<Long>> getUserIdsByPhone(@RequestParam("phone") String phone) { |
| | | |
| | | return R.ok(appUserService.list(new QueryWrapper<TAppUser>().like("phone",phone)).stream().map(TAppUser::getId).collect(Collectors.toList())); |
| | | } |
| | | @Resource |
| | | private GiveVipUtil giveVipUtil; |
| | | @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"}) |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券发放-选择人员") |
| | | @PostMapping("/choiceUser") |
| | | public R<Page<TAppUser>> choiceUser(@RequestBody ChoiceUserListQueryDto userListQueryDto) { |
| | | List<Long> userIds = new ArrayList<>(); |
| | | //如果要筛选标签。用标签获取useids |
| | | if (userListQueryDto.getUserTagId() != null){ |
| | | String[] split = userListQueryDto.getUserTagId().split(","); |
| | | userIds = appUserTagService.lambdaQuery().in(TAppUserTag::getUserTagId, Arrays.asList(split)).list().stream().map(TAppUserTag::getAppUserId).collect(Collectors.toList()); |
| | | } |
| | | //列表查询 |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .in(!userIds.isEmpty(),TAppUser::getId,userIds) |
| | | .eq(TAppUser::getStatus,1) |
| | | .page(Page.of(userListQueryDto.getPageCurr(), userListQueryDto.getPageSize())); |
| | | if (page.getRecords().isEmpty()){ |
| | | return R.ok(page); |
| | | } |
| | | List<Integer> vipIds = new ArrayList<>(); |
| | | vipIds = page.getRecords().stream().map(TAppUser::getVipId).collect(Collectors.toList()); |
| | | //获取会员map |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(vipIds); |
| | | //循环处理 |
| | | for (TAppUser appUser : page.getRecords()) { |
| | | //拿到最新的tagId |
| | | TAppUserTag one = appUserTagService.lambdaQuery().eq(TAppUserTag::getAppUserId, appUser.getId()).orderByDesc(TAppUserTag::getCreateTime).last("limit 1").one(); |
| | | //设置最新的tagName |
| | | R<TUserTag> byIdTag = otherClient.getByIdTag(one.getUserTagId()); |
| | | if (byIdTag.getData()!=null) { |
| | | appUser.setTagName(byIdTag.getData().getName()); |
| | | } |
| | | //匹配vipMap的值 |
| | | appUser.setVipName(vipMap.getData().get(appUser.getVipId())); |
| | | //累计充电次数 |
| | | R<Long> useOrderCount = chargingOrderClient.useOrderCount(appUser.getId()); |
| | | appUser.setOrderCount(useOrderCount.getData()); |
| | | |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "用户添加编辑", tags = {"用户管理-用户列表"}) |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id查询用户信息 |
| | | * @param appUserIds 用户id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/user/getUserByIds") |
| | | public R<List<TAppUser>> getUserByIds(@RequestBody List<Long> appUserIds){ |
| | | return R.ok(appUserService.list(Wrappers.<TAppUser>lambdaQuery().in(TAppUser::getId,appUserIds))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取用户 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/user/getUserById/{id}") |
| | | public R<TAppUser> getUserById(@PathVariable Long id){ |
| | | TAppUser appUser = appUserService.getById(id); |
| | | return R.ok(appUser); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | @Service |
| | | public class TAppCouponServiceImpl extends ServiceImpl<TAppCouponMapper, TAppCoupon> implements TAppCouponService { |
| | | |
| | | @Autowired |
| | | private OrderClient orderClient; |
| | | @Override |
| | | public PageInfo<ExchangeRecordVO> pagelist(ExchangeRecordGoodsQuery dto) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | PageInfo<ExchangeRecordVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ExchangeRecordVO> list = this.baseMapper.pageList(pageInfo,dto); |
| | | // 现金优惠券 |
| | | // 订单ids |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | // 积分优惠券 |
| | | StringBuilder stringBuilder1 = new StringBuilder(); |
| | | |
| | | for (ExchangeRecordVO exchangeRecordVO : list) { |
| | | switch (exchangeRecordVO.getWaysToObtain()){ |
| | | case 1: |
| | | if (exchangeRecordVO.getSerialNumber()!=null){ |
| | | stringBuilder.append(exchangeRecordVO.getSerialNumber()).append(","); |
| | | if (exchangeRecordVO.getOrderId()!=null){ |
| | | stringBuilder.append(exchangeRecordVO.getOrderId()).append(","); |
| | | }else{ |
| | | stringBuilder.append("0").append(","); |
| | | } |
| | | break; |
| | | case 2: |
| | | if (exchangeRecordVO.getSerialNumber()!=null){ |
| | | stringBuilder1.append(exchangeRecordVO.getSerialNumber()).append(","); |
| | | if (exchangeRecordVO.getOrderId()!=null){ |
| | | stringBuilder.append("-").append(exchangeRecordVO.getOrderId()).append(","); |
| | | }else{ |
| | | stringBuilder1.append("0").append(","); |
| | | stringBuilder.append("-").append("0").append(","); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | Date date = DateUtils.toDate(exchangeRecordVO.getEndTime()); |
| | | Date date1 = DateUtils.toDate(exchangeRecordVO.getCreateTime()); |
| | | exchangeRecordVO.setEndTime1(format.format(date)); |
| | | exchangeRecordVO.setCreateTime1(format.format(date1)); |
| | | if (exchangeRecordVO.getStatus()==1){ |
| | | if (exchangeRecordVO.getDelFlag() == 1){ |
| | | // 删除了 就是已取消状态 |
| | |
| | | exchangeRecordVO.setStatus(2); |
| | | } |
| | | } |
| | | // 根据购买方式 查询对应订单号 |
| | | } |
| | | |
| | | // 去除最后一个字符 |
| | | if (StringUtils.hasText(stringBuilder.toString())){ |
| | | String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); |
| | | // 远程调用 查询关联的现金优惠券订单编号 |
| | | // 远程调用 查询关联的订单编号 |
| | | List<String> data = orderClient.getCodeByOrderId(string).getData(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setOrderId(data.get(i)); |
| | | } |
| | | if (StringUtils.hasText(stringBuilder.toString())){ |
| | | String string = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); |
| | | // 远程调用 查询关联的积分兑换优惠券订单编号 |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | name: ruoyi-account |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ruoyi.chargingPile.api.dto.GetPermissionConfigurationDTO; |
| | | import com.ruoyi.chargingPile.api.dto.PartnerListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getPartnerList") |
| | | @ApiOperation(value = "获取合作商列表", tags = {"管理后台-合作商管理"}) |
| | | public AjaxResult<PageInfo<PartnerListDTO>> getPartnerList(@RequestBody GetPartnerList partnerList){ |
| | | public AjaxResult<PageInfo<PartnerListDTO>> getPartnerList(GetPartnerList partnerList){ |
| | | PageInfo<PartnerListDTO> list = partnerService.getPartnerList(partnerList); |
| | | return AjaxResult.success(list); |
| | | } |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "合作商id", name = "id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | public AjaxResult delPartner(@PathVariable("id") Integer id){ |
| | | public AjaxResult delPartner(@PathVariable("id") Integer[] id){ |
| | | return partnerService.delPartner(id); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getPartner") |
| | | @GetMapping("/getPartner") |
| | | @ApiOperation(value = "获取所有合作商", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult<List<Partner>> getPartner(){ |
| | | List<Partner> list = partnerService.list(new LambdaQueryWrapper<Partner>().eq(Partner::getDelFlag, 0)); |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | LambdaQueryWrapper<Partner> wrapper = new LambdaQueryWrapper<Partner>().eq(Partner::getDelFlag, 0); |
| | | if(2 == roleType){ |
| | | wrapper.eq(Partner::getId, objectId); |
| | | } |
| | | List<Partner> list = partnerService.list(wrapper); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getPermissionConfiguration/{siteId}") |
| | | @ApiOperation(value = "获取合作商权限设置", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult<GetPermissionConfigurationDTO> getPermissionConfiguration(@PathVariable("siteId") Integer siteId, Integer partnerId){ |
| | | GetPermissionConfigurationDTO permissionConfiguration = partnerService.getPermissionConfiguration(siteId, partnerId); |
| | | return AjaxResult.success(permissionConfiguration); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/setPermissionConfiguration/{siteId}") |
| | | @ApiOperation(value = "设置合作商权限", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult setPermissionConfiguration(@RequestBody SetPermissionConfiguration req){ |
| | | partnerService.setPermissionConfiguration(req); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | 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.SiteDetailQuery; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.ChargingGunCountVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | 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.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.GeodesyUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | | private TChargingGunService chargingGunService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getSiteList") |
| | | @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult<PageInfo<GetSiteListDTO>> getSiteList(@RequestBody GetSiteList siteList){ |
| | | public AjaxResult<PageInfo<GetSiteListDTO>> getSiteList(GetSiteList siteList){ |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getSiteList1") |
| | | @ApiOperation(value = "获取站点列表 不分页", tags = {"管理后台-活动费用统计"}) |
| | | public AjaxResult<List<Site>> getSiteList1(){ |
| | | return AjaxResult.success(siteService.list(new QueryWrapper<>())); |
| | | } |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理"}) |
| | | @PostMapping("/pageList") |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ |
| | | return AjaxResult.success(siteService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点详细信息", tags = {"小程序-站点管理-站点详情"}) |
| | | @PostMapping("/getDetailById") |
| | | public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){ |
| | | SiteDetailVO siteDetailVO = siteService.getDetailById(query.getSiteId()); |
| | | // 计算距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // 查询绑定车牌提示文案 |
| | | TParkingLot parkingLot = parkingLotClient.getLotBySiteId(query.getSiteId()).getData(); |
| | | if(Objects.nonNull(parkingLot)){ |
| | | siteDetailVO.setRemark(parkingLot.getRemark()); |
| | | } |
| | | return AjaxResult.success(siteDetailVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点下充电桩及充电枪列表", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunList") |
| | | public AjaxResult<List<TChargingPileVO>> getChargingGunList(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId, |
| | | @RequestParam(value = "siteId",required = false)@ApiParam(value = "类型 1=超充,2=快充,3=慢充")Integer type){ |
| | | return AjaxResult.success(chargingPileService.getChargingGunList(siteId,type)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunCount") |
| | | public AjaxResult<Map<String,ChargingGunCountVO>> getChargingGunCount(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId){ |
| | | return AjaxResult.success(chargingGunService.getChargingGunCount(siteId)); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "站点id", name = "id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | public AjaxResult delSite(@PathVariable Integer id){ |
| | | public AjaxResult delSite(@PathVariable Integer[] id){ |
| | | return siteService.delSite(id); |
| | | } |
| | | |
| | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getAllSiteList") |
| | | @ApiOperation(value = "获取所有站点数据", tags = {"管理后台-充电桩信息"}) |
| | | @ApiOperation(value = "获取所有站点数据", tags = {"管理后台-充电桩信息", "管理后台-系统用户管理", "管理后台-角色管理", "管理后台-系统通知", "管理后台-充电评价"}) |
| | | public AjaxResult<List<Site>> getAllSiteList(){ |
| | | List<Site> list = siteService.list(new LambdaQueryWrapper<Site>().eq(Site::getDelFlag, 0) |
| | | .orderByDesc(Site::getCreateTime)); |
| | | //校验当前账户站点权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | LambdaQueryWrapper<Site> wrapper = new LambdaQueryWrapper<Site>().eq(Site::getDelFlag, 0); |
| | | if(2 == roleType){ |
| | | Set<Integer> list = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | wrapper.in(Site::getId, list); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | Set<Integer> list = new HashSet<>(data); |
| | | wrapper.in(Site::getId, list); |
| | | } |
| | | } |
| | | List<Site> list = siteService.list(wrapper.orderByDesc(Site::getCreateTime)); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取站点数据集合 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getSiteByIds") |
| | | public R<List<Site>> getSiteByIds(@RequestBody List<Integer> ids){ |
| | | List<Site> sites = siteService.listByIds(ids); |
| | | return R.ok(sites); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 添加计费策略管理 |
| | | */ |
| | | @Log(title = "添加计费策略", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "添加计费策略") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Integer> add(@RequestBody TAccountingStrategyDTO dto) { |
| | |
| | | /** |
| | | * 修改计费策略 |
| | | */ |
| | | @Log(title = "修改计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "修改计费策略") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TAccountingStrategyDTO dto) { |
| | |
| | | /** |
| | | * 删除计费策略 |
| | | */ |
| | | @Log(title = "删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "删除计费策略") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | |
| | | /** |
| | | * 批量删除计费策略 |
| | | */ |
| | | @Log(title = "批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "批量删除计费策略") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | /** |
| | | * 通过电站id查询计费策略明细列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-计费策略"},value = "通过站点id查询计费策略明细列表") |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailBySiteId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | // TODO 修改 |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId())); |
| | | } |
| | | |
| | | /** |
| | | * 通过站点id查询当前时间段计费策略展示 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询当前时间段计费策略展示") |
| | | @GetMapping(value = "/queryStrategyBySiteIdAndTime") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryStrategyBySiteIdAndTime(@RequestParam Integer siteId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryStrategyBySiteIdAndTime(siteId)); |
| | | } |
| | | |
| | | /** |
| | | * 价格说明金额返回,会员开通金额说明 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "价格说明金额返回,会员开通金额说明") |
| | | @GetMapping(value = "/queryPrice") |
| | | public AjaxResult<StrategyPriceVO> queryPrice(@RequestParam Integer siteId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryPrice(siteId)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | /** |
| | | * 建桩申请 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-建桩申请","后台-申请表单-申请建桩-添加"},value = "建桩申请") |
| | | @Log(title = "建桩申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-建桩申请"},value = "建桩申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TApplyChargingPile dto) { |
| | | // TODO 用户id |
| | |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 添加车库管理 |
| | | */ |
| | | @Log(title = "添加车库", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "添加车库") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TCarport dto) { |
| | |
| | | /** |
| | | * 修改车库 |
| | | */ |
| | | @Log(title = "修改车库", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "修改车库") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TCarport dto) { |
| | |
| | | /** |
| | | * 删除车库 |
| | | */ |
| | | @Log(title = "删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "删除车库") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | |
| | | /** |
| | | * 批量删除车库 |
| | | */ |
| | | @Log(title = "批量删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "批量删除车库") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 添加充电枪管理 |
| | | */ |
| | | @Log(title = "添加充电枪", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "添加充电枪") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult add(@RequestBody TChargingGunDTO dto) { |
| | |
| | | /** |
| | | * 修改充电枪 |
| | | */ |
| | | @Log(title = "修改充电枪", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "修改充电枪") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult update(@RequestBody TChargingGunDTO dto) { |
| | |
| | | /** |
| | | * 删除充电枪 |
| | | */ |
| | | @Log(title = "删除充电枪", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "删除充电枪") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | |
| | | /** |
| | | * 批量删除充电枪 |
| | | */ |
| | | @Log(title = "批量删除充电枪", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-充电枪"},value = "批量删除充电枪") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | |
| | | /** |
| | | * 结束充电 |
| | | */ |
| | | @Log(title = "结束充电", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-充电枪"},value = "结束充电") |
| | | @PostMapping(value = "/stopCharging") |
| | | public AjaxResult<String> stopCharging() { |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | */ |
| | | @ApiOperation(tags = {"小程序-充电桩"},value = "查询充电桩列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TChargingPile>> list(@RequestParam(name = "siteId",value = "站点id",required = false)Integer siteId) { |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "siteId", value = "站点id") |
| | | }) |
| | | public AjaxResult<List<TChargingPile>> list(@RequestParam("siteId") Integer siteId) { |
| | | return AjaxResult.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | /** |
| | | * 管理后台-通过站点id获取充电桩列表 不分页 |
| | | */ |
| | | @ApiOperation(value = "管理后台-通过站点id获取充电桩列表 不分页") |
| | | @PostMapping(value = "/getChargingPileBySiteId") |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId) { |
| | | return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId,siteId))); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @Log(title = "添加充电桩数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @PostMapping("/addChargingPile") |
| | | @ApiOperation(value = "添加充电桩数据", tags = {"管理后台-充电桩信息"}) |
| | | public AjaxResult addChargingPile(@RequestBody TChargingPile chargingPile){ |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @Log(title = "编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @PostMapping("/editChargingPile") |
| | | @ApiOperation(value = "编辑充电桩数据", tags = {"管理后台-充电桩信息"}) |
| | | public AjaxResult editChargingPile(@RequestBody TChargingPile chargingPile){ |
| | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delChargingPile/{id}") |
| | | @Log(title = "删除充电桩", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(value = "删除充电桩", tags = {"管理后台-充电桩信息"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "充电桩id", name = "id", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | public AjaxResult delChargingPile(@PathVariable Integer id){ |
| | | public AjaxResult delChargingPile(@PathVariable Integer[] id){ |
| | | return chargingPileService.delChargingPile(id); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @Log(title = "批量设置计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @PostMapping("/batchSetAccountingStrategy") |
| | | @ApiOperation(value = "批量设置计费策略", tags = {"管理后台-充电桩信息"}) |
| | | public AjaxResult batchSetAccountingStrategy(@RequestBody BatchSetAccountingStrategy setAccountingStrategy){ |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPileNotification; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-charging-pile-notification") |
| | | public class TChargingPileNotificationController { |
| | | |
| | | @Resource |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/chargingPileNotificationPageList") |
| | | @ApiOperation(value = "获取系统通知列表数据", tags = {"管理后台-系统通知"}) |
| | | public AjaxResult<PageInfo<TChargingPileNotification>> chargingPileNotificationPageList(Integer siteId, BasePage basePage){ |
| | | PageInfo<TChargingPileNotification> pageInfo = chargingPileNotificationService.chargingPileNotificationPageList(siteId, basePage); |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delChargingPileNotification/{id}") |
| | | @ApiOperation(value = "删除系统通知", tags = {"管理后台-系统通知"}) |
| | | public AjaxResult delChargingPileNotification(@PathVariable Long id){ |
| | | TChargingPileNotification chargingPileNotification = chargingPileNotificationService.getById(id); |
| | | chargingPileNotification.setDelFlag(1); |
| | | chargingPileNotificationService.updateById(chargingPileNotification); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | /** |
| | | * 添加故障报修管理 |
| | | */ |
| | | @Log(title = "添加故障报修管理", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-故障报修"},value = "添加故障报修管理") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TFaultMessage dto) { |
| | |
| | | import com.ruoyi.chargingPile.service.TMonitoringEquipmentService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 添加监控管理 |
| | | */ |
| | | @Log(title = "添加监控", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-监控"},value = "添加监控") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TMonitoringEquipmentDTO dto) { |
| | |
| | | /** |
| | | * 修改监控 |
| | | */ |
| | | @Log(title = "修改监控", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-监控"},value = "修改监控") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TMonitoringEquipmentDTO dto) { |
| | |
| | | /** |
| | | * 删除监控 |
| | | */ |
| | | @Log(title = "删除监控", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-监控"},value = "删除监控") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | |
| | | /** |
| | | * 批量删除监控 |
| | | */ |
| | | @Log(title = "批量删除监控", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-监控"},value = "批量删除监控") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 添加停车场管理 |
| | | */ |
| | | @Log(title = "添加停车场", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "添加停车场") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TParkingLotDTO dto) { |
| | |
| | | /** |
| | | * 修改停车场 |
| | | */ |
| | | @Log(title = "修改停车场", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "修改停车场") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TParkingLotDTO dto) { |
| | |
| | | /** |
| | | * 删除停车场 |
| | | */ |
| | | @Log(title = "删除停车场", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "删除停车场") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | |
| | | /** |
| | | * 批量删除停车场 |
| | | */ |
| | | @Log(title = "批量删除停车场", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "批量删除停车场") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | |
| | | return AjaxResult.ok(parkingLotService.removeByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 通过站点id查询停车场信息 |
| | | */ |
| | | @GetMapping(value = "/getLotBySiteId") |
| | | public R<TParkingLot> getLotBySiteId(@RequestParam("siteId") Integer siteId){ |
| | | return R.ok(parkingLotService.getOne(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, siteId))); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.TVehicleRamp; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 添加车道管理 |
| | | */ |
| | | @Log(title = "添加车道", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "添加车道") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TVehicleRamp dto) { |
| | |
| | | /** |
| | | * 修改车道 |
| | | */ |
| | | @Log(title = "修改车道", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "修改车道") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TVehicleRamp dto) { |
| | |
| | | /** |
| | | * 删除车道 |
| | | */ |
| | | @Log(title = "删除车道", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "删除车道") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | |
| | | /** |
| | | * 批量删除车道 |
| | | */ |
| | | @Log(title = "批量删除车道", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "批量删除车道") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) { |
| | |
| | | /** |
| | | * 开关闸车道 |
| | | */ |
| | | @Log(title = "开关闸车道", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "开关闸车道") |
| | | @PostMapping(value = "/openOrDown") |
| | | public AjaxResult<String> openOrDown(@RequestBody TVehicleRamp dto) { |
New file |
| | |
| | | package com.ruoyi.chargingPile.domain; |
| | | |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/9 15:28 |
| | | */ |
| | | public enum SiteMenu { |
| | | //站点管理 |
| | | SITE_LIST("/data/site"), |
| | | //站点计费策略 |
| | | SITE_ACCOUNTING_STRATEGY("/data/site/accounting_strategy"), |
| | | //站点编辑 |
| | | SITE_UPDATE("/data/site/update"), |
| | | //站点删除 |
| | | SITE_DELETE("/data/site/delete"), |
| | | //充电桩信息 |
| | | CHARGING_PILE("/data/charging_pile"), |
| | | //充电桩查看 |
| | | CHARGING_PILE_QUERY_INFO("/data/charging_pile/query_info"), |
| | | //充电桩编辑 |
| | | CHARGING_PILE_UPDATE("/data/charging_pile/update"), |
| | | //充电桩删除 |
| | | CHARGING_PILE_DELETE("/data/charging_pile/delete"), |
| | | //充电桩新增接口 |
| | | CHARGING_PILE_ADD_CHARGING_GUN("/data/charging_pile/add_charging_gun"), |
| | | //接口信息 |
| | | CHARGING_GUN("/data/charging_gun"), |
| | | //接口编辑 |
| | | CHARGING_GUN_UPDATE("/data/charging_gun/update"), |
| | | //接口删除 |
| | | CHARGING_GUN_DELETE("/data/charging_gun/delete"), |
| | | //接口查看费率 |
| | | CHARGING_GUN_VIEW_RATES("/data/charging_gun/view_rates"), |
| | | //接口下载二维码 |
| | | CHARGING_GUN_DOWNLOAD_QR_CODE("/data/charging_gun/download_qr_code"), |
| | | //接口查看详情 |
| | | CHARGING_GUN_QUERY_INFO("/data/charging_gun/query_info"), |
| | | //接口结束充电 |
| | | CHARGING_GUN_END_CHARGE("/data/charging_gun/end_charge"), |
| | | //停车场配置 |
| | | PARKING_LOT("/data/parking_lot"), |
| | | //停车场查看 |
| | | PARKING_LOT_QUERY_INFO("/data/parking_lot/query_info"), |
| | | //停车场编辑 |
| | | PARKING_LOT_UPDATE("/data/parking_lot/update"), |
| | | //停车场删除 |
| | | PARKING_LOT_DELETE("/data/parking_lot/delete"), |
| | | //停车场监控 |
| | | PARKING_LOT_MONITOR("/data/parking_lot/monitor"), |
| | | //停车场新增车库 |
| | | PARKING_LOT_ADD_GARAGE("/data/parking_lot/add_garage"), |
| | | //监控管理 |
| | | MONITOR("/data/monitor"), |
| | | //监控查看 |
| | | MONITOR_QUERY_INFO("/data/monitor/query_info"), |
| | | ; |
| | | private String value; |
| | | |
| | | |
| | | SiteMenu(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | 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.SiteVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * @param siteList |
| | | * @return |
| | | */ |
| | | List<GetSiteListDTO> getSiteList(PageInfo<GetSiteListDTO> pageInfo, @Param("item") GetSiteList siteList); |
| | | List<GetSiteListDTO> getSiteList(PageInfo<GetSiteListDTO> pageInfo, @Param("item") GetSiteList siteList, @Param("ids") Set<Integer> ids); |
| | | |
| | | /** |
| | | * 获取站点分页列表 |
| | |
| | | */ |
| | | List<SiteVO> pageList(@Param("query")SiteQuery query,@Param("pageInfo")PageInfo<SiteVO> pageInfo); |
| | | |
| | | /** |
| | | * 获取站点详情 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | SiteDetailVO getDetailById(@Param("siteId")Integer siteId); |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TChargingGunVO> pageList(@Param("query") TChargingGunQuery query, @Param("pageInfo")PageInfo<TChargingGunVO> pageInfo); |
| | | List<TChargingGunVO> pageList(@Param("query") TChargingGunQuery query, @Param("pageInfo")PageInfo<TChargingGunVO> pageInfo, @Param("siteIds") Set<Integer> siteIds); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param page |
| | | * @return |
| | | */ |
| | | List<PageChargingPileListDTO> pageChargingPileList(PageInfo<PageChargingPileListDTO> pageInfo, @Param("item") PageChargingPileList page); |
| | | List<PageChargingPileListDTO> pageChargingPileList(PageInfo<PageChargingPileListDTO> pageInfo, @Param("item") PageChargingPileList page, @Param("siteIds") Set<Integer> siteIds); |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | TChargingPile getChargingPile(Integer id); |
| | | |
| | | /** |
| | | * 获取站点下充电桩及充电枪列表 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TChargingPileVO> getChargingGunList(@Param("siteId")Integer siteId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPileNotification; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TChargingPileNotificationMapper extends BaseMapper<TChargingPileNotification> { |
| | | |
| | | |
| | | /** |
| | | * 获取系统通知列表数据 |
| | | * @param pageInfo |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | List<TChargingPileNotification> chargingPileNotificationPageList(PageInfo<TChargingPileNotification> pageInfo, @Param("siteIds") Set<Integer> siteIds); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.chargingPile.api.dto.GetPermissionConfigurationDTO; |
| | | import com.ruoyi.chargingPile.api.dto.PartnerListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * 删除合作商 |
| | | * @param id |
| | | */ |
| | | AjaxResult delPartner(Integer id); |
| | | AjaxResult delPartner(Integer[] id); |
| | | |
| | | /** |
| | | * 重置密码 |
| | | * @param resetPassword |
| | | */ |
| | | AjaxResult resetPassword(ResetPassword resetPassword); |
| | | |
| | | |
| | | /** |
| | | * 获取合作商权限 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | GetPermissionConfigurationDTO getPermissionConfiguration(Integer siteId, Integer partnerId); |
| | | |
| | | /** |
| | | * 合作商权限配置 |
| | | * @param req |
| | | */ |
| | | void setPermissionConfiguration(SetPermissionConfiguration req); |
| | | |
| | | |
| | | /** |
| | | * 获取合作商授权的站点数据 |
| | | * @param siteMenu 授权菜单路径枚举类 |
| | | * @return |
| | | */ |
| | | Set<Integer> authSite(Integer partnerId, SiteMenu siteMenu); |
| | | |
| | | |
| | | /** |
| | | * 判断当前账户是否有权限 |
| | | * @param siteId 站点id |
| | | * @param siteMenu 菜单路径枚举类 |
| | | * @return |
| | | */ |
| | | boolean authMenu(Integer partnerId, Integer siteId, SiteMenu siteMenu); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | 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.SiteVO; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | AjaxResult delSite(Integer id); |
| | | AjaxResult delSite(Integer[] id); |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | void setAccountingStrategy(Integer id, Integer accountingStrategyId); |
| | | |
| | | /** |
| | | * 获取站点分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | |
| | | PageInfo<SiteVO> pageList(SiteQuery query); |
| | | |
| | | /** |
| | | * 获取站点详情 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | SiteDetailVO getDetailById(Integer siteId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | List<TAccountingStrategyDetailVO> queryAccountingStrategyDetailByStrategyId(Integer strategyId); |
| | | |
| | | |
| | | /** |
| | | * 通过站点id查询当前时间段计费策略展示 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TAccountingStrategyDetailVO> queryStrategyBySiteIdAndTime(Integer siteId); |
| | | |
| | | /** |
| | | * 价格说明金额返回,会员开通金额说明 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | StrategyPriceVO queryPrice(Integer siteId); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.ChargingGunCountVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | AjaxResult update(TChargingGunDTO dto); |
| | | |
| | | /** |
| | | * 获取站点下充电枪数量统计 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | Map<String, ChargingGunCountVO> getChargingGunCount(Integer siteId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPileNotification; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TChargingPileNotificationService extends IService<TChargingPileNotification> { |
| | | |
| | | |
| | | /** |
| | | * 获取系统通知列表数据 |
| | | * @param siteId |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | PageInfo<TChargingPileNotification> chargingPileNotificationPageList(Integer siteId, BasePage basePage); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | AjaxResult delChargingPile(Integer id); |
| | | AjaxResult delChargingPile(Integer[] id); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param setAccountingStrategy |
| | | */ |
| | | void batchSetAccountingStrategy(BatchSetAccountingStrategy setAccountingStrategy); |
| | | |
| | | /** |
| | | * 获取站点下充电桩及充电枪列表 |
| | | * @param siteId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.GetPermissionConfigurationDTO; |
| | | import com.ruoyi.chargingPile.api.dto.PartnerListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.chargingPile.mapper.PartnerMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | 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.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysRoleClient; |
| | |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | @Resource |
| | | private TPartnerSiteService partnerSiteService; |
| | | |
| | | @Resource |
| | | private TSiteMenuService siteMenuService; |
| | | |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional//分布式事务 |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult addPartner(Partner partner) { |
| | | //校验参数和重复数据 |
| | | AjaxResult ajaxResult = addPartnerParameterCheck(partner); |
| | |
| | | this.save(partner); |
| | | //添加登录账户 |
| | | SysUser user = new SysUser(); |
| | | user.setAccount(partner.getAccount()); |
| | | user.setPhonenumber(partner.getPhoneOne()); |
| | | user.setUserName(partner.getName()); |
| | | user.setUserName(partner.getAccount()); |
| | | user.setNickName(partner.getName()); |
| | | user.setAvatar(partner.getLogoUrl()); |
| | | user.setPassword(partner.getPassword()); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @GlobalTransactional//分布式事务 |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult editPartner(Partner partner) { |
| | | //校验参数和重复数据 |
| | | AjaxResult ajaxResult = addPartnerParameterCheck(partner); |
| | |
| | | return AjaxResult.error("登录账号不能重复"); |
| | | } |
| | | Partner oldPartner = this.getById(partner.getId()); |
| | | SysUser user = sysUserClient.queryUserByAccount(oldPartner.getAccount()).getData(); |
| | | SysUser user = sysUserClient.queryUserByUserName(oldPartner.getAccount()).getData(); |
| | | |
| | | //修改数据 |
| | | this.updateById(partner); |
| | |
| | | user = new SysUser(); |
| | | user.setStatus("0"); |
| | | user.setDelFlag("0"); |
| | | user.setAccount(partner.getAccount()); |
| | | user.setPhonenumber(partner.getPhoneOne()); |
| | | user.setUserName(partner.getName()); |
| | | user.setUserName(partner.getAccount()); |
| | | user.setNickName(partner.getName()); |
| | | user.setAvatar(partner.getLogoUrl()); |
| | | user.setPassword(partner.getPassword()); |
| | |
| | | throw new RuntimeException(r.getMsg()); |
| | | } |
| | | }else{ |
| | | user.setAccount(partner.getAccount()); |
| | | user.setPhonenumber(partner.getPhoneOne()); |
| | | user.setUserName(partner.getName()); |
| | | user.setUserName(partner.getAccount()); |
| | | user.setNickName(partner.getName()); |
| | | user.setAvatar(partner.getLogoUrl()); |
| | | user.setPassword(partner.getPassword()); |
| | |
| | | |
| | | /** |
| | | * 删除合作商 |
| | | * @param id 合作商id |
| | | * @param ids 合作商id |
| | | */ |
| | | @Override |
| | | @GlobalTransactional//分布式事务 |
| | | public AjaxResult delPartner(Integer id) { |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult delPartner(Integer[] ids) { |
| | | //查询有无关联数据 |
| | | //站点 |
| | | long count = siteService.count(new LambdaQueryWrapper<Site>().eq(Site::getPartnerId, id).eq(Site::getDelFlag, 0)); |
| | | long count = siteService.count(new LambdaQueryWrapper<Site>().in(Site::getPartnerId, Arrays.asList(ids)).eq(Site::getDelFlag, 0)); |
| | | if(count > 0){ |
| | | return AjaxResult.error("当前合作商有关联得站点,删除失败!"); |
| | | return AjaxResult.error("当前合作商有关联站点,删除失败!"); |
| | | } |
| | | // todo 代码完善 |
| | | //充电桩 |
| | | |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getPartnerId, Arrays.asList(ids)).eq(TChargingPile::getDelFlag, 0)); |
| | | if(count1 > 0){ |
| | | return AjaxResult.error("当前合作商有关联充电桩,删除失败!"); |
| | | } |
| | | for (Integer id : ids) { |
| | | Partner partner = this.getById(id); |
| | | if(null == partner){ |
| | | return AjaxResult.error("删除失败"); |
| | | } |
| | | partner.setDelFlag(true); |
| | | this.updateById(partner); |
| | | SysUser user = sysUserClient.queryUserByAccount(partner.getAccount()).getData(); |
| | | SysUser user = sysUserClient.queryUserByUserName(partner.getAccount()).getData(); |
| | | user.setDelFlag("2"); |
| | | sysUserClient.updateUser(user); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | * @param resetPassword |
| | | */ |
| | | @Override |
| | | @GlobalTransactional//分布式事务 |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult resetPassword(ResetPassword resetPassword) { |
| | | if(null == resetPassword.getId()){ |
| | | return AjaxResult.error("合作商id不能为空"); |
| | |
| | | partner.setPassword(resetPassword.getPassword()); |
| | | this.updateById(partner); |
| | | //修改登录账号的密码 |
| | | SysUser user = sysUserClient.queryUserByAccount(partner.getAccount()).getData(); |
| | | SysUser user = sysUserClient.queryUserByUserName(partner.getAccount()).getData(); |
| | | user.setPassword(partner.getPassword()); |
| | | sysUserClient.resetPassword(user); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取合作商权限 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public GetPermissionConfigurationDTO getPermissionConfiguration(Integer siteId, Integer partnerId) { |
| | | Partner partner = this.getById(partnerId); |
| | | GetPermissionConfigurationDTO dto = new GetPermissionConfigurationDTO(); |
| | | dto.setPermissionRemarks(partner.getPermissionRemarks()); |
| | | Map<String, Object> menu = new HashMap<>(); |
| | | List<TPartnerSite> list = partnerSiteService.list(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | List<Integer> collect = list.stream().map(TPartnerSite::getSiteMenuId).collect(Collectors.toList()); |
| | | List<TSiteMenu> tSiteMenus = siteMenuService.list(new LambdaQueryWrapper<TSiteMenu>() |
| | | .eq(TSiteMenu::getParentId, 0) |
| | | .eq(TSiteMenu::getVisible, 0) |
| | | .eq(TSiteMenu::getStatus, 0).orderByAsc(TSiteMenu::getOrderNum)); |
| | | for (TSiteMenu tSiteMenu : tSiteMenus) { |
| | | menu.put("id", tSiteMenu.getMenuId()); |
| | | menu.put("name", tSiteMenu.getMenuName()); |
| | | menu.put("path", tSiteMenu.getPath()); |
| | | menu.put("type", tSiteMenu.getMenuType()); |
| | | |
| | | List<TSiteMenu> tSiteMenus1 = siteMenuService.list(new LambdaQueryWrapper<TSiteMenu>() |
| | | .eq(TSiteMenu::getParentId, tSiteMenu.getMenuId()) |
| | | .eq(TSiteMenu::getVisible, 0) |
| | | .eq(TSiteMenu::getStatus, 0).orderByAsc(TSiteMenu::getOrderNum)); |
| | | Map<String, Object> child = new HashMap<>(); |
| | | for (TSiteMenu siteMenu : tSiteMenus1) { |
| | | child.put("id", siteMenu.getMenuId()); |
| | | child.put("name", siteMenu.getMenuName()); |
| | | child.put("path", siteMenu.getPath()); |
| | | child.put("type", siteMenu.getMenuType()); |
| | | child.put("selected", collect.contains(siteMenu.getMenuId())); |
| | | } |
| | | menu.put("selected", child.keySet().size() > 0 ? true : false); |
| | | menu.put("child", child); |
| | | } |
| | | dto.setMenu(menu); |
| | | return dto; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 合作商权限配置 |
| | | * @param req |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void setPermissionConfiguration(SetPermissionConfiguration req) { |
| | | //删除原始配置 |
| | | partnerSiteService.remove(new LambdaQueryWrapper<TPartnerSite>().eq(TPartnerSite::getPartnerId, req.getPartnerId()).eq(TPartnerSite::getSiteId, req.getSiteId())); |
| | | //添加新的配置 |
| | | List<TPartnerSite> sites = new ArrayList<>(); |
| | | List<Integer> list = req.getMenuId(); |
| | | for (Integer integer : list) { |
| | | TPartnerSite partnerSite = new TPartnerSite(); |
| | | partnerSite.setPartnerId(req.getPartnerId()); |
| | | partnerSite.setSiteId(req.getSiteId()); |
| | | partnerSite.setSiteMenuId(integer); |
| | | sites.add(partnerSite); |
| | | } |
| | | partnerSiteService.saveBatch(sites); |
| | | //修改权限配置 |
| | | Partner partner = this.getById(req.getPartnerId()); |
| | | partner.setPermissionRemarks(req.getPermissionRemarks()); |
| | | this.updateById(partner); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取合作商授权的站点数据 |
| | | * @param siteMenu 授权菜单路径枚举类 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Set<Integer> authSite(Integer partnerId, SiteMenu siteMenu) { |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, siteMenu.getValue()).eq(TSiteMenu::getStatus, 0)); |
| | | List<TPartnerSite> list = partnerSiteService.list(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId())); |
| | | List<Integer> collect = list.stream().map(TPartnerSite::getSiteId).collect(Collectors.toList()); |
| | | //获取合作商用户关联的站点数据 |
| | | Partner partner = this.getById(partnerId); |
| | | SysUser sysUser = sysUserClient.queryUserByUserName(partner.getAccount()).getData(); |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | collect.addAll(data); |
| | | collect.addAll(data1); |
| | | Set<Integer> siteIds = new HashSet<>(collect); |
| | | if(siteIds.size() == 0){ |
| | | siteIds.add(-1); |
| | | } |
| | | return siteIds; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断当前账户是否有权限 |
| | | * @param siteId 站点id |
| | | * @param siteMenu 菜单路径枚举类 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean authMenu(Integer partnerId, Integer siteId, SiteMenu siteMenu) { |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, siteMenu.getValue()).eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | return null == partnerSite ? false : true; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | 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.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | 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.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | @Resource |
| | | private TChargingGunService chargingGunService; |
| | | |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public PageInfo<GetSiteListDTO> getSiteList(GetSiteList siteList) { |
| | | Set<Integer> ids = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | ids = new HashSet<>(data); |
| | | } |
| | | } |
| | | PageInfo<GetSiteListDTO> pageInfo = new PageInfo<>(siteList.getPageCurr(), siteList.getPageSize()); |
| | | List<GetSiteListDTO> list = this.baseMapper.getSiteList(pageInfo, siteList); |
| | | List<GetSiteListDTO> list = this.baseMapper.getSiteList(pageInfo, siteList, ids); |
| | | for (GetSiteListDTO getSiteListDTO : list) { |
| | | Integer siteId = getSiteListDTO.getId(); |
| | | getSiteListDTO.setAuthAccountingStrategy(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.SITE_ACCOUNTING_STRATEGY)); |
| | | //平台账号才有此权限 |
| | | getSiteListDTO.setAuthPartner(roleType == 1 ? true : false); |
| | | getSiteListDTO.setAuthUpdate(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.SITE_UPDATE)); |
| | | getSiteListDTO.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.SITE_DELETE)); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加站点信息 |
| | |
| | | |
| | | /** |
| | | * 删除站点 |
| | | * @param id 站点id |
| | | * @param ids 站点id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult delSite(Integer id) { |
| | | public AjaxResult delSite(Integer[] ids) { |
| | | //查询是否有关联数据 |
| | | //充电桩 |
| | | // todo 待完善 |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getSiteId, Arrays.asList(ids)).eq(TChargingPile::getDelFlag, 0)); |
| | | if(count1 > 0){ |
| | | return AjaxResult.error("该站点有关联充电桩,删除失败!"); |
| | | } |
| | | for (Integer id : ids) { |
| | | Site site = this.getById(id); |
| | | site.setDelFlag(true); |
| | | this.updateById(site); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public SiteDetailVO getDetailById(Integer siteId) { |
| | | return this.baseMapper.getDetailById(siteId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置站点计费策略 |
| | |
| | | * @param accountingStrategyId 计费策略id |
| | | */ |
| | | @Override |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void setAccountingStrategy(Integer id, Integer accountingStrategyId) { |
| | | Site site = this.getById(id); |
| | | site.setAccountingStrategyId(accountingStrategyId); |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | 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.TAccountingStrategyDetailService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TAccountingStrategyDetailServiceImpl extends ServiceImpl<TAccountingStrategyDetailMapper, TAccountingStrategyDetail> implements TAccountingStrategyDetailService { |
| | | |
| | | @Autowired |
| | | private TAccountingStrategyMapper accountingStrategyMapper; |
| | | @Autowired |
| | | private VipClient vipClient; |
| | | |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryAccountingStrategyDetailByStrategyId(Integer strategyId) { |
| | | return this.baseMapper.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | } |
| | | |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryStrategyBySiteIdAndTime(Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | // 获取当前时间段的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO = list.stream().filter(detail -> detail.getStartTime().compareTo(LocalTime.now().toString()) <= 0 && detail.getEndTime().compareTo(LocalTime.now().toString()) >= 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategy.getDiscount()); |
| | | // 获取后一次的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategy.getDiscount()); |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | | list.add(accountingStrategyDetailNext); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public StrategyPriceVO queryPrice(Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | |
| | | StrategyPriceVO strategyPriceVO = new StrategyPriceVO(); |
| | | |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | // 获取当前时间段的计费策略明细 |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO = list.stream().filter(detail -> detail.getStartTime().compareTo(LocalTime.now().toString()) <= 0 && detail.getEndTime().compareTo(LocalTime.now().toString()) >= 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()) |
| | | .subtract(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount())).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | // 查询最高抵扣的会员 |
| | | 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()); |
| | | return strategyPriceVO; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.ChargingGunCountVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.TMonitoringEquipmentVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TChargingGunMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.common.core.enums.status.ChargingGunModeEnum; |
| | | import com.ruoyi.common.core.enums.status.ChargingGunStatusEnum; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TChargingGunServiceImpl extends ServiceImpl<TChargingGunMapper, TChargingGun> implements TChargingGunService { |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<TChargingGunVO> pageList(TChargingGunQuery query) { |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_GUN); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = new HashSet<>(data); |
| | | } |
| | | } |
| | | PageInfo<TChargingGunVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TChargingGunVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<TChargingGunVO> list = this.baseMapper.pageList(query,pageInfo, siteIds); |
| | | for (TChargingGunVO tChargingGunVO : list) { |
| | | Integer siteId = tChargingGunVO.getSiteId(); |
| | | tChargingGunVO.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_DELETE)); |
| | | tChargingGunVO.setAuthDownloadQRCode(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_DOWNLOAD_QR_CODE)); |
| | | tChargingGunVO.setAuthEndCharge(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_END_CHARGE)); |
| | | tChargingGunVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_QUERY_INFO)); |
| | | tChargingGunVO.setAuthUpdate(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_UPDATE)); |
| | | tChargingGunVO.setAuthViewRates(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_VIEW_RATES)); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | if(ajaxResult.isError()){ |
| | | return ajaxResult; |
| | | } |
| | | long count = this.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, dto.getCode()).eq(TChargingGun::getDelFlag, 0)); |
| | | long count = this.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, dto.getCode()) |
| | | .eq(TChargingGun::getDelFlag, 0)); |
| | | if(count > 0){ |
| | | return AjaxResult.error("接口编码已存在"); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public AjaxResult update(TChargingGunDTO dto) { |
| | | TChargingGun chargingGun = this.getById(dto.getId()); |
| | | if(Arrays.asList(3,4,5,6).contains(chargingGun.getStatus())){ |
| | | return AjaxResult.error("接口占用中,无法编辑!"); |
| | | } |
| | | AjaxResult ajaxResult = addVerify(dto); |
| | | if(ajaxResult.isError()){ |
| | | return ajaxResult; |
| | | } |
| | | TChargingGun one = this.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, dto.getCode()).eq(TChargingGun::getDelFlag, 0)); |
| | | TChargingGun one = this.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, dto.getCode()) |
| | | .eq(TChargingGun::getDelFlag, 0)); |
| | | if(null != one && !dto.getId().equals(one.getId())){ |
| | | return AjaxResult.error("接口编码已存在"); |
| | | } |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, ChargingGunCountVO> getChargingGunCount(Integer siteId) { |
| | | Map<String, ChargingGunCountVO> map = new HashMap<>(4); |
| | | // 查询全部充电枪 |
| | | List<TChargingGun> list = this.list(Wrappers.lambdaQuery(TChargingGun.class).eq(TChargingGun::getSiteId, siteId)); |
| | | int freeCount = 0; |
| | | // 超级充 |
| | | ChargingGunCountVO superSufficient = getGunCount(ChargingGunModeEnum.SUPER_SUFFICIENT.getCode(), list); |
| | | freeCount += superSufficient.getFreeCount(); |
| | | map.put("superSufficient", superSufficient); |
| | | // 快充 |
| | | ChargingGunCountVO fastSufficient = getGunCount(ChargingGunModeEnum.FAST_SUFFICIENT.getCode(), list); |
| | | freeCount += fastSufficient.getFreeCount(); |
| | | map.put("fastSufficient", fastSufficient); |
| | | // 慢充 |
| | | ChargingGunCountVO slowSufficient = getGunCount(ChargingGunModeEnum.SLOW_SUFFICIENT.getCode(), list); |
| | | freeCount += slowSufficient.getFreeCount(); |
| | | map.put("slowSufficient", slowSufficient); |
| | | ChargingGunCountVO chargingGunCountVO = new ChargingGunCountVO(); |
| | | chargingGunCountVO.setTotalCount(list.size()); |
| | | chargingGunCountVO.setFreeCount(freeCount); |
| | | map.put("totalSufficient", chargingGunCountVO); |
| | | return map; |
| | | } |
| | | |
| | | private ChargingGunCountVO getGunCount(Integer chargeMode, List<TChargingGun> list){ |
| | | ChargingGunCountVO chargingGunCountVO = new ChargingGunCountVO(); |
| | | chargingGunCountVO.setTotalCount(list.stream().filter(tChargingGun -> tChargingGun.getChargeMode().equals(chargeMode)).collect(Collectors.toList()).size()); |
| | | chargingGunCountVO.setFreeCount(list.stream().filter(tChargingGun -> tChargingGun.getChargeMode().equals(chargeMode) |
| | | && tChargingGun.getStatus()== ChargingGunStatusEnum.IDLE.getCode()).collect(Collectors.toList()).size()); |
| | | return chargingGunCountVO; |
| | | } |
| | | |
| | | /** |
| | | * 校验必填项 |
| | | * @param dto |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPileNotification; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileNotificationMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TChargingPileNotificationServiceImpl extends ServiceImpl<TChargingPileNotificationMapper, TChargingPileNotification> implements TChargingPileNotificationService { |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取系统通知列表数据 |
| | | * @param siteId |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageInfo<TChargingPileNotification> chargingPileNotificationPageList(Integer siteId, BasePage basePage) { |
| | | //校验当前账户站点权限 |
| | | Set<Integer> siteIds = null; |
| | | if(null == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | LambdaQueryWrapper<Site> wrapper = new LambdaQueryWrapper<Site>().eq(Site::getDelFlag, 0); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = new HashSet<>(data); |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds = new HashSet<>(siteId); |
| | | } |
| | | PageInfo<TChargingPileNotification> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TChargingPileNotification> list = this.baseMapper.chargingPileNotificationPageList(pageInfo, siteIds); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | private TChargingGunService chargingGunService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public PageInfo<PageChargingPileListDTO> pageChargingPileList(PageChargingPileList page) { |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_PILE); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = new HashSet<>(data); |
| | | } |
| | | } |
| | | PageInfo<PageChargingPileListDTO> pageInfo = new PageInfo<>(page.getPageCurr(), page.getPageSize()); |
| | | List<PageChargingPileListDTO> list = this.baseMapper.pageChargingPileList(pageInfo, page); |
| | | List<PageChargingPileListDTO> list = this.baseMapper.pageChargingPileList(pageInfo, page, siteIds); |
| | | for (PageChargingPileListDTO pageChargingPileListDTO : list) { |
| | | Integer siteId = pageChargingPileListDTO.getSiteId(); |
| | | pageChargingPileListDTO.setAuthAddChargingGun(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_PILE_ADD_CHARGING_GUN)); |
| | | pageChargingPileListDTO.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_PILE_DELETE)); |
| | | pageChargingPileListDTO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_PILE_QUERY_INFO)); |
| | | pageChargingPileListDTO.setAuthUpdate(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_PILE_UPDATE)); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 删除充电桩 |
| | | * @param id |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult delChargingPile(Integer id) { |
| | | public AjaxResult delChargingPile(Integer[] ids) { |
| | | //检查是否有关联数据 |
| | | //接口 |
| | | long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, id).eq(TChargingGun::getDelFlag, 0)); |
| | | long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, Arrays.asList(ids)).eq(TChargingGun::getDelFlag, 0)); |
| | | if(count > 0){ |
| | | return AjaxResult.error("该充电桩有关联的接口数据,删除失败!"); |
| | | } |
| | | for (Integer id : ids) { |
| | | TChargingPile chargingPile = this.getById(id); |
| | | chargingPile.setDelFlag(true); |
| | | this.updateById(chargingPile); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | } |
| | | chargingGunService.updateBatchById(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type) { |
| | | List<TChargingPileVO> chargingPileVOS = this.baseMapper.getChargingGunList(siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getSiteId, siteId) |
| | | .eq(TChargingGun::getChargeMode, type)); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); |
| | | }); |
| | | return chargingPileVOS; |
| | | } |
| | | } |
| | |
| | | name: ruoyi-chargingPile |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | |
| | | <result column="remark" property="remark" /> |
| | | <result column="account" property="account" /> |
| | | <result column="password" property="password" /> |
| | | <result column="permission_remarks" property="permissionRemarks"/> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | |
| | | <if test="null != item.roleId and '' != item.name"> |
| | | and role_id = #{item.roleId} |
| | | </if> |
| | | order by create_time desc limit #{item.pageCurr}, #{item.pageSize} |
| | | order by create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="null != item.districtsCode and '' != item.districtsCode"> |
| | | and a.districts_code = #{item.districtsCode} |
| | | </if> |
| | | order by a.sort desc, a.create_time desc limit #{item.pageCurr}, #{item.pageSize} |
| | | <if test="null != ids"> |
| | | and a.id in |
| | | <foreach collection="ids" item="itemm" index="index" open="(" separator="," close=")"> |
| | | #{itemm} |
| | | </foreach> |
| | | </if> |
| | | order by a.sort desc, a.create_time desc |
| | | </select> |
| | | |
| | | <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.SiteVO"> |
| | |
| | | </choose> |
| | | </if> |
| | | </select> |
| | | <select id="getDetailById" resultType="com.ruoyi.chargingPile.api.vo.SiteDetailVO"> |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | FROM t_site WHERE id = #{siteId} AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="query.chargeMode != null"> |
| | | AND tas.chargeMode = #{query.chargeMode} |
| | | </if> |
| | | <if test="null != siteIds"> |
| | | and tcg.site_id in |
| | | <foreach collection="siteIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | AND tas.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY tas.create_time DESC |
| | |
| | | <if test="null != item.type"> |
| | | and a.type = #{item.type} |
| | | </if> |
| | | order by a.create_time desc limit #{item.pageCurr}, #{item.pageSize} |
| | | <if test="null != siteIds"> |
| | | and a.site_id in |
| | | <foreach collection="siteIds" item="itemm" index="index" open="(" separator="," close=")"> |
| | | #{itemm} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | |
| | | |
| | |
| | | left join t_site b on (a.site_id = b.id) |
| | | left join t_partner c on (a.partner_id = c.id) |
| | | </select> |
| | | <select id="getChargingGunList" resultType="com.ruoyi.chargingPile.api.vo.TChargingPileVO"> |
| | | select id,code, `name`, `number` from t_charging_pile |
| | | where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} and site_id = #{siteId} |
| | | </select> |
| | | </mapper> |
| | |
| | | <id column="id" property="id" /> |
| | | <result column="site_id" property="siteId" /> |
| | | <result column="charging_pile_id" property="chargingPileId" /> |
| | | <result column="phone" property="phone"/> |
| | | <result column="content" property="content" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | |
| | | id, site_id, charging_pile_id, content, create_time, del_flag |
| | | </sql> |
| | | |
| | | |
| | | |
| | | <select id="chargingPileNotificationPageList" resultType="com.ruoyi.chargingPile.api.model.TChargingPileNotification"> |
| | | select |
| | | a.id, |
| | | b.`name` as siteName, |
| | | a.phone, |
| | | a.content, |
| | | a.create_time as createTime |
| | | from t_charging_pile_notification a |
| | | left join t_site b on (a.site_id = b.id) |
| | | where a.del_flag = 0 |
| | | <if test="null != siteIds"> |
| | | and a.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | name: ruoyi-integration |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- ruoyi-modules-other-api --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!-- ruoyi-modules-chargingPile-api --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | 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.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TExchangeOrderService; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.order.service.impl.TChargingOrderServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TShoppingOrderService tShoppingOrderService; |
| | | @Autowired |
| | | private TExchangeOrderService exchangeOrderService; |
| | | @Autowired |
| | | private TChargingOrderService chargingOrderService; |
| | | @Autowired |
| | | private TVipOrderService vipOrderService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private ChargingPileClient chargingPileClient; |
| | | /** |
| | | * 管理后台 活动费用统计 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/activityStatistics") |
| | | public R<TActivityVO> activityStatistics(@RequestBody TActivityStatisticsQuery dto) { |
| | | if (StringUtils.hasLength(dto.getPhone())){ |
| | | // 远程调用查询出符合条件的用户ids |
| | | List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData(); |
| | | dto.setUserIds(data); |
| | | } |
| | | if (dto.getSiteId()!=null){ |
| | | // 远程调用查询出符合条件的充电桩ids |
| | | List<TChargingPile> data = chargingPileClient.getChargingPileBySiteId(dto.getSiteId()).getData(); |
| | | dto.setChargingPileIds(data.stream().map(TChargingPile::getId).collect(Collectors.toList())); |
| | | } |
| | | return R.ok(tShoppingOrderService.activityStatistics(dto)); |
| | | } |
| | | |
| | | //订单详情 |
| | | @PostMapping(value = "/detail") |
| | |
| | | return R.ok(res); |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon流水号查询现金优惠券的订单编号 |
| | | * 管理后台 根据t_app_coupon订单ids查询优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCodeBySerialNumber") |
| | | public R<List<String>> getCodeBySerialNumber(String goodsIds){ |
| | | @PostMapping("/getCodeByOrderId") |
| | | public R<List<String>> getCodeByOrderId(String goodsIds){ |
| | | String[] split = goodsIds.split("-"); |
| | | List<String> strings = new ArrayList<>(); |
| | | for (String s : split) { |
| | | TShoppingOrder one = tShoppingOrderService.getOne(new QueryWrapper<TShoppingOrder>() |
| | | if (s.contains("-")){ |
| | | // 带有负号的是积分兑换的订单 |
| | | TExchangeOrder one = exchangeOrderService.getOne(new QueryWrapper<TExchangeOrder>() |
| | | .eq("order_type", 2) |
| | | .eq("serial_number", s)); |
| | | .eq("id", s.replace("-",""))); |
| | | if (one != null){ |
| | | strings.add(one.getCode()); |
| | | }else{ |
| | | strings.add(""); |
| | | } |
| | | }else{ |
| | | TShoppingOrder one = tShoppingOrderService.getOne(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type", 2) |
| | | .eq("id", s)); |
| | | if (one != null){ |
| | | strings.add(one.getCode()); |
| | | }else{ |
| | | strings.add(""); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return R.ok(strings); |
| | | } |
| | | /** |
| | | * 管理后台 根据t_app_coupon流水号查询积分兑换优惠券的订单编号 |
| | | * 管理后台 根据t_app_coupon订单ids查询积分兑换优惠券的订单编号 |
| | | * @param goodsIds 订单号-商品类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCodeBySerialNumberIntegral") |
| | | public R<List<String>> getCodeBySerialNumberIntegral(String goodsIds){ |
| | | String[] split = goodsIds.split("-"); |
| | | List<String> strings = new ArrayList<>(); |
| | | for (String s : split) { |
| | | TExchangeOrder one = exchangeOrderService.getOne(new QueryWrapper<TExchangeOrder |
| | | >() |
| | | .eq("order_type", 2) |
| | | .eq("serial_number", s)); |
| | | if (one != null){ |
| | | strings.add(one.getCode()); |
| | | }else{ |
| | | strings.add(""); |
| | | } |
| | | } |
| | | |
| | | return R.ok(strings); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-order-evaluate") |
| | | public class TOrderEvaluateController { |
| | | |
| | | @Autowired |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价标签及数量查询") |
| | | @PostMapping(value = "/getTagCount") |
| | | public AjaxResult<List<TEvaluationTagVO>> getTagCount() { |
| | | return AjaxResult.ok(orderEvaluateService.getTagCount()); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价分页列表查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TOrderEvaluateVO>> pageList(@RequestBody TOrderEvaluateQuery query) { |
| | | return AjaxResult.ok(orderEvaluateService.getTagList(query)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping(value = "/getPageList") |
| | | @ApiOperation(value = "获取充电评价列表", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult<PageInfo<GetOrderEvaluatePageListDTO>> getPageList(@RequestBody GetOrderEvaluatePageList pageList){ |
| | | PageInfo<GetOrderEvaluatePageListDTO> list = orderEvaluateService.getPageList(pageList); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @DeleteMapping(value = "/delOrderEvaluate") |
| | | @ApiOperation(value = "删除充电评价", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult delOrderEvaluate(@PathVariable Long id){ |
| | | TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id); |
| | | orderEvaluate.setDelFlag(true); |
| | | orderEvaluateService.updateById(orderEvaluate); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/replyEvaluation") |
| | | @ApiOperation(value = "充电评价回复", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult replyEvaluation(@PathVariable("id") Long id, @RequestParam("reply") String reply){ |
| | | TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id); |
| | | reply = reply.replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #40;", "(") |
| | | .replaceAll("& #41;", ")") |
| | | .replaceAll("& #39;", "'") |
| | | .replaceAll("& lt;", "<") |
| | | .replaceAll("& gt;", ">"); |
| | | orderEvaluate.setEvaluationResponse(reply); |
| | | orderEvaluate.setResponseTime(LocalDateTime.now()); |
| | | orderEvaluateService.updateById(orderEvaluate); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @DeleteMapping(value = "/delOrderEvaluateReply") |
| | | @ApiOperation(value = "删除充电评价回复", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult delOrderEvaluateReply(@PathVariable Long id){ |
| | | TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id); |
| | | orderEvaluate.setEvaluationResponse(""); |
| | | orderEvaluateService.updateById(orderEvaluate); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "电站详情中评价列表查询") |
| | | @GetMapping(value = "/getSiteDetailEveList") |
| | | public AjaxResult<SiteDetailEvaluateVO> getSiteDetailEveList(@RequestParam(value = "siteId")@ApiParam(value = "站点id")Integer siteId) { |
| | | return AjaxResult.ok(orderEvaluateService.getSiteDetailEveList(siteId)); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 19:07 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class GetOrderEvaluatePageList extends BasePage { |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String code; |
| | | @ApiModelProperty(value = "评价内容") |
| | | private String content; |
| | | @ApiModelProperty(value = "评价类型(1=好评,2=中评,3=差评)") |
| | | private Integer evaluateType; |
| | | @ApiModelProperty(value = "归属电站id") |
| | | private Integer siteId; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 19:09 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class GetOrderEvaluatePageListDTO { |
| | | @ApiModelProperty("订单id") |
| | | private String id; |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | private Long appUserId; |
| | | @ApiModelProperty("用户头像") |
| | | private String avatar; |
| | | @ApiModelProperty("用户电话") |
| | | private String phone; |
| | | @ApiModelProperty("评分") |
| | | private Integer mark; |
| | | @ApiModelProperty("归属电站名称") |
| | | private String siteName; |
| | | private Integer siteId; |
| | | @ApiModelProperty("评价内容") |
| | | private String content; |
| | | @ApiModelProperty("评价图片") |
| | | private String imgUrl; |
| | | @ApiModelProperty("评价时间") |
| | | private String createTime; |
| | | @ApiModelProperty("评价标签") |
| | | private List<String> tags; |
| | | @ApiModelProperty("回复内容") |
| | | private String recover; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Mapper |
| | | public interface TGrantVipMapper extends BaseMapper<TGrantVip> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface TOrderEvaluateMapper extends BaseMapper<TOrderEvaluate> { |
| | | |
| | | /** |
| | | * 订单评价分页列表查询 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TOrderEvaluateVO> pageList(@Param("query") TOrderEvaluateQuery query,@Param("pageInfo")PageInfo<TOrderEvaluateVO> pageInfo); |
| | | |
| | | |
| | | /** |
| | | * 获取充电评价列表数据 |
| | | * @param pageList |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<GetOrderEvaluatePageListDTO> getPageList(@Param("query") GetOrderEvaluatePageList pageList, @Param("evaluationTagIds") List<Integer> evaluationTagIds, |
| | | PageInfo<GetOrderEvaluatePageListDTO> pageInfo); |
| | | |
| | | /** |
| | | * 查询站点下的所有订单评价 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<TOrderEvaluateVO> getOrderEvaluateBySiteId(@Param("siteId")Integer siteId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface TOrderEvaluateTagMapper extends BaseMapper<TOrderEvaluateTag> { |
| | | |
| | | /** |
| | | * 获取标签评价数量 |
| | | * @param tagIds |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getCountByTagIds(@Param("tagIds") List<Integer> tagIds); |
| | | } |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface TShoppingOrderMapper extends BaseMapper<TShoppingOrder> { |
| | | |
| | | List<TActivityStatisticslVO> activityStatistics(@Param("pageInfo") PageInfo<TActivityStatisticslVO> pageInfo, @Param("req")TActivityStatisticsQuery dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | public interface TGrantVipService extends IService<TGrantVip> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOrderEvaluateService extends IService<TOrderEvaluate> { |
| | | |
| | | /** |
| | | * 获取评价标签 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getTagCount(); |
| | | |
| | | /** |
| | | * 充电订单评价分页列表查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TOrderEvaluateVO> getTagList(TOrderEvaluateQuery query); |
| | | |
| | | /** |
| | | * 电站详情中评价列表查询 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | SiteDetailEvaluateVO getSiteDetailEveList(Integer siteId); |
| | | |
| | | |
| | | /** |
| | | * 获取充电评价列表 |
| | | * @param pageList |
| | | * @return |
| | | */ |
| | | PageInfo<GetOrderEvaluatePageListDTO> getPageList(GetOrderEvaluatePageList pageList); |
| | | } |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TShoppingOrderService extends IService<TShoppingOrder> { |
| | | |
| | | TActivityVO activityStatistics(TActivityStatisticsQuery dto); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.mapper.TGrantVipMapper; |
| | | import com.ruoyi.order.mapper.TVipOrderMapper; |
| | | import com.ruoyi.order.service.TGrantVipService; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-07 |
| | | */ |
| | | @Service |
| | | public class TGrantVipServiceImpl extends ServiceImpl<TGrantVipMapper, TGrantVip> implements TGrantVipService { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | | import com.ruoyi.order.api.vo.SiteDetailEvaluateVO; |
| | | import com.ruoyi.order.api.vo.TOrderEvaluateVO; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageList; |
| | | import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.mapper.TOrderEvaluateMapper; |
| | | import com.ruoyi.order.mapper.TOrderEvaluateTagMapper; |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.feignClient.TEvaluationTagClient; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TOrderEvaluateServiceImpl extends ServiceImpl<TOrderEvaluateMapper, TOrderEvaluate> implements TOrderEvaluateService { |
| | | |
| | | @Resource |
| | | private TEvaluationTagClient evaluationTagClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private AppUserCarClient appUserCarClient; |
| | | @Autowired |
| | | private TOrderEvaluateTagMapper orderEvaluateTagMapper; |
| | | @Resource |
| | | private TChargingOrderMapper chargingOrderMapper; |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private TOrderEvaluateMapper orderEvaluateMapper; |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagCount() { |
| | | // 查询标签列表 |
| | | R<List<TEvaluationTagVO>> r = evaluationTagClient.getTagList(null); |
| | | List<TEvaluationTagVO> tagList = r.getData(); |
| | | List<Integer> tagIds = tagList.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); |
| | | // 统计标签使用数量 |
| | | List<TEvaluationTagVO> counts = orderEvaluateTagMapper.getCountByTagIds(tagIds); |
| | | tagList.forEach(tag -> { |
| | | counts.forEach(count -> { |
| | | if (tag.getId().equals(count.getId())) { |
| | | tag.setTagCount(count.getTagCount()); |
| | | } |
| | | }); |
| | | }); |
| | | tagList = tagList.stream().sorted(Comparator.comparing(TEvaluationTagVO::getTagCount).reversed()).collect(Collectors.toList()); |
| | | // 统计有图,好评,中差评数量 |
| | | long imgUrlCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) |
| | | .isNotNull(TOrderEvaluate::getImgUrl)); |
| | | packageTagCount(imgUrlCount,"有图",tagList); |
| | | long goodCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) |
| | | .ge(TOrderEvaluate::getMark,4)); |
| | | packageTagCount(goodCount,"好评",tagList); |
| | | long badCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) |
| | | .le(TOrderEvaluate::getMark,3)); |
| | | packageTagCount(badCount,"中差评",tagList); |
| | | return tagList; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TOrderEvaluateVO> getTagList(TOrderEvaluateQuery query) { |
| | | PageInfo<TOrderEvaluateVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | // 查询站点下的所有订单 |
| | | List<TChargingOrder> tChargingOrders = chargingOrderMapper.selectList(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .eq(TChargingOrder::getSiteId, query.getSiteId())); |
| | | if(CollectionUtils.isEmpty(tChargingOrders)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | List<Long> orderIds = tChargingOrders.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | query.setOrderIds(orderIds); |
| | | List<TOrderEvaluateVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | // 查询用户信息 |
| | | List<TAppUser> appUsers = appUserClient.getUserByIds(list.stream().map(TOrderEvaluateVO::getAppUserId).collect(Collectors.toList())).getData(); |
| | | // 查询用户绑定车辆品牌 |
| | | List<TAppUserCar> appUserCars = appUserCarClient.getCarByIds(list.stream().map(TOrderEvaluateVO::getAppUserCarId).collect(Collectors.toList())).getData(); |
| | | list.forEach(orderEvaluateVO -> { |
| | | TAppUser appUser = appUsers.stream().filter(user -> user.getId().equals(orderEvaluateVO.getAppUserId())).findFirst().orElse(null); |
| | | if(Objects.nonNull(appUser)){ |
| | | orderEvaluateVO.setName(appUser.getName()); |
| | | orderEvaluateVO.setAvatar(appUser.getAvatar()); |
| | | } |
| | | TAppUserCar appUserCar = appUserCars.stream().filter(car -> car.getId().equals(Long.parseLong(String.valueOf(orderEvaluateVO.getAppUserCarId())))).findFirst().orElse(null); |
| | | if(Objects.nonNull(appUserCar)){ |
| | | orderEvaluateVO.setCarName(appUserCar.getVehicleBrand()); |
| | | } |
| | | }); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public SiteDetailEvaluateVO getSiteDetailEveList(Integer siteId) { |
| | | SiteDetailEvaluateVO siteDetailEvaluateVO = new SiteDetailEvaluateVO(); |
| | | // 查询站点下的所有订单评价 |
| | | List<TOrderEvaluateVO> tChargingOrders = orderEvaluateMapper.getOrderEvaluateBySiteId(siteId); |
| | | if(!CollectionUtils.isEmpty(tChargingOrders)){ |
| | | siteDetailEvaluateVO.setOrderEvaluateVOS(tChargingOrders); |
| | | // 统计好评率 |
| | | long goodCount = tChargingOrders.stream().filter(orderEvaluateVO -> orderEvaluateVO.getMark()>=4).count(); |
| | | BigDecimal reviewRate = new BigDecimal(goodCount).divide(new BigDecimal(tChargingOrders.size())).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | siteDetailEvaluateVO.setReviewRate(reviewRate); |
| | | siteDetailEvaluateVO.setEvaluateCount(tChargingOrders.size()); |
| | | siteDetailEvaluateVO.setOrderEvaluateVOS(tChargingOrders.stream().limit(3).collect(Collectors.toList())); |
| | | } |
| | | return siteDetailEvaluateVO; |
| | | } |
| | | |
| | | /** |
| | | * 统计有图,好评,中差评数量 |
| | | * @param count |
| | | * @param name |
| | | * @param tagList |
| | | */ |
| | | private void packageTagCount(Long count,String name,List<TEvaluationTagVO> tagList){ |
| | | if(count>0){ |
| | | TEvaluationTagVO evaluationTagVO = new TEvaluationTagVO(); |
| | | evaluationTagVO.setName(name); |
| | | evaluationTagVO.setTagCount(Integer.parseInt(String.valueOf(count))); |
| | | tagList.add(evaluationTagVO); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取充电评价列表 |
| | | * @param pageList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageInfo<GetOrderEvaluatePageListDTO> getPageList(GetOrderEvaluatePageList pageList) { |
| | | PageInfo<GetOrderEvaluatePageListDTO> pageInfo = new PageInfo<>(pageList.getPageCurr(), pageList.getPageSize()); |
| | | List<Integer> evaluationTagIds = null; |
| | | if(null != pageList.getEvaluateType()){ |
| | | List<TEvaluationTagVO> data = evaluationTagClient.getTagList(pageList.getEvaluateType()).getData(); |
| | | evaluationTagIds = data.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); |
| | | } |
| | | List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, pageInfo); |
| | | for (GetOrderEvaluatePageListDTO dto : list) { |
| | | TAppUser appUser = appUserClient.getUserById(dto.getAppUserId()).getData(); |
| | | dto.setAvatar(appUser.getAvatar()); |
| | | String phone = appUser.getPhone(); |
| | | dto.setPhone(phone.substring(0, 3) + "****" + phone.substring(6)); |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(dto.getSiteId())).getData().get(0); |
| | | dto.setSiteName(site.getName()); |
| | | List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, dto.getId())); |
| | | List<Integer> tagIds = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); |
| | | List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData(); |
| | | List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); |
| | | dto.setTags(collect); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import com.ruoyi.order.mapper.TShoppingOrderMapper; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TShoppingOrderServiceImpl extends ServiceImpl<TShoppingOrderMapper, TShoppingOrder> implements TShoppingOrderService { |
| | | |
| | | @Override |
| | | public TActivityVO activityStatistics(TActivityStatisticsQuery dto) { |
| | | TActivityVO res = new TActivityVO(); |
| | | |
| | | |
| | | |
| | | PageInfo<TActivityStatisticslVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<TActivityStatisticslVO> list = this.baseMapper.activityStatistics(pageInfo,dto); |
| | | list.sort((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())); |
| | | // 优惠券金额 |
| | | BigDecimal coupon = new BigDecimal("0"); |
| | | // 会员抵扣金额 |
| | | BigDecimal discount = new BigDecimal("0"); |
| | | // 会员活动金额 |
| | | BigDecimal vipActivity = new BigDecimal("0"); |
| | | // 赠送会员 |
| | | BigDecimal grantVip = new BigDecimal("0"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | for (TActivityStatisticslVO tActivityStatisticslVO : list) { |
| | | // 判断享有了哪些类型 |
| | | switch (tActivityStatisticslVO.getOrderType()){ |
| | | case 1: |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | |
| | | // 充电订单 优惠券金额大于0 |
| | | if (tActivityStatisticslVO.getCouponDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | coupon = coupon.add(tActivityStatisticslVO.getCouponDiscountAmount()); |
| | | stringBuilder.append("优惠券抵扣").append("+"); |
| | | } |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | discount = discount.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | stringBuilder.append("会员抵扣").append("+"); |
| | | } |
| | | stringBuilder.deleteCharAt(stringBuilder.length()-1); |
| | | tActivityStatisticslVO.setType(stringBuilder.toString()); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | break; |
| | | case 2: |
| | | StringBuilder stringBuilder1 = new StringBuilder(); |
| | | |
| | | // 购物订单 优惠券金额大于0 |
| | | if (tActivityStatisticslVO.getCouponDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | coupon = coupon.add(tActivityStatisticslVO.getCouponDiscountAmount()); |
| | | stringBuilder1.append("优惠券抵扣").append("+"); |
| | | } |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | discount = discount.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | stringBuilder1.append("会员抵扣").append("+"); |
| | | } |
| | | stringBuilder1.deleteCharAt(stringBuilder1.length()-1); |
| | | tActivityStatisticslVO.setType(stringBuilder1.toString()); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | break; |
| | | case 3: |
| | | // 会员订单 优惠金额大于0 |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | vipActivity = vipActivity.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | } |
| | | tActivityStatisticslVO.setType("会员活动"); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | break; |
| | | case 4: |
| | | // 赠送会员订单 如果支付金额为0 那么就是后台赠送的会员 |
| | | if (tActivityStatisticslVO.getPaymentAmount().compareTo(BigDecimal.ZERO)==0){ |
| | | grantVip = grantVip.add(tActivityStatisticslVO.getOrderAmount()); |
| | | tActivityStatisticslVO.setType("赠送会员"); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | }else{ |
| | | // 赠送 |
| | | grantVip = grantVip.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | tActivityStatisticslVO.setType("赠送会员"); |
| | | tActivityStatisticslVO.setTime(simpleDateFormat.format(tActivityStatisticslVO.getCreateTime())); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | res.setList(pageInfo); |
| | | res.setTotal(coupon.add(discount).add(vipActivity).add(grantVip)); |
| | | res.setCoupon(coupon); |
| | | res.setDiscount(discount); |
| | | res.setVipActivity(vipActivity); |
| | | res.setGrantVip(grantVip); |
| | | return res; |
| | | } |
| | | } |
| | |
| | | name: ruoyi-order |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | |
| | | <result column="order_classification" property="orderClassification" /> |
| | | <result column="app_user_id" property="appUserId" /> |
| | | <result column="app_user_car_id" property="appUserCarId" /> |
| | | <result column="site_id" property="siteId" /> |
| | | <result column="parking_lot_id" property="parkingLotId" /> |
| | | <result column="charging_pile_id" property="chargingPileId" /> |
| | | <result column="charging_gun_id" property="chargingGunId" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, order_type, order_classification, app_user_id, app_user_car_id, parking_lot_id, charging_pile_id, charging_gun_id, start_time, end_time, status, recharge_amount, recharge_payment_type, recharge_payment_status, recharge_serial_number, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag |
| | | id, code, order_type, order_classification, app_user_id, app_user_car_id,site_id, parking_lot_id, charging_pile_id, charging_gun_id, start_time, end_time, status, recharge_amount, recharge_payment_type, recharge_payment_status, recharge_serial_number, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <result column="order_type" property="orderType" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="app_user_id" property="appUserId" /> |
| | | <result column="app_user_car_id" property="appUserCarId" /> |
| | | <result column="mark" property="mark" /> |
| | | <result column="content" property="content" /> |
| | | <result column="img_url" property="imgUrl" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, order_type, order_id, app_user_id, mark, content, img_url, evaluation_response, create_time, response_time, del_flag |
| | | id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, create_time, response_time, del_flag |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.order.api.vo.TOrderEvaluateVO"> |
| | | select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, |
| | | create_time, response_time, del_flag |
| | | from t_order_evaluate where id in |
| | | (select toe.id |
| | | from t_order_evaluate toe |
| | | left join t_order_evaluate_tag toet on toe.id = toet.order_evaluate_id |
| | | <where> |
| | | <if test="query.orderIds != null and query.orderIds.size()>0"> |
| | | and toe.order_id in |
| | | <foreach collection="query.orderIds" item="orderId" open="(" separator="," close=")"> |
| | | #{orderId} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.tagType != null"> |
| | | <choose> |
| | | <when test="query.tagType == 2"> |
| | | AND toe.img_url IS NOT NULL |
| | | </when> |
| | | <when test="query.tagType == 3"> |
| | | AND toe.mark >= 4 |
| | | </when> |
| | | <when test="query.tagType == 4"> |
| | | AND toe.mark <= 3 |
| | | </when> |
| | | <when test="query.tagType == 5"> |
| | | AND toet.evaluation_tag_id = #{query.tagId} |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | AND toe.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | GROUP BY toe.id) |
| | | <if test="query.tagType != null"> |
| | | <choose> |
| | | <when test="query.tagType == 1"> |
| | | ORDER BY create_time DESC |
| | | </when> |
| | | <otherwise> |
| | | ORDER BY |
| | | CASE |
| | | WHEN img_url IS NOT NULL THEN 0 |
| | | ELSE 1 |
| | | END ASC, |
| | | create_time DESC; |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="query.tagType == null"> |
| | | ORDER BY |
| | | CASE |
| | | WHEN img_url IS NOT NULL THEN 0 |
| | | ELSE 1 |
| | | END ASC, |
| | | create_time DESC; |
| | | </if> |
| | | </select> |
| | | <select id="getOrderEvaluateBySiteId" resultType="com.ruoyi.order.api.vo.TOrderEvaluateVO"> |
| | | select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, |
| | | create_time, response_time, del_flag |
| | | from t_order_evaluate toe |
| | | where toe.order_id in |
| | | (select toc.order_id |
| | | from t_charging_order toc |
| | | where toc.site_id = #{siteId} |
| | | and toc.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}) |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getPageList" resultType="com.ruoyi.order.dto.GetOrderEvaluatePageListDTO"> |
| | | select |
| | | CAST(a.id AS CHAR) as id, |
| | | b.`code`, |
| | | a.mark, |
| | | b.site_id as siteId, |
| | | b.app_user_id as appUserId, |
| | | a.content, |
| | | a.img_url as imgUrl, |
| | | DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%s') as createTime, |
| | | a.evaluation_response as `recover` |
| | | from t_order_evaluate a |
| | | left join t_charging_order b on (a.order_id = b.id) |
| | | where a.order_type = 1 and a.del_flag = 0 |
| | | <if test="null != query.code and '' != query.code"> |
| | | and b.`code` like CONCAT('%', #{query.code}, '%') |
| | | </if> |
| | | <if test="null != query.content and '' != query.content"> |
| | | and a.content like CONCAT('%', #{query.content}, '%') |
| | | </if> |
| | | <if test="null != query.evaluateType"> |
| | | and a.id in (select order_evaluate_id from t_order_evaluate_tag where evaluation_tag_id in |
| | | <foreach collection="evaluationTagIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | <if test="null != query.siteId"> |
| | | and b.site_id = #{query.siteId} |
| | | </if> |
| | | order by a.create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, order_evaluate_id, evaluation_tag_id |
| | | </sql> |
| | | <select id="getCountByTagIds" resultType="com.ruoyi.other.api.vo.TEvaluationTagVO"> |
| | | SELECT evaluation_tag_id,count(id) AS tagCount FROM t_order_evaluate_tag |
| | | <where> |
| | | <if test="tagIds != null and tagIds.size() > 0"> |
| | | AND evaluation_tag_id IN |
| | | <foreach collection="tagIds" item="tagId" open="(" separator="," close=")"> |
| | | #{tagId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY evaluation_tag_id |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, code, app_user_id, order_type, goods_id, coupon_id, purchase_quantity, app_user_address_id, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, payment_status, payment_type, serial_number, remark, status, express_company, express_number, consigner_id, consigner_time, receiving_time, cancellation_time, cancellation_id, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag |
| | | </sql> |
| | | <select id="activityStatistics" resultType="com.ruoyi.order.api.vo.TActivityStatisticslVO"> |
| | | <if test="req.orderType == null or req.orderType == 1"> |
| | | <if test="req.type == null or req.type == 1 or req.type == 2"> |
| | | select t1.code ,t1.order_amount as orderAmount, |
| | | t1.coupon_discount_amount as couponDiscountAmount, |
| | | t1.vip_discount_amount as vipDiscountAmount, |
| | | t1.payment_amount as paymentAmount, |
| | | t1.create_time as createTime, |
| | | 1 as orderType |
| | | from t_charging_order t1 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 1"> |
| | | and t1.coupon_discount_amount != null and t1.coupon_discount_amount != 0 |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 2"> |
| | | and t1.vip_discount_amount != null and t1.vip_discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != req.chargingPileIds and req.chargingPileIds.size()>0" > |
| | | and t1.charging_pile_id in |
| | | <foreach collection="req.chargingPileIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t1.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t1.recharge_payment_status =2 |
| | | and t1.refund_status !=2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 2"> |
| | | <if test="req.type == null or req.type == 1 or req.type == 2"> |
| | | union all |
| | | select t2.code ,t2.order_amount as orderAmount, |
| | | t2.coupon_discount_amount as couponDiscountAmount, |
| | | t2.vip_discount_amount as vipDiscountAmount, |
| | | t2.payment_amount as paymentAmount, |
| | | t2.create_time as createTime, |
| | | 2 as orderType |
| | | from t_shopping_order t2 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t2.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 1"> |
| | | and t2.coupon_discount_amount != null and t1.coupon_discount_amount != 0 |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 2"> |
| | | and t2.vip_discount_amount != null and t1.vip_discount_amount != 0 |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t2.vip_discount_amount != null and t1.vip_discount_amount != 0 and t2.coupon_discount_amount != null and t1.coupon_discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t2.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t2.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t2.refund_status !=2 |
| | | and t2.payment_status =2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 3"> |
| | | <if test="req.type == null or req.type == 3"> |
| | | union all |
| | | select t3.code ,t3.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | t3.discount_amount as vipDiscountAmount, |
| | | t3.payment_amount as paymentAmount, |
| | | t3.create_time as createTime, |
| | | 3 as orderType |
| | | from t_vip_order t3 |
| | | where 1 = 1 |
| | | and t3.type ==1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t3.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t3.discount_amount != null and t3.discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t3.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t3.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t3.payment_status =2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 4"> |
| | | <if test="req.type == null or req.type == 4"> |
| | | union all |
| | | select t4.code ,t4.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | t4.discount_amount as vipDiscountAmount, |
| | | t4.payment_amount as paymentAmount, |
| | | t4.create_time as createTime, |
| | | 4 as orderType |
| | | from t_vip_order t4 |
| | | where 1 = 1 |
| | | and t4.type =2 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t4.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t4.discount_amount != null and t4.discount_amount != 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t4.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t4.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t4.payment_status =2 |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 4"> |
| | | <if test="req.type == null or req.type == 4"> |
| | | union all |
| | | select t5.code ,t5.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | 0 as vipDiscountAmount, |
| | | 0 as paymentAmount, |
| | | t5.create_time as createTime, |
| | | 4 as orderType |
| | | from t_grant_vip t5 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t5.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t5.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t5.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | | import com.ruoyi.order.api.vo.TActivityVO; |
| | | import com.ruoyi.other.api.domain.TActivity; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.dto.AdvertisingDTO; |
| | | import com.ruoyi.other.query.CouponQuery; |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理后台活动费用统计 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/activity") |
| | | public class TActivityStatisticsController { |
| | | @Autowired |
| | | private OrderClient orderClient; |
| | | @ApiOperation(tags = {"管理后台-活动费用统计"},value = "管理后台活动费用统计") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<TActivityVO> pageList(@RequestBody TActivityStatisticsQuery query) { |
| | | return AjaxResult.ok(orderClient.activityStatistics(query).getData()); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.enums.status.AdvertisingStatusEnum; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.other.api.domain.TAdvertising; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.dto.AdvertisingDTO; |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.dto.GrantCouponDto; |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.ruoyi.other.service.TGoodsService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @PostMapping("/exchangeRecord") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情-兑换记录") |
| | | public AjaxResult<PageInfo<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) { |
| | | |
| | | return AjaxResult.ok(null); |
| | | PageInfo<ExchangeRecordVO> data = appCouponClient.getExchangeRecordByCouponId(dto).getData(); |
| | | List<ExchangeRecordVO> records = data.getRecords(); |
| | | for (ExchangeRecordVO record : records) { |
| | | TCoupon byId = tCouponService.getById(record.getCouponId()); |
| | | if (byId!=null){ |
| | | record.setDiscountAmount("¥"+byId.getDiscountAmount()); |
| | | if (Objects.equals(byId.getMeetTheConditions(), BigDecimal.ZERO)){ |
| | | record.setMeetTheConditions("无门槛"); |
| | | }else{ |
| | | record.setMeetTheConditions("满"+byId.getMeetTheConditions()+"元可用"); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.ok(data); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "发放优惠券") |
| | | @GetMapping(value = "/pageList") |
| | | public AjaxResult pageList(@RequestBody GrantCouponDto dto) { |
| | | TCoupon byId = tCouponService.getById(dto.getCouponId()); |
| | | Integer waysToObtain = byId.getWaysToObtain(); |
| | | dto.setWaysToObtain(waysToObtain); |
| | | switch (byId.getValidityPeriodMode()){ |
| | | case 1: |
| | | dto.setEndTime(byId.getEndTime()); |
| | | break; |
| | | case 2: |
| | | dto.setEndTime(LocalDateTime.now().plusDays(byId.getDays())); |
| | | break; |
| | | } |
| | | // 远程送优惠券 |
| | | return AjaxResult.success(); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | |
| | | |
| | | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.service.TEnterpriseUserApplicationService; |
| | | import com.sun.xml.internal.bind.v2.TODO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 添加计费策略管理 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-计费策略","后台-申请表单-集团用户"},value = "添加集团用户申请") |
| | | @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"小程序-计费策略"},value = "添加集团用户申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TEnterpriseUserApplication dto) { |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) { |
| | | // TODO 用户id |
| | | return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); |
| | | } |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import com.ruoyi.other.query.InvoiceTypePageList; |
| | | import com.ruoyi.other.service.TEvaluationTagService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-evaluation-tag") |
| | | public class TEvaluationTagController { |
| | | |
| | | private final TEvaluationTagService evaluationTagService; |
| | | |
| | | @Autowired |
| | | public TEvaluationTagController(TEvaluationTagService evaluationTagService) { |
| | | this.evaluationTagService = evaluationTagService; |
| | | } |
| | | |
| | | @PostMapping("/getTagList") |
| | | public R<List<TEvaluationTagVO>> getTagList() { |
| | | return R.ok(evaluationTagService.getTagList()); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/pageList") |
| | | @ApiOperation(value = "获取评价标签列表", tags = {"管理后台-评价标签设置"}) |
| | | public AjaxResult<PageInfo<TEvaluationTag>> pageList(String name, BasePage basePage){ |
| | | PageInfo<TEvaluationTag> pageInfo = evaluationTagService.pageList(name, basePage); |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/addEvaluationTag") |
| | | @ApiOperation(value = "添加评价标签", tags = {"管理后台-评价标签设置"}) |
| | | public AjaxResult addEvaluationTag(@RequestBody TEvaluationTag evaluationTag){ |
| | | evaluationTagService.save(evaluationTag); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getEvaluationTagInfo/{id}") |
| | | @ApiOperation(value = "获取评价标签详情", tags = {"管理后台-评价标签设置"}) |
| | | public AjaxResult<TEvaluationTag> getEvaluationTagInfo(@PathVariable Integer id){ |
| | | TEvaluationTag evaluationTag = evaluationTagService.getById(id); |
| | | return AjaxResult.success(evaluationTag); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/editEvaluationTag") |
| | | @ApiOperation(value = "编辑评价标签", tags = {"管理后台-评价标签设置"}) |
| | | public AjaxResult editEvaluationTag(@RequestBody TEvaluationTag evaluationTag){ |
| | | evaluationTagService.updateById(evaluationTag); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delEvaluationTag/{id}") |
| | | @ApiOperation(value = "删除评价标签", tags = {"管理后台-评价标签设置"}) |
| | | public AjaxResult<TInvoiceType> delEvaluationTag(@PathVariable Integer[] id){ |
| | | List<TEvaluationTag> tEvaluationTags = evaluationTagService.listByIds(Arrays.asList(id)); |
| | | for (TEvaluationTag evaluationTag : tEvaluationTags) { |
| | | evaluationTag.setDelFlag(true); |
| | | evaluationTagService.updateById(evaluationTag); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id集合获取数据 |
| | | * @param tagIds |
| | | * @return |
| | | */ |
| | | @GetMapping("/getListByIds") |
| | | public R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds){ |
| | | List<TEvaluationTag> tEvaluationTags = evaluationTagService.listByIds(tagIds); |
| | | return R.ok(tEvaluationTags); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.query.InvoiceTypePageList; |
| | | import com.ruoyi.other.service.TInvoiceTypeService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-invoice-type") |
| | | public class TInvoiceTypeController { |
| | | |
| | | @Resource |
| | | private TInvoiceTypeService invoiceTypeService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/pageList") |
| | | @ApiOperation(value = "获取发票类型列表", tags = {"管理后台-发票类型管理"}) |
| | | public AjaxResult<PageInfo<TInvoiceType>> pageList(InvoiceTypePageList pageList){ |
| | | PageInfo<TInvoiceType> pageInfo = invoiceTypeService.pageList(pageList); |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/addInvoiceType") |
| | | @ApiOperation(value = "添加发票类型", tags = {"管理后台-发票类型管理"}) |
| | | public AjaxResult addInvoiceType(@RequestBody TInvoiceType invoiceType){ |
| | | invoiceTypeService.save(invoiceType); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getInvoiceTypeInfo/{id}") |
| | | @ApiOperation(value = "获取发票类型详情", tags = {"管理后台-发票类型管理"}) |
| | | public AjaxResult<TInvoiceType> getInvoiceTypeInfo(@PathVariable Integer id){ |
| | | TInvoiceType invoiceType = invoiceTypeService.getById(id); |
| | | return AjaxResult.success(invoiceType); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/editInvoiceType") |
| | | @ApiOperation(value = "编辑发票类型", tags = {"管理后台-发票类型管理"}) |
| | | public AjaxResult editInvoiceType(@RequestBody TInvoiceType invoiceType){ |
| | | invoiceTypeService.updateById(invoiceType); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delInvoiceType/{id}") |
| | | @ApiOperation(value = "删除发票类型", tags = {"管理后台-发票类型管理"}) |
| | | public AjaxResult<TInvoiceType> delInvoiceType(@PathVariable Integer[] id){ |
| | | List<TInvoiceType> tInvoiceTypes = invoiceTypeService.listByIds(Arrays.asList(id)); |
| | | for (TInvoiceType invoiceType : tInvoiceTypes) { |
| | | invoiceType.setDelFlag(true); |
| | | invoiceTypeService.updateById(invoiceType); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TRoleSite; |
| | | import com.ruoyi.other.service.TRoleSiteService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-role-site") |
| | | public class TRoleSiteController { |
| | | |
| | | @Resource |
| | | private TRoleSiteService roleSiteService; |
| | | |
| | | /** |
| | | * 查询角色站点数据 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getSiteIds") |
| | | public R<List<Integer>> getSiteIds(Long roleId){ |
| | | List<TRoleSite> list = roleSiteService.list(new LambdaQueryWrapper<TRoleSite>().eq(TRoleSite::getRoleId, roleId)); |
| | | List<Integer> collect = list.stream().map(TRoleSite::getSiteId).collect(Collectors.toList()); |
| | | return R.ok(collect); |
| | | } |
| | | |
| | | /** |
| | | * 添加角色站点数据 |
| | | * @param roleSites |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/getSiteIds") |
| | | public R addRoleSite(@RequestBody List<TRoleSite> roleSites){ |
| | | roleSiteService.saveBatch(roleSites); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除角色站点数据 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @DeleteMapping("/delRoleSite/{roleId}") |
| | | public R delRoleSite(@PathVariable("roleId") Long roleId){ |
| | | roleSiteService.remove(new LambdaQueryWrapper<TRoleSite>().eq(TRoleSite::getRoleId, roleId)); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.service.TSystemConfigurationService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"小程序-系统设置","后台-内容设置"},value = "联系客服,查询设置") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TSystemConfiguration> getDetailById(@RequestParam(name = "type",value = "1=客服信息,2=系统设置") Integer type) { |
| | | public AjaxResult<TSystemConfiguration> getDetailById(@RequestParam(name = "type")@ApiParam(value = "1=客服信息,2=系统设置") Integer type) { |
| | | return AjaxResult.ok(systemConfigurationService.getOne(Wrappers.lambdaQuery(TSystemConfiguration.class) |
| | | .eq(TSystemConfiguration::getType, type))); |
| | | } |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.service.TUserSiteService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-user-site") |
| | | public class TUserSiteController { |
| | | |
| | | @Resource |
| | | private TUserSiteService userSiteService; |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取可访问的站点数据 |
| | | * @param userId 用户id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getSiteIds") |
| | | public R<List<Integer>> getSiteIds(Long userId){ |
| | | List<TUserSite> list = userSiteService.list(new LambdaQueryWrapper<TUserSite>().eq(TUserSite::getUserId, userId)); |
| | | List<Integer> collect = list.stream().map(TUserSite::getSiteId).collect(Collectors.toList()); |
| | | return R.ok(collect); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加用户站点数据 |
| | | * @param userSite |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/addUserSite") |
| | | public R addUserSite(@RequestBody List<TUserSite> userSite){ |
| | | userSiteService.saveBatch(userSite); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户对应的站点数据 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @DeleteMapping("/delUserSite/{userId}") |
| | | public R delUserSite(@PathVariable Long userId){ |
| | | userSiteService.remove(new LambdaQueryWrapper<TUserSite>().eq(TUserSite::getUserId, userId)); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | return R.ok(idNameMap); |
| | | } |
| | | |
| | | /** |
| | | * 获取最高抵扣、最低起步价,最高折扣的会员 |
| | | * @param type 1=最高抵扣、2=最低起步价,3=最高折扣 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getVipInfoByType") |
| | | public R<TVip> getVipInfoByType(@RequestParam Integer type){ |
| | | switch (type){ |
| | | case 1: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByDesc(TVip::getMaximumDeduction) |
| | | .last("LIMIT 1"))); |
| | | case 2: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByAsc(TVip::getMonthlyCard) |
| | | .last("LIMIT 1"))); |
| | | default: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByDesc(TVip::getMonthlyCardDiscount) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TEvaluationTagMapper extends BaseMapper<TEvaluationTag> { |
| | | |
| | | /** |
| | | * 获取评价标签列表 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getTagList(); |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param pageInfo |
| | | * @param name |
| | | * @return |
| | | */ |
| | | List<TEvaluationTag> pageList(PageInfo<TEvaluationTag> pageInfo, @Param("name") String name); |
| | | } |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.query.InvoiceTypePageList; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TInvoiceTypeMapper extends BaseMapper<TInvoiceType> { |
| | | |
| | | |
| | | List<TInvoiceType> pageList(PageInfo<TInvoiceType> pageInfo, @Param("req") InvoiceTypePageList pageList); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.query; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/12 18:07 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class InvoiceTypePageList extends BasePage { |
| | | @ApiModelProperty(value = "类型名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "公司名称") |
| | | private String company; |
| | | @ApiModelProperty(value = "开票方式(1=人工,2=自动)") |
| | | private Integer method; |
| | | } |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TEvaluationTagService extends IService<TEvaluationTag> { |
| | | |
| | | /** |
| | | * 查询标签列表 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getTagList(); |
| | | |
| | | |
| | | /** |
| | | * 获取列表页数据 |
| | | * @param name |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | PageInfo<TEvaluationTag> pageList(String name, BasePage basePage); |
| | | } |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.query.InvoiceTypePageList; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TInvoiceTypeService extends IService<TInvoiceType> { |
| | | |
| | | /** |
| | | * 获取发票类型列表数据 |
| | | * @param pageList |
| | | * @return |
| | | */ |
| | | PageInfo<TInvoiceType> pageList(InvoiceTypePageList pageList); |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import com.ruoyi.other.mapper.TEvaluationTagMapper; |
| | | import com.ruoyi.other.service.TEvaluationTagService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TEvaluationTagServiceImpl extends ServiceImpl<TEvaluationTagMapper, TEvaluationTag> implements TEvaluationTagService { |
| | | |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagList() { |
| | | return this.baseMapper.getTagList(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param name |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageInfo<TEvaluationTag> pageList(String name, BasePage basePage) { |
| | | PageInfo<TEvaluationTag> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TEvaluationTag> list = this.baseMapper.pageList(pageInfo, name); |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.mapper.TInvoiceTypeMapper; |
| | | import com.ruoyi.other.query.InvoiceTypePageList; |
| | | import com.ruoyi.other.service.TInvoiceTypeService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TInvoiceTypeServiceImpl extends ServiceImpl<TInvoiceTypeMapper, TInvoiceType> implements TInvoiceTypeService { |
| | | |
| | | |
| | | /** |
| | | * 获取发票类型列表数据 |
| | | * @param pageList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageInfo<TInvoiceType> pageList(InvoiceTypePageList pageList) { |
| | | PageInfo<TInvoiceType> pageInfo = new PageInfo<>(pageList.getPageCurr(), pageList.getPageSize()); |
| | | List<TInvoiceType> list = this.baseMapper.pageList(pageInfo, pageList); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | name: ruoyi-other |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.other.api.domain.TEvaluationTag"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="type" property="type" /> |
| | | <result column="`name`" property="name" /> |
| | | <result column="`type`" property="type" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, type, create_time, del_flag |
| | | id, `name`, `type`, create_time, del_flag |
| | | </sql> |
| | | <select id="getTagList" 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()} ORDER BY `type` |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="pageList" resultMap="BaseResultMap"> |
| | | select * from t_evaluation_tag where del_flag = 0 |
| | | <if test="null != name and '' != name"> |
| | | and name like CONCAT('%', #{name}, '%') |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | id, name, invoicing_company, invoicing_method, electricity_tariff, service_tariff, added_service_tariff, del_flag, create_time |
| | | </sql> |
| | | |
| | | |
| | | <select id="pageList" resultMap="BaseResultMap"> |
| | | select * from t_invoice_type where del_flag = 0 |
| | | <if test="null != req.name and '' != req.name"> |
| | | and name like CONCAT('%', #{req.name}, '%') |
| | | </if> |
| | | <if test="null != req.company and '' != req.company"> |
| | | and invoicing_company like CONCAT('%', #{req.company}, '%') |
| | | </if> |
| | | <if test="null != req.method"> |
| | | and invoicing_method = #{req.method} |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | name: ruoyi-payment |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |