Merge remote-tracking branch 'origin/master'
| | |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | | private BigDecimal vipElectrovalence; |
| | | @ApiModelProperty(value = "距离 单位米") |
| | | private BigDecimal distance; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOrderAppealVO对象", description = "充电桩订单VO") |
| | | public class TCharingOrderVO { |
| | | @ApiModelProperty(value = "分页列表") |
| | | private PageInfo<ChargingOrderVO> list; |
| | | @ApiModelProperty(value = "总充电量") |
| | | private BigDecimal total; |
| | | @ApiModelProperty(value = "充电时长") |
| | | private BigDecimal time; |
| | | @ApiModelProperty(value = "收入") |
| | | private BigDecimal income; |
| | | @ApiModelProperty(value = "电费") |
| | | private BigDecimal electronicMoney; |
| | | @ApiModelProperty(value = "服务费") |
| | | private BigDecimal serviceMoney; |
| | | } |
| | |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | |
| | | @ApiModelProperty(value = "优惠券名称和张数 后台列表展示使用") |
| | | @TableField(exist = false) |
| | | private String couponName; |
| | | |
| | | |
| | | } |
| | |
| | | * 会员服务 |
| | | * @author ruoyi |
| | | */ |
| | | @FeignClient(contextId = "VipClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = VipFallbackFactory.class) |
| | | @FeignClient(contextId = "VipClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = VipFallbackFactory.class) |
| | | public interface VipClient { |
| | | |
| | | /** |
| | |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/21 17:41 |
| | | */ |
| | | @FeignClient(contextId = "WebSocketClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = WebSocketFallbackFactory.class) |
| | | @FeignClient(contextId = "WebSocketClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = WebSocketFallbackFactory.class) |
| | | public interface WebSocketClient { |
| | | |
| | | |
| | |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- SpringBoot Actuator --> |
| | | <dependency> |
| | |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.seata</groupId> |
| | | <artifactId>seata-all</artifactId> |
| | | <version>1.6.1</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ |
| | | return AjaxResult.success(siteService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"}) |
| | | @PostMapping("/getMapSiteList") |
| | | public AjaxResult<List<SiteVO>> getMapSiteList(@Validated @RequestBody SiteQuery query){ |
| | | return AjaxResult.success(siteService.getMapSiteList(query)); |
| | | } |
| | | @ApiOperation(value = "获取站点详细信息", tags = {"小程序-站点管理-站点详情"}) |
| | | @PostMapping("/getDetailById") |
| | | public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){ |
| | |
| | | * @return |
| | | */ |
| | | List<Site> getSiteListGun(@Param("ids")Set<Integer> ids); |
| | | |
| | | /** |
| | | * 获取站点列表不分页 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<SiteVO> getMapSiteList(@Param("query")SiteQuery query); |
| | | } |
| | |
| | | */ |
| | | List<Site> getSiteListGun(); |
| | | |
| | | /** |
| | | * 获取站点列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<SiteVO> getMapSiteList(SiteQuery query); |
| | | } |
| | |
| | | return this.baseMapper.getSiteListGun(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<SiteVO> getMapSiteList(SiteQuery query) { |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | List<SiteVO> list = this.baseMapper.getMapSiteList(query); |
| | | if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ |
| | | // 查询会员信息 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | list.forEach(item -> { |
| | | item.setVipElectrovalence(vip.getDiscount().multiply(item.getElectrovalence())); |
| | | }); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置站点计费策略 |
| | |
| | | select |
| | | a.accounting_strategy_id, |
| | | (a.electrovalence+a.service_charge) AS electrovalence, |
| | | ((a.electrovalence+a.service_charge)*a.discount) AS vipElectrovalence |
| | | ((a.electrovalence+a.service_charge)*b.discount) AS vipElectrovalence |
| | | from |
| | | t_accounting_strategy_detail a |
| | | left join |
| | | t_accounting_strategy b on (a.accounting_strategy_id = b.id) |
| | | where b.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND DATE_FORMAT(NOW(), '%H:%i:%s') between b.start_time and b.end_time) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) |
| | | AND DATE_FORMAT(NOW(), '%H:%i:%s') between a.start_time and a.end_time) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) |
| | | <where> |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.SiteStatusEnum@NORMAL_USE.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | | </where> |
| | | <if test="query.sortType != null"> |
| | | <choose> |
| | | <when test="query.sortType == 1"> |
| | | ORDER BY ts.distance ASC |
| | | ORDER BY distance ASC |
| | | </when> |
| | | <when test="query.sortType == 2"> |
| | | ORDER BY tasd.electrovalence ASC |
| | |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | <select id="getMapSiteList" resultType="com.ruoyi.chargingPile.api.vo.SiteVO"> |
| | | select |
| | | ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status, ts.construction_site, ts.img_url, |
| | | ts.lon, ts.lat, ts.address, ts.country_code, ts.phone,ts.guide, ts.service_description, ts.vehicle_description, |
| | | ts.parking_space, ts.rate_description, ts.space_charge_explain, ts.accounting_strategy_id,ts.del_flag,tcg.fastCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | | POW( |
| | | SIN( |
| | | ( |
| | | #{query.lat} * PI() / 180 - ts.lat * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) + COS(#{query.lat} * PI() / 180) * COS(ts.lat * PI() / 180) * POW( |
| | | SIN( |
| | | ( |
| | | #{query.lon} * PI() / 180 - ts.lon * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) |
| | | ) |
| | | ) * 1000 |
| | | ) AS distance |
| | | from t_site ts |
| | | left join ( |
| | | select site_id, |
| | | SUM(CASE WHEN charge_mode = 1 THEN 1 ELSE 0 END) AS superCount, |
| | | SUM(CASE WHEN charge_mode = 2 THEN 1 ELSE 0 END) AS fastCount, |
| | | SUM(CASE WHEN charge_mode = 3 THEN 1 ELSE 0 END) AS slowCount |
| | | from |
| | | t_charging_gun |
| | | where |
| | | del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | group by |
| | | site_id) tcg on (ts.id = tcg.site_id) |
| | | left join ( |
| | | select |
| | | a.accounting_strategy_id, |
| | | (a.electrovalence+a.service_charge) AS electrovalence, |
| | | ((a.electrovalence+a.service_charge)*b.discount) AS vipElectrovalence |
| | | from |
| | | t_accounting_strategy_detail a |
| | | left join |
| | | t_accounting_strategy b on (a.accounting_strategy_id = b.id) |
| | | where b.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND DATE_FORMAT(NOW(), '%H:%i:%s') between a.start_time and a.end_time) tasd on (ts.accounting_strategy_id = tasd.accounting_strategy_id) |
| | | <where> |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | | </where> |
| | | <if test="query.sortType != null"> |
| | | <choose> |
| | | <when test="query.sortType == 1"> |
| | | ORDER BY distance ASC |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | public class IotDAConfig { |
| | | |
| | | /** |
| | | * ak配置 |
| | | * ak配置 SSD4HKIJPFO68W8QFSNG |
| | | */ |
| | | private String ak; |
| | | /** |
| | | * sk配置 |
| | | * sk配置 8Obp0fPsyFQ3bQUIaO2kKrS3XVPMOlXZ1nqPgK2k |
| | | */ |
| | | private String sk; |
| | | /** |
| | |
| | | package com.ruoyi.integration.iotda.constant; |
| | | |
| | | public class IotConstant { |
| | | public static final int SUCCESS = 1; |
| | | public static final int FAIL = 0; |
| | | /** |
| | | * 华为云iot token |
| | | */ |
New file |
| | |
| | | package com.ruoyi.integration.iotda.constant; |
| | | |
| | | public class ServiceIdConstant { |
| | | /** |
| | | * 登录认证应答 |
| | | */ |
| | | public static final String ONLINE_REPLY = "online_reply"; |
| | | /** |
| | | * 登录认证应答 |
| | | */ |
| | | public static final String PONG = "pong"; |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | */ |
| | | public static final String BILLING_MODE_VERIFY_REPLY = "billing_mode_verify_reply"; |
| | | /** |
| | | * 计费模型请求应答 |
| | | */ |
| | | public static final String ACQUISITION_BILLING_MODE_REPLY = "acquisition_billing_mode_reply"; |
| | | /** |
| | | * 读取实时监测数据 |
| | | */ |
| | | public static final String READ_REAL_TIME_MONITORING_DATA = "read_real_time_monitoring_data"; |
| | | /** |
| | | * 充电结束 |
| | | */ |
| | | public static final String END_CHARGE = "end_charge"; |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | */ |
| | | public static final String PLATFORM_CONFIRMATION_CHARGING = "platform_confirmation_charging"; |
| | | /** |
| | | * 运营平台远程控制启机 |
| | | */ |
| | | public static final String PLATFORM_START_CHARGING = "platform_start_charging"; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.iotda.utils.listener; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * iotda消息监听 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @RestController |
| | | public class IotMessageListener { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 设备消息监听 |
| | | * @param jsonObject |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | @PostMapping(value = "/message") |
| | | public AjaxResult<Integer> add(@RequestBody JSONObject jsonObject) throws IOException { |
| | | System.err.println(jsonObject); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.iotda.utils.produce; |
| | | |
| | | import com.huaweicloud.sdk.core.exception.ConnectionException; |
| | | import com.huaweicloud.sdk.core.exception.RequestTimeoutException; |
| | | import com.huaweicloud.sdk.core.exception.ServiceResponseException; |
| | | import com.huaweicloud.sdk.iotda.v5.IoTDAClient; |
| | | import com.huaweicloud.sdk.iotda.v5.model.CreateMessageRequest; |
| | | import com.huaweicloud.sdk.iotda.v5.model.CreateMessageResponse; |
| | | import com.huaweicloud.sdk.iotda.v5.model.DeviceMessageRequest; |
| | | import com.ruoyi.common.core.utils.uuid.UUID; |
| | | import com.ruoyi.integration.iotda.builder.IotBuilder; |
| | | import com.ruoyi.integration.iotda.config.IotDAConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | |
| | | @Slf4j |
| | | @Component |
| | | public class IotMessageProduce { |
| | | |
| | | |
| | | @Autowired |
| | | private IotBuilder iotBuilder; |
| | | |
| | | /** |
| | | * 设备消息下发 |
| | | * @param deviceId 设备id |
| | | * @param name 消息名称 |
| | | * @param message 消息内容 |
| | | * @return |
| | | */ |
| | | public String sendMessage(String deviceId,String name,String message){ |
| | | CreateMessageRequest request = new CreateMessageRequest(); |
| | | request.withDeviceId(deviceId); |
| | | DeviceMessageRequest body = new DeviceMessageRequest(); |
| | | body.withMessageId(UUID.randomUUID().toString()); |
| | | body.withName(name); |
| | | body.withMessage(message); |
| | | request.withBody(body); |
| | | try { |
| | | CreateMessageResponse response = iotBuilder.buildIot().createMessage(request); |
| | | System.out.println(response.toString()); |
| | | } catch (ConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (RequestTimeoutException e) { |
| | | e.printStackTrace(); |
| | | } catch (ServiceResponseException e) { |
| | | e.printStackTrace(); |
| | | System.out.println(e.getHttpStatusCode()); |
| | | System.out.println(e.getRequestId()); |
| | | System.out.println(e.getErrorCode()); |
| | | System.out.println(e.getErrorMsg()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.iotda.utils.tools; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.integration.iotda.constant.ServiceIdConstant; |
| | | import com.ruoyi.integration.mongodb.model.*; |
| | | import com.ruoyi.integration.mongodb.service.*; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | public class MessageUtil { |
| | | |
| | | @Autowired |
| | | private OnlineReplyService onlineReplyService; |
| | | @Autowired |
| | | private PongService pongService; |
| | | @Autowired |
| | | private BillingModeVerifyReplyService billingModeVerifyReplyService; |
| | | @Autowired |
| | | private AcquisitionBillingModeReplyService acquisitionBillingModeReplyService; |
| | | @Autowired |
| | | private ReadRealTimeMonitoringDataService readRealTimeMonitoringDataService; |
| | | @Autowired |
| | | private EndChargeService endChargeService; |
| | | @Autowired |
| | | private PlatformConfirmationChargingService platformConfirmationChargingService; |
| | | @Autowired |
| | | private PlatformStartChargingService platformStartChargingService; |
| | | |
| | | /** |
| | | * 登录认证应答 |
| | | * @param onlineReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String onlineReply(OnlineReply onlineReply){ |
| | | onlineReplyService.create(onlineReply); |
| | | return getMessageJsonString(onlineReply, ServiceIdConstant.ONLINE_REPLY); |
| | | } |
| | | |
| | | /** |
| | | * 心跳包应答 |
| | | * @param pong 实体对象 |
| | | * @return |
| | | */ |
| | | public String pong(Pong pong){ |
| | | pongService.create(pong); |
| | | return getMessageJsonString(pong, ServiceIdConstant.PONG); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | * @param billingModeVerifyReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ |
| | | billingModeVerifyReplyService.create(billingModeVerifyReply); |
| | | return getMessageJsonString(billingModeVerifyReply, ServiceIdConstant.BILLING_MODE_VERIFY_REPLY); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | * @param acquisitionBillingModeReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){ |
| | | acquisitionBillingModeReplyService.create(acquisitionBillingModeReply); |
| | | return getMessageJsonString(acquisitionBillingModeReply, ServiceIdConstant.ACQUISITION_BILLING_MODE_REPLY); |
| | | } |
| | | |
| | | /** |
| | | * 读取实时监测数据 |
| | | * @param readRealTimeMonitoringData 实体对象 |
| | | * @return |
| | | */ |
| | | public String readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){ |
| | | readRealTimeMonitoringDataService.create(readRealTimeMonitoringData); |
| | | return getMessageJsonString(readRealTimeMonitoringData, ServiceIdConstant.READ_REAL_TIME_MONITORING_DATA); |
| | | } |
| | | |
| | | /** |
| | | * 充电结束 |
| | | * @param endCharge 实体对象 |
| | | * @return |
| | | */ |
| | | public String endCharge(EndCharge endCharge){ |
| | | endChargeService.create(endCharge); |
| | | return getMessageJsonString(endCharge, ServiceIdConstant.END_CHARGE); |
| | | } |
| | | |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | * @param platformConfirmationCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){ |
| | | platformConfirmationChargingService.create(platformConfirmationCharging); |
| | | return getMessageJsonString(platformConfirmationCharging, ServiceIdConstant.PLATFORM_CONFIRMATION_CHARGING); |
| | | } |
| | | |
| | | /** |
| | | * 运营平台远程控制启机 |
| | | * @param platformStartCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformConfirmationCharging(PlatformStartCharging platformStartCharging){ |
| | | platformStartChargingService.create(platformStartCharging); |
| | | return getMessageJsonString(platformStartCharging, ServiceIdConstant.PLATFORM_START_CHARGING); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 统一封装消息 |
| | | * @param object 实体对象 |
| | | * @param serviceId 服务ID |
| | | * @return |
| | | */ |
| | | private String getMessageJsonString(Object object, String serviceId){ |
| | | JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); |
| | | jsonObject.put("service_id", serviceId); |
| | | return jsonObject.toJSONString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.base; |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface BaseService<T> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param t 实体类 |
| | | * @return 添加结果 1=成功 0=失败 |
| | | */ |
| | | int create(T t); |
| | | |
| | | /** |
| | | * 根据id查询 |
| | | * @param id 实体id |
| | | * @return 实体对象 |
| | | */ |
| | | T findById(String id); |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * @return 实体列表 |
| | | */ |
| | | List<T> findAll(); |
| | | |
| | | } |
| | |
| | | @Accessors(chain = true) |
| | | public class UpdateBalance { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card_number; //物理卡号 |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String physical_card_number;// 物理卡号 |
| | | private BigDecimal account_balance;// 修改后账户金额 |
| | | |
| | | } |
| | | |
| | |
| | | @Accessors(chain = true) |
| | | public class UpdateBalanceReply { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String physical_card_number;// 物理卡号 |
| | | private BigDecimal account_balance;// 修改后账户金额 |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card_number; //物理卡号 |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; |
| | | |
| | | public interface AcquisitionBillingModeReplyService extends BaseService<AcquisitionBillingModeReply> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | public interface BillingModeVerifyReplyService extends BaseService<BillingModeVerifyReply> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.EndCharge; |
| | | |
| | | public interface EndChargeService extends BaseService<EndCharge> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.OnlineReply; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 登录认证应答接口 |
| | | */ |
| | | public interface OnlineReplyService { |
| | | public interface OnlineReplyService extends BaseService<OnlineReply> { |
| | | |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 充电桩登录认证接口 |
| | | */ |
| | | public interface OnlineService { |
| | | public interface OnlineService extends BaseService<Online> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; |
| | | |
| | | public interface PlatformConfirmationChargingService extends BaseService<PlatformConfirmationCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStartCharging; |
| | | |
| | | public interface PlatformStartChargingService extends BaseService<PlatformStartCharging> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 心跳包应答接口 |
| | | */ |
| | | public interface PongService extends BaseService<Pong> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; |
| | | |
| | | public interface ReadRealTimeMonitoringDataService extends BaseService<ReadRealTimeMonitoringData> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; |
| | | import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | @Service |
| | | public class AcquisitionBillingModeReplyServiceImpl implements AcquisitionBillingModeReplyService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(AcquisitionBillingModeReply acquisitionBillingModeReply) { |
| | | mongoTemplate.save(acquisitionBillingModeReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public AcquisitionBillingModeReply findById(String id) { |
| | | return mongoTemplate.findById(id, AcquisitionBillingModeReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<AcquisitionBillingModeReply> findAll() { |
| | | return mongoTemplate.findAll(AcquisitionBillingModeReply.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; |
| | | import com.ruoyi.integration.mongodb.service.BillingModeVerifyReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | @Service |
| | | public class BillingModeVerifyReplyServiceImpl implements BillingModeVerifyReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(BillingModeVerifyReply billingModeVerifyReply) { |
| | | mongoTemplate.save(billingModeVerifyReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public BillingModeVerifyReply findById(String id) { |
| | | return mongoTemplate.findById(id, BillingModeVerifyReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingModeVerifyReply> findAll() { |
| | | return mongoTemplate.findAll(BillingModeVerifyReply.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.EndCharge; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import com.ruoyi.integration.mongodb.service.EndChargeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class EndChargeServiceImpl implements EndChargeService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(EndCharge endCharge) { |
| | | mongoTemplate.save(endCharge); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public EndCharge findById(String id) { |
| | | return mongoTemplate.findById(id, EndCharge.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<EndCharge> findAll() { |
| | | return mongoTemplate.findAll(EndCharge.class); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.OnlineReply; |
| | | import com.ruoyi.integration.mongodb.service.OnlineReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class OnlineReplyServiceImpl implements OnlineReplyService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(OnlineReply onlineReply) { |
| | | mongoTemplate.save(onlineReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public OnlineReply findById(String id) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<OnlineReply> findAll() { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @Service |
| | | public class OnlineServiceImpl implements OnlineService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Online online) { |
| | | mongoTemplate.save(online); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Online findById(String id) { |
| | | return mongoTemplate.findById(id, Online.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Online> findAll() { |
| | | return mongoTemplate.findAll(Online.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformConfirmationChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformConfirmationChargingServiceImpl implements PlatformConfirmationChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformConfirmationCharging platformConfirmationCharging) { |
| | | mongoTemplate.save(platformConfirmationCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformConfirmationCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformConfirmationCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformConfirmationCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformConfirmationCharging.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.mongodb.service.PlatformStartChargingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PlatformStartChargingServiceImpl implements PlatformStartChargingService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(PlatformStartCharging platformStartCharging) { |
| | | mongoTemplate.save(platformStartCharging); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public PlatformStartCharging findById(String id) { |
| | | return mongoTemplate.findById(id, PlatformStartCharging.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<PlatformStartCharging> findAll() { |
| | | return mongoTemplate.findAll(PlatformStartCharging.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.Online; |
| | | import com.ruoyi.integration.mongodb.model.Pong; |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import com.ruoyi.integration.mongodb.service.PongService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class PongServiceImpl implements PongService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(Pong pong) { |
| | | mongoTemplate.save(pong); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public Pong findById(String id) { |
| | | return mongoTemplate.findById(id, Pong.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Pong> findAll() { |
| | | return mongoTemplate.findAll(Pong.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.mongodb.service.ReadRealTimeMonitoringDataService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class ReadRealTimeMonitoringDataServiceImpl implements ReadRealTimeMonitoringDataService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Override |
| | | public int create(ReadRealTimeMonitoringData readRealTimeMonitoringData) { |
| | | mongoTemplate.save(readRealTimeMonitoringData); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ReadRealTimeMonitoringData findById(String id) { |
| | | return mongoTemplate.findById(id, ReadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ReadRealTimeMonitoringData> findAll() { |
| | | return mongoTemplate.findAll(ReadRealTimeMonitoringData.class); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.GetMyChargingOrderList; |
| | | import com.ruoyi.order.dto.GetNoInvoicedOrder; |
| | | import com.ruoyi.order.dto.MyChargingOrderInfo; |
| | |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TOrderEvaluateService orderEvaluateService; |
| | | @Autowired |
| | | private TOrderEvaluateTagService orderEvaluateTagService; |
| | | |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrder") |
| | | @ApiOperation(value = "充电桩订单列表", tags = {"管理后台-订单管理"}) |
| | | public AjaxResult<PageInfo<ChargingOrderVO>> chargingOrder(@RequestBody ChargingOrderQuery dto){ |
| | | PageInfo<ChargingOrderVO> res = chargingOrderService.chargingOrder(dto); |
| | | public AjaxResult<TCharingOrderVO> chargingOrder(@RequestBody ChargingOrderQuery dto){ |
| | | TCharingOrderVO res = chargingOrderService.chargingOrder(dto); |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/paymentChargingOrder") |
| | | @ApiOperation(value = "支付充电充值费用", tags = {"小程序-扫一扫"}) |
| | | public AjaxResult paymentChargingOrder(AddChargingOrder addChargingOrder){ |
| | | public AjaxResult paymentChargingOrder(@RequestBody AddChargingOrder addChargingOrder){ |
| | | return chargingOrderService.paymentChargingOrder(addChargingOrder); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 查询订单申诉详情 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-订单申诉"},value = "查询订单申诉详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TOrderAppealVO> getDetailById(@RequestParam("id") Integer id) { |
| | | @ApiOperation(tags = {"小程序-订单申诉"},value = "查询订单申诉详情") |
| | | public AjaxResult<TOrderAppealVO> getDetailById(Integer id) { |
| | | return AjaxResult.ok(orderAppealService.getDetailById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/addOrderAppeal") |
| | | @PostMapping(value = "/addOrderAppeal") |
| | | @ApiOperation(value = "申诉订单", tags = {"小程序-充电记录(个人中心)"}) |
| | | public AjaxResult addOrderAppeal(@RequestBody TOrderAppeal orderAppeal){ |
| | | Long appUserId = tokenService.getLoginUserApplet().getUserId(); |
| | |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | |
| | | */ |
| | | AjaxResult stopCharging(String id); |
| | | |
| | | PageInfo<ChargingOrderVO> chargingOrder(ChargingOrderQuery dto); |
| | | TCharingOrderVO chargingOrder(ChargingOrderQuery dto); |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TCharingOrderVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | @Resource |
| | | private AppUserVipDetailClient appUserVipDetailClient; |
| | | |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ChargingOrderVO> chargingOrder(ChargingOrderQuery dto) { |
| | | public TCharingOrderVO chargingOrder(ChargingOrderQuery dto) { |
| | | TCharingOrderVO tCharingOrderVO = new TCharingOrderVO(); |
| | | String startTime1 = null; |
| | | String startTime2 = null; |
| | | String endTime1 = null; |
| | |
| | | endTime1 = split[0]; |
| | | endTime2 = split[1]; |
| | | } |
| | | if (StringUtils.hasLength(dto.getPhone())){ |
| | | List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData(); |
| | | if (data.isEmpty()){ |
| | | data.add(0L); |
| | | } |
| | | dto.setUserIds(data); |
| | | } |
| | | PageInfo<ChargingOrderVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ChargingOrderVO> list = this.baseMapper.chargingOrder(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | tCharingOrderVO.setList(pageInfo); |
| | | return tCharingOrderVO; |
| | | } |
| | | } |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | @PostMapping("/saveSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分设置") |
| | | public R saveSet(@RequestBody TIntegralRule dto) { |
| | | integralRuleService.updateById(dto); |
| | | // JSONObject jsonObject = JSONObject.parseObject(dto); |
| | | // String chargeCredit = jsonObject.getString("chargeCredit"); |
| | | // String credit = jsonObject.getString("credit"); |
| | | // String inviteUsersToEarnPoints = jsonObject.getString("inviteUsersToEarnPoints"); |
| | | // String addVehiclesEarnsPoints = jsonObject.getString("addVehiclesEarnsPoints"); |
| | | // String signInForPoints = jsonObject.getString("signInForPoints"); |
| | | // TIntegralRule tIntegralRule = new TIntegralRule(); |
| | | // tIntegralRule.setAddVehiclesEarnsPoints(signInForPoints); |
| | | // tIntegralRule.setChargeCredit(chargeCredit); |
| | | // tIntegralRule.setCredit(credit); |
| | | // tIntegralRule.setSignInForPoints(addVehiclesEarnsPoints); |
| | | // tIntegralRule.setInviteUsersToEarnPoints(inviteUsersToEarnPoints); |
| | | // TIntegralRule one = integralRuleService.getOne(null); |
| | | // if (one!=null){ |
| | | // one.setAddVehiclesEarnsPoints(signInForPoints); |
| | | // one.setChargeCredit(chargeCredit); |
| | | // one.setCredit(credit); |
| | | // one.setSignInForPoints(addVehiclesEarnsPoints); |
| | | // one.setInviteUsersToEarnPoints(inviteUsersToEarnPoints); |
| | | // integralRuleService.updateById(one); |
| | | // }else{ |
| | | // integralRuleService.save(tIntegralRule); |
| | | // } |
| | | TIntegralRule one = integralRuleService.getOne(null); |
| | | if (one!=null){ |
| | | dto.setId(one.getId()); |
| | | integralRuleService.saveOrUpdate(dto); |
| | | }else{ |
| | | integralRuleService.saveOrUpdate(dto); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.mapper.TCouponMapper; |
| | | import com.ruoyi.other.mapper.TVipMapper; |
| | | import com.ruoyi.other.service.TVipService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | @Service |
| | | public class TVipServiceImpl extends ServiceImpl<TVipMapper, TVip> implements TVipService { |
| | | |
| | | @Autowired |
| | | private TCouponMapper tCouponMapper; |
| | | @Override |
| | | public PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize) { |
| | | PageInfo<TVip> pageInfo = new PageInfo<>(pageCurr,pageSize); |
| | | List<TVip> list = this.baseMapper.pageList(pageInfo); |
| | | |
| | | for (TVip tVip : list) { |
| | | String coupon = tVip.getCoupon(); |
| | | JSONArray jsonArray = JSONObject.parseArray(coupon); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | Integer id = jsonObject.getInteger("id"); |
| | | Integer number = jsonObject.getInteger("number"); |
| | | TCoupon tCoupon = tCouponMapper.selectById(id); |
| | | if (tCoupon!=null){ |
| | | stringBuilder.append(tCoupon.getName()).append("*").append(number).append(";"); |
| | | } |
| | | } |
| | | tVip.setCouponName(stringBuilder.toString()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |