Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppCouponFallbackFactory.java
# ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/VipFallbackFactory.java
# ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/VipClient.java
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
22 文件已重命名
5个文件已添加
87个文件已修改
| | |
| | | public R<PageInfo<ExchangeRecordVO>> getExchangeRecordByCouponId(ExchangeRecordGoodsQuery couponId) { |
| | | return R.fail("根据优惠券id查询领取记录:"+throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R grantCoupon(GrantCouponDto dto) { |
| | | return null; |
| | | return R.fail("给用户发放优惠券:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | private BigDecimal payMoney; |
| | | @ApiModelProperty(value = "最高折扣金额 用于判断哪一张优惠券优惠力度最大 前端忽略") |
| | | private BigDecimal money; |
| | | @ApiModelProperty(value = "当前用户是否为会员0否1是 前端忽略") |
| | | private Integer isVip; |
| | | } |
| | |
| | | com.ruoyi.account.api.factory.AppUserFallbackFactory |
| | | com.ruoyi.account.api.factory.AppCouponFallbackFactory |
| | | com.ruoyi.account.api.factory.AppCouponFallbackFactory |
| | | com.ruoyi.account.api.factory.AppUserCarFallbackFactory |
| | |
| | | @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId") |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "额定功率", required = true) |
| | | @TableField("rated_power") |
| | | private BigDecimal ratedPower; |
| | | |
| | | @ApiModelProperty(value = "实时充电功率", required = true) |
| | | @TableField("charging_power") |
| | | private BigDecimal chargingPower; |
| | | |
| | | @ApiModelProperty(value = "车位号") |
| | | @TableField("parking_number") |
| | |
| | | @ApiModelProperty(value = "设备状态(1=工作中,2=离线,3=故障)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "停车场名称") |
| | | private String parkingLotName; |
| | | |
| | | @ApiModelProperty(value = "查看权限") |
| | | private boolean authQueryInfo = true; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "归属电站") |
| | | private String siteName; |
| | | |
| | | @ApiModelProperty(value = "编辑权限") |
| | | private boolean authUpdate = true; |
| | | |
| | | @ApiModelProperty(value = "删除权限") |
| | | private boolean authDelete = true; |
| | | |
| | | @ApiModelProperty(value = "查看权限") |
| | | private boolean authQueryInfo = true; |
| | | |
| | | @ApiModelProperty(value = "添加权限") |
| | | private boolean authAddParkingLot = true; |
| | | |
| | | @ApiModelProperty(value = "车场监控权限") |
| | | private boolean authMonitor = true; |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.ChargingPileFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.SiteFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.SiteFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingLotFallbackFactory |
New file |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class ChargingOrderAccountingStrategyFallbackFactory implements FallbackFactory<ChargingOrderAccountingStrategyClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ChargingOrderAccountingStrategyFallbackFactory.class); |
| | | |
| | | @Override |
| | | public ChargingOrderAccountingStrategyClient create(Throwable throwable) { |
| | | log.error("充电订单调用失败:{}", throwable.getMessage()); |
| | | return new ChargingOrderAccountingStrategyClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days) { |
| | | return R.fail("获取给定天数每天的充电量统计数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public R<TChargingOrder> orderDetail(Long orderId) { |
| | | return R.fail("订单详情:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Integer> getChargingCount(TChargingCountQuery req) { |
| | | return R.fail("根据会员id和有效期查询有效期内享受充电折扣次数:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.factory.ChargingOrderAccountingStrategyFallbackFactory; |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/14 19:09 |
| | | */ |
| | | @FeignClient(contextId = "ChargingOrderAccountingStrategyClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ChargingOrderAccountingStrategyFallbackFactory.class) |
| | | public interface ChargingOrderAccountingStrategyClient { |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电量统计数据 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-charging-order-accounting-strategy/getTotalElectricQuantity") |
| | | R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days); |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | 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; |
| | | |
| | | /** |
| | |
| | | @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); |
| | | R<Long> useOrderCount(@RequestParam("userId") Long userId); |
| | | |
| | | @PostMapping(value = "/t-charging-order/detail") |
| | | R<TChargingOrder> orderDetail(@RequestParam Long orderId); |
| | | R<TChargingOrder> orderDetail(@RequestParam("orderId") Long orderId); |
| | | |
| | | |
| | | /** |
| | | * 查询会员在本月有多少次享受了充电折扣 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-charging-order/getChargingCount") |
| | | public R<Integer> getChargingCount(@RequestBody TChargingCountQuery req); |
| | | } |
| | |
| | | |
| | | |
| | | @PostMapping(value = "/t-exchange-order/detail") |
| | | R<TExchangeOrder> orderDetail(@RequestParam Long orderId); |
| | | R<TExchangeOrder> orderDetail(@RequestParam("orderId") Long orderId); |
| | | |
| | | } |
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.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "查询用户在会员期 有多少次享用了充电折扣订单") |
| | | public class TChargingCountQuery { |
| | | @ApiModelProperty(value = "会员开始时间") |
| | | private LocalDateTime startTime; |
| | | @ApiModelProperty(value = "会员结束时间") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | } |
| | |
| | | com.ruoyi.order.api.factory.ChargingOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.OrderFallbackFactory |
| | | com.ruoyi.order.api.factory.OrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ExchangeOrderFallbackFactory |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/8 11:55 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_region") |
| | | @ApiModel(value="Region对象", description="") |
| | | public class Region { |
| | | /** |
| | | * 主键 |
| | |
| | | |
| | | @ApiModelProperty(value = "公告内容") |
| | | @TableField("notice_content") |
| | | private Blob noticeContent; |
| | | private String noticeContent; |
| | | |
| | | @ApiModelProperty(value = "公告状态(0正常 1关闭)") |
| | | @TableField("status") |
| | |
| | | @ApiModelProperty(value = "商城专享价开关(0=否,1=是)") |
| | | @TableField("mall_exclusive_price") |
| | | private Integer mallExclusivePrice; |
| | | @ApiModelProperty(value = "内部会员折扣") |
| | | @TableField("discount") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "会员类型 1常规 2内部") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | |
| | | |
| | |
| | | return R.fail("获取最高抵扣、最低起步价,最高折扣的会员失败:" + throwable.getMessage()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public R<TVip> getInfo(Integer type) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<TVip> getInfo1(Integer id) { |
| | | return R.fail("根据会员id 获取会员信息:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | R unitAddorUpadate(@RequestBody TCompany tCompany); |
| | | //单位删除 |
| | | @PostMapping(value = "/t-company/unit/delete") |
| | | R unitDelete(@RequestParam Integer id); |
| | | R unitDelete(@RequestParam("id") Integer id); |
| | | |
| | | @PostMapping(value = "/t-company/unit/detail") |
| | | R<TCompany> unitDetail(@RequestParam Integer id); |
| | | R<TCompany> unitDetail(@RequestParam("id") Integer id); |
| | | |
| | | //标签分页 |
| | | @PostMapping(value = "/t-user-tag/page") |
| | |
| | | R addorUpdateTag(@RequestBody TUserTag tUserTag); |
| | | //删除用户标签 |
| | | @PostMapping(value = "/t-user-tag/delete") |
| | | R deleteTag(@RequestParam Integer id); |
| | | R deleteTag(@RequestParam("id") Integer id); |
| | | |
| | | //获取标签Map |
| | | @PostMapping(value = "/t-user-tag/getTagMap") |
| | | R<Map<Integer, String>> getTagMap(@RequestBody List<Integer> ids); |
| | | //获取标签 |
| | | @PostMapping(value = "/t-user-tag/getById") |
| | | R<TUserTag> getByIdTag(@RequestParam Integer id); |
| | | R<TUserTag> getByIdTag(@RequestParam("id") Integer id); |
| | | |
| | | @PostMapping(value = "/vip/getVipMap") |
| | | R<Map<Integer, String>> getVipMap(@RequestBody List<Integer> ids); |
| | |
| | | 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.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/vip/getVipInfoByType") |
| | | R<TVip> getVipInfoByType(@RequestParam Integer type); |
| | | R<TVip> getVipInfoByType(@RequestParam("type") Integer type); |
| | | |
| | | /** |
| | | * 远程调用 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/vip/getInfo1") |
| | | public R<TVip> getInfo1(@RequestParam("id") Integer id); |
| | | @PostMapping(value = "/vip/getInfo") |
| | | R<TVip> getInfo(@RequestParam Integer id); |
| | | R<TVip> getInfo(@RequestParam("id") Integer id); |
| | | |
| | | |
| | | } |
| | |
| | | com.ruoyi.other.api.factory.OtherFallbackFactory |
| | | com.ruoyi.other.api.factory.UserSiteFallbackFactory |
| | | com.ruoyi.other.api.factory.RoleSiteFallbackFactory |
| | | com.ruoyi.other.api.factory.RoleSiteFallbackFactory |
| | | com.ruoyi.other.api.factory.TEvaluationTagFallbackFactory |
| | | com.ruoyi.other.api.factory.VipFallbackFactory |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-modules-system</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
File was renamed from ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLoginLog.java |
| | |
| | | package com.ruoyi.system.domain; |
| | | package com.ruoyi.system.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | 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.domain.SysLoginLog; |
| | | 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 com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | 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; |
| | |
| | | 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.*; |
| | | |
| | | /** |
| | |
| | | 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.model.LoginUser; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 登录校验方法 |
| | |
| | | package com.ruoyi.auth.service; |
| | | |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.feignClient.SysLoginLogClient; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.system.domain.SysConfig; |
| | |
| | | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 获取参数配置列表 |
| | | */ |
| | | @RequiresPermissions("system:config:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:config:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) |
| | | { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "参数数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) |
| | | { |
| | | return success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:add") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:edit") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) |
| | | { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | public class SysConfigController extends BaseController { |
| | | @Resource |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 获取参数配置列表 |
| | | */ |
| | | @RequiresPermissions("system:config:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:config:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "参数数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) { |
| | | return success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:add") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) { |
| | | if (!configService.checkConfigKeyUnique(config)) { |
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:edit") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) { |
| | | if (!configService.checkConfigKeyUnique(config)) { |
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | } |
| | |
| | | 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.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.service.ISysLoginLogService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Resource |
| | | private ISysLoginLogService sysLoginLogService; |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * 参数配置表 sys_config |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysConfig extends BaseModel |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 参数主键 */ |
| | | @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) |
| | | private Long configId; |
| | | |
| | | /** 参数名称 */ |
| | | @Excel(name = "参数名称") |
| | | private String configName; |
| | | |
| | | /** 参数键名 */ |
| | | @Excel(name = "参数键名") |
| | | private String configKey; |
| | | |
| | | /** 参数键值 */ |
| | | @Excel(name = "参数键值") |
| | | private String configValue; |
| | | |
| | | /** 系统内置(Y是 N否) */ |
| | | @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") |
| | | private String configType; |
| | | |
| | | public Long getConfigId() |
| | | { |
| | | return configId; |
| | | } |
| | | |
| | | public void setConfigId(Long configId) |
| | | { |
| | | this.configId = configId; |
| | | } |
| | | |
| | | @NotBlank(message = "参数名称不能为空") |
| | | @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") |
| | | public String getConfigName() |
| | | { |
| | | return configName; |
| | | } |
| | | |
| | | public void setConfigName(String configName) |
| | | { |
| | | this.configName = configName; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键名长度不能为空") |
| | | @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") |
| | | public String getConfigKey() |
| | | { |
| | | return configKey; |
| | | } |
| | | |
| | | public void setConfigKey(String configKey) |
| | | { |
| | | this.configKey = configKey; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键值不能为空") |
| | | @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") |
| | | public String getConfigValue() |
| | | { |
| | | return configValue; |
| | | } |
| | | |
| | | public void setConfigValue(String configValue) |
| | | { |
| | | this.configValue = configValue; |
| | | } |
| | | |
| | | public String getConfigType() |
| | | { |
| | | return configType; |
| | | } |
| | | |
| | | public void setConfigType(String configType) |
| | | { |
| | | this.configType = configType; |
| | | } |
| | | |
| | | |
| | | @ApiModelProperty(value = "备注说明") |
| | | @Excel(name = "备注说明") |
| | | private String remark; |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("configId", getConfigId()) |
| | | .append("configName", getConfigName()) |
| | | .append("configKey", getConfigKey()) |
| | | .append("configValue", getConfigValue()) |
| | | .append("configType", getConfigType()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | public class SysConfig extends BaseModel { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 参数主键 |
| | | */ |
| | | @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) |
| | | private Long configId; |
| | | |
| | | /** |
| | | * 参数名称 |
| | | */ |
| | | @Excel(name = "参数名称") |
| | | private String configName; |
| | | |
| | | /** |
| | | * 参数键名 |
| | | */ |
| | | @Excel(name = "参数键名") |
| | | private String configKey; |
| | | |
| | | /** |
| | | * 参数键值 |
| | | */ |
| | | @Excel(name = "参数键值") |
| | | private String configValue; |
| | | |
| | | /** |
| | | * 系统内置(Y是 N否) |
| | | */ |
| | | @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") |
| | | private String configType; |
| | | |
| | | public Long getConfigId() { |
| | | return configId; |
| | | } |
| | | |
| | | public void setConfigId(Long configId) { |
| | | this.configId = configId; |
| | | } |
| | | |
| | | @NotBlank(message = "参数名称不能为空") |
| | | @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") |
| | | public String getConfigName() { |
| | | return configName; |
| | | } |
| | | |
| | | public void setConfigName(String configName) { |
| | | this.configName = configName; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键名长度不能为空") |
| | | @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") |
| | | public String getConfigKey() { |
| | | return configKey; |
| | | } |
| | | |
| | | public void setConfigKey(String configKey) { |
| | | this.configKey = configKey; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键值不能为空") |
| | | @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") |
| | | public String getConfigValue() { |
| | | return configValue; |
| | | } |
| | | |
| | | public void setConfigValue(String configValue) { |
| | | this.configValue = configValue; |
| | | } |
| | | |
| | | public String getConfigType() { |
| | | return configType; |
| | | } |
| | | |
| | | public void setConfigType(String configType) { |
| | | this.configType = configType; |
| | | } |
| | | |
| | | |
| | | @ApiModelProperty(value = "备注说明") |
| | | @Excel(name = "备注说明") |
| | | private String remark; |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("configId", getConfigId()) |
| | | .append("configName", getConfigName()) |
| | | .append("configKey", getConfigKey()) |
| | | .append("configValue", getConfigValue()) |
| | | .append("configType", getConfigType()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * 参数配置 数据层 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Mapper |
| | | public interface SysConfigMapper |
| | | { |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 通过ID查询配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfigById(Long configId); |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | public List<SysConfig> selectConfigList(SysConfig config); |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数键名 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig checkConfigKeyUnique(String configKey); |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigById(Long configId); |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigByIds(Long[] configIds); |
| | | public interface SysConfigMapper extends BaseMapper<SysConfig> { |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 通过ID查询配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfigById(Long configId); |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | public List<SysConfig> selectConfigList(SysConfig config); |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数键名 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig checkConfigKeyUnique(String configKey); |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigById(Long configId); |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigByIds(Long[] configIds); |
| | | } |
| | |
| | | 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 com.ruoyi.system.api.domain.SysLoginLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface SysNoticeMapper |
| | | { |
| | | public interface SysNoticeMapper { |
| | | /** |
| | | * 查询公告信息 |
| | | * |
| | |
| | | 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; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ISysNoticeService |
| | | { |
| | | public interface ISysNoticeService { |
| | | /** |
| | | * 查询公告信息 |
| | | * |
| | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.mapper.SysConfigMapper; |
| | |
| | | |
| | | /** |
| | | * 参数配置 服务层实现 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysConfigServiceImpl implements ISysConfigService |
| | | { |
| | | @Autowired |
| | | private SysConfigMapper configMapper; |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | /** |
| | | * 项目启动时,初始化参数到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() |
| | | { |
| | | // TODO |
| | | public class SysConfigServiceImpl implements ISysConfigService { |
| | | @Resource |
| | | private SysConfigMapper configMapper; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | /** |
| | | * 项目启动时,初始化参数到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | // TODO |
| | | // loadingConfigCache(); |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param configId 参数配置ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | @Override |
| | | public SysConfig selectConfigById(Long configId) |
| | | { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigId(configId); |
| | | return configMapper.selectConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数key |
| | | * @return 参数键值 |
| | | */ |
| | | @Override |
| | | public String selectConfigByKey(String configKey) |
| | | { |
| | | String configValue = Convert.toStr(redisService.getCacheObject(getCacheKey(configKey))); |
| | | if (StringUtils.isNotEmpty(configValue)) |
| | | { |
| | | return configValue; |
| | | } |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey(configKey); |
| | | SysConfig retConfig = configMapper.selectConfig(config); |
| | | if (StringUtils.isNotNull(retConfig)) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); |
| | | return retConfig.getConfigValue(); |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | @Override |
| | | public List<SysConfig> selectConfigList(SysConfig config) |
| | | { |
| | | return configMapper.selectConfigList(config); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertConfig(SysConfig config) |
| | | { |
| | | int row = configMapper.insertConfig(config); |
| | | if (row > 0) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) |
| | | { |
| | | SysConfig temp = configMapper.selectConfigById(config.getConfigId()); |
| | | if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) |
| | | { |
| | | redisService.deleteObject(getCacheKey(temp.getConfigKey())); |
| | | } |
| | | |
| | | int row = configMapper.updateConfig(config); |
| | | if (row > 0) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | */ |
| | | @Override |
| | | public void deleteConfigByIds(Long[] configIds) |
| | | { |
| | | for (Long configId : configIds) |
| | | { |
| | | SysConfig config = selectConfigById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) |
| | | { |
| | | throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | configMapper.deleteConfigById(configId); |
| | | redisService.deleteObject(getCacheKey(config.getConfigKey())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 加载参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingConfigCache(){ |
| | | List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 清空参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() |
| | | { |
| | | Collection<String> keys = redisService.keys(CacheConstants.SYS_CONFIG_KEY + "*"); |
| | | redisService.deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 重置参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetConfigCache() |
| | | { |
| | | clearConfigCache(); |
| | | loadingConfigCache(); |
| | | } |
| | | |
| | | /** |
| | | * 校验参数键名是否唯一 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkConfigKeyUnique(SysConfig config) |
| | | { |
| | | Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); |
| | | if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) |
| | | { |
| | | return CacheConstants.SYS_CONFIG_KEY + configKey; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param configId 参数配置ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | @Override |
| | | public SysConfig selectConfigById(Long configId) { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigId(configId); |
| | | return configMapper.selectConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数key |
| | | * @return 参数键值 |
| | | */ |
| | | @Override |
| | | public String selectConfigByKey(String configKey) { |
| | | String configValue = Convert.toStr(redisService.getCacheObject(getCacheKey(configKey))); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | return configValue; |
| | | } |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey(configKey); |
| | | SysConfig retConfig = configMapper.selectConfig(config); |
| | | if (StringUtils.isNotNull(retConfig)) { |
| | | redisService.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); |
| | | return retConfig.getConfigValue(); |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | @Override |
| | | public List<SysConfig> selectConfigList(SysConfig config) { |
| | | return configMapper.selectConfigList(config); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertConfig(SysConfig config) { |
| | | int row = configMapper.insertConfig(config); |
| | | if (row > 0) { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) { |
| | | SysConfig temp = configMapper.selectConfigById(config.getConfigId()); |
| | | if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) { |
| | | redisService.deleteObject(getCacheKey(temp.getConfigKey())); |
| | | } |
| | | |
| | | int row = configMapper.updateConfig(config); |
| | | if (row > 0) { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | */ |
| | | @Override |
| | | public void deleteConfigByIds(Long[] configIds) { |
| | | for (Long configId : configIds) { |
| | | SysConfig config = selectConfigById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { |
| | | throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | configMapper.deleteConfigById(configId); |
| | | redisService.deleteObject(getCacheKey(config.getConfigKey())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 加载参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingConfigCache() { |
| | | List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 清空参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() { |
| | | Collection<String> keys = redisService.keys(CacheConstants.SYS_CONFIG_KEY + "*"); |
| | | redisService.deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 重置参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetConfigCache() { |
| | | clearConfigCache(); |
| | | loadingConfigCache(); |
| | | } |
| | | |
| | | /** |
| | | * 校验参数键名是否唯一 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkConfigKeyUnique(SysConfig config) { |
| | | Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); |
| | | if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) { |
| | | return CacheConstants.SYS_CONFIG_KEY + configKey; |
| | | } |
| | | } |
| | |
| | | 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.SysLoginLog; |
| | | 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 javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.system.domain.SysNotice; |
| | | import com.ruoyi.system.mapper.SysNoticeMapper; |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 公告 服务层实现 |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysNoticeServiceImpl implements ISysNoticeService |
| | | { |
| | | @Autowired |
| | | public class SysNoticeServiceImpl implements ISysNoticeService { |
| | | @Resource |
| | | private SysNoticeMapper noticeMapper; |
| | | |
| | | /** |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.110.169:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 87dfc9b5-3336-4273-906c-a31cc3925c47 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 87dfc9b5-3336-4273-906c-a31cc3925c47 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | | file-extension: yml |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | <mapper namespace="com.ruoyi.system.mapper.SysLoginLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.SysLoginLog"> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.api.domain.SysLoginLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="user_name" property="username" /> |
| | |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 账户模块 |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiAccountApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(RuoYiAccountApplication.class, args); |
| | |
| | | @ApiOperation(value = "选择优惠券分页查询", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/couponList") |
| | | public AjaxResult<PageInfo<CouponListVOVO>> couponList(@RequestBody CouponListDto dto) { |
| | | // todo token获取用户id |
| | | Long userId = 11L; |
| | | dto.setUserId(userId); |
| | | |
| | | PageInfo<CouponListVOVO> res = tAppCouponService.couponList(dto); |
| | | return AjaxResult.ok(res); |
| | | } |
| | |
| | | */ |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "删除用户地址") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(appUserAddressService.removeById(id)); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.CouponListDto; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.CouponListVOVO; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.account.mapper.TAppCouponMapper; |
| | | import com.ruoyi.account.mapper.TAppUserMapper; |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private OrderClient orderClient; |
| | | @Autowired |
| | | private OtherClient otherClient; |
| | | @Autowired |
| | | private VipClient vipClient; |
| | | @Autowired |
| | | private ChargingPileClient chargingPileClient; |
| | | @Autowired |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Autowired |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | |
| | | @Override |
| | | public PageInfo<ExchangeRecordVO> pagelist(ExchangeRecordGoodsQuery dto) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | return pageInfo; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private TAppUserMapper tAppUserMapper; |
| | | @Override |
| | | public PageInfo<CouponListVOVO> couponList(CouponListDto dto) { |
| | | // todo token获取用户id |
| | | Long userId = 11L; |
| | | dto.setUserId(userId); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | PageInfo<CouponListVOVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<CouponListVOVO> list = this.baseMapper.couponList(pageInfo,dto.getUserId()); |
| | | TAppUser tAppUser = tAppUserMapper.selectById(dto.getUserId()); |
| | | Integer isVip = 0;// 是否能享受会员折扣 |
| | | if (tAppUser.getVipEndTime() == null){ |
| | | // 不是会员 |
| | | }else { |
| | | // 判断会员有没有过期 |
| | | if (tAppUser.getVipEndTime().isAfter(java.time.LocalDateTime.now())){ |
| | | // 没过期 判断用户本月会员充电折扣次数是否还有剩余 |
| | | TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.list(new LambdaQueryWrapper<TAppUserVipDetail>() |
| | | .orderByDesc(TAppUserVipDetail::getStartTime)).get(0); |
| | | LocalDateTime startTime = tAppUserVipDetail.getStartTime(); |
| | | LocalDateTime endTime = tAppUserVipDetail.getEndTime(); |
| | | TChargingCountQuery tChargingCountQuery = new TChargingCountQuery(); |
| | | tChargingCountQuery.setStartTime(startTime); |
| | | tChargingCountQuery.setEndTime(endTime); |
| | | tChargingCountQuery.setUserId(dto.getUserId()); |
| | | // 当月已享受会员折扣充电次数 |
| | | Integer data = chargingOrderClient.getChargingCount(tChargingCountQuery).getData(); |
| | | // 查询用户当前会员每月享受折扣次数和折扣比例是多少 |
| | | Integer vipId = tAppUser.getVipId(); |
| | | TVip data1 = vipClient.getInfo1(vipId).getData(); |
| | | Integer discountTimes = data1.getDiscountTimes(); |
| | | if (data>=discountTimes){ |
| | | // 不能再享受会员折扣 |
| | | }else{ |
| | | isVip = 1; |
| | | } |
| | | } |
| | | } |
| | | for (CouponListVOVO couponListVOVO : list) { |
| | | couponListVOVO.setValidityTime("有效期:"+format.format(couponListVOVO.getCreateTime())+" - "+format.format(couponListVOVO.getEndTime())); |
| | | } |
| | | List<CouponListVOVO> data = otherClient.getCouponInfoByCouponIds(list).getData(); |
| | | for (CouponListVOVO datum : data) { |
| | | // 根据当前时间段和预付金额计算服务费 |
| | | |
| | | } |
| | | pageInfo.setRecords(data); |
| | | return pageInfo; |
| | | } |
| | |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | | activate: |
| | |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理", "管理后台-充电桩信息"},value = "查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailByStrategyId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam Integer strategyId) { |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam("strategyId") Integer strategyId) { |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "查看计费策略详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TAccountingStrategy> getDetailById(@RequestParam Integer id) { |
| | | public AjaxResult<TAccountingStrategy> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(accountingStrategyService.getById(id)); |
| | | } |
| | | |
| | |
| | | @Log(title = "删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "删除计费策略") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | // 刪除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id)); |
| | |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailBySiteId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam Integer siteId) { |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam("siteId") Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询当前时间段计费策略展示") |
| | | @GetMapping(value = "/queryStrategyBySiteIdAndTime") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryStrategyBySiteIdAndTime(@RequestParam Integer siteId) { |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryStrategyBySiteIdAndTime(@RequestParam("siteId") Integer siteId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryStrategyBySiteIdAndTime(siteId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "价格说明金额返回,会员开通金额说明") |
| | | @GetMapping(value = "/queryPrice") |
| | | public AjaxResult<StrategyPriceVO> queryPrice(@RequestParam Integer siteId) { |
| | | public AjaxResult<StrategyPriceVO> queryPrice(@RequestParam("siteId") Integer siteId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryPrice(siteId)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | | import com.ruoyi.chargingPile.api.vo.TCarportVO; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.service.TApplyChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-车库"},value = "查看车库详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TCarport> getDetailById(@RequestParam Integer id) { |
| | | public AjaxResult<TCarport> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(carportService.getById(id)); |
| | | } |
| | | |
| | |
| | | @Log(title = "删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "删除车库") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | // 刪除车道信息 |
| | | vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class) |
| | | .eq(TVehicleRamp::getCarportId, id)); |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-充电枪", "管理后台-充电桩信息"},value = "查看充电枪详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TChargingGun> getDetailById(@RequestParam Integer id) { |
| | | public AjaxResult<TChargingGun> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(chargingGunService.getById(id)); |
| | | } |
| | | |
| | |
| | | @Log(title = "删除充电枪", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "删除充电枪") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | TChargingGun chargingGun = chargingGunService.getById(id); |
| | | chargingGun.setDelFlag(true); |
| | | chargingGunService.updateById(chargingGun); |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | |
| | | |
| | | |
| | | @GetMapping("/chargeMonitoring/{siteId}") |
| | | @ApiOperation(value = "修改备注", tags = {"管理后台-充电设备监控"}) |
| | | public AjaxResult<ChargeMonitoring> chargeMonitoring(@PathVariable Integer siteId){ |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-监控"},value = "查看监控详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TMonitoringEquipment> getDetailById(@RequestParam Integer id) { |
| | | public AjaxResult<TMonitoringEquipment> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(monitoringEquipmentService.getById(id)); |
| | | } |
| | | |
| | |
| | | @Log(title = "删除监控", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-监控"},value = "删除监控") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(monitoringEquipmentService.removeById(id)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-停车场"},value = "查询停车场列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TParkingLot>> list(@RequestBody TParkingLotQuery query) { |
| | | return AjaxResult.ok(parkingLotService.list(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getName,query.getName()))); |
| | | public AjaxResult<List<TParkingLotVO>> list(@RequestBody TParkingLotQuery query) { |
| | | return AjaxResult.ok(parkingLotService.getList(query.getName())); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-停车场"},value = "查看停车场详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TParkingLot> getDetailById(@RequestParam Integer id) { |
| | | public AjaxResult<TParkingLot> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(parkingLotService.getById(id)); |
| | | } |
| | | |
| | |
| | | @Log(title = "删除停车场", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "删除停车场") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | // 刪除车道信息 |
| | | vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class) |
| | | .eq(TVehicleRamp::getParkingLotId, id)); |
| | |
| | | */ |
| | | @ApiOperation(tags = {"后台-车道"},value = "查看车道详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TVehicleRamp> getDetailById(@RequestParam Integer id) { |
| | | public AjaxResult<TVehicleRamp> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(vehicleRampService.getById(id)); |
| | | } |
| | | |
| | |
| | | @Log(title = "删除车道", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "删除车道") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam Integer id) { |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(vehicleRampService.removeById(id)); |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.chargingPile.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/14 15:54 |
| | | */ |
| | | @ApiModel |
| | | @Data |
| | | public class ChargeMonitoring { |
| | | @ApiModelProperty("电站电话") |
| | | private String phone; |
| | | @ApiModelProperty("详细地址") |
| | | private String address; |
| | | @ApiModelProperty("终点总数") |
| | | private Integer terminalTotal; |
| | | @ApiModelProperty("充电中") |
| | | private Integer charging; |
| | | @ApiModelProperty("未充电") |
| | | private Integer notCharged; |
| | | @ApiModelProperty("额定功率") |
| | | private BigDecimal ratedPower; |
| | | @ApiModelProperty("实时功率") |
| | | private BigDecimal realTimePower; |
| | | @ApiModelProperty("需求功率满足率") |
| | | private BigDecimal demandPowerSatisfactionRate; |
| | | @ApiModelProperty("充电量趋势") |
| | | private Map<String, Object> chargeTrend; |
| | | @ApiModelProperty("利用率趋势") |
| | | private Map<String, Object> utilizationTrend; |
| | | |
| | | } |
| | |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TMonitoringEquipmentVO> pageList(@Param("query") TMonitoringEquipmentQuery query, @Param("pageInfo")PageInfo<TMonitoringEquipmentVO> pageInfo); |
| | | List<TMonitoringEquipmentVO> pageList(@Param("query") TMonitoringEquipmentQuery query, @Param("pageInfo")PageInfo<TMonitoringEquipmentVO> pageInfo,@Param("parkingLotIds")List<Integer> parkingLotIds); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TParkingLotVO> pageList(@Param("query") TParkingLotQuery query, @Param("pageInfo")PageInfo<TParkingLotVO> pageInfo); |
| | | List<TParkingLotVO> pageList(@Param("query") TParkingLotQuery query, @Param("pageInfo")PageInfo<TParkingLotVO> pageInfo, @Param("siteIds") Set<Integer> siteIds); |
| | | |
| | | /** |
| | | * 获取停车场列表 |
| | | * @param name |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | List<TParkingLotVO> getList(@Param("name")String name, @Param("siteIds")Set<Integer> siteIds); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | * @return |
| | | */ |
| | | List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type); |
| | | |
| | | |
| | | /** |
| | | * 获取充电设备监控数据 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | ChargeMonitoring chargeMonitoring(Integer siteId); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TParkingLotVO; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 停车场 服务类 |
| | |
| | | * @return |
| | | */ |
| | | PageInfo<TParkingLotVO> pageList(TParkingLotQuery query); |
| | | |
| | | /** |
| | | * 查询停车场列表 |
| | | * @param name |
| | | * @return |
| | | */ |
| | | List<TParkingLotVO> getList(String name); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | @Resource |
| | | private ChargingOrderAccountingStrategyClient chargingOrderAccountingStrategyClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | }); |
| | | return chargingPileVOS; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取监控设备监控数据 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ChargeMonitoring chargeMonitoring(Integer siteId) { |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(null == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | 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.add(siteId); |
| | | } |
| | | List<Site> sites = siteService.listByIds(siteIds); |
| | | List<TChargingGun> total = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getSiteId, siteIds).eq(TChargingGun::getDelFlag, 0)); |
| | | List<TChargingGun> charging = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getSiteId, siteIds).eq(TChargingGun::getStatus, 4).eq(TChargingGun::getDelFlag, 0)); |
| | | BigDecimal ratedPower = total.stream().map(TChargingGun::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal realTimePower = charging.stream().map(TChargingGun::getChargingPower).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | ChargeMonitoring chargeMonitoring = new ChargeMonitoring(); |
| | | chargeMonitoring.setPhone(sites.size() == 1 ? sites.get(0).getPhone() : ""); |
| | | chargeMonitoring.setAddress(sites.size() == 1 ? sites.get(0).getAddress() : ""); |
| | | chargeMonitoring.setTerminalTotal(total.size()); |
| | | chargeMonitoring.setCharging(charging.size()); |
| | | chargeMonitoring.setNotCharged(total.size() - charging.size()); |
| | | chargeMonitoring.setRatedPower(ratedPower.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargeMonitoring.setRealTimePower(realTimePower.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargeMonitoring.setDemandPowerSatisfactionRate(realTimePower.divide(ratedPower).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN)); |
| | | |
| | | List<String> dates = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | for (int i = 6; i >= 0; i--) { |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - i); |
| | | dates.add(sdf.format(calendar.getTime())); |
| | | } |
| | | List<List<Map<String, Object>>> value1 = chargingOrderAccountingStrategyClient.getTotalElectricQuantity(6).getData(); |
| | | Map<String, Object> chargeTrend = new HashMap<>(); |
| | | chargeTrend.put("date", dates); |
| | | chargeTrend.put("value", value1); |
| | | chargeMonitoring.setChargeTrend(chargeTrend); |
| | | |
| | | |
| | | // chargeMonitoring.setUtilizationTrend(); |
| | | return chargeMonitoring; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.query.TMonitoringEquipmentQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TMonitoringEquipmentVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingLotVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TMonitoringEquipmentMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TMonitoringEquipmentService; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | 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; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TMonitoringEquipmentServiceImpl extends ServiceImpl<TMonitoringEquipmentMapper, TMonitoringEquipment> implements TMonitoringEquipmentService { |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private TParkingLotService parkingLotService; |
| | | @Override |
| | | public PageInfo<TMonitoringEquipmentVO> pageList(TMonitoringEquipmentQuery query) { |
| | | |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | // 查询管理站点下的停车场 |
| | | List<TParkingLotVO> parkingLotVOS = parkingLotService.getList(null); |
| | | List<Integer> parkingLotIds = parkingLotVOS.stream().map(TParkingLotVO::getId).collect(Collectors.toList()); |
| | | |
| | | PageInfo<TMonitoringEquipmentVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TMonitoringEquipmentVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<TMonitoringEquipmentVO> list = this.baseMapper.pageList(query,pageInfo,parkingLotIds); |
| | | for (TMonitoringEquipmentVO monitoringEquipmentVO : list) { |
| | | Integer siteId = parkingLotVOS.stream().filter(park->park.getId().equals(monitoringEquipmentVO.getParkingLotId())).findFirst().get().getSiteId(); |
| | | monitoringEquipmentVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_MONITOR)); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.query.TParkingLotQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingLotVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TParkingLotMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | 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 TParkingLotServiceImpl extends ServiceImpl<TParkingLotMapper, TParkingLot> implements TParkingLotService { |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Override |
| | | public PageInfo<TParkingLotVO> pageList(TParkingLotQuery query) { |
| | | |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.PARKING_LOT); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = new HashSet<>(data); |
| | | } |
| | | } |
| | | PageInfo<TParkingLotVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TParkingLotVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<TParkingLotVO> list = this.baseMapper.pageList(query,pageInfo,siteIds); |
| | | for (TParkingLotVO parkingLotVO : list) { |
| | | Integer siteId = parkingLotVO.getSiteId(); |
| | | parkingLotVO.setAuthAddParkingLot(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_ADD_GARAGE)); |
| | | parkingLotVO.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_DELETE)); |
| | | parkingLotVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_QUERY_INFO)); |
| | | parkingLotVO.setAuthUpdate(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_UPDATE)); |
| | | parkingLotVO.setAuthMonitor(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.PARKING_LOT_MONITOR)); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public List<TParkingLotVO> getList(String name) { |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.PARKING_LOT); |
| | | }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); |
| | | } |
| | | } |
| | | return this.baseMapper.getList(name,siteIds); |
| | | } |
| | | } |
| | |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | application-id: seata-chargingPile |
| | | registry: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | tx-service-group: seata_tx_group #事务组(被一个集群管理) |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | <result column="lower_limit_of_rated_voltage" property="lowerLimitOfRatedVoltage" /> |
| | | <result column="rated_current" property="ratedCurrent" /> |
| | | <result column="rated_power" property="ratedPower" /> |
| | | <result column="charging_power" property="chargingPower" /> |
| | | <result column="parking_number" property="parkingNumber" /> |
| | | <result column="parking_status" property="parkingStatus" /> |
| | | <result column="parking_lock_state" property="parkingLockState" /> |
| | |
| | | <if test="query.parkingLotId != null"> |
| | | AND tme.parking_lot_id = #{query.parkingLotId} |
| | | </if> |
| | | <if test="parkingLotIds != null and parkingLotIds.size()>0"> |
| | | AND tme.parking_lot_id IN |
| | | <foreach collection="parkingLotIds" item="parkingLotId" open="(" separator="," close=")"> |
| | | #{parkingLotId} |
| | | </foreach> |
| | | </if> |
| | | AND tme.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY tme.create_time DESC |
| | |
| | | <if test="query.siteId != null"> |
| | | AND tpl.site_id = #{query.siteId} |
| | | </if> |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and tcg.site_id in |
| | | <foreach collection="siteIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | AND tpl.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY tpl.create_time DESC |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.chargingPile.api.vo.TParkingLotVO"> |
| | | select <include refid="Base_Column_List"></include> |
| | | from t_parking_lot |
| | | <where> |
| | | <if test="name != null and name != ''"> |
| | | AND `name` LIKE concat('%',#{name},'%') |
| | | </if> |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and site_id in |
| | | <foreach collection="siteIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 账户模块 |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiIntegrationApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(RuoYiIntegrationApplication.class, args); |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 账户模块 |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiOrderApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(RuoYiOrderApplication.class, args); |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-charging-order-accounting-strategy") |
| | | public class TChargingOrderAccountingStrategyController { |
| | | |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电量统计数据 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getTotalElectricQuantity/{days}") |
| | | public R<List<List<Map<String, Object>>>> getTotalElectricQuantity(@PathVariable Integer days){ |
| | | List<List<Map<String, Object>>> list = chargingOrderAccountingStrategyService.getTotalElectricQuantity(days); |
| | | return R.ok(list); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | /** |
| | | * 查询会员在本月有多少次享受了充电折扣 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getChargingCount") |
| | | public R<Integer> getChargingCount(@RequestBody TChargingCountQuery req) { |
| | | int size = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getAppUserId, req.getUserId()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus,2) |
| | | .between(TChargingOrder::getStartTime, req.getStartTime(), req.getEndTime())).size(); |
| | | return R.ok(size); |
| | | } |
| | | //用户订单数量 |
| | | @PostMapping(value = "/useOrderCount") |
| | | public R<Long> useOrderCount(@RequestParam Long userId) { |
| | | public R<Long> useOrderCount(@RequestParam("userId") Long userId) { |
| | | Long count = chargingOrderService.lambdaQuery().eq(TChargingOrder::getAppUserId, userId).count(); |
| | | |
| | | return R.ok(count); |
| | | } |
| | | //订单详情 |
| | | @PostMapping(value = "/detail") |
| | | public R<TChargingOrder> detail(@RequestParam Long orderId) { |
| | | public R<TChargingOrder> detail(@RequestParam("orderId") Long orderId) { |
| | | return R.ok(chargingOrderService.getById(orderId)); |
| | | } |
| | | |
| | |
| | | |
| | | //订单详情 |
| | | @PostMapping(value = "/detail") |
| | | public R<TExchangeOrder> detail(@RequestParam Long orderId) { |
| | | public R<TExchangeOrder> detail(@RequestParam("orderId") Long orderId) { |
| | | return R.ok(exchangeOrderService.getById(orderId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(tags = {"小程序-订单申诉"},value = "查询订单申诉详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TOrderAppealVO> getDetailById(@RequestParam Integer id) { |
| | | public AjaxResult<TOrderAppealVO> getDetailById(@RequestParam("id") Integer id) { |
| | | return AjaxResult.ok(orderAppealService.getDetailById(id)); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | |
| | | * @since 2024-08-07 |
| | | */ |
| | | public interface TChargingOrderAccountingStrategyService extends IService<TChargingOrderAccountingStrategy> { |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数范围内的充电量统计 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | List<List<Map<String, Object>>> getTotalElectricQuantity(Integer days); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.order.mapper.TChargingOrderAccountingStrategyMapper; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TChargingOrderAccountingStrategyServiceImpl extends ServiceImpl<TChargingOrderAccountingStrategyMapper, TChargingOrderAccountingStrategy> implements TChargingOrderAccountingStrategyService { |
| | | |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数范围内的充电量统计 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<List<Map<String, Object>>> getTotalElectricQuantity(Integer days) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - days); |
| | | String startTime = sdf.format(calendar.getTime()) + " 00:00:00"; |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getStatus, 5) |
| | | .eq(TChargingOrder::getDelFlag, 0).last(" and end_time between '" + startTime + "' and DATE_FORMAT('%Y-%m-%d %H:%i:%s', now())")); |
| | | List<TChargingOrderAccountingStrategy> list1 = this.list(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().in(TChargingOrderAccountingStrategy::getChargingOrderId)); |
| | | |
| | | List<List<Map<String, Object>>> list2 = new ArrayList<>(); |
| | | Calendar nowDateTime = Calendar.getInstance(); |
| | | for (int i = days; i >= 0; i--) { |
| | | nowDateTime.set(Calendar.DAY_OF_YEAR, nowDateTime.get(Calendar.DAY_OF_YEAR) - i); |
| | | List<TChargingOrder> collect = list.stream().filter(s -> sdf.format(s.getEndTime()).equals(sdf.format(nowDateTime.getTime()))).collect(Collectors.toList()); |
| | | List<Long> orderIds = collect.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | |
| | | |
| | | List<Map<String, Object>> datas = new ArrayList<>(); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("name", "尖"); |
| | | BigDecimal value1 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 1) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value1.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map1); |
| | | |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("name", "峰"); |
| | | BigDecimal value2 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 2) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value2.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map2); |
| | | |
| | | Map<String, Object> map3 = new HashMap<>(); |
| | | map3.put("name", "平"); |
| | | BigDecimal value3 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 3) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value3.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map3); |
| | | |
| | | Map<String, Object> map4 = new HashMap<>(); |
| | | map4.put("name", "谷"); |
| | | BigDecimal value4 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 4) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value4.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map4); |
| | | list2.add(datas); |
| | | } |
| | | return list2; |
| | | } |
| | | } |
| | |
| | | private TEvaluationTagClient evaluationTagClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | @Autowired |
| | | @Resource |
| | | private TOrderEvaluateTagMapper orderEvaluateTagMapper; |
| | | @Resource |
| | | private TChargingOrderMapper chargingOrderMapper; |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private TOrderEvaluateMapper orderEvaluateMapper; |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagCount() { |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 账户模块 |
| | |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiOtherApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(RuoYiOtherApplication.class, args); |
| | |
| | | * @since 2024-08-06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/activity") |
| | | @RequestMapping("/activityStatistics") |
| | | public class TActivityStatisticsController { |
| | | @Autowired |
| | | private OrderClient orderClient; |
| | |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | |
| | | @RestController |
| | | @RequestMapping("/t-company") |
| | | public class TCompanyController { |
| | | @Resource |
| | | private TCompanyService companyService; |
| | | |
| | | //单位分页 |
| | | @PostMapping(value = "/unit/page") |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | | Page<TCompany> page = companyService.lambdaQuery() |
| | | .orderByDesc(TCompany::getCreateTime) |
| | | .like(unitListQueryDto.getCompanyName()!=null&& unitListQueryDto.getCompanyName().isEmpty(), TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .page(Page.of(unitListQueryDto.getPageCurr(), unitListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | |
| | | } |
| | | //单位添加 |
| | | @PostMapping(value = "/unit/addOrUpdate") |
| | | public R add(@RequestBody TCompany tCompany) { |
| | | if (tCompany.getId()==null){ |
| | | tCompany.setCreateTime(LocalDateTime.now()); |
| | | } |
| | | companyService.saveOrUpdate(tCompany); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/unit/delete") |
| | | public R add(@RequestParam Integer id) { |
| | | companyService.removeById(id); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/unit/delete") |
| | | public R<TCompany> delete(@RequestParam Integer id) { |
| | | |
| | | |
| | | return R.ok( companyService.getById(id)); |
| | | } |
| | | @Resource |
| | | private TCompanyService companyService; |
| | | |
| | | //单位分页 |
| | | @PostMapping(value = "/unit/page") |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | | Page<TCompany> page = companyService.lambdaQuery() |
| | | .orderByDesc(TCompany::getCreateTime) |
| | | .like(unitListQueryDto.getCompanyName() != null && unitListQueryDto.getCompanyName().isEmpty(), TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .page(Page.of(unitListQueryDto.getPageCurr(), unitListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | |
| | | } |
| | | |
| | | //单位添加 |
| | | @PostMapping(value = "/unit/addOrUpdate") |
| | | public R add(@RequestBody TCompany tCompany) { |
| | | if (tCompany.getId() == null) { |
| | | tCompany.setCreateTime(LocalDateTime.now()); |
| | | } |
| | | companyService.saveOrUpdate(tCompany); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/unit/delete") |
| | | public R<TCompany> delete(@RequestParam("id") Integer id) { |
| | | return R.ok(companyService.getById(id)); |
| | | } |
| | | } |
| | | |
| | |
| | | TCoupon byId = tCouponService.getById(couponListVOVO.getCouponId()); |
| | | BeanUtils.copyProperties(byId,couponListVOVO); |
| | | couponListVOVO.setCouponName(byId.getName()); |
| | | // 根据预付金额 判断是否满足 |
| | | if (byId.getMeetTheConditions().compareTo(BigDecimal.ZERO) == 0){ |
| | | // 无门槛 |
| | | couponListVOVO.setIsUse(1); |
| | | }else if (couponListVOVO.getPayMoney().compareTo(byId.getMeetTheConditions()) < 0){ |
| | | couponListVOVO.setIsUse(0); |
| | | }else{ |
| | | couponListVOVO.setIsUse(1); |
| | | } |
| | | // 根据优惠券类型和预付金额 判断哪一个优惠券减免的金额最大 将其排在第一位 |
| | | if (couponListVOVO.getIsUse() == 1){ |
| | | switch (byId.getPreferentialMode()){ |
| | | case 1: |
| | | couponListVOVO.setMoney(byId.getDiscountAmount()); |
| | | break; |
| | | case 2: |
| | | |
| | | break; |
| | | } |
| | | }else{ |
| | | couponListVOVO.setMoney(BigDecimal.ZERO); |
| | | } |
| | | |
| | | } |
| | | return R.ok(list); |
| | | } |
| | |
| | | } |
| | | //标签删除 |
| | | @PostMapping(value = "/delete") |
| | | public R delete(@RequestParam Integer id) { |
| | | public R delete(@RequestParam("id") Integer id) { |
| | | tUserTagService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping(value = "/getById") |
| | | public R<TUserTag> getById(@RequestParam Integer id) { |
| | | public R<TUserTag> getById(@RequestParam("id") Integer id) { |
| | | |
| | | return R.ok(tUserTagService.getById(id)); |
| | | } |
| | |
| | | public R<TVip> getById(Integer id) { |
| | | return R.ok(vipService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 远程调用 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getInfo1") |
| | | public R<TVip> getInfo1(@RequestParam("id")Integer id) { |
| | | return R.ok(vipService.getById(id)); |
| | | } |
| | | @ApiOperation(value = "会员列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | @ApiImplicitParams({ |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getVipInfoByType") |
| | | public R<TVip> getVipInfoByType(@RequestParam Integer type){ |
| | | public R<TVip> getVipInfoByType(@RequestParam("type") Integer type){ |
| | | switch (type){ |
| | | case 1: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | |
| | | --- |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
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.other.mapper.RegionMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.other.api.domain.Region"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="code" property="code" /> |
| | | <result column="citycode" property="citycode" /> |
| | | <result column="parent_id" property="parentId" /> |
| | | <result column="english" property="english" /> |
| | | </resultMap> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true #开启数据库代理 |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | | data-source-proxy-mode: AT |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |