Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
95个文件已修改
5个文件已删除
27个文件已添加
| | |
| | | |
| | | 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; |
| | |
| | | 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()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | * 用户服务 |
| | | * @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 { |
| | | |
| | | /** |
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); |
| | | } |
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()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | * 充电桩服务 |
| | | * @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 { |
| | | |
| | | /** |
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); |
| | | } |
| | |
| | | @ApiModelProperty(value = "站点id") |
| | | @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") |
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; |
| | | |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.ChargingPileFallbackFactory |
| | | 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 { |
| | | |
| | | |
| | |
| | | * 充电订单服务 |
| | | * @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 { |
| | | |
| | | |
| | |
| | | * 后台订单服务 |
| | | * @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") |
| | |
| | | @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; |
| | |
| | | @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 = "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.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.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") |
| | |
| | | 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; |
| | |
| | | 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()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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") |
| | |
| | | |
| | | 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.CONTRACT_SERVICE, fallbackFactory = RoleSiteFallbackFactory.class) |
| | | @FeignClient(contextId = "RoleSiteClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = RoleSiteFallbackFactory.class) |
| | | public interface RoleSiteClient { |
| | | |
| | | |
| | |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-user-site/getSiteIds") |
| | | R<List<Integer>> getSiteIds(@RequestParam("roleId") Long roleId); |
| | | @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); |
| | | } |
| | |
| | | |
| | | 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.CONTRACT_SERVICE, fallbackFactory = UserSiteFallbackFactory.class) |
| | | @FeignClient(contextId = "UserSiteClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = UserSiteFallbackFactory.class) |
| | | public interface UserSiteClient { |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-user-site/getSiteIds") |
| | | R<List<Integer>> getSiteIds(@RequestParam("userId") Long userId); |
| | | 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; |
| | | |
| | | } |
| | |
| | | * 充电订单服务 |
| | | * @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> |
| | | |
| | | </project> |
| | |
| | | */ |
| | | @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; |
| | |
| | | |
| | | /** |
| | | * 操作日志记录表 oper_log |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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删除) */ |
| | | @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手机端用户) */ |
| | | @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") |
| | | private Integer operatorType; |
| | | |
| | | /** 操作人员 */ |
| | | @Excel(name = "操作人员") |
| | | private String operName; |
| | | |
| | | /** 部门名称 */ |
| | | @Excel(name = "部门名称") |
| | | private String deptName; |
| | | |
| | | /** 请求url */ |
| | | @Excel(name = "请求地址") |
| | | private String operUrl; |
| | | |
| | | /** 操作地址 */ |
| | | @Excel(name = "操作地址") |
| | | private String operIp; |
| | | |
| | | /** 请求参数 */ |
| | | @Excel(name = "请求参数") |
| | | private String operParam; |
| | | |
| | | /** 返回参数 */ |
| | | @Excel(name = "返回参数") |
| | | private String jsonResult; |
| | | |
| | | /** 操作状态(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() |
| | | { |
| | | return operId; |
| | | } |
| | | |
| | | public void setOperId(Long operId) |
| | | { |
| | | this.operId = operId; |
| | | } |
| | | |
| | | public String getTitle() |
| | | { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) |
| | | { |
| | | this.title = title; |
| | | } |
| | | |
| | | public Integer getBusinessType() |
| | | { |
| | | return businessType; |
| | | } |
| | | |
| | | public void setBusinessType(Integer businessType) |
| | | { |
| | | this.businessType = businessType; |
| | | } |
| | | |
| | | public Integer[] getBusinessTypes() |
| | | { |
| | | return businessTypes; |
| | | } |
| | | |
| | | public void setBusinessTypes(Integer[] businessTypes) |
| | | { |
| | | this.businessTypes = businessTypes; |
| | | } |
| | | |
| | | public String getMethod() |
| | | { |
| | | return method; |
| | | } |
| | | |
| | | public void setMethod(String method) |
| | | { |
| | | this.method = method; |
| | | } |
| | | |
| | | public String getRequestMethod() |
| | | { |
| | | return requestMethod; |
| | | } |
| | | |
| | | public void setRequestMethod(String requestMethod) |
| | | { |
| | | this.requestMethod = requestMethod; |
| | | } |
| | | |
| | | public Integer getOperatorType() |
| | | { |
| | | return operatorType; |
| | | } |
| | | |
| | | public void setOperatorType(Integer operatorType) |
| | | { |
| | | this.operatorType = operatorType; |
| | | } |
| | | |
| | | public String getOperName() |
| | | { |
| | | return operName; |
| | | } |
| | | |
| | | public void setOperName(String operName) |
| | | { |
| | | this.operName = operName; |
| | | } |
| | | |
| | | public String getDeptName() |
| | | { |
| | | return deptName; |
| | | } |
| | | |
| | | public void setDeptName(String deptName) |
| | | { |
| | | this.deptName = deptName; |
| | | } |
| | | |
| | | public String getOperUrl() |
| | | { |
| | | return operUrl; |
| | | } |
| | | |
| | | public void setOperUrl(String operUrl) |
| | | { |
| | | this.operUrl = operUrl; |
| | | } |
| | | |
| | | public String getOperIp() |
| | | { |
| | | return operIp; |
| | | } |
| | | |
| | | public void setOperIp(String operIp) |
| | | { |
| | | this.operIp = operIp; |
| | | } |
| | | |
| | | public String getOperParam() |
| | | { |
| | | return operParam; |
| | | } |
| | | |
| | | public void setOperParam(String operParam) |
| | | { |
| | | this.operParam = operParam; |
| | | } |
| | | |
| | | public String getJsonResult() |
| | | { |
| | | return jsonResult; |
| | | } |
| | | |
| | | public void setJsonResult(String jsonResult) |
| | | { |
| | | this.jsonResult = jsonResult; |
| | | } |
| | | |
| | | public Integer getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getErrorMsg() |
| | | { |
| | | return errorMsg; |
| | | } |
| | | |
| | | public void setErrorMsg(String errorMsg) |
| | | { |
| | | this.errorMsg = errorMsg; |
| | | } |
| | | |
| | | public Date getOperTime() |
| | | { |
| | | return operTime; |
| | | } |
| | | |
| | | public void setOperTime(Date operTime) |
| | | { |
| | | this.operTime = operTime; |
| | | } |
| | | |
| | | public Long getCostTime() |
| | | { |
| | | return costTime; |
| | | } |
| | | |
| | | public void setCostTime(Long costTime) |
| | | { |
| | | this.costTime = costTime; |
| | | } |
| | | 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删除) |
| | | */ |
| | | @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手机端用户) |
| | | */ |
| | | @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") |
| | | private Integer operatorType; |
| | | |
| | | /** |
| | | * 操作人员 |
| | | */ |
| | | @Excel(name = "操作人员") |
| | | private String operName; |
| | | |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | @Excel(name = "部门名称") |
| | | private String deptName; |
| | | |
| | | /** |
| | | * 请求url |
| | | */ |
| | | @Excel(name = "请求地址") |
| | | private String operUrl; |
| | | |
| | | /** |
| | | * 操作地址 |
| | | */ |
| | | @Excel(name = "操作地址") |
| | | private String operIp; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @Excel(name = "请求参数") |
| | | private String operParam; |
| | | |
| | | /** |
| | | * 返回参数 |
| | | */ |
| | | @Excel(name = "返回参数") |
| | | private String jsonResult; |
| | | |
| | | /** |
| | | * 操作状态(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() { |
| | | return operId; |
| | | } |
| | | |
| | | public void setOperId(Long operId) { |
| | | this.operId = operId; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public Integer getBusinessType() { |
| | | return businessType; |
| | | } |
| | | |
| | | public void setBusinessType(Integer businessType) { |
| | | this.businessType = businessType; |
| | | } |
| | | |
| | | public Integer[] getBusinessTypes() { |
| | | return businessTypes; |
| | | } |
| | | |
| | | public void setBusinessTypes(Integer[] businessTypes) { |
| | | this.businessTypes = businessTypes; |
| | | } |
| | | |
| | | public String getMethod() { |
| | | return method; |
| | | } |
| | | |
| | | public void setMethod(String method) { |
| | | this.method = method; |
| | | } |
| | | |
| | | public String getRequestMethod() { |
| | | return requestMethod; |
| | | } |
| | | |
| | | public void setRequestMethod(String requestMethod) { |
| | | this.requestMethod = requestMethod; |
| | | } |
| | | |
| | | public Integer getOperatorType() { |
| | | return operatorType; |
| | | } |
| | | |
| | | public void setOperatorType(Integer operatorType) { |
| | | this.operatorType = operatorType; |
| | | } |
| | | |
| | | public String getOperName() { |
| | | return operName; |
| | | } |
| | | |
| | | public void setOperName(String operName) { |
| | | this.operName = operName; |
| | | } |
| | | |
| | | public String getDeptName() { |
| | | return deptName; |
| | | } |
| | | |
| | | public void setDeptName(String deptName) { |
| | | this.deptName = deptName; |
| | | } |
| | | |
| | | public String getOperUrl() { |
| | | return operUrl; |
| | | } |
| | | |
| | | public void setOperUrl(String operUrl) { |
| | | this.operUrl = operUrl; |
| | | } |
| | | |
| | | public String getOperIp() { |
| | | return operIp; |
| | | } |
| | | |
| | | public void setOperIp(String operIp) { |
| | | this.operIp = operIp; |
| | | } |
| | | |
| | | public String getOperParam() { |
| | | return operParam; |
| | | } |
| | | |
| | | public void setOperParam(String operParam) { |
| | | this.operParam = operParam; |
| | | } |
| | | |
| | | public String getJsonResult() { |
| | | return jsonResult; |
| | | } |
| | | |
| | | public void setJsonResult(String jsonResult) { |
| | | this.jsonResult = jsonResult; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getErrorMsg() { |
| | | return errorMsg; |
| | | } |
| | | |
| | | public void setErrorMsg(String errorMsg) { |
| | | this.errorMsg = errorMsg; |
| | | } |
| | | |
| | | public Date getOperTime() { |
| | | return operTime; |
| | | } |
| | | |
| | | public void setOperTime(Date operTime) { |
| | | this.operTime = operTime; |
| | | } |
| | | |
| | | public Long getCostTime() { |
| | | return 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) |
| | |
| | | /** |
| | | * 角色类型 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.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()); |
| | | } |
| | | }; |
| | | } |
| | | } |
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); |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 记录登录信息 |
| | | * |
| | | * @param username 用户名 |
| | | * @param status 状态 |
| | | * @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); |
| | | } |
| | | else if (Constants.LOGIN_FAIL.equals(status)) |
| | | { |
| | | logininfor.setStatus(Constants.LOGIN_FAIL_STATUS); |
| | | } |
| | | remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER); |
| | | } |
| | | public class SysRecordLogService { |
| | | @Resource |
| | | private SysLoginLogClient sysLoginLogClient; |
| | | |
| | | /** |
| | | * 记录登录信息 |
| | | * |
| | | * @param username 用户名 |
| | | * @param status 状态 |
| | | * @param message 消息内容 |
| | | * @return |
| | | */ |
| | | 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); |
| | | } |
| | | |
| | | |
| | | 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; |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | * 文件服务的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"; |
| | | } |
| | |
| | | |
| | | /** |
| | | * Entity基类 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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已删除 */ |
| | | @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; |
| | | |
| | | public Boolean getDisabled() { |
| | | return disabled; |
| | | } |
| | | |
| | | public void setDisabled(Boolean disabled) { |
| | | this.disabled = disabled; |
| | | } |
| | | |
| | | public String getSearchValue() |
| | | { |
| | | return searchValue; |
| | | } |
| | | |
| | | public void setSearchValue(String searchValue) |
| | | { |
| | | this.searchValue = searchValue; |
| | | } |
| | | |
| | | public String getCreateBy() |
| | | { |
| | | return createBy; |
| | | } |
| | | |
| | | public void setCreateBy(String createBy) |
| | | { |
| | | this.createBy = createBy; |
| | | } |
| | | |
| | | public Date getCreateTime() |
| | | { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) |
| | | { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getUpdateBy() |
| | | { |
| | | return updateBy; |
| | | } |
| | | |
| | | public void setUpdateBy(String updateBy) |
| | | { |
| | | this.updateBy = updateBy; |
| | | } |
| | | |
| | | public Date getUpdateTime() |
| | | { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) |
| | | { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getRemark() |
| | | { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) |
| | | { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Map<String, Object> getParams() |
| | | { |
| | | if (params == null) |
| | | { |
| | | params = new HashMap<>(); |
| | | } |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(Map<String, Object> params) |
| | | { |
| | | this.params = params; |
| | | } |
| | | 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已删除 |
| | | */ |
| | | @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; |
| | | |
| | | public Boolean getDisabled() { |
| | | return disabled; |
| | | } |
| | | |
| | | public void setDisabled(Boolean disabled) { |
| | | this.disabled = disabled; |
| | | } |
| | | |
| | | public String getSearchValue() { |
| | | return searchValue; |
| | | } |
| | | |
| | | public void setSearchValue(String searchValue) { |
| | | this.searchValue = searchValue; |
| | | } |
| | | |
| | | public String getCreateBy() { |
| | | return createBy; |
| | | } |
| | | |
| | | public void setCreateBy(String createBy) { |
| | | this.createBy = createBy; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getUpdateBy() { |
| | | return updateBy; |
| | | } |
| | | |
| | | public void setUpdateBy(String updateBy) { |
| | | this.updateBy = updateBy; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Map<String, Object> getParams() { |
| | | if (params == null) { |
| | | params = new HashMap<>(); |
| | | } |
| | | return 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); |
| | | } |
| | | } |
| | |
| | | </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; |
| | |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/operlog") |
| | | 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) |
| | | { |
| | | 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(); |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:operlog:export") |
| | | @PostMapping("/export") |
| | | 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) |
| | | { |
| | | return toAjax(operLogService.deleteOperLogByIds(operIds)); |
| | | } |
| | | |
| | | @RequiresPermissions("system:operlog:remove") |
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() |
| | | { |
| | | operLogService.cleanOperLog(); |
| | | return success(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysOperLog operLog) |
| | | { |
| | | return toAjax(operLogService.insertOperlog(operLog)); |
| | | } |
| | | public class SysOperlogController extends BaseController { |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | |
| | | |
| | | @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<>(); |
| | | if(StringUtils.isNotEmpty(query.getOperName())){ |
| | | wrapper.like(SysOperLog::getOperName, query.getOperName()); |
| | | } |
| | | if(StringUtils.isNotEmpty(query.getTitle())){ |
| | | wrapper.like(SysOperLog::getTitle, query.getTitle()); |
| | | } |
| | | 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) { |
| | | 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) { |
| | | return toAjax(operLogService.deleteOperLogByIds(operIds)); |
| | | } |
| | | |
| | | @RequiresPermissions("system:operlog:remove") |
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public AjaxResult clean() { |
| | | operLogService.cleanOperLog(); |
| | | return success(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping |
| | | 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); |
| | | |
| | | PageInfo<SysRole> page = roleService.page(pageInfo, new LambdaQueryWrapper<SysRole>().eq(SysRole::getCompanyId, companyId).ne(SysRole::getRoleId,20)); |
| | | @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, 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("当前用户不能删除"); |
| | |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | | } |
| | | |
| | | |
| | | @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") |
| | |
| | | } |
| | | |
| | | |
| | | @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()); |
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 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> |
| | | { |
| | | /** |
| | | * 新增操作日志 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 结果 |
| | | */ |
| | | public int insertOperlog(SysOperLog operLog); |
| | | |
| | | /** |
| | | * 查询系统操作日志集合 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 操作日志集合 |
| | | */ |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog); |
| | | |
| | | /** |
| | | * 批量删除系统操作日志 |
| | | * |
| | | * @param operIds 需要删除的操作日志ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteOperLogByIds(Long[] operIds); |
| | | |
| | | /** |
| | | * 查询操作日志详细 |
| | | * |
| | | * @param operId 操作ID |
| | | * @return 操作日志对象 |
| | | */ |
| | | public SysOperLog selectOperLogById(Long operId); |
| | | |
| | | /** |
| | | * 清空操作日志 |
| | | */ |
| | | public void cleanOperLog(); |
| | | public interface ISysOperLogService extends IService<SysOperLog> { |
| | | /** |
| | | * 新增操作日志 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 结果 |
| | | */ |
| | | public int insertOperlog(SysOperLog operLog); |
| | | |
| | | /** |
| | | * 查询系统操作日志集合 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 操作日志集合 |
| | | */ |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog); |
| | | |
| | | /** |
| | | * 批量删除系统操作日志 |
| | | * |
| | | * @param operIds 需要删除的操作日志ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteOperLogByIds(Long[] operIds); |
| | | |
| | | /** |
| | | * 查询操作日志详细 |
| | | * |
| | | * @param operId 操作ID |
| | | * @return 操作日志对象 |
| | | */ |
| | | public SysOperLog selectOperLogById(Long operId); |
| | | |
| | | /** |
| | | * 清空操作日志 |
| | | */ |
| | | public void cleanOperLog(); |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 用户 业务层 |
| | |
| | | */ |
| | | 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 |
| | | { |
| | | @Autowired |
| | | private SysOperLogMapper operLogMapper; |
| | | |
| | | /** |
| | | * 新增操作日志 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertOperlog(SysOperLog operLog) |
| | | { |
| | | return operLogMapper.insertOperlog(operLog); |
| | | } |
| | | |
| | | /** |
| | | * 查询系统操作日志集合 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 操作日志集合 |
| | | */ |
| | | @Override |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog) |
| | | { |
| | | return operLogMapper.selectOperLogList(operLog); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除系统操作日志 |
| | | * |
| | | * @param operIds 需要删除的操作日志ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteOperLogByIds(Long[] operIds) |
| | | { |
| | | return operLogMapper.deleteOperLogByIds(operIds); |
| | | } |
| | | |
| | | /** |
| | | * 查询操作日志详细 |
| | | * |
| | | * @param operId 操作ID |
| | | * @return 操作日志对象 |
| | | */ |
| | | @Override |
| | | public SysOperLog selectOperLogById(Long operId) |
| | | { |
| | | return operLogMapper.selectOperLogById(operId); |
| | | } |
| | | |
| | | /** |
| | | * 清空操作日志 |
| | | */ |
| | | @Override |
| | | public void cleanOperLog() |
| | | { |
| | | operLogMapper.cleanOperLog(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveBatch(Collection<SysOperLog> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveOrUpdateBatch(Collection<SysOperLog> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateBatchById(Collection<SysOperLog> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveOrUpdate(SysOperLog entity) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public SysOperLog getOne(Wrapper<SysOperLog> queryWrapper, boolean throwEx) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getMap(Wrapper<SysOperLog> queryWrapper) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public <V> V getObj(Wrapper<SysOperLog> queryWrapper, Function<? super Object, V> mapper) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public BaseMapper<SysOperLog> getBaseMapper() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Class<SysOperLog> getEntityClass() { |
| | | return null; |
| | | } |
| | | public class SysOperLogServiceImpl implements ISysOperLogService { |
| | | @Autowired |
| | | private SysOperLogMapper operLogMapper; |
| | | |
| | | /** |
| | | * 新增操作日志 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertOperlog(SysOperLog operLog) { |
| | | return operLogMapper.insertOperlog(operLog); |
| | | } |
| | | |
| | | /** |
| | | * 查询系统操作日志集合 |
| | | * |
| | | * @param operLog 操作日志对象 |
| | | * @return 操作日志集合 |
| | | */ |
| | | @Override |
| | | public List<SysOperLog> selectOperLogList(SysOperLog operLog) { |
| | | return operLogMapper.selectOperLogList(operLog); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除系统操作日志 |
| | | * |
| | | * @param operIds 需要删除的操作日志ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteOperLogByIds(Long[] operIds) { |
| | | return operLogMapper.deleteOperLogByIds(operIds); |
| | | } |
| | | |
| | | /** |
| | | * 查询操作日志详细 |
| | | * |
| | | * @param operId 操作ID |
| | | * @return 操作日志对象 |
| | | */ |
| | | @Override |
| | | public SysOperLog selectOperLogById(Long operId) { |
| | | return operLogMapper.selectOperLogById(operId); |
| | | } |
| | | |
| | | /** |
| | | * 清空操作日志 |
| | | */ |
| | | @Override |
| | | public void cleanOperLog() { |
| | | operLogMapper.cleanOperLog(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveBatch(Collection<SysOperLog> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveOrUpdateBatch(Collection<SysOperLog> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateBatchById(Collection<SysOperLog> entityList, int batchSize) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveOrUpdate(SysOperLog entity) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public SysOperLog getOne(Wrapper<SysOperLog> queryWrapper, boolean throwEx) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getMap(Wrapper<SysOperLog> queryWrapper) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public <V> V getObj(Wrapper<SysOperLog> queryWrapper, Function<? super Object, V> mapper) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public BaseMapper<SysOperLog> getBaseMapper() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Class<SysOperLog> getEntityClass() { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @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; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | |
| | | } |
| | | |
| | | @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> |
| | |
| | | </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> |
| | | and del_flag = '0' and roleType =1 |
| | | <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 |
| | | </select> |
| | | <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | |
| | | 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))); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | 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.*; |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | @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 |
| | | @GetMapping("/getPermissionConfiguration/{siteId}") |
| | | @ApiOperation(value = "获取合作商权限设置", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult<GetPermissionConfigurationDTO> getPermissionConfiguration(@PathVariable("siteId") Integer siteId, @RequestParam("partnerId") Integer partnerId){ |
| | | public AjaxResult<GetPermissionConfigurationDTO> getPermissionConfiguration(@PathVariable("siteId") Integer siteId, Integer partnerId){ |
| | | GetPermissionConfigurationDTO permissionConfiguration = partnerService.getPermissionConfiguration(siteId, partnerId); |
| | | return AjaxResult.success(permissionConfiguration); |
| | | } |
| | |
| | | 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.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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | @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); |
| | | } |
| | |
| | | // 计算距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // TODO 查询绑定车牌提示文案 |
| | | // 查询绑定车牌提示文案 |
| | | TParkingLot parkingLot = parkingLotClient.getLotBySiteId(query.getSiteId()).getData(); |
| | | if(Objects.nonNull(parkingLot)){ |
| | | siteDetailVO.setRemark(parkingLot.getRemark()); |
| | | } |
| | | return AjaxResult.success(siteDetailVO); |
| | | } |
| | | |
| | |
| | | @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)); |
| | | return AjaxResult.success(chargingPileService.getChargingGunList(siteId,type)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情"}) |
| | |
| | | @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(){ |
| | | //校验当前账户站点权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | |
| | | 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.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)); |
| | | } |
| | | |
| | | } |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | 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> |
| | |
| | | @RestController |
| | | @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.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; |
| | |
| | | .in(TCarport::getParkingLotId, 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.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> |
| | |
| | | * @since 2024-08-08 |
| | | */ |
| | | public interface TChargingPileNotificationMapper extends BaseMapper<TChargingPileNotification> { |
| | | |
| | | |
| | | /** |
| | | * 获取系统通知列表数据 |
| | | * @param pageInfo |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | List<TChargingPileNotification> chargingPileNotificationPageList(PageInfo<TChargingPileNotification> pageInfo, @Param("siteIds") Set<Integer> siteIds); |
| | | |
| | | } |
| | |
| | | * 删除合作商 |
| | | * @param id |
| | | */ |
| | | AjaxResult delPartner(Integer id); |
| | | AjaxResult delPartner(Integer[] id); |
| | | |
| | | /** |
| | | * 重置密码 |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | AjaxResult delSite(Integer id); |
| | | AjaxResult delSite(Integer[] id); |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | 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.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> |
| | |
| | | * @since 2024-08-08 |
| | | */ |
| | | public interface TChargingPileNotificationService extends IService<TChargingPileNotification> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取系统通知列表数据 |
| | | * @param siteId |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | PageInfo<TChargingPileNotification> chargingPileNotificationPageList(Integer siteId, BasePage basePage); |
| | | } |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | AjaxResult delChargingPile(Integer id); |
| | | AjaxResult delChargingPile(Integer[] id); |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 获取站点下充电桩及充电枪列表 |
| | | * @param siteId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<TChargingPileVO> getChargingGunList(Integer siteId); |
| | | List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type); |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 删除合作商 |
| | | * @param id 合作商id |
| | | * @param ids 合作商id |
| | | */ |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult delPartner(Integer id) { |
| | | 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("当前合作商有关联站点,删除失败!"); |
| | | } |
| | | //充电桩 |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getPartnerId, id).eq(TChargingPile::getDelFlag, 0)); |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getPartnerId, Arrays.asList(ids)).eq(TChargingPile::getDelFlag, 0)); |
| | | if(count1 > 0){ |
| | | return AjaxResult.error("当前合作商有关联充电桩,删除失败!"); |
| | | } |
| | | |
| | | Partner partner = this.getById(id); |
| | | if(null == partner){ |
| | | 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.queryUserByUserName(partner.getAccount()).getData(); |
| | | user.setDelFlag("2"); |
| | | sysUserClient.updateUser(user); |
| | | } |
| | | partner.setDelFlag(true); |
| | | this.updateById(partner); |
| | | SysUser user = sysUserClient.queryUserByUserName(partner.getAccount()).getData(); |
| | | user.setDelFlag("2"); |
| | | sysUserClient.updateUser(user); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | |
| | | /** |
| | | * 删除站点 |
| | | * @param id 站点id |
| | | * @param ids 站点id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult delSite(Integer id) { |
| | | public AjaxResult delSite(Integer[] ids) { |
| | | //查询是否有关联数据 |
| | | //充电桩 |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getSiteId, id).eq(TChargingPile::getDelFlag, 0)); |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getSiteId, Arrays.asList(ids)).eq(TChargingPile::getDelFlag, 0)); |
| | | if(count1 > 0){ |
| | | return AjaxResult.error("该站点有关联充电桩,删除失败!"); |
| | | } |
| | | Site site = this.getById(id); |
| | | site.setDelFlag(true); |
| | | this.updateById(site); |
| | | for (Integer id : ids) { |
| | | Site site = this.getById(id); |
| | | site.setDelFlag(true); |
| | | this.updateById(site); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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("接口编码已存在"); |
| | | } |
| | |
| | | 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("接口编码已存在"); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | /** |
| | | * 删除充电桩 |
| | | * @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("该充电桩有关联的接口数据,删除失败!"); |
| | | } |
| | | TChargingPile chargingPile = this.getById(id); |
| | | chargingPile.setDelFlag(true); |
| | | this.updateById(chargingPile); |
| | | for (Integer id : ids) { |
| | | TChargingPile chargingPile = this.getById(id); |
| | | chargingPile.setDelFlag(true); |
| | | this.updateById(chargingPile); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TChargingPileVO> getChargingGunList(Integer siteId) { |
| | | 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::getSiteId, siteId) |
| | | .eq(TChargingGun::getChargeMode, type)); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | List<TChargingGun> gunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()); |
| | | item.setChargingGunList(gunList); |
| | | item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); |
| | | }); |
| | | return chargingPileVOS; |
| | | } |
| | |
| | | <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> |
| | |
| | | #{itemm} |
| | | </foreach> |
| | | </if> |
| | | order by a.sort desc, a.create_time desc limit #{item.pageCurr}, #{item.pageSize} |
| | | order by a.sort desc, a.create_time desc |
| | | </select> |
| | | |
| | | <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.SiteVO"> |
| | |
| | | #{itemm} |
| | | </foreach> |
| | | </if> |
| | | order by a.create_time desc limit #{item.pageCurr}, #{item.pageSize} |
| | | order by a.create_time desc |
| | | </select> |
| | | |
| | | |
| | |
| | | <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> |
| | |
| | | </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> |
| | |
| | | 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; |
| | | } |
| | |
| | | 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.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.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); |
| | | } |
| | | } |
| | |
| | | <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> |
| | |
| | | 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> |
| | |
| | | @RestController |
| | | @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(); |
| | | } |
| | | } |
| | | |
| | |
| | | @Resource |
| | | private TRoleSiteService roleSiteService; |
| | | |
| | | |
| | | /** |
| | | * 查询角色站点数据 |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getSiteIds") |
| | | public R<List<Integer>> getSiteIds(@RequestParam("roleId") Long roleId){ |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getSiteIds") |
| | | public R<List<Integer>> getSiteIds(@RequestParam("userId") Long userId){ |
| | | 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> |
| | |
| | | * @since 2024-08-06 |
| | | */ |
| | | 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> |
| | |
| | | * @since 2024-08-06 |
| | | */ |
| | | 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; |
| | | } |
| | | } |
| | |
| | | <!-- 通用查询映射结果 --> |
| | | <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> |