Merge branch 'dev' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile into dev
42个文件已修改
1个文件已删除
23个文件已添加
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public R<TChargingGun> getChargingGunByFullNumber(String fullNumber) { |
| | | return R.fail("根据枪唯一码查询信息失败:" + throwable.getMessage()); |
| | | } |
| | | @Override |
| | | public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(List<Integer> siteIds, List<Integer> chargeModels){ |
| | | return R.fail("根据站点ids和充电模式集合查询充电枪集合失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.factory.ChargingGunFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/t-charging-gun/getChargingGunByFullNumber") |
| | | R<TChargingGun> getChargingGunByFullNumber(@RequestParam("fullNumber") String fullNumber); |
| | | |
| | | /** |
| | | * 大屏 根据站点ids和充电模式集合查询充电枪集合 |
| | | */ |
| | | @GetMapping("/t-charging-gun/getGunIdsBySiteIdsAndChargeModels") |
| | | R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.vo; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "大屏对外开放区车位使用情况Vo") |
| | | public class LargeScreenGunVo { |
| | | @ApiModelProperty(value = "超级快充") |
| | | private Integer superFast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer fast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer v2g=0; |
| | | |
| | | @ApiModelProperty(value = "超级快充 使用") |
| | | private Integer useSuperFast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer useFast=0; |
| | | @ApiModelProperty(value = "快充") |
| | | private Integer useV2g=0; |
| | | } |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public R tripartitePlatformStopCharge(String startChargeSeq) { |
| | | return R.fail("三方平台请求停止充电失败:" + throwable.getMessage()); |
| | | } |
| | | @Override |
| | | public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ |
| | | return R.fail("获取站点集合中总的充电量失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/t-charging-order/tripartitePlatformStopCharge") |
| | | R tripartitePlatformStopCharge(@RequestParam("startChargeSeq") String startChargeSeq); |
| | | |
| | | /** |
| | | * 充电桩大屏 获取站点集合中总的充电量 |
| | | */ |
| | | @GetMapping("/t-charging-order/getSumDegreeBySiteIds") |
| | | R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/9 11:35 |
| | | */ |
| | | @Data |
| | | @TableName("t_charging_order_summary_data") |
| | | public class TChargingOrderSummaryData { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | /** |
| | | * 充电订单id |
| | | */ |
| | | @TableField("charging_order_id") |
| | | private Long chargingOrderId; |
| | | /** |
| | | * 充电时长(s) |
| | | */ |
| | | @TableField("charging_duration") |
| | | private Long chargingDuration; |
| | | /** |
| | | * 充电度数 |
| | | */ |
| | | @TableField("charging_capacity") |
| | | private BigDecimal chargingCapacity; |
| | | /** |
| | | * 收入 |
| | | */ |
| | | @TableField("income") |
| | | private BigDecimal income; |
| | | /** |
| | | * 电费 |
| | | */ |
| | | @TableField("electric_price") |
| | | private BigDecimal electricPrice; |
| | | /** |
| | | * 服务费 |
| | | */ |
| | | @TableField("service_price") |
| | | private BigDecimal servicePrice; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("t_screen_content") |
| | | @ApiModel("大屏设置对象") |
| | | public class TScreenContent { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @ApiModelProperty("主键ID") |
| | | private Integer id; |
| | | |
| | | @TableField("site_id") |
| | | @ApiModelProperty("站点id") |
| | | private Integer siteId; |
| | | |
| | | @TableField("green_electricity_today") |
| | | @ApiModelProperty("今日绿电消纳值") |
| | | private BigDecimal greenElectricityToday; |
| | | |
| | | @TableField("car_discharge") |
| | | @ApiModelProperty("累计汽车放电量") |
| | | private BigDecimal carDischarge; |
| | | |
| | | @TableField("green_electricity") |
| | | @ApiModelProperty("累计绿电消纳电量") |
| | | private BigDecimal greenElectricity; |
| | | |
| | | @TableField("title") |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | |
| | | @TableField("title_one") |
| | | @ApiModelProperty("标题1") |
| | | private String titleOne; |
| | | |
| | | @TableField("value_one") |
| | | @ApiModelProperty("值1") |
| | | private BigDecimal valueOne; |
| | | |
| | | @TableField("unit_one") |
| | | @ApiModelProperty("计量单位1") |
| | | private String unitOne; |
| | | |
| | | @TableField("title_two") |
| | | @ApiModelProperty("标题2") |
| | | private String titleTwo; |
| | | |
| | | @TableField("value_two") |
| | | @ApiModelProperty("值2") |
| | | private BigDecimal valueTwo; |
| | | |
| | | @TableField("unit_two") |
| | | @ApiModelProperty("计量单位2") |
| | | private String unitTwo; |
| | | |
| | | @TableField("title_three") |
| | | @ApiModelProperty("标题3") |
| | | private String titleThree; |
| | | |
| | | @TableField("value_three") |
| | | @ApiModelProperty("值3") |
| | | private BigDecimal valueThree; |
| | | |
| | | @TableField("unit_three") |
| | | @ApiModelProperty("计量单位3") |
| | | private String unitThree; |
| | | |
| | | @TableField("statistical_deadline") |
| | | @ApiModelProperty("截止统计日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDateTime statisticalDeadline; |
| | | |
| | | @TableField("create_time") |
| | | @ApiModelProperty("创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField("update_time") |
| | | @ApiModelProperty("更新时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | Partner partner = partnerClient.getPartnerById(userInfo.getSysUser().getObjectId()).getData(); |
| | | map.put("partnerName", partner.getName()); |
| | | } |
| | | long time = userInfo.getSysUser().getPassWordUpdate().getTime(); |
| | | map.put("password", false); |
| | | //30天提示修改密码 |
| | | if(System.currentTimeMillis() >= (time + 2592000000L)){ |
| | | map.put("password", true); |
| | | } |
| | | // 修改用户最后登录时间 |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(userInfo.getSysUser().getUserId()); |
| | |
| | | claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); |
| | | claimsMap.put(SecurityConstants.USER_TYPE, "system"); |
| | | claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); |
| | | |
| | | // 接口返回信息 |
| | | Map<String, Object> rspMap = new HashMap<String, Object>(); |
| | | rspMap.put("access_token", JwtUtils.createToken(claimsMap)); |
| | |
| | | loginUser.setLoginTime(System.currentTimeMillis()); |
| | | loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); |
| | | // 根据uuid将loginUser缓存 |
| | | String userKey = getTokenKey(loginUser.getToken()); |
| | | redisService.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); |
| | | String tokenKey = getTokenKey(loginUser.getToken()); |
| | | redisService.setCacheObject(tokenKey, loginUser, expireTime, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | public void refreshToken1(LoginUserApplet dto) { |
| | |
| | | private String getTokenKey(String token) { |
| | | return ACCESS_TOKEN + token; |
| | | } |
| | | |
| | | private String getUserKey(Long userid) { |
| | | return ACCESS_TOKEN + userid; |
| | | } |
| | | } |
| | |
| | | import io.jsonwebtoken.Claims; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | return ServletUtils.webFluxResponseWriter(exchange.getResponse(), msg, HttpStatus.UNAUTHORIZED); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取缓存key |
| | | */ |
| | |
| | | import com.ruoyi.common.security.annotation.EnableRyFeignClients; |
| | | import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setRoleType(1); |
| | | user.setPassWordUpdate(new Date()); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(user.getRoleId()); |
| | |
| | | sysUserVo.setSysUser(sysUser); |
| | | sysUserVo.setRoles(roles); |
| | | sysUserVo.setPermissions(permissions); |
| | | |
| | | return R.ok(sysUserVo); |
| | | } |
| | | |
| | |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="forbiddenRemark" column="forbidden_remark"/> |
| | | <result property="remark" column="remark" /> |
| | | <result property="passWordUpdate" column="passWordUpdate" /> |
| | | <result property="roleType" column="roleType" /> |
| | | <result property="objectId" column="objectId" /> |
| | | <association property="dept" column="dept_id" javaType="com.ruoyi.system.api.domain.SysDept" resultMap="deptResult" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.passWordUpdate, |
| | | d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, |
| | | r.role_id, r.role_name, r.role_key, r.data_scope, r.status as role_status ,u.roleType as roleType,u.objectId AS objectId |
| | | from sys_user u |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.other.api.vo.CouponListVOVO; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @Log(title = "【扫一扫】添加车辆", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "添加车辆", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/addCar") |
| | | public AjaxResult addCar(@RequestBody TAppUserCar dto) { |
| | |
| | | public R<List<ExchangeRecordVO>> getExchangeRecordByCouponId(@RequestBody ExchangeRecordGoodsQuery couponId){ |
| | | return R.ok(tAppCouponService.pagelist(couponId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "优惠卷可用数量", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping(value = "/couponCount") |
| | | public R<Long> couponCount() { |
| | |
| | | import com.ruoyi.account.service.TAppUserAddressService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 添加用户地址管理 |
| | | */ |
| | | @Log(title = "【我的】添加用户地址", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "添加用户地址") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TAppUserAddress dto) { |
| | |
| | | /** |
| | | * 修改用户地址 |
| | | */ |
| | | @Log(title = "【我的】设置默认地址", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "设置默认地址") |
| | | @GetMapping(value = "/setDefaultAddress") |
| | | public AjaxResult<String> setDefaultAddress(@RequestParam(value = "id") Long id) { |
| | |
| | | /** |
| | | * 修改用户地址 |
| | | */ |
| | | @Log(title = "【我的】修改用户地址", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "修改用户地址") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TAppUserAddress dto) { |
| | |
| | | /** |
| | | * 删除用户地址 |
| | | */ |
| | | @Log(title = "【我的】删除用户地址", businessType = BusinessType.DELETE,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "删除用户地址") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Long id) { |
| | |
| | | // 指定发送邮件的主机为 |
| | | String host = "smtp.163.com"; |
| | | Properties properties = new Properties(); |
| | | properties.put("mail.smtp.host", "smtp.163.com"); |
| | | properties.put("mail.smtp.host", host); |
| | | properties.put("mail.smtp.socketFactory.port", "465"); |
| | | properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); |
| | | properties.put("mail.smtp.auth", "true"); |
| | |
| | | public javax.mail.PasswordAuthentication getPasswordAuthentication() |
| | | { |
| | | //发件人邮件用户名、授权码,换成自己的发件箱及授权码 |
| | | return new PasswordAuthentication("13281306557@163.com", "NUSdxDQqadYvVek2"); |
| | | return new PasswordAuthentication(from, "NUSdxDQqadYvVek2"); |
| | | } |
| | | }); |
| | | |
| | |
| | | // Set From,设置发件人 |
| | | InternetAddress fromMail = new InternetAddress(from); |
| | | //设置发件人名称,TODO 换成自己的发件箱 |
| | | fromMail.setPersonal(MimeUtility.encodeText("明星新能源科技有限公司<13281306557@163.com>")); |
| | | fromMail.setPersonal(MimeUtility.encodeText("明星新能源科技有限公司<" + from + ">")); |
| | | message.setFrom(fromMail); |
| | | // Set To: 设置收件人 |
| | | InternetAddress toMail = new InternetAddress(to); |
| | |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "查询当前用户是否为会员 0否1是", tags = {"小程序--查询当前用户是否为会员"}) |
| | | @PostMapping(value = "/getUserInfo") |
| | | public AjaxResult<Integer> getUserInfo() { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "用户详情积分明细", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/points/page1") |
| | | public R<Page<TAppUserIntegralChange>> pointsDetail1(@RequestBody PointsQueryDto pointsQueryDto) { |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "积分详情", tags = {"小程序-个人中心"}) |
| | | @GetMapping(value = "/user/points/detail") |
| | | public R<TAppUserIntegralChange> pointsDetail(String id) { |
| | |
| | | } |
| | | @Resource |
| | | private TAppUserVipDetailService appUserVipDetailService; |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "个人中心信息", tags = {"小程序-个人中心"}) |
| | | @GetMapping(value = "/user/info") |
| | | public R<AppUserInfoDto> info() { |
| | |
| | | appUserInfoDto.setPoints(byId.getPoints()==null?0:byId.getPoints()); |
| | | return R.ok(appUserInfoDto); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】设置头像", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "设置头像", tags = {"小程序-个人中心"}) |
| | | @GetMapping(value = "/user/set/avatar") |
| | | public R avatar(String url) { |
| | |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @GetMapping(value = "/user/coupon") |
| | | public R<ListInfoCouponDto> userCoupon(@RequestParam("type") Integer type) { |
| | |
| | | return R.ok(listInfoCouponDto); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/coupon/getById") |
| | | public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) |
| | | @PostMapping(value = "/user/invite/page") |
| | | public R<Page<TInviteUser>> invitePage(@RequestBody BasePage basePage) { |
| | |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) |
| | | @GetMapping(value = "/user/invite/info") |
| | | public R<InviteInfoDto> inviteInfo() { |
| | |
| | | |
| | | return R.ok(inviteInfoDto); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】更换手机号", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) |
| | | @PostMapping(value = "/user/updatePhone") |
| | | public AjaxResult<String> updatePhone(@Validated @RequestBody UpdatePhoneDTO dto) { |
| | |
| | | appUserService.updateById(appUser1); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】注销接口", businessType = BusinessType.DELETE,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "注销接口", tags = {"小程序-用户管理-注销账号"}) |
| | | @DeleteMapping("/logoff") |
| | | public AjaxResult<?> logoff(HttpServletRequest request) { |
| | |
| | | return R.ok(appUserService.list(Wrappers.lambdaQuery(TAppUser.class) |
| | | .eq(TAppUser::getPhone,phone))); |
| | | } |
| | | |
| | | |
| | | @Log(title = "【我的】签到", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "签到", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/sign") |
| | | public R sign() { |
| | |
| | | } |
| | | |
| | | |
| | | //已签到日期 |
| | | @ApiOperation(value = "本月已签到日期", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/has/sign") |
| | | public R<List<TAppUserSign>> hasSign() { |
| | |
| | | return R.ok(signRecords); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //已连续签到多少天 |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "本月已连续签到天数", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/continue/sign") |
| | | public R continueSign() { |
| | |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】添加编辑车辆", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) |
| | | @PostMapping(value = "/user/car/addOrUpdate") |
| | | public R carAdd(@RequestBody TAppUserCar appUserCar) { |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Log(title = "【我的】添加编辑车辆", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/delete") |
| | | public R carDelete(String id) { |
| | |
| | | boolean b = appUserCarService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "车辆详情", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/detail") |
| | | public R<TAppUserCar> carDetail(String id) { |
| | |
| | | } |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取车辆品牌", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getBrands") |
| | | public R getBrands(String name) throws Exception { |
| | |
| | | return R.ok(data); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "根据品牌获取车系", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getModel") |
| | | public R getModel(String id) throws Exception { |
| | |
| | | } |
| | | return R.ok(backList); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "根据车系获取车型", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getSeries") |
| | | public R getSeries(String id) throws Exception { |
| | |
| | | return R.ok(data); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "根据车型获取详情", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getDetail") |
| | | public R getDetail(String id) throws Exception { |
| | |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】修改个人信息", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @PostMapping(value = "/user/editAppUserInfo") |
| | | @ApiOperation(value = "修改个人信息", tags = {"小程序-个人中心"}) |
| | | public AjaxResult editAppUserInfo(@RequestBody TAppUser appUser){ |
| | |
| | | String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3); |
| | | System.err.println(result3); |
| | | } |
| | | |
| | | |
| | | @Log(title = "【我的】退出登录", businessType = BusinessType.STOP,operatorType = OperatorType.MOBILE) |
| | | @PostMapping(value = "/user/logOut") |
| | | @ApiOperation(value = "退出登录", tags = {"小程序-个人中心"}) |
| | | public AjaxResult logOut(){ |
| | |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.account.util.VipInfoDto; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.dto.VipCouponDto; |
| | |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getVipUseDetail") |
| | | @ApiOperation(value = "生效会员列表", tags = {"小程序-个人中心"}) |
| | | public R<List<TAppUserVipDetail>> getVipUseDetail(){ |
| | |
| | | import com.ruoyi.account.api.vo.InvoiceInformationVo; |
| | | import com.ruoyi.account.service.TInvoiceInformationService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】添加开票抬头数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ResponseBody |
| | | @PostMapping(value = "/addInvoiceInformation") |
| | | @ApiOperation(value = "添加开票抬头数据", tags = {"小程序-充电发票"}) |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1; |
| | | return AjaxResult.success(siteService.pageList(query,isLogin)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"}) |
| | |
| | | int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1; |
| | | return AjaxResult.success(siteService.getMapSiteList(query,isLogin)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点详细信息", tags = {"小程序-站点管理-站点详情"}) |
| | | @PostMapping("/getDetailById") |
| | | public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){ |
| | |
| | | } |
| | | return AjaxResult.success(siteDetailVO); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点下充电桩及充电枪列表", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunList") |
| | | public AjaxResult<List<TChargingPileVO>> getChargingGunList(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId, |
| | |
| | | return AjaxResult.success(chargingGunService.getChargingGunCount(siteId)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunCount1") |
| | | public AjaxResult<Map<String,ChargingGunCountVO>> getChargingGunCount1(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId){ |
| | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; |
| | | import com.ruoyi.chargingPile.api.vo.GunStatusStatisticsVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.*; |
| | | import com.ruoyi.chargingPile.config.FileUploadConfig; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).eq(TChargingGun::getFullNumber, fullNumber)); |
| | | return R.ok(chargingGun); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据枪唯一码查询信息 |
| | | * @return |
| | | */ |
| | | @ApiOperation(tags = {"大屏-对外开放区车位使用情况"},value = "对外开放区车位使用情况") |
| | | @GetMapping("/getLargeScreenGun") |
| | | public R<LargeScreenGunVo> getLargeScreenGun(){ |
| | | LargeScreenGunVo largeScreenGunVo = new LargeScreenGunVo(); |
| | | List<TChargingGun> tChargingGuns = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getSiteId,25,26).in(TChargingGun::getChargeMode, 1,2,4)); |
| | | if(tChargingGuns.isEmpty()){ |
| | | return R.ok(largeScreenGunVo); |
| | | } |
| | | List<TChargingGun> supperFast = tChargingGuns.stream().filter(e -> e.getChargeMode() == 1).collect(Collectors.toList()); |
| | | largeScreenGunVo.setSuperFast(supperFast.size()); |
| | | int supperFastSize = supperFast.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); |
| | | largeScreenGunVo.setUseSuperFast(supperFastSize); |
| | | List<TChargingGun> fast = tChargingGuns.stream().filter(e -> e.getChargeMode() == 2).collect(Collectors.toList()); |
| | | largeScreenGunVo.setFast(fast.size()); |
| | | int fastSize = fast.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); |
| | | largeScreenGunVo.setUseFast(fastSize); |
| | | List<TChargingGun> v2g = tChargingGuns.stream().filter(e -> e.getChargeMode() == 4).collect(Collectors.toList()); |
| | | largeScreenGunVo.setV2g(v2g.size()); |
| | | int v2gSize = v2g.stream().filter(e -> e.getStatus() != 2).collect(Collectors.toList()).size(); |
| | | largeScreenGunVo.setUseV2g(v2gSize); |
| | | |
| | | return R.ok(largeScreenGunVo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 大屏 根据站点ids和充电模式集合查询充电枪集合 没有过滤del_flag |
| | | */ |
| | | @GetMapping("/getGunIdsBySiteIdsAndChargeModels") |
| | | public R<List<Integer>> getGunIdsBySiteIdsAndChargeModels(@RequestParam("siteIds") List<Integer> siteIds ,@RequestParam("chargeModels") List<Integer> chargeModels){ |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>() |
| | | .select(TChargingGun::getId).in(TChargingGun::getSiteId, siteIds) |
| | | .in(TChargingGun::getChargeMode, chargeModels)); |
| | | return R.ok(list.stream().map(TChargingGun::getId).collect(Collectors.toList())); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | private final TChargingPileService chargingPileService; |
| | | private final TChargingGunService chargingGunService; |
| | | |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | |
| | | String gun_code = vo.getGun_code(); |
| | | //0:正常,1:故障,2=插枪 |
| | | Integer status = vo.getStatus(); |
| | | Map<String, Object> charging_pile_online = redisService.getCacheMap("charging_gun_online"); |
| | | Long time = (Long) charging_pile_online.get(pile_code + gun_code); |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", (pile_code + gun_code)); |
| | | //小于1分钟才处理数据,防止频繁查询数据 |
| | | if(null != time && (System.currentTimeMillis() - time) < 60000){ |
| | | return; |
| | | } |
| | | TChargingGun tChargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getFullNumber, (pile_code + gun_code)).eq(TChargingGun::getDelFlag, 0)); |
| | | if(null != tChargingGun){ |
| | | charging_pile_online.put(tChargingGun.getFullNumber(), System.currentTimeMillis()); |
| | | redisService.setCacheMap("charging_gun_online", charging_pile_online); |
| | | redisTemplate.opsForHash().put("charging_gun_online", tChargingGun.getFullNumber(), System.currentTimeMillis()); |
| | | |
| | | TChargingPile chargingPile = chargingPileService.getById(tChargingGun.getChargingPileId()); |
| | | //枪处于离线或者故障,返回状态为正常,则修改其状态 |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | private IotInterfaceClient iotInterfaceClient; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private TFaultMessageService faultMessageService; |
| | |
| | | */ |
| | | @Override |
| | | public void updateStatus() { |
| | | Map<String, Object> charging_gun_online = redisService.getCacheMap("charging_gun_online"); |
| | | Set<String> keySet = charging_gun_online.keySet(); |
| | | List<TChargingGun> list = new ArrayList<>(); |
| | | if(keySet.size() > 0){ |
| | | list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).in(TChargingGun::getFullNumber, keySet)); |
| | | } |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0)); |
| | | for (TChargingGun chargingGun : list) { |
| | | Long time = (Long) charging_gun_online.get(chargingGun.getFullNumber()); |
| | | Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", chargingGun.getFullNumber()); |
| | | //判断设备是否真的离线3分钟(2分钟+代码中的60秒间隔处理存储) |
| | | if(null != time && System.currentTimeMillis() - time > 180000){ |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.vo.UpdateChargingPileStatusVo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.integration.api.model.*; |
| | |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * iotda消息监听 |
| | |
| | | private IotMessageProduce iotMessageProduce; |
| | | @Resource |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private ChargingPileClient chargingPileClient; |
| | | |
| | | |
| | | |
| | |
| | | break; |
| | | case SendTagConstant.PING: |
| | | PingMessage pingMessage = JSON.parseObject(content.toJSONString(),PingMessage.class); |
| | | sendResult = enhanceProduce.pingMessage(pingMessage); |
| | | //存储缓存中,5分钟有效 |
| | | redisTemplate.opsForValue().set("ping:" + pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(), pingMessage, 5, TimeUnit.MINUTES); |
| | | sendResult = null; |
| | | // sendResult = enhanceProduce.pingMessage(pingMessage); |
| | | // chargingMessage.setPingMessage(pingMessage); |
| | | // chargingMessageUtil.handleMessage(chargingMessage); |
| | | // 响应硬件 |
| | |
| | | pong.setCharging_gun_code(pingMessage.getCharging_gun_code()); |
| | | pong.setCharging_gun_status(0); |
| | | iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | |
| | | UpdateChargingPileStatusVo vo1 = new UpdateChargingPileStatusVo(); |
| | | vo1.setGun_code(pingMessage.getCharging_gun_code()); |
| | | vo1.setPile_code(pingMessage.getCharging_pile_code()); |
| | | vo1.setStatus(pingMessage.getCharging_gun_status()); |
| | | chargingPileClient.updateChargingPileStatus(vo1); |
| | | // 监管平台推送充电设备状态 |
| | | String gunCode = pingMessage.getCharging_pile_code() + pingMessage.getCharging_gun_code(); |
| | | ChargingMessage chargingMessage1 = new ChargingMessage(); |
| | | chargingMessage1.setServiceId(SendTagConstant.GUN_STATUS); |
| | | GunStatusMessage gunStatusMessage = new GunStatusMessage(); |
| | | gunStatusMessage.setFullNumber(gunCode); |
| | | chargingMessage1.setGunStatusMessage(gunStatusMessage); |
| | | sendResult = enhanceProduce.gunStatusMessage(chargingMessage1); |
| | | |
| | | |
| | | // sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
New file |
| | |
| | | package com.ruoyi.jianguan.controller; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.ruoyi.chargingPile.api.vo.LargeScreenGunVo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.jianguan.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.jianguan.vo.LargeChargingPowerVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api(tags = "大屏") |
| | | @RestController |
| | | @RequestMapping("/large-screen") |
| | | public class LargeScreenController { |
| | | |
| | | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | private final UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | public LargeScreenController(UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService) { |
| | | this.uploadRealTimeMonitoringDataService = uploadRealTimeMonitoringDataService; |
| | | } |
| | | |
| | | |
| | | @SneakyThrows |
| | | @ApiOperation(tags = {"大屏-停车场充电功率曲线图"},value = "停车场充电功率曲线图") |
| | | @GetMapping("/getChargingPower") |
| | | public R<List<LargeChargingPowerVo>> getChargingPower(){ |
| | | String sevenDayAgo = LocalDate.now().minusDays(7) + " 00:00:00"; |
| | | String oneDayAgo = LocalDate.now().minusDays(1) + " 23:59:59"; |
| | | Date oneDayAgoTime = format.parse(oneDayAgo); |
| | | Date sevenDayAgoTime = format.parse(sevenDayAgo); |
| | | ArrayList<LargeChargingPowerVo> largeChargingPowerVos = new ArrayList<>(); |
| | | List<UploadRealTimeMonitoringData> rangeTimeData = uploadRealTimeMonitoringDataService.getRangeTimeData(oneDayAgoTime, sevenDayAgoTime); |
| | | for (int count = 7; count > 0; count--) { |
| | | LargeChargingPowerVo largeChargingPowerVo = new LargeChargingPowerVo(); |
| | | String time = LocalDate.now().minusDays(count).toString(); |
| | | List<UploadRealTimeMonitoringData> list = rangeTimeData.stream().filter(e -> e.getCreateTime().contains(time)).collect(Collectors.toList()); |
| | | if(!list.isEmpty()){ |
| | | BigDecimal powerAverage = list.stream().map(UploadRealTimeMonitoringData::getPower).reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(list.size()), 0, RoundingMode.HALF_UP); |
| | | largeChargingPowerVo.setPower(powerAverage); |
| | | } |
| | | largeChargingPowerVo.setTime(time); |
| | | largeChargingPowerVos.add(largeChargingPowerVo); |
| | | } |
| | | |
| | | return R.ok(largeChargingPowerVos); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.jianguan.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel("大屏 停车场充电功率曲线Vo") |
| | | public class LargeChargingPowerVo { |
| | | @ApiModelProperty("时间") |
| | | private String time; |
| | | |
| | | @ApiModelProperty("平均功率") |
| | | private BigDecimal power=BigDecimal.ONE; |
| | | } |
| | |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.export.*; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.dto.SettlementConfirmAdd; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.SettlementListQuery; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderListVO; |
| | | import com.ruoyi.order.api.vo.SettlementTotalVO; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.order.export.OrderInvoiceExport; |
| | | import com.ruoyi.order.export.TChargingOrderExport; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderTimeVO; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.api.vo.SettlementTotalVO; |
| | | import com.ruoyi.order.export.TChargingOrderExport; |
| | | import com.ruoyi.order.service.AccountingStrategyOrderService; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import com.ruoyi.order.service.TSettlementConfirmService; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | package com.ruoyi.order.controller; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.util.PreviousSixMonths; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import com.ruoyi.order.vo.WatchChargingOrderVo; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | chargingOrderInfoVO.setList(list); |
| | | return AjaxResult.success(chargingOrderInfoVO); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Log(title = "【扫一扫】添加评价", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ResponseBody |
| | | @PostMapping(value = "/addEvaluate") |
| | | @ApiOperation(value = "添加评价", tags = {"小程序-扫一扫"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "【扫一扫】支付充电充值费用", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @ResponseBody |
| | | @PostMapping(value = "/paymentChargingOrder") |
| | | @ApiOperation(value = "支付充电充值费用", tags = {"小程序-扫一扫"}) |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/preChargeCheck/{id}") |
| | | @ApiOperation(value = "获取安全检测数据", tags = {"小程序-扫一扫"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/getChargingDetails/{id}") |
| | | @ApiOperation(value = "获取充电中页面数据", tags = {"小程序-扫一扫"}) |
| | |
| | | ChargingDetails chargingDetails = chargingOrderService.getChargingDetails(id); |
| | | return AjaxResult.success(chargingDetails); |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "【扫一扫】手动停止充电", businessType = BusinessType.STOP,operatorType = OperatorType.MOBILE) |
| | | @ResponseBody |
| | | @PutMapping(value = "/stopCharging/{id}") |
| | | @ApiOperation(value = "手动停止充电", tags = {"小程序-扫一扫"}) |
| | |
| | | @PostMapping(value = "/work/chargeDetail") |
| | | @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"}) |
| | | public R workCharge(@RequestBody ChargingDetailQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | if (statisticsQueryDto.getDayType()==1) { |
| | | List<Map<String,Object>> charMap1 = chargingOrderService.getHourType(siteIds,statisticsQueryDto); |
| | | List<Map<String, Object>> charMap = new ArrayList<>(); |
| | | // 生成从 "00:00" 到 "23:00" 的时间数据 |
| | | for (int hour = 0; hour < 24; hour++) { |
| | | String time = String.format("%02d:00", hour); |
| | | Map<String, Object> mapWithTimeValue = findMapWithTimeValue(charMap1, time); |
| | | if (mapWithTimeValue!=null){ |
| | | charMap.add(mapWithTimeValue); |
| | | }else { |
| | | Map<String, Object> timeMap = new HashMap<>(); |
| | | timeMap.put("time", time); // 初始化值为 null |
| | | timeMap.put("electrovalence", 0); |
| | | timeMap.put("orderCount", 0); |
| | | timeMap.put("servicecharge", 0); |
| | | timeMap.put("electricity", 0); |
| | | charMap.add(timeMap); |
| | | try { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | // 假设 chargingOrderService.getDateType() 返回的是按天的数据 |
| | | List<Map<String, Object>> charMap1 = chargingOrderService.getDateType(siteIds, statisticsQueryDto); |
| | | |
| | | // 解析 startTime 和 endTime 为 LocalDate |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateMap.put("electricity", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | if (statisticsQueryDto.getDayType()==1) { |
| | | List<Map<String,Object>> charMap1 = chargingOrderService.getHourType(siteIds,statisticsQueryDto); |
| | | List<Map<String, Object>> charMap = new ArrayList<>(); |
| | | // 生成从 "00:00" 到 "23:00" 的时间数据 |
| | | for (int hour = 0; hour < 24; hour++) { |
| | | String time = String.format("%02d:00", hour); |
| | | Map<String, Object> mapWithTimeValue = findMapWithTimeValue(charMap1, time); |
| | | if (mapWithTimeValue!=null){ |
| | | charMap.add(mapWithTimeValue); |
| | | }else { |
| | | Map<String, Object> timeMap = new HashMap<>(); |
| | | timeMap.put("time", time); // 初始化值为 null |
| | | timeMap.put("electrovalence", 0); |
| | | timeMap.put("orderCount", 0); |
| | | timeMap.put("servicecharge", 0); |
| | | timeMap.put("electricity", 0); |
| | | charMap.add(timeMap); |
| | | } |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | // 假设 chargingOrderService.getDateType() 返回的是按天的数据 |
| | | List<Map<String, Object>> charMap1 = chargingOrderService.getDateType(siteIds, statisticsQueryDto); |
| | | |
| | | // 解析 startTime 和 endTime 为 LocalDate |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateMap.put("electricity", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | |
| | | // return dateRangeStatistics; |
| | | return R.ok(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> charMap1 = chargingOrderService.getMonthType(siteIds,statisticsQueryDto); |
| | | // 解析 startTime 和 endTime 为 LocalDate |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateMap.put("electricity", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | return R.ok(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> charMap1 = chargingOrderService.getMonthType(siteIds,statisticsQueryDto); |
| | | // 解析 startTime 和 endTime 为 LocalDate |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(charMap1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateMap.put("electricity", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusMonths(1); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusMonths(1); |
| | | return R.ok(dateRangeStatistics); |
| | | |
| | | } |
| | | return R.ok(dateRangeStatistics); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return R.ok(); |
| | | |
| | |
| | | return chargingOrderService.pushOrderInfo(code); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加汇总数据(临时) |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping(value = "/addChargingOrderSummaryData") |
| | | public R addChargingOrderSummaryData(){ |
| | | return chargingOrderService.addChargingOrderSummaryData(); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩数据大屏 新能源汽车电池安全检测次数统计 |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping(value = "/getStatisticsOfBattery") |
| | | @ApiOperation(value = "新能源汽车电池安全检测次数统计", tags = {"充电桩数据大屏"}) |
| | | public R<StatisticsOfBatteryVO> getStatisticsOfBattery(){ |
| | | |
| | | return chargingOrderService.getStatisticsOfBattery(); |
| | | } |
| | | |
| | | /** |
| | | * 充电桩数据大屏 获取站点集合中总的充电量 |
| | | */ |
| | | @GetMapping("/getSumDegreeBySiteIds") |
| | | public R<BigDecimal> getSumDegreeBySiteIds(@RequestParam("siteIds") List<Integer> SiteIds){ |
| | | return R.ok(chargingOrderService.getSumDegreeBySiteIds(SiteIds)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】申诉订单", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ResponseBody |
| | | @PostMapping(value = "/addOrderAppeal") |
| | | @ApiOperation(value = "申诉订单", tags = {"小程序-充电记录(个人中心)"}) |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价标签及数量查询") |
| | | @GetMapping(value = "/getTagCount") |
| | | public AjaxResult<List<TEvaluationTagVO>> getTagCount(@ApiParam(value = "站点id")Integer siteId) { |
| | | return AjaxResult.ok(orderEvaluateService.getTagCount(siteId)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "充电订单评价分页列表查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TOrderEvaluateVO>> pageList(@RequestBody TOrderEvaluateQuery query) { |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-订单评价"},value = "电站详情中评价列表查询") |
| | | @GetMapping(value = "/getSiteDetailEveList") |
| | | public AjaxResult<SiteDetailEvaluateVO> getSiteDetailEveList(@RequestParam(value = "siteId")@ApiParam(value = "站点id")Integer siteId) { |
| | |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】添加评价记录", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @PostMapping(value = "/addOrderEvaluate") |
| | | @ApiOperation(value = "添加评价记录", tags = {"小程序-充电记录"}) |
| | | public AjaxResult addOrderEvaluate(@RequestBody OrderEvaluateVo query){ |
| | |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderList") |
| | | @ApiOperation(value = "获取购买订单列表", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult<Map<String, Object>> getMyShoppingOrderList(GetMyShoppingOrderList query) { |
| | | Map<String, Object> list = shoppingOrderService.getMyShoppingOrderList(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderListNum") |
| | | @ApiOperation(value = "获取购买订单列表数量", tags = {"小程序-商城购买订单"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderInfo1/{id}") |
| | | @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult<MyShoppingOrderInfo> getMyShoppingOrderInfo1(@PathVariable String id) { |
| | |
| | | return AjaxResult.success(info); |
| | | } |
| | | |
| | | |
| | | @Log(title = "【我的】确认收货操作", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @PutMapping("/confirmReceipt/{id}") |
| | | @ApiOperation(value = "确认收货操作", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult confirmReceipt(@PathVariable String id) { |
| | |
| | | } |
| | | |
| | | |
| | | @Log(title = "【我的】取消订单操作", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @PutMapping("/cancelOrder/{id}") |
| | | @ApiOperation(value = "取消订单操作", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult cancelOrder(@PathVariable String id) { |
| | |
| | | import com.ruoyi.order.api.vo.ChargingOrderListVO; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.OrderCountByDate; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | @Param("pageCurr") Integer pageCurr, @Param("pageSize") Integer pageSize); |
| | | |
| | | List<ChargingOrderVO> chargingOrder(@Param("pageInfo") PageInfo<ChargingOrderVO> pageInfo, @Param("req") ChargingOrderQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2,@Param("endTime1") String endTime1,@Param("endTime2") String endTime11); |
| | | List<ChargingOrderVO> chargingOrderNolimit( @Param("req") ChargingOrderQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2,@Param("endTime1") String endTime1,@Param("endTime2") String endTime11); |
| | | Map<String, Object> chargingOrderNolimit( @Param("req") ChargingOrderQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2,@Param("endTime1") String endTime1,@Param("endTime2") String endTime11); |
| | | |
| | | List<PayOrderDto> payOrderQuery(@Param("pageInfo")PageInfo<PayOrderDto> pageInfo,@Param("data") PayOrderQueryDto payOrderQueryDto); |
| | | |
| | |
| | | Long countNoTag(); |
| | | |
| | | Long countCar(@Param("brands") List<String> brands); |
| | | |
| | | List<OrderCountByDate> countOrdersByDate(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime,@Param("gunIds")List<Integer> gunIds); |
| | | |
| | | BigDecimal getSumDegreeBySiteIds(@Param("siteIds") List<Integer> siteIds); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.order.api.model.TChargingOrderSummaryData; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/9 11:39 |
| | | */ |
| | | public interface TChargingOrderSummaryDataMapper extends BaseMapper<TChargingOrderSummaryData> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.TChargingOrderSummaryData; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/9 11:39 |
| | | */ |
| | | public interface ITChargingOrderSummaryDataService extends IService<TChargingOrderSummaryData> { |
| | | } |
| | |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | R pushOrderInfo(String code); |
| | | |
| | | |
| | | R addChargingOrderSummaryData(); |
| | | |
| | | /** |
| | | * 大屏-新能源汽车电池安全检测次数统计 |
| | | */ |
| | | R<StatisticsOfBatteryVO> getStatisticsOfBattery(); |
| | | |
| | | BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds); |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.OrderCountByDate; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | |
| | | |
| | | @Resource |
| | | private TransactionRecordClient transactionRecordClient; |
| | | |
| | | @Resource |
| | | private ITChargingOrderSummaryDataService chargingOrderSummaryDataService; |
| | | |
| | | |
| | | |
| | |
| | | if (siteIds.isEmpty())siteIds.add(-1); |
| | | dto.setSiteIds(siteIds); |
| | | List<ChargingOrderVO> list = this.baseMapper.chargingOrder(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); |
| | | List<ChargingOrderVO> list1 = this.baseMapper.chargingOrderNolimit(dto,startTime1,startTime2,endTime1,endTime2); |
| | | BigDecimal total = new BigDecimal("0"); |
| | | long time = 0L; |
| | | BigDecimal electronicMoney = new BigDecimal("0"); |
| | | BigDecimal serviceMoney = new BigDecimal("0"); |
| | | BigDecimal commissionMoney = new BigDecimal("0"); |
| | | BigDecimal refundMoney = new BigDecimal("0"); |
| | | // BigDecimal refundMoney = new BigDecimal("0"); |
| | | BigDecimal paymentMoney = new BigDecimal("0"); |
| | | List<TChargingOrderAccountingStrategy> list3 = chargingOrderAccountingStrategyService.list(); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | List<TChargingOrderRefund> chargingOrderRefunds = chargingOrderRefundService.lambdaQuery() |
| | | .eq(TChargingOrderRefund::getRefundStatus,2).list(); |
| | | |
| | | // BigDecimal total = new BigDecimal("0"); |
| | | // long time = 0L; |
| | | // BigDecimal electronicMoney = new BigDecimal("0"); |
| | | // BigDecimal serviceMoney = new BigDecimal("0"); |
| | | // BigDecimal refundMoney = new BigDecimal("0"); |
| | | // BigDecimal paymentMoney = new BigDecimal("0"); |
| | | for (ChargingOrderVO chargingOrderVO : list1) { |
| | | if(null == chargingOrderVO.getStatus() || 5 != chargingOrderVO.getStatus()){ |
| | | continue; |
| | | } |
| | | List<TChargingOrderAccountingStrategy> list4 = list3.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderVO.getId())).collect(Collectors.toList()); |
| | | BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | electronicMoney = electronicMoney.add(electronic_reduce); |
| | | total = total.add(chargingCapacity); |
| | | if (!chargingOrderVO.getOrderSource().equals(2)) { |
| | | serviceMoney = serviceMoney.add(service_reduce); |
| | | paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); |
| | | }else{ |
| | | serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | } |
| | | if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrderVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderVO.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | time+=between; |
| | | } |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefunds.stream().filter(e -> e.getChargingOrderId() != null && e.getChargingOrderId().equals(chargingOrderVO.getId())) |
| | | .collect(Collectors.toList()); |
| | | for (TChargingOrderRefund tChargingOrderRefund : list2) { |
| | | refundMoney = refundMoney.add(tChargingOrderRefund.getRefundTotalAmount()); |
| | | } |
| | | // List<TChargingOrderRefund> chargingOrderRefunds = chargingOrderRefundService.lambdaQuery() |
| | | // .eq(TChargingOrderRefund::getRefundStatus,2).list(); |
| | | |
| | | |
| | | Map<String, Object> map = this.baseMapper.chargingOrderNolimit(dto,startTime1,startTime2,endTime1,endTime2); |
| | | // for (ChargingOrderVO chargingOrderVO : list1) { |
| | | // if(null == chargingOrderVO.getStatus() || 5 != chargingOrderVO.getStatus()){ |
| | | // continue; |
| | | // } |
| | | // List<TChargingOrderAccountingStrategy> list4 = list3.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderVO.getId())).collect(Collectors.toList()); |
| | | // BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // electronicMoney = electronicMoney.add(electronic_reduce); |
| | | // total = total.add(chargingCapacity); |
| | | // if (!chargingOrderVO.getOrderSource().equals(2)) { |
| | | // serviceMoney = serviceMoney.add(service_reduce); |
| | | // paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); |
| | | // }else{ |
| | | // serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | // paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | // } |
| | | // if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ |
| | | // LocalDateTime startTime = chargingOrderVO.getStartTime(); |
| | | // LocalDateTime endTime = chargingOrderVO.getEndTime(); |
| | | // // 计算时间差 单位秒 |
| | | // long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | // time+=between; |
| | | // } |
| | | //// List<TChargingOrderRefund> list2 = chargingOrderRefunds.stream().filter(e -> e.getChargingOrderId() != null && e.getChargingOrderId().equals(chargingOrderVO.getId())) |
| | | //// .collect(Collectors.toList()); |
| | | //// for (TChargingOrderRefund tChargingOrderRefund : list2) { |
| | | //// refundMoney = refundMoney.add(tChargingOrderRefund.getRefundTotalAmount()); |
| | | //// } |
| | | // } |
| | | if(null != map){ |
| | | tCharingOrderVO.setTotal(map.get("total")==null?BigDecimal.ZERO:(BigDecimal) map.get("total")); |
| | | tCharingOrderVO.setTime(map.get("time")==null?0L:(Long) map.get("time")); |
| | | tCharingOrderVO.setIncome((map.get("paymentMoney")==null?BigDecimal.ZERO:(BigDecimal) map.get("paymentMoney")).setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | tCharingOrderVO.setElectronicMoney((map.get("electronicMoney")==null?BigDecimal.ZERO:(BigDecimal) map.get("electronicMoney")).setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | tCharingOrderVO.setServiceMoney((map.get("serviceMoney")==null?BigDecimal.ZERO:(BigDecimal) map.get("serviceMoney")).setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | }else{ |
| | | tCharingOrderVO.setTotal(BigDecimal.ZERO); |
| | | tCharingOrderVO.setTime(0L); |
| | | tCharingOrderVO.setIncome(BigDecimal.ZERO); |
| | | tCharingOrderVO.setElectronicMoney(BigDecimal.ZERO); |
| | | tCharingOrderVO.setServiceMoney(BigDecimal.ZERO); |
| | | } |
| | | tCharingOrderVO.setTotal(total); |
| | | tCharingOrderVO.setTime(time); |
| | | tCharingOrderVO.setIncome(paymentMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | tCharingOrderVO.setElectronicMoney(electronicMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | tCharingOrderVO.setServiceMoney(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | pageInfo.setRecords(list); |
| | | tCharingOrderVO.setList(pageInfo); |
| | | return tCharingOrderVO; |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | //添加汇总统计数据 |
| | | List<TChargingOrderAccountingStrategy> list4 = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>().eq("charging_order_id", chargingOrder.getId())); |
| | | BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceMoney = BigDecimal.ZERO; |
| | | BigDecimal paymentMoney = BigDecimal.ZERO; |
| | | long time = 0; |
| | | if (!chargingOrder.getOrderSource().equals(2)) { |
| | | serviceMoney = serviceMoney.add(service_reduce); |
| | | paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); |
| | | }else{ |
| | | serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | } |
| | | if (chargingOrder.getStartTime()!=null && chargingOrder.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrder.getStartTime(); |
| | | LocalDateTime endTime = chargingOrder.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | time = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | } |
| | | TChargingOrderSummaryData summaryData = new TChargingOrderSummaryData(); |
| | | summaryData.setChargingOrderId(chargingOrder.getId()); |
| | | summaryData.setChargingCapacity(chargingCapacity); |
| | | summaryData.setChargingDuration(time); |
| | | summaryData.setIncome(paymentMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | summaryData.setElectricPrice(electronic_reduce.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | summaryData.setServicePrice(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | chargingOrderSummaryDataService.save(summaryData); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | tcecClient.notificationChargeOrderInfo(chargingOrder.getStartChargeSeq(), chargingOrder.getOperatorId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public R addChargingOrderSummaryData(){ |
| | | List<TChargingOrderAccountingStrategy> list3 = chargingOrderAccountingStrategyService.list(); |
| | | List<TChargingOrder> list1 = this.list(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getDelFlag, 0)); |
| | | for (TChargingOrder chargingOrderVO : list1) { |
| | | if(null == chargingOrderVO.getStatus() || 5 != chargingOrderVO.getStatus()){ |
| | | continue; |
| | | } |
| | | List<TChargingOrderAccountingStrategy> list4 = list3.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderVO.getId())).collect(Collectors.toList()); |
| | | BigDecimal electronic_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal service_reduce = list4.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal chargingCapacity = list4.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal serviceMoney = new BigDecimal("0"); |
| | | BigDecimal paymentMoney = new BigDecimal("0"); |
| | | if (!chargingOrderVO.getOrderSource().equals(2)) { |
| | | serviceMoney = serviceMoney.add(service_reduce); |
| | | paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce); |
| | | }else{ |
| | | serviceMoney = serviceMoney.add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | paymentMoney = paymentMoney.add(electronic_reduce).add(service_reduce.multiply(new BigDecimal("0.8"))); |
| | | } |
| | | Long time = 0L; |
| | | if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrderVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderVO.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | time+=between; |
| | | } |
| | | |
| | | TChargingOrderSummaryData summaryData = new TChargingOrderSummaryData(); |
| | | summaryData.setChargingOrderId(chargingOrderVO.getId()); |
| | | summaryData.setChargingCapacity(chargingCapacity); |
| | | summaryData.setChargingDuration(time); |
| | | summaryData.setIncome(paymentMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | summaryData.setElectricPrice(electronic_reduce.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | summaryData.setServicePrice(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | chargingOrderSummaryDataService.save(summaryData); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 大屏-新能源汽车电池安全检测次数统计 |
| | | */ |
| | | @Override |
| | | public R<StatisticsOfBatteryVO> getStatisticsOfBattery() { |
| | | StatisticsOfBatteryVO vo = new StatisticsOfBatteryVO(); |
| | | //1.计算累计次数 |
| | | //查询该俩站点的快充和超充的充电枪id集合 site_id 25 26 charge_model 1 2 |
| | | R<List<Integer>> r = chargingGunClient.getGunIdsBySiteIdsAndChargeModels(Arrays.asList(25,26),Arrays.asList(1,2)); |
| | | if (r.getCode()!=200){ |
| | | return R.ok(vo); |
| | | } |
| | | List<Integer> gunIds=r.getData(); |
| | | //统计 |
| | | Long total= 0L; |
| | | if(gunIds!=null && !gunIds.isEmpty()) { |
| | | total = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getDelFlag, 0)//未删除 |
| | | .in(TChargingOrder::getStatus, Arrays.asList(3, 5))//充电中、已结束 |
| | | .in(TChargingOrder::getChargingGunId, gunIds));//符合条件的充电枪 |
| | | } |
| | | vo.setTotal(total.intValue()); |
| | | //2.折线图 |
| | | /* // 计算日期范围:前七天(不含今日)直接查找数据量太大,内存报错 |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDateTime startDate = today.minusDays(7).atStartOfDay(); |
| | | LocalDateTime endDate = today.minusDays(1).atTime(LocalTime.MAX); |
| | | // 查询数据库 |
| | | List<OrderCountByDate> orderCounts = this.baseMapper.countOrdersByDate(startDate, endDate, gunIds);*/ |
| | | // 转换结果 |
| | | List<LocalDate> dates = new ArrayList<>(); |
| | | List<Integer> counts = new ArrayList<>(); |
| | | LocalDate today = LocalDate.now(); |
| | | // 直接查找数据量太大,内存报错,分每天查找 |
| | | for (int i = 7; i >= 1; i--) {//升序 |
| | | LocalDate day = today.minusDays(i); |
| | | LocalDateTime startOfDay = day.atStartOfDay(); |
| | | LocalDateTime endOfDay = day.atTime(LocalTime.MAX); |
| | | //统计 |
| | | Long count=0L; |
| | | if(gunIds!=null && !gunIds.isEmpty()){ |
| | | count = this.baseMapper.selectCount(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getDelFlag,0)//未删除 |
| | | .in(TChargingOrder::getStatus,Arrays.asList(3,5))//充电中、已结束 |
| | | .in(TChargingOrder::getChargingGunId,gunIds)//符合条件的充电枪 站点 超充快充 |
| | | .between(BasePojo::getCreateTime,startOfDay,endOfDay));//每天 |
| | | } |
| | | dates.add(day); |
| | | counts.add(count.intValue()); |
| | | } |
| | | vo.setDates(dates); |
| | | vo.setCounts(counts); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSumDegreeBySiteIds(List<Integer> siteIds) { |
| | | |
| | | return this.baseMapper.getSumDegreeBySiteIds(siteIds); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.api.model.TChargingOrderSummaryData; |
| | | import com.ruoyi.order.mapper.TChargingOrderSummaryDataMapper; |
| | | import com.ruoyi.order.service.ITChargingOrderSummaryDataService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/5/9 11:40 |
| | | */ |
| | | @Service |
| | | public class TChargingOrderSummaryDataServiceImpl extends ServiceImpl<TChargingOrderSummaryDataMapper, TChargingOrderSummaryData> implements ITChargingOrderSummaryDataService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class OrderCountByDate { |
| | | |
| | | private LocalDate date; |
| | | private Long count; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class StatisticsOfBatteryVO { |
| | | @ApiModelProperty("累计检测") |
| | | private Integer total; |
| | | @ApiModelProperty("日期") |
| | | private List<LocalDate> dates; |
| | | @ApiModelProperty("次数") |
| | | private List<Integer> counts; |
| | | } |
| | |
| | | |
| | | </select> |
| | | <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> |
| | | |
| | | select * from (SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | co.recharge_serial_number as serail_number, |
| | | co.payment_amount, |
| | | co.create_time as pay_time, |
| | | co.id as order_id, |
| | | co.app_user_id as user_id, |
| | | 1 as type |
| | | select * from ( |
| | | SELECT |
| | | re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | co.recharge_serial_number as serail_number, |
| | | co.payment_amount, |
| | | co.create_time as pay_time, |
| | | co.id as order_id, |
| | | co.app_user_id as user_id, |
| | | 1 as type |
| | | FROM t_charging_order_refund re |
| | | LEFT JOIN t_charging_order co ON re.charging_order_id = co.id |
| | | UNION ALL |
| | | SELECT re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | so.serial_number, |
| | | so.payment_amount, |
| | | so.create_time as pay_time, |
| | | so.id as order_id, |
| | | so.app_user_id as user_id, |
| | | 2 as type |
| | | SELECT |
| | | re.id, |
| | | re.`code`, |
| | | re.refund_code, |
| | | re.refund_title, |
| | | re.refund_reason, |
| | | re.refund_amount, |
| | | re.refund_total_amount, |
| | | re.refund_time, |
| | | re.pay_type, |
| | | re.pay_amount, |
| | | re.refund_remark, |
| | | so.serial_number, |
| | | so.payment_amount, |
| | | so.create_time as pay_time, |
| | | so.id as order_id, |
| | | so.app_user_id as user_id, |
| | | 2 as type |
| | | FROM t_shopping_order_refund re |
| | | LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id |
| | | UNION ALL |
| | | SELECT vr.id, |
| | | vr.`code`, |
| | | vr.refund_code, |
| | | vr.refund_title, |
| | | vr.refund_reason, |
| | | vr.refund_amount, |
| | | vr.refund_total_amount, |
| | | vr.refund_time, |
| | | vr.pay_type, |
| | | vr.pay_amount, |
| | | vr.refund_remark, |
| | | vo.serial_number, |
| | | vo.payment_amount, |
| | | vo.create_time as pay_time, |
| | | vo.id as order_id, |
| | | vo.app_user_id as user_id, |
| | | 3 as type |
| | | SELECT |
| | | vr.id, |
| | | vr.`code`, |
| | | vr.refund_code, |
| | | vr.refund_title, |
| | | vr.refund_reason, |
| | | vr.refund_amount, |
| | | vr.refund_total_amount, |
| | | vr.refund_time, |
| | | vr.pay_type, |
| | | vr.pay_amount, |
| | | vr.refund_remark, |
| | | vo.serial_number, |
| | | vo.payment_amount, |
| | | vo.create_time as pay_time, |
| | | vo.id as order_id, |
| | | vo.app_user_id as user_id, |
| | | 3 as type |
| | | FROM t_vip_order_refund vr |
| | | LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id |
| | | |
| | | |
| | | ) o |
| | | <where> |
| | | <if test="data.code != null and data.code != ''"> |
| | |
| | | |
| | | </select> |
| | | <select id="getHourType" resultType="java.util.Map"> |
| | | select |
| | | aa.time, |
| | | sum(aa.servicecharge) as servicecharge, |
| | | sum(aa.electrovalence) as electrovalence, |
| | | sum(aa.electricity) as electricity, |
| | | count(1) as orderCount |
| | | from ( |
| | | SELECT |
| | | DATE_FORMAT( |
| | | DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | a.start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | a.end_time |
| | | </if> |
| | | , '%H:00' ) as time, |
| | | SUM(CASE |
| | | , '%H:00') as time, |
| | | (CASE |
| | | WHEN a.order_source = 0 THEN b.period_service_price |
| | | WHEN a.order_source = 1 THEN b.period_service_price |
| | | ELSE b.period_service_price * 0.8 |
| | | END) as servicecharge, |
| | | SUM(b.period_electric_price) as electrovalence, |
| | | SUM(b.charging_capacity) as electricity, |
| | | count(1) as orderCount |
| | | (b.period_electric_price) as electrovalence, |
| | | (b.charging_capacity) as electricity |
| | | FROM |
| | | t_charging_order a |
| | | t_charging_order a |
| | | left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price, sum(charging_capacity) as charging_capacity, sum(period_electric_price + period_service_price) as money from t_charging_order_accounting_strategy group by charging_order_id) b on (a.id = b.charging_order_id) |
| | | WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE( |
| | | WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | a.create_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | a.end_time |
| | | </if> |
| | | ) = #{statisticsQueryDto.hourDate} |
| | | , '%Y-%m-%d') = #{statisticsQueryDto.hourDate} |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and a.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | ) as aa GROUP BY aa.time ORDER BY aa.time |
| | | </select> |
| | | <select id="getDateType" resultType="java.util.Map"> |
| | | select |
| | | aa.time, |
| | | sum(aa.servicecharge) as servicecharge, |
| | | sum(aa.electrovalence) as electrovalence, |
| | | sum(aa.electricity) as electricity, |
| | | count(1) as orderCount |
| | | from ( |
| | | SELECT |
| | | DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | a.end_time |
| | | </if> |
| | | , '%Y-%m-%d' ) as time, |
| | | SUM(CASE |
| | | , '%Y-%m-%d') as time, |
| | | (CASE |
| | | WHEN a.order_source = 0 THEN b.period_service_price |
| | | WHEN a.order_source = 1 THEN b.period_service_price |
| | | ELSE b.period_service_price * 0.8 |
| | | END) as servicecharge, |
| | | SUM(b.period_electric_price) as electrovalence, |
| | | SUM(b.charging_capacity) as electricity, |
| | | count(1) as orderCount |
| | | (b.period_electric_price) as electrovalence, |
| | | (b.charging_capacity) as electricity |
| | | FROM |
| | | t_charging_order a |
| | | left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price, sum(charging_capacity) as charging_capacity, sum(period_electric_price + period_service_price) as money from t_charging_order_accounting_strategy group by charging_order_id) b on (a.id = b.charging_order_id) |
| | | WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE( |
| | | WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | a.start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | a.end_time |
| | | </if> |
| | | ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | , '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and a.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | ) as aa GROUP BY aa.time ORDER BY aa.time |
| | | </select> |
| | | <select id="getMonthType" resultType="java.util.Map"> |
| | | select |
| | | aa.time, |
| | | sum(aa.servicecharge) as servicecharge, |
| | | sum(aa.electrovalence) as electrovalence, |
| | | sum(aa.electricity) as electricity, |
| | | count(1) as orderCount |
| | | from ( |
| | | SELECT |
| | | DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | a.end_time |
| | | </if> |
| | | , '%Y-%m' ) as time, |
| | | SUM(CASE |
| | | , '%Y-%m') as time, |
| | | (CASE |
| | | WHEN a.order_source = 0 THEN b.period_service_price |
| | | WHEN a.order_source = 1 THEN b.period_service_price |
| | | ELSE b.period_service_price * 0.8 |
| | | END) as servicecharge, |
| | | SUM(b.period_electric_price) as electrovalence, |
| | | SUM(b.charging_capacity) as electricity, |
| | | count(1) as orderCount |
| | | (b.period_electric_price) as electrovalence, |
| | | (b.charging_capacity) as electricity |
| | | FROM |
| | | t_charging_order a |
| | | left join (select charging_order_id, sum(period_electric_price) as period_electric_price, sum(period_service_price) as period_service_price, sum(charging_capacity) as charging_capacity, sum(period_electric_price + period_service_price) as money from t_charging_order_accounting_strategy group by charging_order_id) b on (a.id = b.charging_order_id) |
| | | WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE( |
| | | WHERE a.del_flag = 0 and a.status = 5 and a.recharge_payment_status = 2 and DATE_FORMAT( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | a.start_time |
| | | </if> |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | a.end_time |
| | | </if> |
| | | ) between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | , '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and a.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | |
| | | |
| | | ) as aa GROUP BY aa.time ORDER BY aa.time |
| | | </select> |
| | | <select id="getchargingCapacity" resultType="java.util.Map"> |
| | | SELECT |
| | |
| | | tc.name as name, |
| | | cp.name AS siteName |
| | | FROM |
| | | `charging_pile_order`.`t_charging_order` co |
| | | (select site_id,create_time,charging_gun_id, charging_pile_id, current, (CASE WHEN need_elec = 0 THEN `current` ELSE need_elec END) as need_elec from `charging_pile_order`.`t_charging_order`) co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id |
| | | <where> |
| | |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | <select id="chargingOrderNolimit" resultType="com.ruoyi.order.api.vo.ChargingOrderVO"> |
| | | select t1.* |
| | | <select id="chargingOrderNolimit" resultType="map"> |
| | | select |
| | | sum(charging_capacity) as total, |
| | | sum(charging_duration) as `time`, |
| | | sum(electric_price) as electronicMoney, |
| | | sum(income) as paymentMoney, |
| | | sum(service_price) as serviceMoney |
| | | from t_charging_order_summary_data |
| | | where charging_order_id in ( |
| | | select t1.id |
| | | from t_charging_order t1 |
| | | where 1=1 |
| | | <if test="null != req.code and req.code!=''"> |
| | |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | | </if> |
| | | and t1.del_flag = 0 |
| | | order by t1.create_time desc |
| | | ) |
| | | </select> |
| | | <select id="countOrdersByDate" resultType="com.ruoyi.order.vo.OrderCountByDate"> |
| | | SELECT DATE_FORMAT(create_time, '%m/%d') AS `date`, COUNT(*) AS `count` |
| | | FROM t_charging_order |
| | | WHERE |
| | | del_flag = 0 |
| | | and |
| | | status in (3,5) |
| | | |
| | | and charging_gun_id in |
| | | <foreach item="item" index="index" collection="gunIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | and create_time BETWEEN #{startTime} AND #{endTime} |
| | | GROUP BY DATE(create_time, '%m/%d') |
| | | ORDER BY DATE(create_time, '%m/%d') ASC |
| | | </select> |
| | | |
| | | <select id="getSumDegreeBySiteIds" resultType="java.math.BigDecimal"> |
| | | select sum(charging_capacity) from t_charging_order where del_flag=0 |
| | | and site_id in |
| | | <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | |
| | | </select> |
| | | </mapper> |
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.order.mapper.TChargingOrderSummaryDataMapper"> |
| | | |
| | | </mapper> |
| | |
| | | AND toi.create_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | AND toi.app_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | AND toi.app_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | |
| | | AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | | </if> |
| | | <if test="query.userIds != null and query.userIds.size()>0"> |
| | | AND toi.billing_user_id IN |
| | | AND toi.app_user_id IN |
| | | <foreach collection="query.userIds" close=")" open="(" item="userId" separator=","> |
| | | #{userId} |
| | | </foreach> |
| | |
| | | public AjaxResult<PageInfo<TAdvertising>> pageList(@RequestBody AdvertisingDTO dto) { |
| | | return AjaxResult.ok(advertisingService.pageList(dto)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-广告管理"},value = "广告列表查询") |
| | | @GetMapping(value = "/list") |
| | | public AjaxResult<List<TAdvertising>> list(@RequestParam("position") Integer position) { |
| | |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | /** |
| | | * 添加计费策略管理 |
| | | */ |
| | | @Log(title = "添加集团用户申请", businessType = BusinessType.INSERT) |
| | | @Log(title = "【我的】添加集团用户申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-集团用户"},value = "添加集团用户申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@Validated @RequestBody TEnterpriseUserApplication dto) { |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | |
| | | List<TEvaluationTag> tEvaluationTags = evaluationTagService.listByIds(tagIds); |
| | | return R.ok(tEvaluationTags); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | |
| | | TGoods byId = goodsService.getById(id); |
| | | return AjaxResult.ok(byId); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getInfoByType") |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情") |
| | | public R getInfoByType(Integer goodType,Integer id,Integer type) { |
| | |
| | | public AjaxResult<PageInfo<TGoods>> pageList(@RequestBody GoodsDTO dto) { |
| | | return AjaxResult.ok(goodsService.pageList(dto)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "商品列表分页查询") |
| | | @PostMapping(value = "/app/pageList") |
| | | public AjaxResult<PageInfo<TGoods>> apppageList(@RequestBody AppGoodQuery appGoodQuery) { |
| | | return AjaxResult.ok(goodsService.pageList1(appGoodQuery)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品检查数量") |
| | | @PostMapping(value = "/app/shop/check") |
| | | public R check(@RequestBody ExchangeDto exchangeDto) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】积分兑换商品", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") |
| | | @PostMapping(value = "/app/shop") |
| | | public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | |
| | | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | |
| | | @Log(title = "【我的】支付商品", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-现金商城"},value = "支付商品") |
| | | @PostMapping(value = "/app/pay") |
| | | public Object pay(@RequestBody ExchangeDto exchangeDto) { |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-首页-公告管理"},value = "查询") |
| | | @GetMapping(value = "/list") |
| | | public AjaxResult<List<TNotice>> list() { |
New file |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import com.ruoyi.other.api.dto.NoticeQueryDto; |
| | | import com.ruoyi.other.service.TNoticeService; |
| | | import com.ruoyi.other.service.TScreenContentService; |
| | | import com.ruoyi.other.util.EnergyRefreshService; |
| | | import com.ruoyi.other.vo.*; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t_screen_content") |
| | | public class TScreenContentController { |
| | | |
| | | @Resource |
| | | private TScreenContentService screenContentService; |
| | | @Resource |
| | | private EnergyRefreshService energyRefreshService; |
| | | |
| | | /** |
| | | * 顶部-累计电量 |
| | | */ |
| | | @ApiOperation(tags = {"顶部-累计电量"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/top") |
| | | public AjaxResult<ScreenTopVO> top(@RequestParam("siteIds") List<Integer> siteIds) { |
| | | return AjaxResult.success(screenContentService.top(siteIds)); |
| | | } |
| | | |
| | | /** |
| | | * 光伏发电和消纳 这里的绿电是调后台大屏内容管理的 |
| | | */ |
| | | @ApiOperation(tags = {"光伏发电和消纳"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/photovoltaicAndConsumption") |
| | | public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() { |
| | | //需调用接口 获取光伏发电量 |
| | | |
| | | return AjaxResult.success(new PhotovoltaicAndConsumptionVO()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 累计减排数据 |
| | | */ |
| | | @ApiOperation(tags = {"减排数据"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/emissionReduction") |
| | | public AjaxResult<EmissionReductionVO> emissionReduction (@RequestParam("siteIds") List<Integer> siteIds) { |
| | | return AjaxResult.success( screenContentService.emissionReduction(siteIds)); |
| | | } |
| | | /** |
| | | * 光伏发电实时情况 |
| | | */ |
| | | @ApiOperation(tags = {"光伏发电实时情况"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/photovoltaicPowerGeneration") |
| | | public AjaxResult<PhotovoltaicPowerGenerationVO> photovoltaicPowerGeneration (@RequestParam("siteIds") List<Integer> siteIds) { |
| | | return AjaxResult.success( screenContentService.photovoltaicPowerGeneration(siteIds)); |
| | | } |
| | | |
| | | /** |
| | | * 储能放电情况 |
| | | */ |
| | | @ApiOperation(tags = {"储能放电情况"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/energyStorageDischarge") |
| | | public AjaxResult<EnergyStorageDischargeVO> energyStorageDischarge() { |
| | | //需调用接口 获取光伏发电量 |
| | | EnergyStorageDischargeVO vo = new EnergyStorageDischargeVO(); |
| | | vo.setTodayDischarge(energyRefreshService.getCurrentValue()); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 停车场共享情况及相关数据 |
| | | */ |
| | | @ApiOperation(tags = {"停车场共享情况及相关数据"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/screen") |
| | | public AjaxResult<TScreenContent> screen(@RequestParam("siteIds") List<Integer> siteIds) { |
| | | List<TScreenContent> list = screenContentService.list(new LambdaQueryWrapper<TScreenContent>().in(TScreenContent::getSiteId, siteIds)); |
| | | TScreenContent tScreenContent = new TScreenContent(); |
| | | if(list==null|| list.isEmpty()){ |
| | | return AjaxResult.success(tScreenContent); |
| | | } |
| | | BeanUtils.copyProperties( list.get(0),tScreenContent); |
| | | list.remove(0); |
| | | list.forEach(x->{ |
| | | tScreenContent.setCarDischarge(tScreenContent.getCarDischarge().add(x.getCarDischarge())); |
| | | tScreenContent.setGreenElectricity(tScreenContent.getGreenElectricity().add(x.getGreenElectricity())); |
| | | tScreenContent.setGreenElectricityToday(tScreenContent.getGreenElectricityToday().add(x.getGreenElectricityToday())); |
| | | tScreenContent.setValueOne(tScreenContent.getValueOne().add(x.getValueOne())); |
| | | tScreenContent.setValueTwo(tScreenContent.getValueTwo().add(x.getValueTwo())); |
| | | tScreenContent.setValueThree(tScreenContent.getValueThree().add(x.getValueThree())); |
| | | if(tScreenContent.getStatisticalDeadline().isBefore(x.getStatisticalDeadline())) tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline()); |
| | | }); |
| | | return AjaxResult.success(tScreenContent); |
| | | } |
| | | |
| | | /** |
| | | * 数据回显 站点id |
| | | */ |
| | | //todo 鉴权 |
| | | @RequiresPermissions(value = {"/publicAnnouncementManagement"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "查询") |
| | | @GetMapping(value = "/{siteId}") |
| | | public AjaxResult<TScreenContent> detail(@PathVariable("siteId") Integer siteId) { |
| | | TScreenContent one = screenContentService.getOne(new LambdaQueryWrapper<TScreenContent>().eq(TScreenContent::getSiteId, siteId)); |
| | | return AjaxResult.success(one); |
| | | } |
| | | |
| | | /** |
| | | * 新增修改 |
| | | */ |
| | | //todo 鉴权 |
| | | @RequiresPermissions(value = {"",""}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-大屏内容设置-基础信息"},value = "新增修改") |
| | | @PostMapping(value = "/saveOrUpdate") |
| | | @Log(title = "【大屏管理】新增修改内容", businessType = BusinessType.INSERT) |
| | | public AjaxResult saveOrUpdate(@RequestBody TScreenContent screenContent) { |
| | | screenContentService.saveOrUpdate(screenContent); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | .last("LIMIT 1"))); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo") |
| | | public R<List<VipInfoDto>> vipInfo() { |
| | |
| | | |
| | | @Resource |
| | | private AppUserVipDetailClient vipDetailClient; |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "当前生效会员信息", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/recent/vipInfo") |
| | | public R<List<VipInfoDto>> recentVipInfo() { |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Log(title = "【会员】购买会员", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public Object vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | @Mapper |
| | | public interface TScreenContentMapper extends BaseMapper<TScreenContent> { |
| | | |
| | | BigDecimal getCarDisCharge(@Param("siteIds") List<Integer> siteIds); |
| | | |
| | | BigDecimal getGreenElectricity(@Param("siteIds") List<Integer> siteIds); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import com.ruoyi.other.vo.EmissionReductionVO; |
| | | import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; |
| | | import com.ruoyi.other.vo.ScreenTopVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | public interface TScreenContentService extends IService<TScreenContent> { |
| | | |
| | | EmissionReductionVO emissionReduction(List<Integer> siteIds); |
| | | |
| | | PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds); |
| | | |
| | | ScreenTopVO top(List<Integer> siteIds); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.mapper.TScreenContentMapper; |
| | | import com.ruoyi.other.mapper.TSystemConfigurationMapper; |
| | | import com.ruoyi.other.service.TScreenContentService; |
| | | import com.ruoyi.other.service.TSystemConfigurationService; |
| | | import com.ruoyi.other.vo.EmissionReductionVO; |
| | | import com.ruoyi.other.vo.PhotovoltaicPowerGenerationVO; |
| | | import com.ruoyi.other.vo.ScreenStorageConfigVO; |
| | | import com.ruoyi.other.vo.ScreenTopVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.json.Json; |
| | | import javax.json.JsonObject; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.concurrent.ThreadLocalRandom; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author huliguo |
| | | * @since 2025/5/23 |
| | | */ |
| | | @Service |
| | | public class TScreenContentServiceImpl extends ServiceImpl<TScreenContentMapper, TScreenContent> implements TScreenContentService { |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Resource |
| | | private TSystemConfigurationMapper systemConfigurationMapper; |
| | | |
| | | @Override |
| | | public EmissionReductionVO emissionReduction(List<Integer> siteIds) { |
| | | //需调用接口 计算光伏减排 |
| | | EmissionReductionVO vo = new EmissionReductionVO(); |
| | | //获取总电量 计算电量 |
| | | BigDecimal charge=new BigDecimal("0.00"); |
| | | if (siteIds!=null && !siteIds.isEmpty()){ |
| | | R<BigDecimal> r = chargingOrderClient.getSumDegreeBySiteIds(siteIds); |
| | | if (r.getCode()==200){ |
| | | charge=r.getData(); |
| | | } |
| | | } |
| | | //计算电量占比率 |
| | | if (charge.compareTo(BigDecimal.ZERO) != 0) { |
| | | // 定义乘数和除数 |
| | | BigDecimal multiplier = new BigDecimal("0.1404"); // 0.1404 |
| | | BigDecimal divisor = new BigDecimal("1000"); // 1000 |
| | | // 计算:charge × 0.1404 ÷ 1000 |
| | | charge = charge |
| | | .multiply(multiplier) // 乘以 0.1404 |
| | | .divide(divisor, 2, RoundingMode.HALF_UP); // 除以 1000,保留6位小数,四舍五入 |
| | | } |
| | | vo.setCharge(charge); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public PhotovoltaicPowerGenerationVO photovoltaicPowerGeneration(List<Integer> siteIds) { |
| | | //需调用接口 |
| | | |
| | | //假数据 |
| | | PhotovoltaicPowerGenerationVO vo = new PhotovoltaicPowerGenerationVO(); |
| | | List<LocalDate> dates = new ArrayList<>(); |
| | | List<Integer> values = new ArrayList<>(); |
| | | LocalDate today = LocalDate.now(); |
| | | // 生成每天数据 |
| | | for (int i = 7; i >= 1; i--) {//升序 |
| | | LocalDate day = today.minusDays(i); |
| | | //统计 |
| | | dates.add(day); |
| | | int value = new Random().nextInt(151) + 100; // 100-250 |
| | | values.add(value); |
| | | } |
| | | vo.setDates(dates); |
| | | vo.setValues(values); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public ScreenTopVO top(List<Integer> siteIds) { |
| | | ScreenTopVO vo = new ScreenTopVO(); |
| | | |
| | | BigDecimal charge=new BigDecimal("0.00"); |
| | | BigDecimal carCharge=new BigDecimal("0.00"); |
| | | BigDecimal greenElectricity=new BigDecimal("0.00"); |
| | | if (siteIds!=null && !siteIds.isEmpty()){ |
| | | //获取充电量 |
| | | R<BigDecimal> r = chargingOrderClient.getSumDegreeBySiteIds(siteIds); |
| | | if (r.getCode()==200){ |
| | | charge=r.getData(); |
| | | } |
| | | //汽车放电量 |
| | | carCharge = this.baseMapper.getCarDisCharge(siteIds); |
| | | |
| | | //累计绿电消纳电量 |
| | | greenElectricity = this.baseMapper.getGreenElectricity(siteIds); |
| | | } |
| | | vo.setCarCharge(charge); |
| | | vo.setCarDisCharge(carCharge); |
| | | vo.setGreenElectricity(greenElectricity); |
| | | |
| | | //获取系统建设日期和累计储能放电量 |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,3)); |
| | | //解析 |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | //计算储能充电量 |
| | | LocalDate systemCreateTime = configVO.getSystemCreateTime(); |
| | | LocalDate today = LocalDate.now(); |
| | | int days = (int) ChronoUnit.DAYS.between(systemCreateTime, today) +1;//包括今天 |
| | | |
| | | BigDecimal dailyRate = new BigDecimal("100"); |
| | | BigDecimal totalCharge = dailyRate.multiply(BigDecimal.valueOf(days)) |
| | | .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP); |
| | | vo.setStorageCharge(totalCharge); |
| | | //获取储能放电量 |
| | | |
| | | // 判断是否等于今天 |
| | | if (configVO.getLastUpdated().equals(today)) { |
| | | vo.setStorageDisCharge(configVO.getStorageDisCharge()); |
| | | return vo; |
| | | } |
| | | //判断离今天还有几天 |
| | | int count = (int) ChronoUnit.DAYS.between(configVO.getLastUpdated(), today) +1;//包括今天 |
| | | BigDecimal storageDisCharge = configVO.getStorageDisCharge(); |
| | | // 每天生成一个随机值(不超过100)并累加 |
| | | for (int i = 0; i < count; i++) { |
| | | int dailyCharge = ThreadLocalRandom.current().nextInt(0, 101); // 0-100的随机数 |
| | | storageDisCharge = storageDisCharge.add(new BigDecimal(dailyCharge)); |
| | | } |
| | | |
| | | // 更新回对象 |
| | | configVO.setStorageDisCharge(storageDisCharge); |
| | | configVO.setLastUpdated(today); |
| | | String json = JSON.toJSONString(configVO); |
| | | sysConfig.setContent(json); |
| | | |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | vo.setStorageDisCharge(storageDisCharge); |
| | | return vo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.util; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.mapper.TSystemConfigurationMapper; |
| | | import com.ruoyi.other.vo.ScreenStorageConfigVO; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalTime; |
| | | import java.util.Random; |
| | | |
| | | @Service |
| | | public class EnergyRefreshService { |
| | | private final Random random = new Random(); |
| | | @Resource |
| | | private TSystemConfigurationMapper systemConfigurationMapper; |
| | | |
| | | private final BigDecimal targetLow = new BigDecimal("85"); |
| | | |
| | | private final BigDecimal targetHigh = new BigDecimal("87"); |
| | | |
| | | |
| | | private final int maxIncrement = 10; |
| | | |
| | | private boolean isRunning = true; // 控制任务是否继续执行 |
| | | |
| | | // 定时任务方法 |
| | | @Scheduled(cron = "0 */15 * * * ?")//15分钟执行一次 |
| | | public synchronized void refreshValue() { |
| | | // 检查当前时间是否在允许的时间段内 |
| | | LocalTime now = LocalTime.now(); |
| | | boolean isInMorning = now.isAfter(LocalTime.of(10, 0)) && now.isBefore(LocalTime.of(12, 0)); |
| | | boolean isInAfternoon = now.isAfter(LocalTime.of(15, 0)) && now.isBefore(LocalTime.of(21, 0)); |
| | | |
| | | if (!isInMorning && !isInAfternoon) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | //获取当前值 |
| | | BigDecimal currentValue = getCurrentValue(); |
| | | // 检查是否已停止或达到目标范围 |
| | | if (!isRunning || isWithinTargetRange(currentValue)) { |
| | | isRunning = false; |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 生成随机增量并更新值 |
| | | int increment = random.nextInt(maxIncrement + 1); |
| | | currentValue = currentValue.add(BigDecimal.valueOf(increment)) |
| | | .setScale(2, RoundingMode.HALF_UP); |
| | | //更新值 |
| | | updateCurrentValue(currentValue); |
| | | System.out.printf("定时刷新:当前时间 %s,当前值:%.2f%n", now, currentValue); |
| | | } |
| | | |
| | | private boolean isWithinTargetRange(BigDecimal value) { |
| | | return value.compareTo(targetLow) >= 0 && value.compareTo(targetHigh) <= 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前值 |
| | | */ |
| | | public BigDecimal getCurrentValue() { |
| | | //获取系统建设日期和累计储能放电量 |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,3)); |
| | | //解析 |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | return configVO.getCurrentValue(); |
| | | } |
| | | |
| | | /** |
| | | * 更新当前值 |
| | | */ |
| | | private void updateCurrentValue(BigDecimal currentValue) { |
| | | //获取系统建设日期和累计储能放电量 |
| | | TSystemConfiguration sysConfig = systemConfigurationMapper.selectOne(new LambdaQueryWrapper<TSystemConfiguration>() |
| | | .eq(TSystemConfiguration::getType,3)); |
| | | //解析 |
| | | ScreenStorageConfigVO configVO = JSON.parseObject(sysConfig.getContent(), ScreenStorageConfigVO.class); |
| | | //更新 |
| | | configVO.setCurrentValue(currentValue); |
| | | String json = JSON.toJSONString(configVO); |
| | | sysConfig.setContent(json); |
| | | systemConfigurationMapper.updateById(sysConfig); |
| | | } |
| | | |
| | | |
| | | |
| | | // 重置任务 |
| | | @Scheduled(cron = "0 0 0 * * ?") // 每天凌晨0点执行 |
| | | public void reset() { |
| | | BigDecimal currentValue = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | updateCurrentValue(currentValue); |
| | | //更新 |
| | | this.isRunning = true; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class EmissionReductionVO { |
| | | @ApiModelProperty("累计光伏发电二氧化碳减排量(吨)") |
| | | private BigDecimal photovoltaic = new BigDecimal("63.00"); |
| | | @ApiModelProperty("累计光伏发电二氧化碳减排量(占比率)") |
| | | private BigDecimal photovoltaicRate = new BigDecimal("48.8"); |
| | | |
| | | @ApiModelProperty("累计储能二氧化碳减排量(吨)") |
| | | private BigDecimal energyStorage = new BigDecimal("20.00"); |
| | | @ApiModelProperty("累计储能二氧化碳减排量(占比率)") |
| | | private BigDecimal energyStorageRate = new BigDecimal("48.8"); |
| | | |
| | | @ApiModelProperty("累计充电二氧化碳减排量(吨)") |
| | | private BigDecimal charge; |
| | | @ApiModelProperty("累计充电二氧化碳减排量(占比率)") |
| | | private BigDecimal chargeRate = new BigDecimal("4.8"); |
| | | |
| | | @ApiModelProperty("总计二氧化碳减排量(吨)") |
| | | private BigDecimal total = new BigDecimal("48000"); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class EnergyStorageDischargeVO { |
| | | @ApiModelProperty("储能配置") |
| | | private Integer config=100; |
| | | @ApiModelProperty("今日储能") |
| | | private Integer todayStorage=100; |
| | | @ApiModelProperty("今日放能") |
| | | private BigDecimal todayDischarge; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class PhotovoltaicAndConsumptionVO { |
| | | @ApiModelProperty("光伏面积") |
| | | private Integer area = 3593; |
| | | @ApiModelProperty("装机容量") |
| | | private BigDecimal capacity = new BigDecimal("759.52"); |
| | | @ApiModelProperty("今日已发电") |
| | | private BigDecimal todayGenerateElectricity=new BigDecimal("71.29"); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PhotovoltaicPowerGenerationVO { |
| | | @ApiModelProperty("日期") |
| | | private List<LocalDate> dates; |
| | | @ApiModelProperty("数据") |
| | | private List<Integer> values; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class ScreenStorageConfigVO { |
| | | /** |
| | | * 系统建设日期 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate systemCreateTime; |
| | | |
| | | /** |
| | | * 储能放电量 随机增长,每日不超过100度 |
| | | */ |
| | | private BigDecimal storageDisCharge; |
| | | |
| | | /** |
| | | * 最后一次更改时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate lastUpdated; |
| | | |
| | | /** |
| | | * 储能放电情况 今日放能 规定时间内 随机增长 凌晨数值重置 |
| | | */ |
| | | private BigDecimal currentValue; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ScreenTopVO { |
| | | @ApiModelProperty("汽车充电量") |
| | | private BigDecimal carCharge; |
| | | @ApiModelProperty("汽车放电量") |
| | | private BigDecimal carDisCharge; |
| | | @ApiModelProperty("光伏发电量") |
| | | private BigDecimal photovoltaic=new BigDecimal("0.00"); |
| | | @ApiModelProperty("光伏用电量") |
| | | private BigDecimal greenElectricity; |
| | | @ApiModelProperty("储能充电量") |
| | | private BigDecimal storageCharge; |
| | | @ApiModelProperty("储能放电量") |
| | | private BigDecimal storageDisCharge; |
| | | |
| | | |
| | | } |
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.TScreenContentMapper"> |
| | | |
| | | <select id="getCarDisCharge" resultType="java.math.BigDecimal"> |
| | | select |
| | | sum(car_discharge) |
| | | FROM t_screen_content |
| | | WHERE |
| | | site_id in |
| | | <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | <select id="getGreenElectricity" resultType="java.math.BigDecimal"> |
| | | select |
| | | sum(green_electricity) |
| | | FROM t_screen_content |
| | | WHERE |
| | | site_id in |
| | | <foreach item="item" index="index" collection="siteIds" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |