Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
Conflicts:
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingPileClient.java
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
| | |
| | | private Long userId; |
| | | @ApiModelProperty("预付价格") |
| | | private BigDecimal payMoney; |
| | | @ApiModelProperty("桩编号") |
| | | private Integer number; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "CarListVO对象",description = "小程序-扫一扫选择车辆") |
| | | public class CarListVO { |
| | | |
| | | @ApiModelProperty(value = "图片") |
| | | private String reviewRate; |
| | | |
| | | @ApiModelProperty(value = "车型-车牌号") |
| | | private String evaluateCount; |
| | | @ApiModelProperty(value = "车辆id") |
| | | private Long driverId; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private Integer isUse; |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long couponId; |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private BigDecimal payMoney; |
| | | @ApiModelProperty(value = "最高折扣金额 用于判断哪一张优惠券优惠力度最大 前端忽略") |
| | | @ApiModelProperty(value = "使用了优惠券后的服务费 用于判断哪一张优惠券优惠力度最大 前端忽略") |
| | | private BigDecimal money; |
| | | @ApiModelProperty(value = "当前用户是否为会员0否1是 前端忽略") |
| | | private Integer isVip; |
| | |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "关联订单") |
| | | private String orderId; |
| | | @ApiModelProperty(value = "封面图") |
| | | private String coverPicture; |
| | | @ApiModelProperty(value = "详情图") |
| | | private String detailsPicture; |
| | | @ApiModelProperty(value = " 前端忽略 获取方式 1=积分兑换 2现金购买") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty(value = "优惠券id") |
| | |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id获取充电桩列表失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<BigDecimal> getServiceMoney(String param) { |
| | | return R.fail("根据会员折扣、预付金额 计算服务费失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId") |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | /** |
| | | * 小程序远程调用 根据会员折扣、预付金额 计算服务费 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getServiceMoney") |
| | | public R<BigDecimal> getServiceMoney(@RequestParam("param") String param); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "充电车辆 id") |
| | | @TableField("app_user_car_id") |
| | | private Integer appUserCarId; |
| | | private Long appUserCarId; |
| | | |
| | | @ApiModelProperty(value = "站点 id") |
| | | @TableField("site_id") |
| | |
| | | @TableField("explain") |
| | | private String explain; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | @TableField("cover_picture") |
| | | private String coverPicture; |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("details_picture") |
| | | private String detailsPicture; |
| | | |
| | | @ApiModelProperty(value = "说明") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "状态(1=上架,2=下架)") |
| | | @TableField("status") |
| | | private Integer status; |
| | |
| | | @ApiModelProperty(value = "内部会员折扣") |
| | | @TableField("discount") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "会员类型 1常规 2内部") |
| | | @ApiModelProperty(value = "添加的会员类型 1常规 2内部") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
New file |
| | |
| | | package com.ruoyi.system.api.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 用户信息 小程序登录使用 |
| | | * |
| | | * @author 无关风月 |
| | | */ |
| | | @Data |
| | | public class LoginUserApplet implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户唯一标识 |
| | | */ |
| | | private String token; |
| | | /** |
| | | * 用户姓名 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 用户名id |
| | | */ |
| | | private Integer userid; |
| | | |
| | | /** |
| | | * 用户名 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 登录时间 |
| | | */ |
| | | private Long loginTime; |
| | | |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | private Long expireTime; |
| | | |
| | | /** |
| | | * 登录IP地址 |
| | | */ |
| | | private String ipaddr; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | * 用户标识 |
| | | */ |
| | | public static final String USER_KEY = "user_key"; |
| | | /** |
| | | * 小程序登录用户标识 |
| | | */ |
| | | public static final String USER_APPLET_KEY = "user_applet_key"; |
| | | |
| | | /** |
| | | * 登录用户 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 小程序根据令牌获取用户标识 |
| | | * |
| | | * @param token 令牌 |
| | | * @return 用户ID |
| | | */ |
| | | public static String getUserKeyApplet(String token) |
| | | { |
| | | Claims claims = parseToken(token); |
| | | return getValue(claims, SecurityConstants.USER_APPLET_KEY); |
| | | } |
| | | /** |
| | | * 根据令牌获取用户ID |
| | | * |
| | | * @param token 令牌 |
| | |
| | | return getValue(claims, SecurityConstants.DETAILS_USER_ID); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据身份信息获取用户ID |
| | | * |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.obs.services.ObsClient; |
| | | import com.obs.services.model.ObjectMetadata; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | |
| | | public class ObsUploadUtil { |
| | | |
| | | public static String endPoint = "obs.cn-southwest-2.myhuaweicloud.com"; |
| | | public static String accessKeyId = "LP9N1TLAYN8ERS1PVIYK"; |
| | | public static String accessKeySecret = "bV55lFHi1cG0SYBvnab8yIgDX6etKRSLh5j1gkPR"; |
| | | public static String bucketName = "haitunyingyu"; |
| | | public static String oss_domain = "https://haitunyingyu.obs.cn-southwest-2.myhuaweicloud.com/"; |
| | | // 创建ObsClient实例 |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | public static String obsUpload(MultipartFile file) throws IOException{ |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | | InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (originalFilename.contains("apk")){ |
| | | fileName = "bf2fe5c5499341e5bc0d56c0c7d5fb2e.apk"; |
| | | System.err.println("apk"); |
| | | }else{ |
| | | fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | } |
| | | obsClient.putObject(bucketName,"admin/"+fileName,content,meta);// 上传Object. |
| | | if(fileName != null && !"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+"admin/"+fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /** |
| | | * 删除某个Object |
| | | * |
| | | * @param bucketUrl |
| | | * @return |
| | | */ |
| | | public static boolean deleteObject(String bucketUrl) { |
| | | try { |
| | | bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // 删除Object. |
| | | obsClient.deleteObject(bucketName, bucketUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | //ossClient.shutdown(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // public static void createBucket(String bucketName) |
| | | // { |
| | | // //初始化 OSSClient |
| | | //// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | // |
| | | // // 新建一个Bucket |
| | | // Bucket bucket = ossClient.createBucket(bucketName); |
| | | // System.out.println(bucket.getName()); |
| | | // System.out.println(bucket.getCreationDate()); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // OssUploadUtil.createBucket("ssfdfsd"); |
| | | // } |
| | | } |
| | |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | |
| | | rspMap.put("expires_in", expireTime); |
| | | return rspMap; |
| | | } |
| | | |
| | | /** |
| | | * 创建小程序令牌 |
| | | */ |
| | | public Map<String, Object> createTokenApplet(LoginUserApplet loginUser) { |
| | | String token = IdUtils.fastUUID(); |
| | | Integer userId = loginUser.getUserid(); |
| | | String name = loginUser.getName(); |
| | | loginUser.setToken(token); |
| | | loginUser.setIpaddr(IpUtils.getIpAddr()); |
| | | refreshToken1(loginUser); |
| | | // Jwt存储信息 |
| | | Map<String, Object> claimsMap = new HashMap<String, Object>(); |
| | | claimsMap.put(SecurityConstants.USER_APPLET_KEY, token); |
| | | claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); |
| | | claimsMap.put(SecurityConstants.DETAILS_USERNAME, name); |
| | | // 接口返回信息 |
| | | Map<String, Object> rspMap = new HashMap<String, Object>(); |
| | | rspMap.put("access_token", JwtUtils.createToken(claimsMap)); |
| | | rspMap.put("expires_in", expireTime); |
| | | return rspMap; |
| | | } |
| | | public LoginUserApplet getLoginUserApplet() { |
| | | return getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | } |
| | | public LoginUserApplet getLoginUserAppletToken(HttpServletRequest request) { |
| | | // 获取请求携带的令牌 |
| | | String token = SecurityUtils.getToken(request); |
| | | return getLoginUserApplet(token); |
| | | } |
| | | /** |
| | | * 小程序 获取用户身份信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | public LoginUserApplet getLoginUserApplet(String token) { |
| | | LoginUserApplet user = null; |
| | | try { |
| | | if (StringUtils.isNotEmpty(token)) { |
| | | String userkey = JwtUtils.getUserKeyApplet(token); |
| | | user = redisService.getCacheObject(getTokenKey(userkey)); |
| | | return user; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return user; |
| | | } |
| | | /** |
| | | * 获取用户身份信息 |
| | | * |
| | |
| | | String userKey = getTokenKey(loginUser.getToken()); |
| | | redisService.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | public void refreshToken1(LoginUserApplet dto) { |
| | | dto.setLoginTime(System.currentTimeMillis()); |
| | | dto.setExpireTime(dto.getLoginTime() + expireTime * MILLIS_MINUTE); |
| | | // 根据uuid将loginUser缓存 |
| | | String userKey = getTokenKey(dto.getToken()); |
| | | redisService.setCacheObject(userKey, dto, expireTime, TimeUnit.MINUTES); |
| | | } |
| | | private String getTokenKey(String token) |
| | | { |
| | | return ACCESS_TOKEN + token; |
| | |
| | | import com.ruoyi.account.api.dto.CouponListDto; |
| | | import com.ruoyi.account.api.dto.GrantCouponDto; |
| | | import com.ruoyi.account.api.model.TAppCoupon; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.api.query.ExchangeRecordGoodsQuery; |
| | | import com.ruoyi.account.api.vo.CarListVO; |
| | | import com.ruoyi.account.api.vo.CouponListVOVO; |
| | | import com.ruoyi.account.api.vo.ExchangeRecordVO; |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.account.service.TAppUserCarService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | |
| | | @Autowired |
| | | private OtherClient otherClient; |
| | | |
| | | @Autowired |
| | | private TAppUserCarService appUserCarService; |
| | | /** |
| | | * 查询用户可用优惠券数量 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | |
| | | @ApiOperation(value = "选择优惠券分页查询", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/couponList") |
| | | public AjaxResult<PageInfo<CouponListVOVO>> couponList(@RequestBody CouponListDto dto) { |
| | | |
| | | PageInfo<CouponListVOVO> res = tAppCouponService.couponList(dto); |
| | | return AjaxResult.ok(res); |
| | | } |
| | | /** |
| | | * 选择车辆列表 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "选择车辆列表", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/carList") |
| | | public AjaxResult<List<TAppUserCar>> carList() { |
| | | // todo 用户id |
| | | List<TAppUserCar> appUserId = appUserCarService.list(new QueryWrapper<TAppUserCar>() |
| | | .eq("app_user_id", 11)); |
| | | return AjaxResult.ok(appUserId); |
| | | } |
| | | |
| | | /** |
| | | * 管理后台远程调用 根据优惠券ids 查询对应的发放数量 |
| | |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | PageInfo<CouponListVOVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<CouponListVOVO> list = this.baseMapper.couponList(pageInfo,dto.getUserId()); |
| | | TAppUser tAppUser = tAppUserMapper.selectById(dto.getUserId()); |
| | | Integer isVip = 0;// 是否能享受会员折扣 |
| | | Integer isVip = 0;// 是否能享受会员折扣 0否 1是普通会员 2内部会员 |
| | | // 会员折扣 |
| | | Double discount = 0.0; |
| | | // 普通会员最高折扣金额 |
| | | Double discountMoney = 0.0; |
| | | if (tAppUser.getVipEndTime() == null){ |
| | | // 不是会员 |
| | | isVip = 0; |
| | | }else { |
| | | // 判断会员有没有过期 |
| | | if (tAppUser.getVipEndTime().isAfter(java.time.LocalDateTime.now())){ |
| | |
| | | TVip data1 = vipClient.getInfo1(vipId).getData(); |
| | | Integer discountTimes = data1.getDiscountTimes(); |
| | | if (data>=discountTimes){ |
| | | // 不能再享受会员折扣 |
| | | // 折扣次数用光了 不能再享受会员折扣 |
| | | isVip = 0; |
| | | }else{ |
| | | if (data1.getType() == 2){ |
| | | // 如果内部会员 使用该折扣 |
| | | discount = data1.getDiscount().doubleValue(); |
| | | isVip = 2; |
| | | }else{ |
| | | // 普通会员 最高折扣金额 |
| | | discountMoney = data1.getMaximumDeduction().doubleValue(); |
| | | isVip = 1; |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | // 会员过期 不能享受 |
| | | isVip = 0; |
| | | } |
| | | } |
| | | for (CouponListVOVO couponListVOVO : list) { |
| | | couponListVOVO.setValidityTime("有效期:"+format.format(couponListVOVO.getCreateTime())+" - "+format.format(couponListVOVO.getEndTime())); |
| | | } |
| | | List<CouponListVOVO> data = otherClient.getCouponInfoByCouponIds(list).getData(); |
| | | for (CouponListVOVO datum : data) { |
| | | // 桩编号 + 是否是会员 + 内部会员折扣 + 普通会员最高折扣金额 + 预付金额 |
| | | String temp = dto.getNumber()+"-"+isVip+"-"+discount+"-"+discountMoney+"-"+dto.getPayMoney(); |
| | | // 根据当前时间段和预付金额计算服务费 |
| | | |
| | | BigDecimal serviceMoney = chargingPileClient.getServiceMoney(temp).getData(); |
| | | for (CouponListVOVO datum : data) { |
| | | // 判断优惠券类型 |
| | | switch (datum.getPreferentialMode()){ |
| | | case 1: |
| | | datum.setIsUse(1); |
| | | // 满减券 判断服务费是否满足满减条件 |
| | | if (datum.getMeetTheConditions().compareTo(new BigDecimal(BigInteger.ZERO)) == 0){ |
| | | // 无门槛优惠券 |
| | | datum.setMoney(serviceMoney.subtract(datum.getDiscountAmount())); |
| | | }else if (serviceMoney.compareTo(datum.getMeetTheConditions())>=0){ |
| | | // 满足条件 |
| | | datum.setMoney(serviceMoney.subtract(datum.getDiscountAmount())); |
| | | }else{ |
| | | // 不满足条件 |
| | | datum.setMoney(serviceMoney); |
| | | datum.setIsUse(0); |
| | | } |
| | | break; |
| | | case 2: |
| | | datum.setIsUse(1); |
| | | // 折扣券 判断 |
| | | if (datum.getMeetTheConditions().compareTo(new BigDecimal(BigInteger.ZERO)) == 0){ |
| | | // 无门槛优惠券 |
| | | datum.setMoney(serviceMoney.subtract(datum.getDiscountAmount())); |
| | | }else if (serviceMoney.compareTo(datum.getMeetTheConditions())>=0){ |
| | | // 折扣后的服务费 |
| | | BigDecimal divide = serviceMoney.multiply(datum.getDiscount()).divide(new BigDecimal(10), 2, BigDecimal.ROUND_HALF_UP); |
| | | // 计算折扣了多少钱 判断是否超过最高折扣金额 |
| | | BigDecimal subtract = serviceMoney.subtract(divide); |
| | | if (subtract.compareTo(datum.getMaximumDiscountAmount())>0){ |
| | | // 超过最高折扣金额 减去最高折扣金额 |
| | | datum.setMoney(serviceMoney.subtract(datum.getMaximumDiscountAmount())); |
| | | }else{ |
| | | // 没超过最高折扣金额 |
| | | datum.setMoney(divide); |
| | | } |
| | | }else{ |
| | | // 不满足条件 |
| | | datum.setMoney(serviceMoney); |
| | | datum.setIsUse(0); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | // 通过集合的money字段 将money从大到小排序 |
| | | data.sort(Comparator.comparing(CouponListVOVO::getMoney).reversed()); |
| | | pageInfo.setRecords(data); |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.GeodesyUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | @Resource |
| | | private TChargingGunService chargingGunService; |
| | | |
| | | @Autowired |
| | | private TParkingLotService parkingLotService; |
| | | |
| | | |
| | | |
| | |
| | | public AjaxResult<List<Site>> getSiteList1(){ |
| | | return AjaxResult.success(siteService.list(new QueryWrapper<>())); |
| | | } |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理"}) |
| | | |
| | | @PostMapping("/getSiteListGun") |
| | | @ApiOperation(value = "获取站点列表 不分页", tags = {"管理后台-接口信息使用"}) |
| | | public AjaxResult<List<Site>> getSiteListGun(){ |
| | | return AjaxResult.success(siteService.getSiteListGun()); |
| | | } |
| | | |
| | | @PostMapping("/getSiteListParkLot") |
| | | @ApiOperation(value = "获取站点列表不分页", tags = {"管理后台-停车场绑定"}) |
| | | public AjaxResult<List<Site>> getSiteListParkLot(){ |
| | | return AjaxResult.success(siteService.getSiteListParkLot()); |
| | | } |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理-首页"}) |
| | | @PostMapping("/pageList") |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ |
| | | return AjaxResult.success(siteService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点详细信息", tags = {"小程序-站点管理-站点详情"}) |
| | | @PostMapping("/getDetailById") |
| | | public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){ |
| | |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // 查询绑定车牌提示文案 |
| | | TParkingLot parkingLot = parkingLotClient.getLotBySiteId(query.getSiteId()).getData(); |
| | | TParkingLot parkingLot = parkingLotService.getOne(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, query.getSiteId())); |
| | | if(Objects.nonNull(parkingLot)){ |
| | | siteDetailVO.setRemark(parkingLot.getRemark()); |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | | import com.ruoyi.chargingPile.api.model.TVehicleRamp; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | @Autowired |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | |
| | | return AjaxResult.ok(accountingStrategyService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 小程序远程调用 根据会员折扣、预付金额 计算服务费 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getServiceMoney") |
| | | public R<BigDecimal> getServiceMoney(@RequestParam("param") String param){ |
| | | // 桩编号 + 是否是会员 + 内部会员折扣金额 + 普通会员最高折扣金额 + 预付金额 |
| | | String[] split = param.split("-"); |
| | | // 根据桩编号 查询电站 |
| | | TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getNumber, split[0]).one(); |
| | | Site byId = siteService.getById(one.getSiteId()); |
| | | // 计费策略 |
| | | TAccountingStrategy one1 = accountingStrategyService.lambdaQuery().eq(TAccountingStrategy::getSiteId, byId.getId()) |
| | | .eq(TAccountingStrategy::getAuditStatus, 3).one(); |
| | | // 会员折扣 |
| | | BigDecimal discount = one1.getDiscount(); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, one1.getId()) |
| | | .list(); |
| | | // 当前时间属于哪个计费策略 |
| | | LocalTime now = LocalTime.now(); |
| | | // 电价 |
| | | BigDecimal electronic = new BigDecimal(BigInteger.ZERO); |
| | | // 最终服务费 |
| | | BigDecimal serviceMoney = new BigDecimal(BigInteger.ZERO); |
| | | // 预付金额 |
| | | BigDecimal beforeMoney = new BigDecimal(split[4]); |
| | | // 普通会员最高折扣金额 |
| | | BigDecimal discountMoney = new BigDecimal(split[3]); |
| | | // 内部会员折扣 |
| | | BigDecimal discountInner = new BigDecimal(split[2]); |
| | | // 最终服务费 |
| | | BigDecimal res = new BigDecimal(BigInteger.ZERO); |
| | | for (TAccountingStrategyDetail tAccountingStrategyDetail : list) { |
| | | if (now.isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && now.isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){ |
| | | electronic = tAccountingStrategyDetail.getElectrovalence(); |
| | | // 非会员下的服务费 |
| | | BigDecimal multiply = beforeMoney.multiply(tAccountingStrategyDetail.getServiceCharge()).divide(electronic, 2, RoundingMode.HALF_UP); |
| | | if (byId.getBusinessCategory() == 1){ |
| | | // 直营才享受会员折扣 |
| | | // 根据电价和预付金额 是否有会员折扣 计算最终服务费 |
| | | if (split[1].equals("1")){ |
| | | // 抵扣金额 |
| | | BigDecimal multiply1 = multiply.multiply(discount); |
| | | if (multiply1.compareTo(discountMoney)>0){ |
| | | multiply1 = discountMoney; |
| | | } |
| | | // 普通最终服务费 |
| | | res = multiply.subtract(multiply1); |
| | | } |
| | | if (split[1].equals("2")){ |
| | | // 内部会员折扣 最终服务费 |
| | | res = discountInner.multiply(multiply); |
| | | } |
| | | }else{ |
| | | // 非直营 |
| | | res = multiply; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.ok(res); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | SiteDetailVO getDetailById(@Param("siteId")Integer siteId); |
| | | |
| | | /** |
| | | * 获取站点列表不分页 管理后台-停车场绑定 |
| | | * @return |
| | | */ |
| | | List<Site> getSiteListParkLot(@Param("ids")Set<Integer> ids); |
| | | |
| | | /** |
| | | * 获取站点列表不分页接口信息使用 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | List<Site> getSiteListGun(@Param("ids")Set<Integer> ids); |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/7 19:54 |
| | |
| | | * @return |
| | | */ |
| | | SiteDetailVO getDetailById(Integer siteId); |
| | | |
| | | /** |
| | | * 获取站点列表不分页 管理后台-停车场绑定 |
| | | * @return |
| | | */ |
| | | List<Site> getSiteListParkLot(); |
| | | |
| | | |
| | | /** |
| | | * 获取站点列表不分页接口信息使用 |
| | | * @return |
| | | */ |
| | | List<Site> getSiteListGun(); |
| | | |
| | | } |
| | |
| | | return this.baseMapper.getDetailById(siteId); |
| | | } |
| | | |
| | | @Override |
| | | public List<Site> getSiteListParkLot() { |
| | | Set<Integer> ids = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | ids = new HashSet<>(data); |
| | | } |
| | | } |
| | | return this.baseMapper.getSiteListParkLot(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<Site> getSiteListGun() { |
| | | Set<Integer> ids = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | ids = new HashSet<>(data); |
| | | } |
| | | } |
| | | return this.baseMapper.getSiteListGun(ids); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置站点计费策略 |
| | |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | FROM t_site WHERE id = #{siteId} AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </select> |
| | | <select id="getSiteListParkLot" resultType="com.ruoyi.chargingPile.api.model.Site"> |
| | | select ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status,tpl.id AS parkingLotId |
| | | from t_site ts |
| | | left join t_parking_lot tpl on (ts.id = tpl.site_id) |
| | | <where> |
| | | <if test="null != ids and ids.size()>0"> |
| | | AND ts.id IN |
| | | <foreach collection="ids" item="id" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND tpl.id IS NULL |
| | | </where> |
| | | </select> |
| | | <select id="getSiteListGun" resultType="com.ruoyi.chargingPile.api.model.Site"> |
| | | select <include refid="Base_Column_List"></include> |
| | | from t_site |
| | | <where> |
| | | <if test="null != ids and ids.size()>0"> |
| | | AND id IN |
| | | <foreach collection="ids" item="id" index="index" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!--rocketmq--> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-stream-rocketmq</artifactId> |
| | | <version>2.2.2.RELEASE</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-client</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-acl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-client</artifactId> |
| | | <version>4.7.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-acl</artifactId> |
| | | <version>4.7.1</version> |
| | | </dependency> |
| | | |
| | | <!--spirngboot集成mongodb--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "acquisition_billing_mode") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingMode { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 计费模型请求应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "acquisition_billing_mode_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingModeReply { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号 |
| | | private BigDecimal sharp_peak_electricity_rate;// 尖费电费费率(精确到五位小数) |
| | | private BigDecimal sharp_peak_service_rate;// 尖服务费费率(精确到五位小数) |
| | | private BigDecimal peak_electricity_rate;// 峰电费费率(精确到五位小数) |
| | | private BigDecimal peak_service_rate;// 峰服务费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_electricity_rate;// 平电费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_service_rate;// 平服务费费率(精确到五位小数) |
| | | private BigDecimal low_peak_electricity_rate;// 谷电费费率(精确到五位小数) |
| | | private BigDecimal low_peak_service_rate;// 谷服务费费率(精确到五位小数) |
| | | private BigDecimal loss_ratio;// 计损比例 |
| | | private Integer time1;// 0:00~0:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time2;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time3;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time4; |
| | | private Integer time5; |
| | | private Integer time6; |
| | | private Integer time7; |
| | | private Integer time8; |
| | | private Integer time9; |
| | | private Integer time10; |
| | | private Integer time11; |
| | | private Integer time12; |
| | | private Integer time13; |
| | | private Integer time14; |
| | | private Integer time15; |
| | | private Integer time16; |
| | | private Integer time17; |
| | | private Integer time18; |
| | | private Integer time19; |
| | | private Integer time20; |
| | | private Integer time21; |
| | | private Integer time22; |
| | | private Integer time23; |
| | | private Integer time24; |
| | | private Integer time25; |
| | | private Integer time26; |
| | | private Integer time27; |
| | | private Integer time28; |
| | | private Integer time29; |
| | | private Integer time30; |
| | | private Integer time31; |
| | | private Integer time32; |
| | | private Integer time33; |
| | | private Integer time34; |
| | | private Integer time35; |
| | | private Integer time36; |
| | | private Integer time37; |
| | | private Integer time38; |
| | | private Integer time39; |
| | | private Integer time40; |
| | | private Integer time41; |
| | | private Integer time42; |
| | | private Integer time43; |
| | | private Integer time44; |
| | | private Integer time45; |
| | | private Integer time46; |
| | | private Integer time47;// 23:00~23:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time48;// 23:30~0:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 计费模型验证请求 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "billing_mode_verify") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerify { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号,首次连接到平台时置零 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "billing_mode_verify_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerifyReply { |
| | | |
| | | private String charging_pile_code; // 桩编 |
| | | private String billing_model_code; // 计费模型编 |
| | | private Integer billing_model_result; // 验证结果(0:桩计费模型与平台一致,1:桩计费模型与平台不一致) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsAbort { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer bms_stop_charging_reason; // BMS 中止充电原因(1-2 位——所需求的 SOC 目标值,3-4 位——达到总电压的设定值,5-6 位——达到单体电压设定值,7-8 位——充电机主动中止) |
| | | private Integer bms_aborted_charging_fault_cause; // BMS 中止充电故障原因(1-2 位——绝缘故障,3-4 位——输出连接器过温故障,5-6 位——BMS 元件、输出连接器过温,7-8 位——充电连接器故障,9-10 位——电池组温度过高故障,11-12 位——高压继电器故障,13 位-14 位——检测点 2 电压检测故障,15-16 位——其他故障) |
| | | private Integer bms_aborted_charging_error_cause; // BMS 中止充电错误原因(1-2 位——电流过大,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电过程BMS需求、充电机输出 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_demand_and_charger_exportation") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsDemandAndChargerExportation { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_voltage_requirements; // BMS 电压需求 |
| | | private BigDecimal bms_current_requirements; // BMS 电流需求 |
| | | private Integer bms_charging_mode; // BMS 充电模式(1:恒压充电;2:恒流充电) |
| | | private BigDecimal bms_voltage_measurement_value; // BMS 充电电压测量值 |
| | | private BigDecimal bms_current_measurement_value; // BMS 充电电流测量值 |
| | | private Integer bms_battery_voltage_and_group_number; // BMS 最高单体动力蓄电池电压及组号(1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V 偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15) |
| | | private BigDecimal bms_charged_status; // BMS 当前荷电状态 SOC( %) |
| | | private Integer bms_remaining_charging_time; // BMS 估算剩余充电时间 |
| | | private BigDecimal voltage_output_value; // 电桩电压输出值 |
| | | private BigDecimal current_output_value; // 电桩电流输出值 |
| | | private Integer cumulative_charging_time; // 累计充电时间 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电过程BMS信息 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_information") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsInformation { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer bms_highest_voltage_number; // BMS 最高单体动力蓄电池电压所在编号 |
| | | private String bms_maximum_battery_temperature; // BMS 最高动力蓄电池温度 |
| | | private Integer maximum_temperature_detection_point_number; // 最高温度检测点编号 |
| | | private String minimum_cell_temperature; // 最低动力蓄电池温度 |
| | | private Integer lowest_temperature_detection_pointt_number; // 最低动力蓄电池温度检测点编号 |
| | | private Integer bms_battery_voltage; // BMS 单体动力蓄电池电压过高 /过低(0:正常,1:过高,10:过低) |
| | | private Integer bms_battery_charging_status; // BMS 整车动力蓄电池荷电状态SOC 过高/过低(0:正常,1:过高,10:过低) |
| | | private Integer bms_charging_overcurrent; // BMS 动力蓄电池充电过电流(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_high_battery_temperature; // BMS 动力蓄电池温度过高(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_battery_insulation_status; // BMS 动力蓄电池绝缘状态(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_output_connector_connection_status; // BMS 动力蓄电池组输出连接器连接状态(0:正常,1:过流,10:不可信状态) |
| | | private Integer charge_prohibition; // 充电禁止(0:禁止,1:允许) |
| | | private Integer reserve; // 预留位 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电握手 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "charging_handshake") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingHandshake { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String bms_protocol_version;// BMS 通信协议版本号 |
| | | private Integer bms_battery_type;// BMS 电池类型(1:铅酸电池;2:氢:电池;3:磷酸铁锂电池;4:锰酸锂电池;5:钴酸锂电池;6:三元材料电池;7:聚合物锂离子电池;8:钛酸锂电池;FFH:其他) |
| | | private BigDecimal bms_battery_capacity;// BMS 整车动力蓄电池系统额定容量 |
| | | private BigDecimal bms_total_battery_voltage;// BMS 整车动力蓄电池系统额定总电压 |
| | | private String bms_battery_manufacturer;// BMS 电池生产厂商名称 |
| | | private String bms_battery_serial_number;// BMS 电池组序号 |
| | | private Integer bms_battery_production_year;// BMS 电池组生产日期年 |
| | | private Integer bms_battery_production_month;// BMS 电池组生产日期月 |
| | | private Integer bms_battery_production_day;// BMS 电池组生产日期日 |
| | | private Integer bms_battery_charging_times;// BMS 电池组充电次数 |
| | | private Integer bms_battery_property_rights;// BMS 电池组产权标识 |
| | | private Integer reserved;// 预留位 |
| | | private String vim;// BMS 车辆识别码 |
| | | private Integer bms_software_version;// BMS 软件版本号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩返回数据(上行) |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "charging_pile_returns_ground_lock_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileReturnsGroundLockData { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer control_state; // 地锁控制返回标志(1:鉴权成功,0:鉴权失败) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩主动申请启动充电 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "charging_pile_starts_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileStartsCharging { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer start_method; // 启动方式(1:表示通过刷卡启动充电,2:表示通过帐号启动充电(暂不支持),3:表示vin码启动充电) |
| | | private Integer need_password; // 是否需要密码(0:不需要,1:需要) |
| | | private String account; // 账号或者物理卡号 |
| | | private String password; // 输入密码 |
| | | private String vin; // "VIN 码,启动方式为vin码启动充电时上送,其他方式置零( ASCII码),VIN码需要反序上送 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据清除 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "clear_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCard { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; // 清除离线卡的个数,最大 24 个 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据清除应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "clear_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCardReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | private Integer clear_result1; // 清除标记(0:清除失败,1:清除成功) |
| | | private Integer clear_result2; |
| | | private Integer clear_result3; |
| | | private Integer clear_result4; |
| | | private Integer clear_result5; |
| | | private Integer clear_result6; |
| | | private Integer clear_result7; |
| | | private Integer clear_result8; |
| | | private Integer clear_result9; |
| | | private Integer clear_result10; |
| | | private Integer clear_result11; |
| | | private Integer clear_result12; |
| | | private Integer clear_result13; |
| | | private Integer clear_result14; |
| | | private Integer clear_result15; |
| | | private Integer clear_result16; |
| | | private Integer clear_result17; |
| | | private Integer clear_result18; |
| | | private Integer clear_result19; |
| | | private Integer clear_result20; |
| | | private Integer clear_result21; |
| | | private Integer clear_result22; |
| | | private Integer clear_result23; |
| | | private Integer clear_result24; |
| | | private Integer failure_cause1; // 失败原因(1:卡号格式错误,2:清除成功) |
| | | private Integer failure_cause2; |
| | | private Integer failure_cause3; |
| | | private Integer failure_cause4; |
| | | private Integer failure_cause5; |
| | | private Integer failure_cause6; |
| | | private Integer failure_cause7; |
| | | private Integer failure_cause8; |
| | | private Integer failure_cause9; |
| | | private Integer failure_cause10; |
| | | private Integer failure_cause11; |
| | | private Integer failure_cause12; |
| | | private Integer failure_cause13; |
| | | private Integer failure_cause14; |
| | | private Integer failure_cause15; |
| | | private Integer failure_cause16; |
| | | private Integer failure_cause17; |
| | | private Integer failure_cause18; |
| | | private Integer failure_cause19; |
| | | private Integer failure_cause20; |
| | | private Integer failure_cause21; |
| | | private Integer failure_cause22; |
| | | private Integer failure_cause23; |
| | | private Integer failure_cause24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 交易记录确认 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "confirm_transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ConfirmTransactionRecord { |
| | | |
| | | private String transaction_serial_number;// 桩编码 |
| | | private Integer confirm_result;// 确认结果(0:上传成功,1:非法账单) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电结束 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "end_charge") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class EndCharge { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_battery_charging_status; // BMS 中止荷电状态 SOC |
| | | private BigDecimal bms_minimum_battery_voltage; // BMS 动力蓄电池单体最低电压 |
| | | private BigDecimal bms_maximum_battery_voltage; // BMS 动力蓄电池单体最高电压 |
| | | private Integer bms_minimum_battery_temperature; // BMS 动力蓄电池最低温度 |
| | | private Integer bms_maximum_battery_temperature; // BMS 动力蓄电池最高温度 |
| | | private BigDecimal cumulative_charging_time; // 电桩累计充电时间 |
| | | private BigDecimal output_energy; // 电桩输出能量 |
| | | private String charger_code; // 电桩充电机编号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 错误报文 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "error_message") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ErrorMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charger_identification_0; // 接收 SPN2560=0x00 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charger_identification_170; // 接收 SPN2560=0xAA 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charger_identification_reserve; // 预留位 |
| | | private Integer time_synchronization_and_maximum_output_charger; // 接收充电机的时间同步和充电机最大输出能力报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charge_preparation; // 接收充电机完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_preparation_reserve; // 预留位 |
| | | private Integer charging_status; // 接收充电机充电状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer stop_charging; // 接收充电机中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_reserve; // 预留位 |
| | | private Integer charging_statistics; // 接收充电机充电统计报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_other; // BMS 其他 |
| | | private Integer bms_and_vehicle_identification; // 接收 BMS 和车辆的辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_and_vehicle_identification_reserve; // 预留位 |
| | | private Integer battery_charging_parameter; // 接收电池充电参数报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_completes_charging_preparation; // 接收 BMS 完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_completes_charging_preparation_reserve; // 预留位 |
| | | private Integer total_battery_charging_status; // 接收电池充电总状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer battery_charging_requirements; // 接收电池充电要求报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_stop_charging; // 接收 BMS 中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_reserve; // 预留位 |
| | | private Integer bms_charging_statistics; // 接收 BMS 充电统计报文超时0=正常,1=超时,10=不可信状态) |
| | | private String charger_other; // 充电机其他 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 地锁数据上送(充电桩上送) |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "ground_lock_real_time_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class GroundLockRealTimeData { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer parking_lock_status; // 车位锁状态(0:未到位状态,1:升锁到位状态,2:降锁到位状态) |
| | | private Integer parking_status; // 车位状态(0:无车辆,1:停放车辆) |
| | | private Integer ground_locking_capacity; // 地锁电量状态 |
| | | private Integer alarm_status; // 报警状态(0:正常无报警,1:待机状态摇臂破坏,2:摇臂升降异常(未到位)) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电阶段充电机中止 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "motor_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class MotorAbort { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charger_stops_charging_reason; // 充电机中止充电原因(1-2 位——达到充电机设定的条件中止,3-4 位——人工中止,5-6 位——异常中止) |
| | | private Integer charging_failure_cause; // 充电机中止充电故障原因(1-2 位——充电机过温故障,3-4 位——充电连接器故障,5-6 位——充电机内部过温故障,7-8 位——所需电量不能传送,9-10 位——充电机急停故障,11-12 位——其他故障,13-16 位——预留位) |
| | | private Integer charging_machine_stopped_charging_error_cause; // 充电机中止充电错误原因(1-2 位——电流不匹配,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩登录认证 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "online") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Online { |
| | | private String charging_pile_code;// 充电桩编号 |
| | | private Integer charging_pile_type;// 充电桩类型(0 表示直流桩,1 表示交流桩) |
| | | private Integer charging_gun_number;// 充电枪数量 |
| | | private String protocol_version;// 通信协议版本 |
| | | private String program_version;// 程序版本 |
| | | private Integer network_link_type;// 网络链接类型(0:SIM 卡,1:LAN,2:WAN,3:其他) |
| | | private String sim;// Sim 卡 |
| | | private Integer operator;// 运营商(0: 移动,2:电信,3:联通,4:其他) |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 登录认证应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "online_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OnlineReply { |
| | | private String charging_pile_code;// 桩编码 |
| | | private Integer online_result;// 登陆结果(0:成功,1:失败) |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 遥控地锁升锁与降锁命令 (下行) |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "open_or_close_ground_lock") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OpenOrCloseGroundLock { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer operate; // 升/降地锁(1:升锁,2:降锁) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 参数配置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ParameterSetting { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_maximum_charging_voltage; // BMS 单体动力蓄电池最高允许充电电压 |
| | | private BigDecimal bms_maximum_charging_current; // BMS 最高允许充电电流 |
| | | private BigDecimal bms_battery_total_energy; // BMS 动力蓄电池标称总能量 |
| | | private BigDecimal bms_total_charging_voltage; // BMS 最高允许充电总电压 |
| | | private Integer bms_maximum_temperature; // BMS 最高允许温度 |
| | | private BigDecimal bms_battery_charging_status; // BMS 整车动力蓄电池荷电状态 (soc) |
| | | private BigDecimal bms_battery_voltage; // BMS 整车动力蓄电池当前电池 电压 |
| | | private BigDecimal maximum_output_voltage; // 电桩最高输出电压 |
| | | private BigDecimal minimum_output_voltage; // 电桩最低输出电压 |
| | | private BigDecimal maximum_output_current; // 电桩最大输出电流 |
| | | private BigDecimal minimum_output_current; // 电桩最小输出电流 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩心跳包 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "ping") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Ping { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private Integer charging_gun_status;// 抢状态(0:正常,1:故障) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_confirmation_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformConfirmationCharging { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private String card_number; // 逻辑卡号 |
| | | private BigDecimal account_balance; // 账户余额 |
| | | private Integer authentication; // 鉴权成功标志(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(1:账户不存在,2: 账户冻结,3:账户余额不足,4:该卡存在未结账记录,5: 桩停用,6:该账户不能在此桩上充电,7:密码错误,8:电站电容不足,9:系统中 vin 码不存在,10:该桩存在未结账记录,11:该桩不支持刷卡) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程更新 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_remote_update") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdate { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer charging_pile_type; // 桩型号(1:直流,2:交流) |
| | | private Integer charging_pile_power; // 桩功率 |
| | | private String upgrade_server_address; // 升级服务器地址 |
| | | private Integer upgrade_server_port; // 升级服务器端口 |
| | | private String username; // 用户名 |
| | | private String password; // 密码 |
| | | private String file_path; // 文件路径 |
| | | private Integer operate; // 执行控制(1:立即执行,2:空闲执行) |
| | | private Integer download_timeout; // 下载超时时间 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程更新应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_remote_update_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdateReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer escalation_state; // 升级状态(0:成功,1:编码错误,2:程序与桩型号不符,3:下载更新文件超时) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程重启 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_restart") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestart { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer operate; // 执行控制 (1:立即执行,2:空闲执行) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程重启应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_restart_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestartReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; // 设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 运营平台远程控制启机 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_start_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartCharging { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private String card_number; // 逻辑卡号 |
| | | private String physical_card_number; // 物理卡号 |
| | | private BigDecimal account_balance; // 账户余额 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程启机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_start_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartChargingReply { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer startup_result; // 启动结果(0:失败,1:成功) |
| | | private Integer failure_cause; // "失败原因(0:无,1:设备编号不匹配,2:枪已在充电,3:设备故障,4:设备离线,5:未插枪桩在收到启充命令后,检测到未插枪则发送 0x33 报文回复充电失败。若在 60 秒(以收到 0x34 时间开始计算)内检测到枪重新连接,则补送 0x33 成功报文;超时或者离线等其他异常,桩不启充、不补发 0x33 报文)" |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 运营平台远程停机 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_stop_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopCharging { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程停机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_stop_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopChargingReply { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer stop_result; // 停止结果(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(0:无,1:设备编号不匹配,2:枪未处于充电状态,3:其他) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 心跳包应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "pong") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Pong { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private Integer charging_gun_status;// 心跳应答(0) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据查询 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "query_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCard { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据查询应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "query_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCardReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | private Integer query_result1; // 查询结果(0:不存在,1:存在) |
| | | private Integer query_result2; |
| | | private Integer query_result3; |
| | | private Integer query_result4; |
| | | private Integer query_result5; |
| | | private Integer query_result6; |
| | | private Integer query_result7; |
| | | private Integer query_result8; |
| | | private Integer query_result9; |
| | | private Integer query_result10; |
| | | private Integer query_result11; |
| | | private Integer query_result12; |
| | | private Integer query_result13; |
| | | private Integer query_result14; |
| | | private Integer query_result15; |
| | | private Integer query_result16; |
| | | private Integer query_result17; |
| | | private Integer query_result18; |
| | | private Integer query_result19; |
| | | private Integer query_result20; |
| | | private Integer query_result21; |
| | | private Integer query_result22; |
| | | private Integer query_result23; |
| | | private Integer query_result24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 读取实时监测数据 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "read_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ReadRealTimeMonitoringData { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 计费模型设置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "setup_billing_model") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String billing_model_code; // 计费模型编号 |
| | | private BigDecimal sharp_peak_electricity_rate; // 尖费电费费率(精确到五位小数) |
| | | private BigDecimal sharp_peak_service_rate; // 尖服务费费率(精确到五位小数) |
| | | private BigDecimal peak_electricity_rate; // 峰电费费率(精确到五位小数) |
| | | private BigDecimal peak_service_rate; // 峰服务费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_electricity_rate; // 平电费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_service_rate; // 平服务费费率(精确到五位小数) |
| | | private BigDecimal low_peak_electricity_rate; // 谷电费费率(精确到五位小数) |
| | | private BigDecimal low_peak_service_rate; // 谷服务费费率(精确到五位小数) |
| | | private BigDecimal loss_ratio; // 计损比例 |
| | | private Integer time1; // 0:00~0:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time2; // 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time3; |
| | | private Integer time4; |
| | | private Integer time5; |
| | | private Integer time6; |
| | | private Integer time7; |
| | | private Integer time8; |
| | | private Integer time9; |
| | | private Integer time10; |
| | | private Integer time11; |
| | | private Integer time12; |
| | | private Integer time13; |
| | | private Integer time14; |
| | | private Integer time15; |
| | | private Integer time16; |
| | | private Integer time17; |
| | | private Integer time18; |
| | | private Integer time19; |
| | | private Integer time20; |
| | | private Integer time21; |
| | | private Integer time22; |
| | | private Integer time23; |
| | | private Integer time24; |
| | | private Integer time25; |
| | | private Integer time26; |
| | | private Integer time27; |
| | | private Integer time28; |
| | | private Integer time29; |
| | | private Integer time30; |
| | | private Integer time31; |
| | | private Integer time32; |
| | | private Integer time33; |
| | | private Integer time34; |
| | | private Integer time35; |
| | | private Integer time36; |
| | | private Integer time37; |
| | | private Integer time38; |
| | | private Integer time39; |
| | | private Integer time40; |
| | | private Integer time41; |
| | | private Integer time42; |
| | | private Integer time43; |
| | | private Integer time44; |
| | | private Integer time45; |
| | | private Integer time46; |
| | | private Integer time47; |
| | | private Integer time48; |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 计费模型应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "setup_billing_model_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModelReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String set_result; //设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据同步 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "synchronize_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCard { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer card_number; // 下发卡个数 |
| | | private String card1; // 第 1 个卡逻辑卡号,离线卡逻辑卡号 |
| | | private String card2; |
| | | private String card3; |
| | | private String card4; |
| | | private String card5; |
| | | private String card6; |
| | | private String card7; |
| | | private String card8; |
| | | private String card9; |
| | | private String card10; |
| | | private String card11; |
| | | private String card12; |
| | | private String card13; |
| | | private String card14; |
| | | private String card15; |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 卡数据同步应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "synchronize_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCardReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer save_result; // 保存结果(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(1:卡号格式错误,2:储存空间不足) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 对时设置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "timing_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSetting { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 对时设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "timing_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSettingReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 交易记录 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TransactionRecord { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String start_time;// 开始时间 |
| | | private String end_time;// 结束时间 |
| | | private BigDecimal sharp_peak_unit_price;// 尖单价 |
| | | private BigDecimal sharp_peak_charge;// 尖电量 |
| | | private BigDecimal loss_sharp_peak_charge;// 计损尖电量 |
| | | private BigDecimal sharp_peak_amount;// 尖金额 |
| | | private BigDecimal peak_unit_price;// 峰单价 |
| | | private BigDecimal peak_charge;// 峰电量 |
| | | private BigDecimal loss_peak_charge;// 计损峰电量 |
| | | private BigDecimal peak_amount;// 峰金额 |
| | | private BigDecimal flat_peak_unit_price;// 平单价 |
| | | private BigDecimal flat_peak_charge;// 平电量 |
| | | private BigDecimal loss_flat_peak_charge;// 计损平电量 |
| | | private BigDecimal flat_peak_amount;// 平金额 |
| | | private BigDecimal low_peak_unit_price;// 谷单价 |
| | | private BigDecimal low_peak_charge;// 谷电量 |
| | | private BigDecimal loss_low_peak_charge;// 计损谷电量 |
| | | private BigDecimal low_peak_amount;// 谷金额 |
| | | private BigDecimal total_initial_value;// 电表总起值 |
| | | private BigDecimal total_stop_value;// 电表总止值 |
| | | private BigDecimal total_electricity;// 总电量 |
| | | private BigDecimal loss_total_electricity;// 计损总电量 |
| | | private BigDecimal payment_amount;// 消费金额 |
| | | private String vin;// 电动汽车唯一标识 |
| | | private Integer start_method;// 交易标识(1:app 启动,2:卡启动,4:离线卡启动,5: vin 码启动充电) |
| | | private String trade_date;// 交易日期、时间 |
| | | private Integer stop_reason;// 停止原因 |
| | | private String physical_card_number;// 物理卡号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程账户余额更新 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "update_balance") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalance { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card_number; //物理卡号 |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 余额更新应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "update_balance_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalanceReply { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String physical_card_number;// 物理卡号 |
| | | private BigDecimal account_balance;// 修改后账户金额 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 上传实时监测数据 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringData { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charging_gun_status; // 状态(0:离线,1:故障,2:空闲,3:充电) |
| | | private Integer homing_status; // 枪是否归位(0:否,1:是,2:未知) |
| | | private Integer insertion_status; // 是否插枪(0:否,1:是) |
| | | private BigDecimal output_voltage; // 输出电压,精确到小数点后一位;待机置零 |
| | | private BigDecimal output_current; // 输出电流,精确到小数点后一位;待机置零 |
| | | private Integer gun_line_temperature; // 枪线温度,整形,偏移量-50;待机置零 |
| | | private String gun_line_code; // 枪线编码,没有置零 |
| | | private Integer soc; // SOC待机置零;交流桩置零 |
| | | private Integer battery_temperature; // 电池组最高温度,整形,偏移量-50 ºC;待机置零;交流桩置零 |
| | | private Integer cumulative_charging_time; // 累计充电时间,单位:min;待机置零 |
| | | private Integer time_remaining; // 剩余时间,单位:min;待机置零、交流桩置零 |
| | | private BigDecimal charging_degree; // 充电度数,精确到小数点后四位;待机置零 |
| | | private BigDecimal loss_of_charging_degree; // 计损充电度数,精确到小数点后四位;待机置零,未设置计损比例时等于充电度数 |
| | | private BigDecimal paid_amount; // 已充金额,精确到小数点后四位;待机置零(电费+服务费)*计损充电度数 |
| | | private Integer hardware_fault; // 硬件故障(1:急停按钮动作故障;2:无可用整流模块;3:出风口温度过高;4:交流防雷故障;5:交直流模块 DC20 通信中断;6:绝缘检测模块 FC08 通信中断;7:电度表通信中断;8:读卡器通信中断;9:RC10 通信中断;10:风扇调速板故障;11:直流熔断器故障;12:高压接触器故障;13:门打开) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩工作参数设置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "working_parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSetting { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer allow_work;// 是否允许工作(0:表示允许正常工作,1:表示停止使用,锁定充电桩) |
| | | private Integer maximum_output_power; // 充电桩最大允许输出功率 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩工作参数设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "working_parameter_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSettingReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; //设置结果(0:失败,1:成功) |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | /** |
| | | * 登录认证应答接口 |
| | | */ |
| | | public interface OnlineReplyService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | /** |
| | | * 充电桩登录认证接口 |
| | | */ |
| | | public interface OnlineService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.mongodb.service.OnlineReplyService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * 登录认证应答实现类 |
| | | **/ |
| | | @Service |
| | | public class OnlineReplyServiceImpl implements OnlineReplyService { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * 充电桩登录认证实现类 |
| | | **/ |
| | | @Service |
| | | public class OnlineServiceImpl implements OnlineService { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.base; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 消息实体,所有消息都需要继承此类 |
| | | */ |
| | | @Data |
| | | public abstract class BaseMessage { |
| | | /** |
| | | * 业务键,用于RocketMQ控制台查看消费情况 |
| | | */ |
| | | protected String key; |
| | | /** |
| | | * 发送消息来源,用于排查问题 |
| | | */ |
| | | protected String source = ""; |
| | | |
| | | /** |
| | | * 发送时间 |
| | | */ |
| | | protected LocalDateTime sendTime = LocalDateTime.now(); |
| | | |
| | | /** |
| | | * 重试次数,用于判断重试次数,超过重试次数发送异常警告 |
| | | */ |
| | | protected Integer retryTimes = 0; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.beans.factory.config.BeanPostProcessor; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | public class EnvironmentIsolationConfig implements BeanPostProcessor { |
| | | private RocketEnhanceProperties rocketEnhanceProperties; |
| | | |
| | | public EnvironmentIsolationConfig(RocketEnhanceProperties rocketEnhanceProperties) { |
| | | this.rocketEnhanceProperties = rocketEnhanceProperties; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 在装载Bean之前实现参数修改 |
| | | */ |
| | | @Override |
| | | public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { |
| | | if (bean instanceof DefaultRocketMQListenerContainer) { |
| | | |
| | | DefaultRocketMQListenerContainer container = (DefaultRocketMQListenerContainer) bean; |
| | | |
| | | if (rocketEnhanceProperties.isEnabledIsolation() && StringUtils.hasText(rocketEnhanceProperties.getEnvironment())) { |
| | | container.setTopic(String.join("_", container.getTopic(), rocketEnhanceProperties.getEnvironment())); |
| | | } |
| | | return container; |
| | | } |
| | | return bean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | |
| | | @ConfigurationProperties(prefix = "rocketmq.enhance") |
| | | @Data |
| | | public class RocketEnhanceProperties { |
| | | |
| | | private boolean enabledIsolation; |
| | | |
| | | private String environment; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate; |
| | | import org.apache.rocketmq.spring.core.RocketMQTemplate; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.messaging.converter.CompositeMessageConverter; |
| | | import org.springframework.messaging.converter.MappingJackson2MessageConverter; |
| | | import org.springframework.messaging.converter.MessageConverter; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Configuration |
| | | @EnableConfigurationProperties(RocketEnhanceProperties.class) |
| | | public class RocketMQEnhanceAutoConfiguration { |
| | | |
| | | /** |
| | | * 注入增强的RocketMQEnhanceTemplate |
| | | */ |
| | | @Bean |
| | | public RocketMQEnhanceTemplate rocketMQEnhanceTemplate(RocketMQTemplate rocketMQTemplate){ |
| | | return new RocketMQEnhanceTemplate(rocketMQTemplate); |
| | | } |
| | | |
| | | /** |
| | | * 解决RocketMQ Jackson不支持Java时间类型配置 |
| | | * 源码参考:{@link org.apache.rocketmq.spring.autoconfigure.MessageConverterConfiguration} |
| | | */ |
| | | @Bean |
| | | @Primary |
| | | public RocketMQMessageConverter enhanceRocketMQMessageConverter(){ |
| | | RocketMQMessageConverter converter = new RocketMQMessageConverter(); |
| | | CompositeMessageConverter compositeMessageConverter = (CompositeMessageConverter) converter.getMessageConverter(); |
| | | List<MessageConverter> messageConverterList = compositeMessageConverter.getConverters(); |
| | | for (MessageConverter messageConverter : messageConverterList) { |
| | | if(messageConverter instanceof MappingJackson2MessageConverter){ |
| | | MappingJackson2MessageConverter jackson2MessageConverter = (MappingJackson2MessageConverter) messageConverter; |
| | | ObjectMapper objectMapper = jackson2MessageConverter.getObjectMapper(); |
| | | objectMapper.registerModules(new JavaTimeModule()); |
| | | } |
| | | } |
| | | return converter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 环境隔离配置 |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(name="rocketmq.enhance.enabledIsolation", havingValue="true") |
| | | public EnvironmentIsolationConfig environmentSetup(RocketEnhanceProperties rocketEnhanceProperties){ |
| | | return new EnvironmentIsolationConfig(rocketEnhanceProperties); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import org.springframework.messaging.converter.*; |
| | | import org.springframework.util.ClassUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class RocketMQMessageConverter { |
| | | |
| | | private static final boolean JACKSON_PRESENT; |
| | | private static final boolean FASTJSON_PRESENT; |
| | | |
| | | static { |
| | | ClassLoader classLoader = RocketMQMessageConverter.class.getClassLoader(); |
| | | JACKSON_PRESENT = ClassUtils.isPresent("com.fasterxml.jackson,databind.ObjectMapper", classLoader) |
| | | && ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", classLoader); |
| | | FASTJSON_PRESENT = ClassUtils.isPresent("com.alibaba.fastjson.JSON", classLoader) |
| | | && ClassUtils.isPresent("com.alibaba.fastjson.support.config.FastJsonConfig", classLoader); |
| | | } |
| | | private final CompositeMessageConverter messageConverter; |
| | | |
| | | public RocketMQMessageConverter(){ |
| | | List<MessageConverter> messageConverters = new ArrayList<>(); |
| | | ByteArrayMessageConverter byteArrayMessageConverter = new ByteArrayMessageConverter(); |
| | | byteArrayMessageConverter.setContentTypeResolver(null); |
| | | messageConverters.add(byteArrayMessageConverter); |
| | | messageConverters.add(new StringMessageConverter()); |
| | | if (JACKSON_PRESENT) { |
| | | messageConverters.add(new MappingJackson2MessageConverter()); |
| | | } |
| | | if(FASTJSON_PRESENT) { |
| | | try { |
| | | messageConverters.add( |
| | | (MessageConverter) ClassUtils.forName( |
| | | "com.alibaba.fastjson.support.spring.messaging.MappingFastJsonMessageConverter", ClassUtils.getDefaultClassLoader()).newInstance()); |
| | | } catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) { |
| | | |
| | | } |
| | | } |
| | | messageConverter = new CompositeMessageConverter(messageConverters); |
| | | } |
| | | |
| | | public MessageConverter getMessageConverter(){ return messageConverter; } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.constant; |
| | | |
| | | public class EnhanceMessageConstant { |
| | | |
| | | /** |
| | | * 延时等级 |
| | | */ |
| | | public static final int FIVE_SECOND=5000; |
| | | /** |
| | | * 消息前缀 |
| | | */ |
| | | public static final String RETRY_PREFIX="retry_"; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EnhanceMemberMessageListener extends EnhanceMessageHandler<MemberMessage> implements RocketMQListener<MemberMessage> { |
| | | |
| | | @Override |
| | | protected void handleMessage(MemberMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | System.out.println("业务消息处理:"+message.getUserName()); |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(MemberMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(MemberMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(MemberMessage memberMessage) { |
| | | super.dispatchMessage(memberMessage); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.produce; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate; |
| | | import lombok.Setter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.UUID; |
| | | |
| | | @RestController |
| | | @RequestMapping("enhance") |
| | | @Slf4j |
| | | public class EnhanceProduceController { |
| | | |
| | | //注入增强后的模板,可以自动实现环境隔离,日志记录 |
| | | @Setter(onMethod_ = @Autowired) |
| | | private RocketMQEnhanceTemplate rocketMQEnhanceTemplate; |
| | | |
| | | private static final String topic = "rocket_enhance"; |
| | | private static final String tag = "member"; |
| | | |
| | | /** |
| | | * 发送实体消息 |
| | | */ |
| | | @GetMapping("/member") |
| | | public SendResult member() { |
| | | String key = UUID.randomUUID().toString(); |
| | | MemberMessage message = new MemberMessage(); |
| | | // 设置业务key |
| | | message.setKey(key); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource("MEMBER"); |
| | | // 业务消息内容 |
| | | message.setUserName("Java日知录"); |
| | | message.setBirthday(LocalDate.now()); |
| | | |
| | | return rocketMQEnhanceTemplate.send(topic, tag, message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.test; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class MemberMessage extends BaseMessage { |
| | | |
| | | private String userName; |
| | | private LocalDate birthday; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import com.ruoyi.integration.rocket.constant.EnhanceMessageConstant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.apache.rocketmq.client.producer.SendStatus; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | public abstract class EnhanceMessageHandler<T extends BaseMessage> { |
| | | /** |
| | | * 默认重试次数 |
| | | */ |
| | | private static final int MAX_RETRY_TIMES = 3; |
| | | |
| | | /** |
| | | * 延时等级 |
| | | */ |
| | | private static final int DELAY_LEVEL = EnhanceMessageConstant.FIVE_SECOND; |
| | | |
| | | |
| | | @Resource |
| | | private RocketMQEnhanceTemplate rocketMQEnhanceTemplate; |
| | | |
| | | /** |
| | | * 消息处理 |
| | | * |
| | | * @param message 待处理消息 |
| | | * @throws Exception 消费异常 |
| | | */ |
| | | protected abstract void handleMessage(T message) throws Exception; |
| | | |
| | | /** |
| | | * 超过重试次数消息,需要启用isRetry |
| | | * |
| | | * @param message 待处理消息 |
| | | */ |
| | | protected abstract void handleMaxRetriesExceeded(T message); |
| | | |
| | | |
| | | /** |
| | | * 是否需要根据业务规则过滤消息,去重逻辑可以在此处处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | protected boolean filter(T message) { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否异常时重复发送 |
| | | * |
| | | * @return true: 消息重试,false:不重试 |
| | | */ |
| | | protected abstract boolean isRetry(); |
| | | |
| | | /** |
| | | * 消费异常时是否抛出异常 |
| | | * 返回true,则由rocketmq机制自动重试 |
| | | * false:消费异常(如果没有开启重试则消息会被自动ack) |
| | | */ |
| | | protected abstract boolean throwException(); |
| | | |
| | | /** |
| | | * 最大重试次数 |
| | | * |
| | | * @return 最大重试次数,默认5次 |
| | | */ |
| | | protected int getMaxRetryTimes() { |
| | | return MAX_RETRY_TIMES; |
| | | } |
| | | |
| | | /** |
| | | * isRetry开启时,重新入队延迟时间 |
| | | * @return -1:立即入队重试 |
| | | */ |
| | | protected int getDelayLevel() { |
| | | return DELAY_LEVEL; |
| | | } |
| | | |
| | | /** |
| | | * 使用模板模式构建消息消费框架,可自由扩展或删减 |
| | | */ |
| | | public void dispatchMessage(T message) { |
| | | // 基础日志记录被父类处理了 |
| | | log.info("消费者收到消息[{}]", JSONObject.toJSON(message)); |
| | | |
| | | if (filter(message)) { |
| | | log.info("消息id{}不满足消费条件,已过滤。",message.getKey()); |
| | | return; |
| | | } |
| | | // 超过最大重试次数时调用子类方法处理 |
| | | if (message.getRetryTimes() > getMaxRetryTimes()) { |
| | | handleMaxRetriesExceeded(message); |
| | | return; |
| | | } |
| | | try { |
| | | long now = System.currentTimeMillis(); |
| | | handleMessage(message); |
| | | long costTime = System.currentTimeMillis() - now; |
| | | log.info("消息{}消费成功,耗时[{}ms]", message.getKey(),costTime); |
| | | } catch (Exception e) { |
| | | log.error("消息{}消费异常", message.getKey(),e); |
| | | // 是捕获异常还是抛出,由子类决定 |
| | | if (throwException()) { |
| | | //抛出异常,由DefaultMessageListenerConcurrently类处理 |
| | | throw new RuntimeException(e); |
| | | } |
| | | //此时如果不开启重试机制,则默认ACK了 |
| | | if (isRetry()) { |
| | | handleRetry(message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected void handleRetry(T message) { |
| | | // 获取子类RocketMQMessageListener注解拿到topic和tag |
| | | RocketMQMessageListener annotation = this.getClass().getAnnotation(RocketMQMessageListener.class); |
| | | if (annotation == null) { |
| | | return; |
| | | } |
| | | //重新构建消息体 |
| | | String messageSource = message.getSource(); |
| | | if(!messageSource.startsWith(EnhanceMessageConstant.RETRY_PREFIX)){ |
| | | message.setSource(EnhanceMessageConstant.RETRY_PREFIX + messageSource); |
| | | } |
| | | message.setRetryTimes(message.getRetryTimes() + 1); |
| | | |
| | | SendResult sendResult; |
| | | |
| | | try { |
| | | // 如果消息发送不成功,则再次重新发送,如果发送异常则抛出由MQ再次处理(异常时不走延迟消息) |
| | | sendResult = rocketMQEnhanceTemplate.send(annotation.topic(), annotation.selectorExpression(), message, getDelayLevel()); |
| | | } catch (Exception ex) { |
| | | // 此处捕获之后,相当于此条消息被消息完成然后重新发送新的消息 |
| | | //由生产者直接发送 |
| | | throw new RuntimeException(ex); |
| | | } |
| | | // 发送失败的处理就是不进行ACK,由RocketMQ重试 |
| | | if (sendResult.getSendStatus() != SendStatus.SEND_OK) { |
| | | throw new RuntimeException("重试消息发送失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import com.ruoyi.integration.rocket.configuration.RocketEnhanceProperties; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.apache.rocketmq.spring.core.RocketMQTemplate; |
| | | import org.apache.rocketmq.spring.support.RocketMQHeaders; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.messaging.Message; |
| | | import org.springframework.messaging.support.MessageBuilder; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| | | public class RocketMQEnhanceTemplate { |
| | | private final RocketMQTemplate template; |
| | | |
| | | @Resource |
| | | private RocketEnhanceProperties rocketEnhanceProperties; |
| | | |
| | | public RocketMQTemplate getTemplate() { |
| | | return template; |
| | | } |
| | | |
| | | /** |
| | | * 根据系统上下文自动构建隔离后的topic |
| | | * 构建目的地 |
| | | */ |
| | | public String buildDestination(String topic, String tag) { |
| | | topic = reBuildTopic(topic); |
| | | return topic + ":" + tag; |
| | | } |
| | | |
| | | /** |
| | | * 根据环境重新隔离topic |
| | | * @param topic 原始topic |
| | | */ |
| | | private String reBuildTopic(String topic) { |
| | | if(rocketEnhanceProperties.isEnabledIsolation() && StringUtils.hasText(rocketEnhanceProperties.getEnvironment())){ |
| | | return topic +"_" + rocketEnhanceProperties.getEnvironment(); |
| | | } |
| | | return topic; |
| | | } |
| | | |
| | | /** |
| | | * 发送同步消息 |
| | | */ |
| | | public <T extends BaseMessage> SendResult send(String topic, String tag, T message) { |
| | | // 注意分隔符 |
| | | return send(buildDestination(topic,tag), message); |
| | | } |
| | | |
| | | |
| | | public <T extends BaseMessage> SendResult send(String destination, T message) { |
| | | // 设置业务键,此处根据公共的参数进行处理 |
| | | // 更多的其它基础业务处理... |
| | | Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build(); |
| | | SendResult sendResult = template.syncSend(destination, sendMessage); |
| | | // 此处为了方便查看给日志转了json,根据选择选择日志记录方式,例如ELK采集 |
| | | log.info("[{}]同步消息[{}]发送结果[{}]", destination, JSONObject.toJSON(message), JSONObject.toJSON(sendResult)); |
| | | return sendResult; |
| | | } |
| | | |
| | | /** |
| | | * 发送延迟消息 |
| | | */ |
| | | public <T extends BaseMessage> SendResult send(String topic, String tag, T message, int delayLevel) { |
| | | return send(buildDestination(topic,tag), message, delayLevel); |
| | | } |
| | | |
| | | public <T extends BaseMessage> SendResult send(String destination, T message, int delayLevel) { |
| | | Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build(); |
| | | SendResult sendResult = template.syncSend(destination, sendMessage, 3000, delayLevel); |
| | | log.info("[{}]延迟等级[{}]消息[{}]发送结果[{}]", destination, delayLevel, JSONObject.toJSON(message), JSONObject.toJSON(sendResult)); |
| | | return sendResult; |
| | | } |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | /** |
| | | * 查询用户最近一次充电记录使用的车辆 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getCar") |
| | | public R<Long> getCar() { |
| | | // todo 获取用户id |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getAppUserId, 11) |
| | | .isNotNull(TChargingOrder::getAppUserCarId)); |
| | | if (!list.isEmpty()){ |
| | | // 最近使用的车辆id |
| | | Long size = list.get(0).getAppUserCarId(); |
| | | return R.ok(size); |
| | | }else{ |
| | | return R.ok(-1L); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询会员在本月有多少次享受了充电折扣 |
New file |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.utils.ObsUploadUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | @RestController |
| | | @RequestMapping("/base/oss") |
| | | @Api(value = "文件上传", tags = "文件上传", description = "文件上传") |
| | | public class OssController { |
| | | private static final String endpoint = "obs.cn-north-4.myhuaweicloud.com"; |
| | | private static final String accessKeyId = "DRJFJRVQ9KVLQUSJUROI"; |
| | | private static final String accessKeySecret = "3zpPkULh0a8CTTYjKL4f7szQZECkvVol4SwNab0f"; |
| | | private static final String bucketName = "jkjianshen"; |
| | | @PostMapping("/upload") |
| | | @ApiOperation(value = "文件上传") |
| | | public String upload(@RequestParam("file") MultipartFile file) throws IOException { |
| | | String s = ObsUploadUtil.obsUpload(file); |
| | | return s; |
| | | } |
| | | // @PostMapping("/uploadVideo") |
| | | // @ApiOperation(value = "视频上传",tags = "文件上传") |
| | | // public String uploadVideo(@RequestParam("file") MultipartFile file) throws Exception { |
| | | // // 获取文件名 |
| | | // String fileName = file.getOriginalFilename(); |
| | | // // 构建目标文件路径 |
| | | // String filePath = "/usr/local/temp" + fileName; |
| | | //// String filePath = "C:/temp/" + fileName; |
| | | // // 创建目标文件对象 |
| | | // File targetFile = new File(filePath); |
| | | // // 将 MultipartFile 内容写入目标文件 |
| | | // try (FileOutputStream fos = new FileOutputStream(targetFile)) { |
| | | // fos.write(file.getBytes()); |
| | | // } |
| | | // String s = UploadVideoUtil.endUpload(targetFile.toString(), UUIDUtil.getRandomCode(5)+fileName); |
| | | // // 创建要删除的文件对象 |
| | | // File fileToDelete = new File(targetFile.toString()); |
| | | // // 检查文件是否存在,并删除文件 |
| | | // if (fileToDelete.exists()) { |
| | | // fileToDelete.delete(); |
| | | // } |
| | | // return s; |
| | | // } |
| | | |
| | | // @PostMapping("/upload") |
| | | // @ApiOperation(value = "文件上传",tags = "文件上传") |
| | | // public ResponseEntity<String> upload(@RequestParam("file") MultipartFile file) throws IOException { |
| | | // // 创建 OSSClient 实例 |
| | | // OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret); |
| | | // |
| | | // |
| | | // // 创建 PutObjectRequest 对象 |
| | | // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, file.getOriginalFilename(), file.getInputStream()); |
| | | // |
| | | // ObjectMetadata metadata = new ObjectMetadata(); |
| | | // // 取消文件缓存,文件每次都会从OSS服务器获取 |
| | | // metadata.setHeader("Cache-Control", "no-cache"); |
| | | // metadata.setHeader("Expires", "0"); |
| | | // |
| | | // |
| | | // // 上传文件 |
| | | // PutObjectResult putObjectResult = ossClient.putObject(putObjectRequest); |
| | | // |
| | | // // 关闭 OSSClient 实例 |
| | | // ossClient.shutdown(); |
| | | // |
| | | // String fileUrl = "https://" + bucketName + "." + endpoint + "/" + file.getOriginalFilename(); |
| | | // return ResponseEntity.ok(fileUrl); |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | }else{ |
| | | record.setMeetTheConditions("满"+byId.getMeetTheConditions()+"元可用"); |
| | | } |
| | | record.setCoverPicture(byId.getCoverPicture()); |
| | | record.setDetailsPicture(byId.getDetailsPicture()); |
| | | } |
| | | } |
| | | return AjaxResult.ok(data); |
| | |
| | | package com.ruoyi.other.controller; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.dto.SaveIntegralDTO; |
| | | import com.ruoyi.other.service.THtmlService; |
| | | import com.ruoyi.other.service.TIntegralRuleService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | |
| | | |
| | | |
| | | @PostMapping("/getSet") |
| | | @ApiOperation(value = "获取积分设置") |
| | | @GetMapping("/getSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "获取积分设置") |
| | | public R<TIntegralRule> getSet() { |
| | | TIntegralRule res = integralRuleService.getOne(new QueryWrapper<>()); |
| | | return R.ok(res); |
| | |
| | | |
| | | |
| | | @PostMapping("/saveSet") |
| | | @ApiOperation(value = "保存积分设置") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分设置") |
| | | public R saveSet(@RequestBody TIntegralRule dto) { |
| | | integralRuleService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(value = "type 1=积分规则说明," + |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "type 1=积分规则说明," + |
| | | "2=会员折扣说明," + |
| | | "3=优惠券说明," + |
| | | "4=双倍积分说明," + |
| | |
| | | return R.ok(g.getContent()); |
| | | } |
| | | @GetMapping("/saveInfo") |
| | | @ApiOperation(value = "保存积分说明") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分说明") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "info", value = "内容", required = true), |
| | | @ApiImplicitParam(name = "type", value = "type 1=积分规则说明,\" +\n" + |
| | |
| | | @Autowired |
| | | private TVipService vipService; |
| | | @PostMapping("/saveVip") |
| | | @ApiOperation(value = "会员添加") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加") |
| | | public AjaxResult saveVip(@RequestBody TVip dto) { |
| | | vipService.save(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/delete") |
| | | @ApiOperation(value = "会员删除") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员删除") |
| | | public AjaxResult delete(Integer id) { |
| | | vipService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(value = "会员修改") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员修改") |
| | | public AjaxResult updateVip(@RequestBody TVip dto) { |
| | | vipService.updateById(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(value = "会员查看详情") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员查看详情") |
| | | public AjaxResult<TVip> getInfo(Integer id) { |
| | | return AjaxResult.ok(vipService.getById(id)); |
| | | } |
| | |
| | | public R<TVip> getInfo1(@RequestParam("id")Integer id) { |
| | | return R.ok(vipService.getById(id)); |
| | | } |
| | | @ApiOperation(value = "会员列表分页查询") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pageCurr", value = "分页参数,当前页码", required = true), |
| | |
| | | <result column="double_integration" property="doubleIntegration" /> |
| | | <result column="mall_exclusive_price" property="mallExclusivePrice" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="discount" property="discount" /> |
| | | <result column="type" property="type" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, reveal, monthly_card, monthly_card_reveal, monthly_card_discount, monthly_card_discount_start, monthly_card_discount_end, monthly_card_discount_reveal, season_card, season_card_reveal, season_card_discount, season_card_discount_start, season_card_discount_end, season_card_discount_reveal, annual_card, annual_card_reveal, annual_card_discount, annual_card_discount_start, annual_card_discount_end, annual_card_discount_reveal, discount_times, maximum_deduction, deduction_type, coupon, double_integration, mall_exclusive_price, create_time, del_flag |
| | | ,discount, type |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.other.api.domain.TVip"> |
| | | select * from t_vip |