小程序接口相关调整
This commit is contained in:
parent
ac525609f6
commit
be3c8e9e4c
@ -1,7 +1,10 @@
|
|||||||
package com.evotech.hd.authorization.config.oauth2;
|
package com.evotech.hd.authorization.config.oauth2;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.http.server.ServletServerHttpResponse;
|
import org.springframework.http.server.ServletServerHttpResponse;
|
||||||
@ -11,12 +14,7 @@ import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
|
|||||||
import org.springframework.security.oauth2.core.OAuth2Error;
|
import org.springframework.security.oauth2.core.OAuth2Error;
|
||||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import java.io.IOException;
|
||||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
|
||||||
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
public class MyAuthenticationFailureHandler implements AuthenticationFailureHandler {
|
public class MyAuthenticationFailureHandler implements AuthenticationFailureHandler {
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.evotech.hd.authorization.config.oauth2;
|
package com.evotech.hd.authorization.config.oauth2;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import java.time.temporal.ChronoUnit;
|
import jakarta.servlet.ServletException;
|
||||||
import java.util.Map;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
@ -17,11 +17,9 @@ import org.springframework.security.oauth2.server.authorization.authentication.O
|
|||||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import java.io.IOException;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import jakarta.servlet.ServletException;
|
import java.util.Map;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
public class MyAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
|
public class MyAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ public class MyAuthenticationSuccessHandler implements AuthenticationSuccessHand
|
|||||||
ServletServerHttpResponse httpResponse = new ServletServerHttpResponse(response);
|
ServletServerHttpResponse httpResponse = new ServletServerHttpResponse(response);
|
||||||
|
|
||||||
|
|
||||||
this.accessTokenHttpResponseConverter.write(new Result<String>().success(tokenResponseParameters), null, httpResponse);
|
this.accessTokenHttpResponseConverter.write(new Result<Map<String, Object>>().success(tokenResponseParameters), null, httpResponse);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,16 @@
|
|||||||
package com.evotech.hd.authorization.config.security;
|
package com.evotech.hd.authorization.config.security;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.http.server.ServletServerHttpResponse;
|
import org.springframework.http.server.ServletServerHttpResponse;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import java.io.IOException;
|
||||||
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登陆了,没有权限时,触发异常 返回信息
|
* 登陆了,没有权限时,触发异常 返回信息
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
package com.evotech.hd.authorization.config.security;
|
package com.evotech.hd.authorization.config.security;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.http.server.ServletServerHttpResponse;
|
import org.springframework.http.server.ServletServerHttpResponse;
|
||||||
@ -8,12 +12,7 @@ import org.springframework.security.core.AuthenticationException;
|
|||||||
import org.springframework.security.oauth2.server.resource.InvalidBearerTokenException;
|
import org.springframework.security.oauth2.server.resource.InvalidBearerTokenException;
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import java.io.IOException;
|
||||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
|
||||||
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 未认证(没有登录)时,返回异常 信息
|
* 未认证(没有登录)时,返回异常 信息
|
||||||
|
|||||||
@ -1,17 +1,16 @@
|
|||||||
package com.evotech.hd.authorization.config.security.userdetail;
|
package com.evotech.hd.authorization.config.security.userdetail;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.evotech.hd.authorization.service.ResourceService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.resource.auth.AuthUser;
|
||||||
|
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.authentication.DisabledException;
|
import org.springframework.security.authentication.DisabledException;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import com.evotech.hd.authorization.service.ResourceService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUser;
|
|
||||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class UserDetailService implements UserDetailsService {
|
public class UserDetailService implements UserDetailsService {
|
||||||
|
|||||||
@ -1,17 +1,15 @@
|
|||||||
package com.evotech.hd.authorization.controller;
|
package com.evotech.hd.authorization.controller;
|
||||||
|
|
||||||
|
import com.evotech.hd.authorization.service.CaptchaService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.authorization.service.CaptchaService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
@Tag(name = "验证码")
|
@Tag(name = "验证码")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/captcha")
|
@RequestMapping("/captcha")
|
||||||
|
|||||||
@ -1,18 +1,9 @@
|
|||||||
package com.evotech.hd.authorization.controller;
|
package com.evotech.hd.authorization.controller;
|
||||||
|
|
||||||
import org.apache.http.auth.AuthenticationException;
|
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.evotech.hd.authorization.entity.LoginRequest;
|
import com.evotech.hd.authorization.entity.LoginRequest;
|
||||||
import com.evotech.hd.authorization.entity.UserVo;
|
import com.evotech.hd.authorization.entity.UserVo;
|
||||||
import com.evotech.hd.authorization.service.LoginService;
|
import com.evotech.hd.authorization.service.LoginService;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
@ -20,6 +11,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.apache.http.auth.AuthenticationException;
|
||||||
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@Tag(name = "登陆")
|
@Tag(name = "登陆")
|
||||||
@RestController
|
@RestController
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.evotech.hd.authorization.service;
|
package com.evotech.hd.authorization.service;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
|
||||||
public interface CaptchaService {
|
public interface CaptchaService {
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
public interface CloudService {
|
public interface CloudService {
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/batterystation/login/list", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
@GetMapping(value = "/battery/station/login/list", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||||
public Result<List<BatteryStation>> loadBatteryStation(@RequestParam("proxyCode") String proxyCode);
|
public Result<List<BatteryStation>> loadBatteryStation(@RequestParam("proxyCode") String proxyCode);
|
||||||
|
|
||||||
@GetMapping(value = "/company/login/one", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
@GetMapping(value = "/company/login/one", consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.evotech.hd.authorization.service;
|
package com.evotech.hd.authorization.service;
|
||||||
|
|
||||||
import org.apache.http.auth.AuthenticationException;
|
|
||||||
|
|
||||||
import com.evotech.hd.authorization.entity.LoginRequest;
|
import com.evotech.hd.authorization.entity.LoginRequest;
|
||||||
import com.evotech.hd.authorization.entity.UserVo;
|
import com.evotech.hd.authorization.entity.UserVo;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.apache.http.auth.AuthenticationException;
|
||||||
|
|
||||||
public interface LoginService {
|
public interface LoginService {
|
||||||
|
|
||||||
|
|||||||
@ -21,19 +21,19 @@ public interface ResourceService {
|
|||||||
|
|
||||||
@GetMapping(value = "/user/userbyname",
|
@GetMapping(value = "/user/userbyname",
|
||||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||||
public com.evotech.hd.common.core.entity.Result<AuthUser> loadUserByName(@RequestParam("uname") String userName);
|
public Result<AuthUser> loadUserByName(@RequestParam("uname") String userName);
|
||||||
|
|
||||||
@PostMapping(value = "/user/userpermbyid",
|
@PostMapping(value = "/user/userpermbyid",
|
||||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||||
public com.evotech.hd.common.core.entity.Result<String> userPermById(@NotNull @RequestParam("uid") String userId, @RequestParam("type")Integer type);
|
public Result<String> userPermById(@NotNull @RequestParam("uid") String userId, @RequestParam("type")Integer type);
|
||||||
|
|
||||||
@PostMapping(value = "/loginlog/add",
|
@PostMapping(value = "/loginlog/add",
|
||||||
consumes = {MediaType.APPLICATION_JSON_VALUE})
|
consumes = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> addLoginLog(@RequestBody LogLogin log);
|
public Result<Integer> addLoginLog(@RequestBody LogLogin log);
|
||||||
|
|
||||||
@GetMapping(value = "/logininfo/get",
|
@GetMapping(value = "/logininfo/get",
|
||||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||||
public com.evotech.hd.common.core.entity.Result<LoginCacheInfo> loginInfo(@RequestParam("uid") String uid);
|
public Result<LoginCacheInfo> loginInfo(@RequestParam("uid") String uid);
|
||||||
|
|
||||||
@GetMapping(value = "/user/station",consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
@GetMapping(value = "/user/station",consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
|
||||||
public Result<List<AuthUserStation>> loadBatteryStation(@RequestParam("uid") String uid);
|
public Result<List<AuthUserStation>> loadBatteryStation(@RequestParam("uid") String uid);
|
||||||
|
|||||||
@ -1,18 +1,16 @@
|
|||||||
package com.evotech.hd.authorization.service.impl;
|
package com.evotech.hd.authorization.service.impl;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.evotech.hd.authorization.service.CaptchaService;
|
|
||||||
import com.evotech.hd.common.core.constant.HDConstant;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.redis.utils.RedisUtil;
|
|
||||||
|
|
||||||
import cn.hutool.captcha.CaptchaUtil;
|
import cn.hutool.captcha.CaptchaUtil;
|
||||||
import cn.hutool.captcha.LineCaptcha;
|
import cn.hutool.captcha.LineCaptcha;
|
||||||
import cn.hutool.captcha.generator.RandomGenerator;
|
import cn.hutool.captcha.generator.RandomGenerator;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.evotech.hd.authorization.service.CaptchaService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.constant.HDConstant;
|
||||||
|
import com.evotech.hd.common.redis.utils.RedisUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CaptchaServiceImpl implements CaptchaService {
|
public class CaptchaServiceImpl implements CaptchaService {
|
||||||
@ -32,7 +30,7 @@ public class CaptchaServiceImpl implements CaptchaService {
|
|||||||
String imageBase64Data = captcha.getImageBase64Data();
|
String imageBase64Data = captcha.getImageBase64Data();
|
||||||
String captchaId = IdUtil.fastSimpleUUID();
|
String captchaId = IdUtil.fastSimpleUUID();
|
||||||
redisUtil.set(HDConstant.CAPTCHA_REDIS_PREFIX + captchaId, code, captchaExpire);
|
redisUtil.set(HDConstant.CAPTCHA_REDIS_PREFIX + captchaId, code, captchaExpire);
|
||||||
return new Result<String>().success("OK", captchaId + ":" + imageBase64Data);
|
return new Result<String>().success(captchaId + ":" + imageBase64Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -15,10 +15,10 @@ import com.evotech.hd.authorization.service.ResourceService;
|
|||||||
import com.evotech.hd.authorization.utils.LoginRequesHeadertUtil;
|
import com.evotech.hd.authorization.utils.LoginRequesHeadertUtil;
|
||||||
import com.evotech.hd.authorization.utils.Oauth2AccessTokenUtil;
|
import com.evotech.hd.authorization.utils.Oauth2AccessTokenUtil;
|
||||||
import com.evotech.hd.authorization.utils.TokenUtil;
|
import com.evotech.hd.authorization.utils.TokenUtil;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||||
import com.evotech.hd.common.core.constant.HDConstant;
|
import com.evotech.hd.common.core.constant.HDConstant;
|
||||||
import com.evotech.hd.common.core.entity.LoginCacheInfo;
|
import com.evotech.hd.common.core.entity.LoginCacheInfo;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||||
@ -70,7 +70,7 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
// 1. 校验验证码
|
// 1. 校验验证码
|
||||||
Result<Boolean> res = captchaService.checkCaptcha(lr.getCode());
|
Result<Boolean> res = captchaService.checkCaptcha(lr.getCode());
|
||||||
if (res.getStatus() != 1) {
|
if (res.getStatus() != 1) {
|
||||||
return new Result<UserVo>().error(res.getCode(), res.getMsg());
|
return new Result<UserVo>().error(CodeMsg.getCodeMsgByCode(res.getCode()), res.getMsg());
|
||||||
}
|
}
|
||||||
// 2. 从请求头获取client信息
|
// 2. 从请求头获取client信息
|
||||||
Map<String, String> oAuth2Client = LoginRequesHeadertUtil.getOAuth2Client(request);
|
Map<String, String> oAuth2Client = LoginRequesHeadertUtil.getOAuth2Client(request);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求返回对象
|
* 请求返回对象
|
||||||
@ -26,9 +27,28 @@ public class Result<T> implements Serializable {
|
|||||||
@Schema(description = "返回数据")
|
@Schema(description = "返回数据")
|
||||||
private T data;
|
private T data;
|
||||||
|
|
||||||
|
public static <T> Result<T> getInstance(){
|
||||||
|
return new Result<T>();
|
||||||
|
}
|
||||||
|
|
||||||
public Result() {
|
public Result() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> Result<T> build(Class<T> cls) {
|
||||||
|
return (Result<T>) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> Result<List<T>> buildList(Class<T> cls) {
|
||||||
|
return (Result<List<T>>) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result<T> success() {
|
||||||
|
this.status = 1;
|
||||||
|
this.code = CodeMsg.SUCCESS.getCode();
|
||||||
|
this.msg = CodeMsg.SUCCESS.getMsg();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Result<T> success(T o) {
|
public Result<T> success(T o) {
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
this.code = CodeMsg.SUCCESS.getCode();
|
this.code = CodeMsg.SUCCESS.getCode();
|
||||||
@ -65,4 +85,20 @@ public class Result<T> implements Serializable {
|
|||||||
this.msg = errorMsg;
|
this.msg = errorMsg;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result<T> exception(T data) {
|
||||||
|
this.status = -1;
|
||||||
|
this.code = CodeMsg.ERROR.getCode();
|
||||||
|
this.msg = CodeMsg.ERROR.getMsg();
|
||||||
|
this.data = data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result<T> businessException(String code, String msg, T o) {
|
||||||
|
this.status = -1;
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
this.data = o;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,9 @@ public class OrderListVo {
|
|||||||
@Schema(name = "换电站")
|
@Schema(name = "换电站")
|
||||||
private String stationName;
|
private String stationName;
|
||||||
|
|
||||||
|
@Schema(name = "订单金额")
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
@Schema(name = "预约人")
|
@Schema(name = "预约人")
|
||||||
private String perName;
|
private String perName;
|
||||||
|
|
||||||
@ -44,7 +47,7 @@ public class OrderListVo {
|
|||||||
private Date orderTime;
|
private Date orderTime;
|
||||||
|
|
||||||
@Schema(name = "订单状态", description = "订单状态:1-已创建,2-换电中,3-换电完成,4-充电中,5-充电完成,6-待结算,7-已完成,9-已取消, -1-退款")
|
@Schema(name = "订单状态", description = "订单状态:1-已创建,2-换电中,3-换电完成,4-充电中,5-充电完成,6-待结算,7-已完成,9-已取消, -1-退款")
|
||||||
private Integer orderStatus;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(name = "交易编码", description = "第三方收款返回的唯一标识")
|
@Schema(name = "交易编码", description = "第三方收款返回的唯一标识")
|
||||||
private String notifyOrderNo;
|
private String notifyOrderNo;
|
||||||
|
|||||||
@ -22,6 +22,31 @@ public interface HDConstant {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class DcConstant{
|
||||||
|
/** 出租中 */
|
||||||
|
public static final Integer STATUS_CZ = 1;
|
||||||
|
/** 充电中 */
|
||||||
|
public static final Integer STATUS_CD = 2;
|
||||||
|
/** 空闲 */
|
||||||
|
public static final Integer STATUS_KX = 3;
|
||||||
|
/** 故障 */
|
||||||
|
public static final Integer STATUS_GZ = 4;
|
||||||
|
/** 其他 */
|
||||||
|
public static final Integer STATUS_QT = 5;
|
||||||
|
|
||||||
|
/** 来源_电站 */
|
||||||
|
public static final Integer SOURCE_FROM_STATION = 1;
|
||||||
|
/** 来源_车 */
|
||||||
|
public static final Integer SOURCE_FROM_CAR = 2;
|
||||||
|
|
||||||
|
/** 电站 */
|
||||||
|
public static final Integer POINT_TYPE_STATION = 1;
|
||||||
|
/** 车 */
|
||||||
|
public static final Integer POINT_TYPE_CAR = 2;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 订单相关参数
|
* 订单相关参数
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evotech.hd.cloud.dao;
|
package com.evotech.hd.common.core.dao.cloud;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.evotech.hd.cloud.entity.order.Order;
|
import com.evotech.hd.common.core.entity.order.Order;
|
||||||
import com.evotech.hd.common.core.Dto.home.*;
|
import com.evotech.hd.common.core.Dto.home.*;
|
||||||
import com.evotech.hd.common.core.Dto.request.HomeRequestDto;
|
import com.evotech.hd.common.core.Dto.request.HomeRequestDto;
|
||||||
import com.evotech.hd.common.core.constant.HDConstant;
|
import com.evotech.hd.common.core.constant.HDConstant;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evotech.hd.cloud.dao;
|
package com.evotech.hd.common.core.dao.cloud;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.evotech.hd.cloud.entity.order.OrderDetail;
|
import com.evotech.hd.common.core.entity.order.OrderDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口
|
* 接口
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.evotech.hd.common.core.dao.cloud;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.evotech.hd.common.core.entity.system.SysParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口
|
||||||
|
*
|
||||||
|
* @ClassName:SysParamDao
|
||||||
|
* @date: 2025年07月02日 14:32
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
public interface SysParamDao extends BaseMapper<SysParam> {
|
||||||
|
}
|
||||||
@ -1,164 +1,171 @@
|
|||||||
package com.evotech.hd.common.core.entity;
|
//package com.evotech.hd.common.core.entity;
|
||||||
|
//
|
||||||
import java.io.Serializable;
|
//import java.io.Serializable;
|
||||||
|
//
|
||||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
//import com.evotech.hd.common.core.enums.CodeMsg;
|
||||||
|
//
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
//import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
//import lombok.Data;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @author zrb
|
// * @author zrb
|
||||||
* @date 2024年9月2日17:25:54
|
// * @date 2024年9月2日17:25:54
|
||||||
*/
|
// */
|
||||||
@Data
|
//@Data
|
||||||
@Schema(name = "请求返回对象")
|
//@Schema(name = "请求返回对象")
|
||||||
public class Result<T> implements Serializable {
|
//public class Result<T> implements Serializable {
|
||||||
|
//
|
||||||
private static final long serialVersionUID = -7806513009135956518L;
|
// private static final long serialVersionUID = -7806513009135956518L;
|
||||||
|
//
|
||||||
@Schema(description = "请求处理状态", example = "1")
|
// @Schema(description = "请求处理状态", example = "1")
|
||||||
private Integer status;
|
// private Integer status;
|
||||||
@Schema(description = "状态码", example = "1000")
|
// @Schema(description = "状态码", example = "1000")
|
||||||
private String code;
|
// private String code;
|
||||||
@Schema(description = "返回消息")
|
// @Schema(description = "返回消息")
|
||||||
private String msg;
|
// private String msg;
|
||||||
@Schema(description = "返回数据")
|
// @Schema(description = "返回数据")
|
||||||
private Object data;
|
// private Object data;
|
||||||
|
//
|
||||||
private T obj;
|
// private T obj;
|
||||||
|
//
|
||||||
|
//
|
||||||
public Result(Integer status, String code, String msg, Object data) {
|
// public Result(Integer status, String code, String msg, Object data) {
|
||||||
this.status = status;
|
// this.status = status;
|
||||||
this.code = code;
|
// this.code = code;
|
||||||
this.msg = msg;
|
// this.msg = msg;
|
||||||
this.data = data;
|
// this.data = data;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Result(Integer status, String msg, Object data) {
|
// public Result(Integer status, String msg, Object data) {
|
||||||
this.status = status;
|
// this.status = status;
|
||||||
this.msg = msg;
|
// this.msg = msg;
|
||||||
this.data = data;
|
// this.data = data;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Result(Integer status) {
|
// public Result(Integer status) {
|
||||||
this.status = status;
|
// this.status = status;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Result() {
|
// public Result() {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Result(Integer status, String code, String msg) {
|
// public Result(Integer status, String code, String msg) {
|
||||||
this.status = status;
|
// this.status = status;
|
||||||
this.code = code;
|
// this.code = code;
|
||||||
this.msg = msg;
|
// this.msg = msg;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Result(Integer status, String msg) {
|
// public Result(Integer status, String msg) {
|
||||||
this.status = status;
|
// this.status = status;
|
||||||
this.msg = msg;
|
// this.msg = msg;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Result<T> success(Object o) {
|
// public Result<T> success() {
|
||||||
this.status = 1;
|
// this.status = 1;
|
||||||
this.code = CodeMsg.SUCCESS.getCode();
|
// this.code = CodeMsg.SUCCESS.getCode();
|
||||||
this.msg = CodeMsg.SUCCESS.getMsg();
|
// this.msg = CodeMsg.SUCCESS.getMsg();
|
||||||
this.data = o;
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> success(Object o) {
|
||||||
public Result<T> success(String msg, Object o) {
|
// this.status = 1;
|
||||||
this.status = 1;
|
// this.code = CodeMsg.SUCCESS.getCode();
|
||||||
this.code = CodeMsg.SUCCESS.getCode();
|
// this.msg = CodeMsg.SUCCESS.getMsg();
|
||||||
this.msg = msg;
|
// this.data = o;
|
||||||
this.data = o;
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> success(String msg, Object o) {
|
||||||
public Result<T> success(String msg) {
|
// this.status = 1;
|
||||||
this.status = 1;
|
// this.code = CodeMsg.SUCCESS.getCode();
|
||||||
this.code = CodeMsg.SUCCESS.getCode();
|
// this.msg = msg;
|
||||||
this.msg = msg;
|
// this.data = o;
|
||||||
this.data = CodeMsg.SUCCESS.getMsg();
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> success(String msg) {
|
||||||
public Result<T> success(String code, String msg, Object o) {
|
// this.status = 1;
|
||||||
this.status = 1;
|
// this.code = CodeMsg.SUCCESS.getCode();
|
||||||
this.code = code;
|
// this.msg = msg;
|
||||||
this.msg = msg;
|
// this.data = CodeMsg.SUCCESS.getMsg();
|
||||||
this.data = o;
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> success(String code, String msg, Object o) {
|
||||||
public Result<T> success(CodeMsg cm, Object o) {
|
// this.status = 1;
|
||||||
this.status = 0;
|
// this.code = code;
|
||||||
this.code = cm.getCode();
|
// this.msg = msg;
|
||||||
this.msg = cm.getMsg();
|
// this.data = o;
|
||||||
this.data = o;
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> success(CodeMsg cm, Object o) {
|
||||||
public Result<T> error(String msg) {
|
// this.status = 0;
|
||||||
this.status = 0;
|
// this.code = cm.getCode();
|
||||||
this.code = CodeMsg.ERROR.getCode();
|
// this.msg = cm.getMsg();
|
||||||
this.msg = msg;
|
// this.data = o;
|
||||||
this.data = "ERROR";
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> error(String msg) {
|
||||||
public Result<T> error(String code, String msg) {
|
// this.status = 0;
|
||||||
this.status = 0;
|
// this.code = CodeMsg.ERROR.getCode();
|
||||||
this.code = code;
|
// this.msg = msg;
|
||||||
this.msg = msg;
|
// this.data = "ERROR";
|
||||||
this.data = "ERROR";
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> error(String code, String msg) {
|
||||||
public Result<T> error(CodeMsg cm) {
|
// this.status = 0;
|
||||||
this.status = 0;
|
// this.code = code;
|
||||||
this.code = cm.getCode();
|
// this.msg = msg;
|
||||||
this.msg = cm.getMsg();
|
// this.data = "ERROR";
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Result<T> error(CodeMsg cm, Object o) {
|
// public Result<T> error(CodeMsg cm) {
|
||||||
return error(cm.getCode(), cm.getMsg(), o);
|
// this.status = 0;
|
||||||
}
|
// this.code = cm.getCode();
|
||||||
|
// this.msg = cm.getMsg();
|
||||||
public Result<T> error(String code, String msg, Object o) {
|
// return this;
|
||||||
this.status = 0;
|
// }
|
||||||
this.code = code;
|
//
|
||||||
this.msg = msg;
|
// public Result<T> error(CodeMsg cm, Object o) {
|
||||||
this.data = o;
|
// return error(cm.getCode(), cm.getMsg(), o);
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> error(String code, String msg, Object o) {
|
||||||
public Result<T> error(String msg, Object o) {
|
// this.status = 0;
|
||||||
this.status = 0;
|
// this.code = code;
|
||||||
this.code = CodeMsg.ERROR.getCode();
|
// this.msg = msg;
|
||||||
this.msg = msg;
|
// this.data = o;
|
||||||
this.data = o;
|
// return this;
|
||||||
return this;
|
// }
|
||||||
}
|
//
|
||||||
|
// public Result<T> error(String msg, Object o) {
|
||||||
|
// this.status = 0;
|
||||||
public Result<T> exception(Object data) {
|
// this.code = CodeMsg.ERROR.getCode();
|
||||||
this.status = -1;
|
// this.msg = msg;
|
||||||
this.code = CodeMsg.ERROR.getCode();
|
// this.data = o;
|
||||||
this.msg = CodeMsg.ERROR.getMsg();
|
// return this;
|
||||||
this.data = data==null?"未知异常":data;
|
// }
|
||||||
return this;
|
//
|
||||||
}
|
//
|
||||||
|
// public Result<T> exception(Object data) {
|
||||||
|
// this.status = -1;
|
||||||
public Result<T> bussinessException(String code, String msg, Object o) {
|
// this.code = CodeMsg.ERROR.getCode();
|
||||||
this.status = -1;
|
// this.msg = CodeMsg.ERROR.getMsg();
|
||||||
this.code = code;
|
// this.data = data==null?"未知异常":data;
|
||||||
this.msg = msg;
|
// return this;
|
||||||
this.data = o;
|
// }
|
||||||
return this;
|
//
|
||||||
}
|
//
|
||||||
|
// public Result<T> bussinessException(String code, String msg, Object o) {
|
||||||
}
|
// this.status = -1;
|
||||||
|
// this.code = code;
|
||||||
|
// this.msg = msg;
|
||||||
|
// this.data = o;
|
||||||
|
// return this;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|||||||
@ -1,16 +1,7 @@
|
|||||||
package com.evotech.hd.common.core.entity.cloud;
|
package com.evotech.hd.common.core.entity.cloud;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.evotech.hd.common.core.entity.BaseEntity;
|
import com.evotech.hd.common.core.entity.BaseEntity;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
@ -18,6 +9,8 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zrb
|
* @author zrb
|
||||||
* @since 2024-10-17
|
* @since 2024-10-17
|
||||||
@ -54,11 +47,16 @@ public class BatteryStationDc extends BaseEntity implements Serializable {
|
|||||||
@Schema(description = "站码或车牌照", requiredMode = RequiredMode.REQUIRED)
|
@Schema(description = "站码或车牌照", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String sourceCode;
|
private String sourceCode;
|
||||||
|
/***
|
||||||
|
* 具体参考 HDConstant.DcConstant.STATUS_*
|
||||||
|
*/
|
||||||
@Schema(description = "状态:1-出租中,2-充电中,3-空闲,4-故障,5-其它", requiredMode = RequiredMode.REQUIRED)
|
@Schema(description = "状态:1-出租中,2-充电中,3-空闲,4-故障,5-其它", requiredMode = RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "状态不能为空")
|
@NotNull(message = "状态不能为空")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 具体参考 HDConstant.DcConstant.POINT_TYPE_*
|
||||||
|
*/
|
||||||
@Schema(description = "轨迹点类型:1-电站,2-车辆")
|
@Schema(description = "轨迹点类型:1-电站,2-车辆")
|
||||||
private Integer pointType;
|
private Integer pointType;
|
||||||
|
|
||||||
|
|||||||
@ -1,55 +0,0 @@
|
|||||||
package com.evotech.hd.common.core.entity.cloud;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.evotech.hd.common.core.entity.BaseEntity;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zrb
|
|
||||||
* @since 2024-11-22
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@TableName("hd_cloud_manage.yt_t_order_recharge")
|
|
||||||
@Schema(name = "充值订单")
|
|
||||||
public class OrderRecharge extends BaseEntity implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Schema(description = "订单时间")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
|
||||||
private Date orderTime;
|
|
||||||
|
|
||||||
@Schema(description = "订单编码", hidden = true)
|
|
||||||
private String orderNo;
|
|
||||||
|
|
||||||
@Schema(description = "换电站编码")
|
|
||||||
private String stationCode;
|
|
||||||
|
|
||||||
@Schema(description = "换电站名称")
|
|
||||||
private String stationName;
|
|
||||||
|
|
||||||
@Schema(description = "钱包账户账号")
|
|
||||||
private String accountCode;
|
|
||||||
|
|
||||||
@Schema(description = "充值账号ID")
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
@Schema(description = "交易编码")
|
|
||||||
private String tradeNo;
|
|
||||||
|
|
||||||
@Schema(description = "删除状态:1-已删除,0-未删除", hidden = true)
|
|
||||||
private Integer delFlag;
|
|
||||||
}
|
|
||||||
@ -1,21 +1,17 @@
|
|||||||
package com.evotech.hd.common.core.entity.cloud;
|
package com.evotech.hd.common.core.entity.cloud;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.evotech.hd.common.core.entity.BaseEntity;
|
import com.evotech.hd.common.core.entity.BaseEntity;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zrb
|
* @author zrb
|
||||||
@ -35,7 +31,7 @@ public class OrderSwapBatteryPre extends BaseEntity implements Serializable {
|
|||||||
@Schema(description = "来源是站端时,记录发送Id,其他来源不需要", hidden = true)
|
@Schema(description = "来源是站端时,记录发送Id,其他来源不需要", hidden = true)
|
||||||
private String sourceId;
|
private String sourceId;
|
||||||
|
|
||||||
@Schema(description = "预约人编码", requiredMode = RequiredMode.REQUIRED)
|
@Schema(description = "预约人的微信Id", requiredMode = RequiredMode.REQUIRED)
|
||||||
private String ucode;
|
private String ucode;
|
||||||
|
|
||||||
@Schema(description = "预约人姓名", requiredMode = RequiredMode.REQUIRED)
|
@Schema(description = "预约人姓名", requiredMode = RequiredMode.REQUIRED)
|
||||||
|
|||||||
@ -1,19 +1,15 @@
|
|||||||
package com.evotech.hd.common.core.entity.cloud;
|
package com.evotech.hd.common.core.entity.cloud;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.evotech.hd.common.core.entity.BaseEntity;
|
import com.evotech.hd.common.core.entity.BaseEntity;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zrb
|
* @author zrb
|
||||||
* @since 2024-11-22
|
* @since 2024-11-22
|
||||||
@ -28,38 +24,31 @@ public class TradeDetail extends BaseEntity implements Serializable {
|
|||||||
@Schema(description = "换电站编码")
|
@Schema(description = "换电站编码")
|
||||||
private String stationCode;
|
private String stationCode;
|
||||||
|
|
||||||
@Schema(description = "交易人")
|
@Schema(description = "交易人name")
|
||||||
private String trader;
|
private String trader;
|
||||||
|
|
||||||
@Schema(description = "交易人编码")
|
@Schema(description = "交易人微信Id")
|
||||||
private String traderCode;
|
private String traderCode;
|
||||||
|
|
||||||
@Schema(description = "交易类型:1-充值,2-订单消费,9-提现")
|
|
||||||
private Integer tradeType;
|
|
||||||
|
|
||||||
@Schema(description = "变动金额的钱包账户,钱包金额不变时不需要")
|
|
||||||
private String wallet;
|
|
||||||
|
|
||||||
@Schema(description = "appid")
|
|
||||||
private String appid;
|
|
||||||
|
|
||||||
@Schema(description = "银行类型")
|
|
||||||
private String bankType;
|
|
||||||
|
|
||||||
@Schema(description = "收款商户号")
|
|
||||||
private String mchid;
|
|
||||||
|
|
||||||
@Schema(description = "微信支付API类型")
|
|
||||||
private String wechatPayApiType;
|
|
||||||
|
|
||||||
@Schema(description = "订单总描述")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Schema(description = "交易编码")
|
@Schema(description = "交易编码")
|
||||||
private String outTradeNo;
|
private String outTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "交易类型:1-充值,2-订单消费,3-退款, 9-提现")
|
||||||
|
private Integer tradeType;
|
||||||
|
|
||||||
@Schema(description = "支付方式:1-账户余额,2-微信,3-支付宝,4-网银,5 -充电补偿")
|
@Schema(description = "支付方式:1-账户余额,2-微信,3-支付宝,4-网银,5 -充电补偿")
|
||||||
private Integer payType;
|
private Integer payType;
|
||||||
|
@Schema(description = "微信支付API类型")
|
||||||
|
private String wechatPayApiType;
|
||||||
|
/***
|
||||||
|
* 交易信息
|
||||||
|
*/
|
||||||
|
private String tradeMessage;
|
||||||
|
/***
|
||||||
|
* 交易账号
|
||||||
|
*/
|
||||||
|
// @Schema(description = "变动金额的钱包账户,钱包金额不变时不需要")
|
||||||
|
private String payAccount;
|
||||||
|
|
||||||
@Schema(description = "订单数量")
|
@Schema(description = "订单数量")
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
@ -82,12 +71,9 @@ public class TradeDetail extends BaseEntity implements Serializable {
|
|||||||
@Schema(description = "支付结果,暂用微信结果的枚举类型")
|
@Schema(description = "支付结果,暂用微信结果的枚举类型")
|
||||||
private String payResult;
|
private String payResult;
|
||||||
|
|
||||||
@Schema(description = "在微信等支付网关创建支付订单时失败,返回的失败原因")
|
|
||||||
private String payMsg;
|
|
||||||
|
|
||||||
@Schema(description = "付款人编码,对于个人账户,交易发起人和付款人一般是同一人。公司账户交易发起人是公司,付款人可能是 微信账户")
|
@Schema(description = "付款人编码,对于个人账户,交易发起人和付款人一般是同一人。公司账户交易发起人是公司,付款人可能是 微信账户")
|
||||||
private String payer;
|
private String payWechatId;
|
||||||
|
|
||||||
@Schema(description = "支付完成时间")
|
@Schema(description = "支付完成时间")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
@ -96,12 +82,33 @@ public class TradeDetail extends BaseEntity implements Serializable {
|
|||||||
@Schema(description = "删除标识,1-已删除,0-未删除", hidden = true)
|
@Schema(description = "删除标识,1-已删除,0-未删除", hidden = true)
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
@Schema(description = "退款结果: 0-未退款, 1-退款中,2-已退款, 3-退款失败")
|
@Schema(description = "appid")
|
||||||
private Integer refundResult;
|
private String appid;
|
||||||
|
//
|
||||||
|
@Schema(description = "银行类型")
|
||||||
|
private String bankType;
|
||||||
|
|
||||||
@Schema(description = "在微信等退款网关创建退款订单时失败,返回的失败原因")
|
@Schema(description = "收款商户号")
|
||||||
private String refundMsg;
|
private String mchid;
|
||||||
|
|
||||||
@Schema(description = "退款返回数据")
|
@Schema(description = "订单总描述")
|
||||||
private String refundReturn;
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @Schema(description = "在微信等支付网关创建支付订单时失败,返回的失败原因")
|
||||||
|
// private String payMsg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @Schema(description = "退款结果: 0-未退款, 1-退款中,2-已退款, 3-退款失败")
|
||||||
|
// private Integer refundResult;
|
||||||
|
//
|
||||||
|
// @Schema(description = "在微信等退款网关创建退款订单时失败,返回的失败原因")
|
||||||
|
// private String refundMsg;
|
||||||
|
//
|
||||||
|
// @Schema(description = "退款返回数据")
|
||||||
|
// private String refundReturn;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,158 @@
|
|||||||
|
package com.evotech.hd.common.core.entity.cloud.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandard;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类
|
||||||
|
*
|
||||||
|
* @ClassName:OrderVo
|
||||||
|
* @date: 2025年06月20日 16:08
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "预约订单ID")
|
||||||
|
private Integer orderPreId;
|
||||||
|
|
||||||
|
@Schema(description = "预约用户")
|
||||||
|
private String orderPreUid;
|
||||||
|
|
||||||
|
@Schema(description = "预约用户名称")
|
||||||
|
private String orderPreUname;
|
||||||
|
|
||||||
|
@Schema(description = "预约用户手机")
|
||||||
|
private String orderPrePhone;
|
||||||
|
|
||||||
|
@NotNull(message = "订单类型不能为空")
|
||||||
|
private Integer orderType;
|
||||||
|
|
||||||
|
@Schema(description = "订单编码", hidden = true)
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@NotBlank(message = "车牌号不能为空")
|
||||||
|
private String plateNum;
|
||||||
|
|
||||||
|
@Schema(description = "订单时间", example = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date orderTime;
|
||||||
|
|
||||||
|
@NotBlank(message = "换电站编码不能为空")
|
||||||
|
private String stationCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "换电站名称不能为空")
|
||||||
|
private String stationName;
|
||||||
|
|
||||||
|
@Schema(description = "金额账号")
|
||||||
|
private String accountCode;
|
||||||
|
|
||||||
|
@Schema(description = "订单金额")
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
@Schema(description = "订单状态:1-已创建,2-换电中,3-换电完成,4-充电中,5-充电完成,6-待结算,7-已完成,9-已取消, -1-退款")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "计算费用方式:1-ODO,2-SOC,3-按电量")
|
||||||
|
private Integer feeType;
|
||||||
|
|
||||||
|
@Schema(description = "基础费用")
|
||||||
|
private BigDecimal basicFee;
|
||||||
|
|
||||||
|
@Schema(description = "服务开始时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date serviceTimeBegin;
|
||||||
|
|
||||||
|
@Schema(description = "服务结束时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date serviceTimeEnd;
|
||||||
|
|
||||||
|
@Schema(description = "服务费")
|
||||||
|
private BigDecimal serviceFee;
|
||||||
|
|
||||||
|
@Schema(description = "费用标准")
|
||||||
|
private String feeStandardJson;
|
||||||
|
@Schema(description = "费用标准详情")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BatteryStationHdFeeStandard feeStandardDetail;
|
||||||
|
|
||||||
|
@Schema(description = "上次租赁电池时车辆里程")
|
||||||
|
private BigDecimal lastRentBatCarOdo;
|
||||||
|
|
||||||
|
@Schema(description = "归还电池时车辆里程")
|
||||||
|
private BigDecimal nowReturnBatCarOdo;
|
||||||
|
|
||||||
|
@Schema(description = "按ODO换电费")
|
||||||
|
private BigDecimal odoAmount;
|
||||||
|
|
||||||
|
@Schema(description = "充电开始时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date chargeTimeBegin;
|
||||||
|
|
||||||
|
@Schema(description = "充电结束时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||||
|
private Date chargeTimeEnd;
|
||||||
|
|
||||||
|
@Schema(description = "总充电量")
|
||||||
|
private BigDecimal electAmount;
|
||||||
|
|
||||||
|
@Schema(description = "租借电池包仓位")
|
||||||
|
private Integer rentBatNo;
|
||||||
|
|
||||||
|
@Schema(description = "租用电池包编码")
|
||||||
|
private String rentBatCode;
|
||||||
|
|
||||||
|
@Schema(description = "租用电池包SOC")
|
||||||
|
private Integer rentBatSoc;
|
||||||
|
|
||||||
|
@Schema(description = "归还电池包编码")
|
||||||
|
private String returnBatCode;
|
||||||
|
|
||||||
|
@Schema(description = "归还电池包仓位")
|
||||||
|
private Integer returnBatNo;
|
||||||
|
|
||||||
|
@Schema(description = "归还电池包SOC")
|
||||||
|
private Integer returnBatSoc;
|
||||||
|
|
||||||
|
@Schema(description = "归还电池租出时soc")
|
||||||
|
private Integer returnBatRentSoc;
|
||||||
|
|
||||||
|
@Schema(description = "归还电池租出的换电站编码")
|
||||||
|
private String returnBatRentStationCode;
|
||||||
|
|
||||||
|
@Schema(description = "归还电池租出的换电站")
|
||||||
|
private String returnBatRentStationName;
|
||||||
|
|
||||||
|
@Schema(description = "换电模式:1-全自动,2-半自动,3-人工干预 ")
|
||||||
|
private Integer changeMode;
|
||||||
|
|
||||||
|
@Schema(description = "换电车道 1-A 车道;2-B 车道")
|
||||||
|
private Integer changeLane;
|
||||||
|
|
||||||
|
@Schema(description = "删除状态:1-已删除,0-未删除", hidden = true)
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
@Schema(description = "交易编码", hidden = true)
|
||||||
|
private String tradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "备注信息")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evotech.hd.cloud.entity.order;
|
package com.evotech.hd.common.core.entity.order;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.IdEntity;
|
import com.evotech.hd.common.core.entity.IdEntity;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evotech.hd.cloud.entity.order;
|
package com.evotech.hd.common.core.entity.order;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
@ -19,7 +19,7 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@TableName(value = "yt_t_product_order", schema = "hd_cloud_manage")
|
@TableName(value = "yt_t_order", schema = "hd_cloud_manage")
|
||||||
public class Order extends BaseOrder{
|
public class Order extends BaseOrder{
|
||||||
|
|
||||||
private Integer orderPreId;
|
private Integer orderPreId;
|
||||||
@ -32,7 +32,7 @@ public class Order extends BaseOrder{
|
|||||||
/***
|
/***
|
||||||
* 预约用户名称
|
* 预约用户名称
|
||||||
*/
|
*/
|
||||||
private String preName;
|
private String orderPreUname;
|
||||||
/***
|
/***
|
||||||
* 订单类型, 具体参考 HDConstant.OrderConstant.ORDER_TYPE_*
|
* 订单类型, 具体参考 HDConstant.OrderConstant.ORDER_TYPE_*
|
||||||
*/
|
*/
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evotech.hd.cloud.entity.order;
|
package com.evotech.hd.common.core.entity.order;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.evotech.hd.common.core.entity.IdEntity;
|
import com.evotech.hd.common.core.entity.IdEntity;
|
||||||
@ -83,7 +83,7 @@ public class OrderDetail extends IdEntity {
|
|||||||
/***
|
/***
|
||||||
* 租借电池包SOC
|
* 租借电池包SOC
|
||||||
*/
|
*/
|
||||||
private Double rentBatSOC;
|
private Double rentBatSoc;
|
||||||
/***
|
/***
|
||||||
* 归还电池包仓位
|
* 归还电池包仓位
|
||||||
*/
|
*/
|
||||||
@ -95,7 +95,7 @@ public class OrderDetail extends IdEntity {
|
|||||||
/***
|
/***
|
||||||
* 归还电池包SOC
|
* 归还电池包SOC
|
||||||
*/
|
*/
|
||||||
private Double returnBatSOC;
|
private Double returnBatSoc;
|
||||||
/***
|
/***
|
||||||
* 换电模式 HDConstant.OrderConstant.CHANGE_MODE_*
|
* 换电模式 HDConstant.OrderConstant.CHANGE_MODE_*
|
||||||
*/
|
*/
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.evotech.hd.common.core.entity.order;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zrb
|
||||||
|
* @since 2024-11-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "yt_t_order_recharge", schema = "hd_cloud_manage")
|
||||||
|
@Schema(name = "充值订单")
|
||||||
|
public class OrderRecharge extends BaseOrder implements Serializable {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 1 待支付 2 已支付
|
||||||
|
*/
|
||||||
|
private Integer orderType;
|
||||||
|
|
||||||
|
private String wuId;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package com.evotech.hd.common.core.entity.order;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.evotech.hd.common.core.entity.IdEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款订单类
|
||||||
|
*
|
||||||
|
* @ClassName:OrderRefund
|
||||||
|
* @date: 2025年06月28日 16:21
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "yt_t_order_refund", schema = "hd_cloud_manage")
|
||||||
|
@Schema(name = "退款订单")
|
||||||
|
public class OrderRefund extends IdEntity {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 微信支付单号
|
||||||
|
*/
|
||||||
|
String transactionId;
|
||||||
|
/***
|
||||||
|
* 退款订单号
|
||||||
|
*/
|
||||||
|
String refundOrderNo;
|
||||||
|
/***
|
||||||
|
* 充值订单号
|
||||||
|
*/
|
||||||
|
String outTradeNo;
|
||||||
|
/***
|
||||||
|
* 退款原因
|
||||||
|
*/
|
||||||
|
String reason;
|
||||||
|
/***
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
Integer orderAmount;
|
||||||
|
/***
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
Integer refundAmount;
|
||||||
|
/***
|
||||||
|
* 退款状态. 默认待退款
|
||||||
|
* PENDING_REFUND-待退款
|
||||||
|
* SUCCESS—退款成功
|
||||||
|
* CLOSED—退款关闭。
|
||||||
|
* PROCESSING—退款处理中
|
||||||
|
* ABNORMAL—退款异常,退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台-交易中心,手动处理此笔退款,可参考: 退款异常的处理,或者通过发起异常退款接口进行处理。
|
||||||
|
*/
|
||||||
|
String refundStatus = "PENDING_REFUND";
|
||||||
|
/***
|
||||||
|
* 微信退款单号
|
||||||
|
*/
|
||||||
|
String refundId;
|
||||||
|
/***
|
||||||
|
* 微信退款用户Id
|
||||||
|
*/
|
||||||
|
String refundWechatId;
|
||||||
|
/***
|
||||||
|
* 微信请求结果
|
||||||
|
*/
|
||||||
|
String refundRequestInfo;
|
||||||
|
/***
|
||||||
|
* 微信退款回调结果
|
||||||
|
*/
|
||||||
|
String notifyInfo;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.evotech.hd.common.core.entity.system;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.evotech.hd.common.core.entity.IdEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类
|
||||||
|
*
|
||||||
|
* @ClassName:SysParam
|
||||||
|
* @date: 2025年07月02日 14:26
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName(value = "yt_t_sys_param", schema = "hd_cloud_manage")
|
||||||
|
public class SysParam extends IdEntity {
|
||||||
|
|
||||||
|
/** 参数名 */
|
||||||
|
private String paramName;
|
||||||
|
|
||||||
|
/** 参数码 */
|
||||||
|
private String paramCode;
|
||||||
|
|
||||||
|
/** 参数值 */
|
||||||
|
private String paramValue;
|
||||||
|
|
||||||
|
/** 说明 */
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,5 +1,9 @@
|
|||||||
package com.evotech.hd.common.core.enums;
|
package com.evotech.hd.common.core.enums;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 100 Continue 继续。客户端应继续其请求
|
* 100 Continue 继续。客户端应继续其请求
|
||||||
101 Switching Protocols 切换协议。服务器根据客户端的请求切换协议。只能切换到更高级的协议,例如,切换到HTTP的新版本协议
|
101 Switching Protocols 切换协议。服务器根据客户端的请求切换协议。只能切换到更高级的协议,例如,切换到HTTP的新版本协议
|
||||||
@ -99,5 +103,11 @@ public enum CodeMsg {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CodeMsg getCodeMsgByCode(String code){
|
||||||
|
Map<String, CodeMsg> map = Arrays.stream(CodeMsg.values()).collect(Collectors.toMap(CodeMsg::getCode, v->v));
|
||||||
|
return map.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,8 @@ public enum OrderStatusEnums implements BaseEnum<Integer, String> {
|
|||||||
|
|
||||||
REFUND(-1, "订单退款"),
|
REFUND(-1, "订单退款"),
|
||||||
|
|
||||||
|
REFUND_PART(-2, "订单不分退款"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.evotech.hd.common.core.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枚举
|
||||||
|
*
|
||||||
|
* @ClassName:SwapBatteryStepEnum
|
||||||
|
* @date: 2025年06月23日 16:08
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
public enum SwapBatteryStepEnum implements BaseEnum<Integer, String>{
|
||||||
|
|
||||||
|
// @Schema(description = "步骤:1-车辆进站,2-车辆到达指定位置,3-对中机构,4-取新电,5-拆旧电,6-装新电,7-放旧电,8-完成")
|
||||||
|
VEHICLES_ENTER_STATION(1, "车辆进站"),
|
||||||
|
|
||||||
|
VEHICLE_POSITION(2, "车辆到达指定位置"),
|
||||||
|
|
||||||
|
INSTITUTIONS_FOR_CHINA(3, "对中机构"),
|
||||||
|
|
||||||
|
GET_NEW_ELECTRICITY(4, "取新电"),
|
||||||
|
|
||||||
|
DISMANTLE_OLD_ELECTRICITY(5, "拆旧电"),
|
||||||
|
|
||||||
|
INSTALL_NEW_ELECTRICITY(6, "装新电"),
|
||||||
|
|
||||||
|
DISCHARGE_OLD_ELECTRICITY(7, "放旧电"),
|
||||||
|
|
||||||
|
COMPLETED(8, "完成"),
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Integer code;
|
||||||
|
|
||||||
|
String name;
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
SwapBatteryStepEnum(Integer code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getKey() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue() {return this.name;}
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import cn.hutool.core.util.RandomUtil;
|
|||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class CommonUtil {
|
public class CommonUtil {
|
||||||
@ -57,4 +58,11 @@ public class CommonUtil {
|
|||||||
return yuan.multiply(new BigDecimal(100));
|
return yuan.multiply(new BigDecimal(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BigDecimal fenToYuan(BigDecimal yuan){
|
||||||
|
if(ObjectUtils.isEmpty(yuan)){
|
||||||
|
return new BigDecimal(0);
|
||||||
|
}
|
||||||
|
return yuan.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,11 @@ public class MongoDBException extends Exception{
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MongoDBException(Exception e) {
|
||||||
|
super(e);
|
||||||
|
log.error("mongodb 数据库存储异常============{}", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
public MongoDBException(String message) {
|
public MongoDBException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
log.error("mongodb 数据库存储异常============{}", message);
|
log.error("mongodb 数据库存储异常============{}", message);
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.evotech.hd.common.redis.utils;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类
|
||||||
|
*
|
||||||
|
* @ClassName:RedisServiceUtils
|
||||||
|
* @date: 2025年06月18日 14:43
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RedisServiceUtils {
|
||||||
|
|
||||||
|
private static RedisUtil redisUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RedisServiceUtils(RedisUtil redisUtil){
|
||||||
|
this.redisUtil = redisUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean set(String key, Object value){
|
||||||
|
return redisUtil.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean set(String key, Object value, long time){
|
||||||
|
return redisUtil.set(key, value, time);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object get(String key){
|
||||||
|
return redisUtil.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getStr(String key){
|
||||||
|
return redisUtil.getStringValue(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void del(String... key){
|
||||||
|
redisUtil.del(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,18 +1,17 @@
|
|||||||
package com.evotech.hd.common.web.exception;
|
package com.evotech.hd.common.web.exception;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||||
|
import org.springframework.validation.FieldError;
|
||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import java.util.stream.Collectors;
|
||||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局异常处理
|
* 全局异常处理
|
||||||
@ -36,7 +35,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(value = NullPointerException.class)
|
@ExceptionHandler(value = NullPointerException.class)
|
||||||
public Result<String> exceptionHandler(HttpServletRequest req, NullPointerException e) {
|
public Result<String> exceptionHandler(HttpServletRequest req, NullPointerException e) {
|
||||||
log.error("\r\n===>>>空指针异常:", e);
|
log.error("\r\n===>>>空指针异常:", e);
|
||||||
return new Result<String>().bussinessException(CodeMsg.ERROR.getCode(), e.getMessage(), null);
|
return new Result<String>().businessException(CodeMsg.ERROR.getCode(), e.getMessage(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(value = HttpMessageNotReadableException.class)
|
@ExceptionHandler(value = HttpMessageNotReadableException.class)
|
||||||
public Result<String> exceptionHandler(HttpServletRequest req, HttpMessageNotReadableException e) {
|
public Result<String> exceptionHandler(HttpServletRequest req, HttpMessageNotReadableException e) {
|
||||||
log.error("\r\n===>>>http请求参数解析异常:", e);
|
log.error("\r\n===>>>http请求参数解析异常:", e);
|
||||||
return new Result<String>().bussinessException(CodeMsg.PARAM_ERROR.getCode(), "http请求参数解析异常", e.getMessage());
|
return new Result<String>().businessException(CodeMsg.PARAM_ERROR.getCode(), "http请求参数解析异常", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,7 +56,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(value = MyArgumentException.class)
|
@ExceptionHandler(value = MyArgumentException.class)
|
||||||
public Result<String> exceptionHandler(HttpServletRequest req, MyArgumentException e) {
|
public Result<String> exceptionHandler(HttpServletRequest req, MyArgumentException e) {
|
||||||
log.error("\r\n===>>>请求参数异常:", e);
|
log.error("\r\n===>>>请求参数异常:", e);
|
||||||
return new Result<String>().bussinessException(CodeMsg.PARAM_ERROR.getCode(), CodeMsg.PARAM_ERROR.getMsg(), e.getParamArr());
|
return new Result<String>().businessException(CodeMsg.PARAM_ERROR.getCode(), CodeMsg.PARAM_ERROR.getMsg(), String.join(",", e.getParamArr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +69,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(value = DataIntegrityViolationException.class)
|
@ExceptionHandler(value = DataIntegrityViolationException.class)
|
||||||
public Result<String> exceptionHandler(HttpServletRequest req, DataIntegrityViolationException e) {
|
public Result<String> exceptionHandler(HttpServletRequest req, DataIntegrityViolationException e) {
|
||||||
log.error("\r\n===>>>sql语句异常:", e);
|
log.error("\r\n===>>>sql语句异常:", e);
|
||||||
return new Result<String>().bussinessException(CodeMsg.SQL_RUN_ERROR.getCode(), e.getCause().toString(), null);
|
return new Result<String>().businessException(CodeMsg.SQL_RUN_ERROR.getCode(), e.getCause().toString(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +79,7 @@ public class GlobalExceptionHandler {
|
|||||||
public Result<String> exceptionHandler(HttpServletRequest req, MethodArgumentNotValidException e) {
|
public Result<String> exceptionHandler(HttpServletRequest req, MethodArgumentNotValidException e) {
|
||||||
log.error("\r\n===>>>传参 自动检测出 错误:", e);
|
log.error("\r\n===>>>传参 自动检测出 错误:", e);
|
||||||
String param = e.getBindingResult().getFieldErrors().stream().map(i -> i.getField()).collect(Collectors.joining(","));
|
String param = e.getBindingResult().getFieldErrors().stream().map(i -> i.getField()).collect(Collectors.joining(","));
|
||||||
return new Result<String>().bussinessException(CodeMsg.PARAM_ERROR.getCode(), param, e.getBindingResult().getFieldErrors());
|
return new Result<String>().businessException(CodeMsg.PARAM_ERROR.getCode(), param, e.getBindingResult().getFieldErrors().stream().map(FieldError::getField).collect(Collectors.joining()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +90,7 @@ public class GlobalExceptionHandler {
|
|||||||
@ExceptionHandler(value = Exception.class)
|
@ExceptionHandler(value = Exception.class)
|
||||||
public Result<String> exceptionHandler(HttpServletRequest req, Exception e) {
|
public Result<String> exceptionHandler(HttpServletRequest req, Exception e) {
|
||||||
log.error("\r\n===>>>捕获运行异常:", e);
|
log.error("\r\n===>>>捕获运行异常:", e);
|
||||||
return new Result<String>().bussinessException(CodeMsg.ERROR.getCode(), e instanceof RuntimeException?e.getMessage():e.toString(), null);
|
return new Result<String>().businessException(CodeMsg.ERROR.getCode(), e instanceof RuntimeException?e.getMessage():e.toString(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,29 +1,27 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.evotech.hd.cloud.service.BatteryStationCdStrategyService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationCdStrategy;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationCdStrategyDetail;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationCdStrategyService;
|
import java.util.List;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationCdStrategy;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationCdStrategyDetail;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
@Tag(name = "充电策略")
|
@Tag(name = "充电策略")
|
||||||
@ApiSupport(order = 48)
|
@ApiSupport(order = 48)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation/cd/strategy")
|
@RequestMapping("/battery/station/cd/strategy")
|
||||||
public class BatteryStationCdStrategyController {
|
public class BatteryStationCdStrategyController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
||||||
import com.evotech.hd.cloud.mqtt.message.handle.RequestMessageService;
|
import com.evotech.hd.cloud.mqtt.message.handle.RequestMessageService;
|
||||||
import com.evotech.hd.cloud.service.BatteryStationService;
|
import com.evotech.hd.cloud.service.BatteryStationService;
|
||||||
@ -25,7 +26,7 @@ import java.util.Map;
|
|||||||
@Tag(name = "换电站")
|
@Tag(name = "换电站")
|
||||||
@ApiSupport(order = 11)
|
@ApiSupport(order = 11)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation")
|
@RequestMapping("/battery/station")
|
||||||
public class BatteryStationController {
|
public class BatteryStationController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -36,43 +37,36 @@ public class BatteryStationController {
|
|||||||
@Operation(summary = "增加")
|
@Operation(summary = "增加")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject BatteryStation bs) {
|
public Result<Integer> add(@Valid @ParameterObject BatteryStation bs) {
|
||||||
return batteryStationService.add(bs);
|
return batteryStationService.add(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除")
|
@Operation(summary = "删除")
|
||||||
@PostMapping("/del")
|
@PostMapping("/del")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
public Result<Integer> delete(Integer id) {
|
||||||
return batteryStationService.delete(id);
|
return batteryStationService.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "修改")
|
@Operation(summary = "修改")
|
||||||
@PostMapping({"/update"})
|
@PostMapping({"/update"})
|
||||||
@ApiOperationSupport(order = 3)
|
@ApiOperationSupport(order = 3)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject BatteryStation bs) {
|
public Result<Integer> update(@ParameterObject BatteryStation bs) {
|
||||||
return batteryStationService.update(bs);
|
return batteryStationService.update(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStation>> list(@ParameterObject PageListBatteryStationRequest plbsr) {
|
public Result<Page<BatteryStation>> list(@ParameterObject PageListBatteryStationRequest plbsr) {
|
||||||
return batteryStationService.list(plbsr);
|
return batteryStationService.list(plbsr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询2")
|
|
||||||
@GetMapping("/liststation")
|
|
||||||
@Hidden
|
|
||||||
public com.evotech.hd.common.core.entity.Result<List<BatteryStationVO>> listStation(@RequestParam(required = false) String plateNum) {
|
|
||||||
return batteryStationService.listStation(plateNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "站点秘钥")
|
@Operation(summary = "站点秘钥")
|
||||||
@PostMapping("/rsa_secret_key")
|
@PostMapping("/rsa_secret_key")
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 5)
|
||||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> RsaSecretKey(@NotBlank @RequestParam String stationCode) {
|
public Result<Map<String, String>> RsaSecretKey(@NotBlank @RequestParam String stationCode) {
|
||||||
return batteryStationService.RsaSecretKey(stationCode);
|
return batteryStationService.RsaSecretKey(stationCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,4 +103,12 @@ public class BatteryStationController {
|
|||||||
return batteryStationService.resourceList(pkIds);
|
return batteryStationService.resourceList(pkIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "微信首页换电站地图信息")
|
||||||
|
@GetMapping("/list/station")
|
||||||
|
@Hidden
|
||||||
|
public Result<List<BatteryStationVO>> listStation(@RequestParam(required = false) String longitudeAndLatitude, @RequestParam(required = false) String plateNum) {
|
||||||
|
return batteryStationService.listStation(longitudeAndLatitude, plateNum);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,30 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDcRequest;
|
||||||
|
import com.evotech.hd.cloud.service.BatteryStationDcService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryTrace;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDcRequest;
|
import java.util.List;
|
||||||
import com.evotech.hd.cloud.service.BatteryStationDcService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryTrace;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
@Tag(name = "换电站电池")
|
@Tag(name = "换电站电池")
|
||||||
@ApiSupport(order = 12)
|
@ApiSupport(order = 12)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation/dc")
|
@RequestMapping("/battery/station/dc")
|
||||||
public class BatteryStationDcController {
|
public class BatteryStationDcController {
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ public class BatteryStationDcController {
|
|||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public Result<List<BatteryStationDc>> list(@ParameterObject PageListBatteryStationDcRequest plbsdcr) {
|
public Result<Page<BatteryStationDc>> list(@ParameterObject PageListBatteryStationDcRequest plbsdcr) {
|
||||||
return batteryStationDcService.list(plbsdcr);
|
return batteryStationDcService.list(plbsdcr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +1,26 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDccRequest;
|
||||||
|
import com.evotech.hd.cloud.service.BatteryStationDccService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationDcc;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDccRequest;
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationDccService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationDcc;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
@Tag(name = "换电站电池仓")
|
@Tag(name = "换电站电池仓")
|
||||||
@ApiSupport(order = 13)
|
@ApiSupport(order = 13)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation/dcc")
|
@RequestMapping("/battery/station/dcc")
|
||||||
public class BatteryStationDccController {
|
public class BatteryStationDccController {
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +51,7 @@ public class BatteryStationDccController {
|
|||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public Result<List<BatteryStationDcc>> list(@ParameterObject PageListBatteryStationDccRequest plbsDccr) {
|
public Result<Page<BatteryStationDcc>> list(@ParameterObject PageListBatteryStationDccRequest plbsDccr) {
|
||||||
return batteryStationDccService.list(plbsDccr);
|
return batteryStationDccService.list(plbsDccr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +1,26 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDjRequest;
|
||||||
|
import com.evotech.hd.cloud.service.BatteryStationDjService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationDj;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationDjRequest;
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationDjService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationDj;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
@Tag(name = "换电站电机")
|
@Tag(name = "换电站电机")
|
||||||
@ApiSupport(order = 14)
|
@ApiSupport(order = 14)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation/dj")
|
@RequestMapping("/battery/station/dj")
|
||||||
public class BatteryStationDjController {
|
public class BatteryStationDjController {
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +51,7 @@ public class BatteryStationDjController {
|
|||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public Result<List<BatteryStationDj>> list(@ParameterObject PageListBatteryStationDjRequest plbsdjr) {
|
public Result<Page<BatteryStationDj>> list(@ParameterObject PageListBatteryStationDjRequest plbsdjr) {
|
||||||
return batteryStationDjService.list(plbsdjr);
|
return batteryStationDjService.list(plbsdjr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,28 +1,26 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.evotech.hd.cloud.service.BatteryStationHdFeeStandardService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandard;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationHdFeeStandardService;
|
import java.util.List;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandard;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
@Tag(name = "换电站费用标准")
|
@Tag(name = "换电站费用标准")
|
||||||
@ApiSupport(order = 16)
|
@ApiSupport(order = 16)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation/fee")
|
@RequestMapping("/battery/station/fee")
|
||||||
public class BatteryStationHdFeeStandardController {
|
public class BatteryStationHdFeeStandardController {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,28 +1,26 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.evotech.hd.cloud.service.BatteryStationHdFeeStandardDetailService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandardDetail;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationHdFeeStandardDetailService;
|
import java.util.List;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandardDetail;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
@Tag(name = "换电站费用标准明细")
|
@Tag(name = "换电站费用标准明细")
|
||||||
@ApiSupport(order = 17)
|
@ApiSupport(order = 17)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation/fee/detail")
|
@RequestMapping("/battery/station/fee/detail")
|
||||||
public class BatteryStationHdFeeStandardDetailController {
|
public class BatteryStationHdFeeStandardDetailController {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +1,27 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.evotech.hd.cloud.service.BatteryStationRobotService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationRobot;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationRobotService;
|
import java.util.List;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationRobot;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
@Tag(name = "换电站机器人")
|
@Tag(name = "换电站机器人")
|
||||||
@ApiSupport(order = 15)
|
@ApiSupport(order = 15)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/batterystation/robot")
|
@RequestMapping("/battery/station/robot")
|
||||||
public class BatteryStationRobotController {
|
public class BatteryStationRobotController {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +1,20 @@
|
|||||||
package com.evotech.hd.cloud.controller;
|
package com.evotech.hd.cloud.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.evotech.hd.cloud.entity.MessageMqtt;
|
||||||
|
import com.evotech.hd.cloud.entity.request.PageListMessageMqttRequest;
|
||||||
|
import com.evotech.hd.cloud.service.MessageMqttService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.MessageMqtt;
|
|
||||||
import com.evotech.hd.cloud.entity.request.PageListMessageMqttRequest;
|
|
||||||
import com.evotech.hd.cloud.service.MessageMqttService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
@Tag(name = "MQTT消息")
|
@Tag(name = "MQTT消息")
|
||||||
@ApiSupport(order = 9)
|
@ApiSupport(order = 9)
|
||||||
@RestController
|
@RestController
|
||||||
@ -32,7 +29,7 @@ public class MessageMqttController {
|
|||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
public Result<List<MessageMqtt>> list(@ParameterObject PageListMessageMqttRequest plmmr) {
|
public Result<Page<MessageMqtt>> list(@ParameterObject PageListMessageMqttRequest plmmr) {
|
||||||
return messageMqttService.list(plmmr);
|
return messageMqttService.list(plmmr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.evotech.hd.cloud.controller.customer;
|
package com.evotech.hd.cloud.controller.customer;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.evotech.hd.cloud.service.CompanyService;
|
import com.evotech.hd.cloud.service.CompanyService;
|
||||||
import com.evotech.hd.common.core.Dto.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.entity.BasePageRequest;
|
import com.evotech.hd.common.core.entity.BasePageRequest;
|
||||||
@ -31,33 +32,33 @@ public class CompanyController {
|
|||||||
@Operation(summary = "增加")
|
@Operation(summary = "增加")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject Company company) {
|
public Result<Integer> add(@Valid @ParameterObject Company company) {
|
||||||
return companyService.add(company);
|
return companyService.add(company);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除")
|
@Operation(summary = "删除")
|
||||||
@PostMapping("/del")
|
@PostMapping("/del")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(@NotNull Integer id) {
|
public Result<Integer> delete(@NotNull Integer id) {
|
||||||
return companyService.delete(id);
|
return companyService.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "修改")
|
@Operation(summary = "修改")
|
||||||
@PostMapping({"/update"})
|
@PostMapping({"/update"})
|
||||||
@ApiOperationSupport(order = 3)
|
@ApiOperationSupport(order = 3)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject Company company) {
|
public Result<Integer> update(@ParameterObject Company company) {
|
||||||
return companyService.update(company);
|
return companyService.update(company);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public com.evotech.hd.common.core.entity.Result<List<Company>> list(@Valid @ParameterObject BasePageRequest bpr) {
|
public Result<Page<Company>> list(@Valid @ParameterObject BasePageRequest bpr) {
|
||||||
return companyService.list(bpr);
|
return companyService.list(bpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/companyByCode")
|
@GetMapping("/companyByCode")
|
||||||
public com.evotech.hd.common.core.entity.Result<Map<String, String>> companyByCode(String ccode) {
|
public Result<Map<String, String>> companyByCode(String ccode) {
|
||||||
return companyService.companyByCode(ccode);
|
return companyService.companyByCode(ccode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.evotech.hd.cloud.controller.customer;
|
package com.evotech.hd.cloud.controller.customer;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.evotech.hd.cloud.entity.request.PageListVehicleRequest;
|
import com.evotech.hd.cloud.entity.request.PageListVehicleRequest;
|
||||||
import com.evotech.hd.cloud.service.VehicleService;
|
import com.evotech.hd.cloud.service.VehicleService;
|
||||||
import com.evotech.hd.common.core.Dto.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
@ -33,49 +34,49 @@ public class VehicleController {
|
|||||||
@Operation(summary = "增加")
|
@Operation(summary = "增加")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> add(@Valid @ParameterObject VehicleInfo vi) {
|
public Result<Integer> add(@Valid @ParameterObject VehicleInfo vi) {
|
||||||
return vehicleService.add(vi);
|
return vehicleService.add(vi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除")
|
@Operation(summary = "删除")
|
||||||
@PostMapping("/del")
|
@PostMapping("/del")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> delete(Integer id) {
|
public Result<Integer> delete(Integer id) {
|
||||||
return vehicleService.delete(id);
|
return vehicleService.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "修改")
|
@Operation(summary = "修改")
|
||||||
@PostMapping({"/update"})
|
@PostMapping({"/update"})
|
||||||
@ApiOperationSupport(order = 3)
|
@ApiOperationSupport(order = 3)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> update(@ParameterObject VehicleInfo vi) {
|
public Result<Integer> update(@ParameterObject VehicleInfo vi) {
|
||||||
return vehicleService.update(vi);
|
return vehicleService.update(vi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> list(@ParameterObject PageListVehicleRequest plvr) {
|
public Result<Page<VehicleInfo>> list(@ParameterObject PageListVehicleRequest plvr) {
|
||||||
return vehicleService.list(plvr);
|
return vehicleService.list(plvr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "关联公司")
|
@Operation(summary = "关联公司")
|
||||||
@PostMapping("/company/relation")
|
@PostMapping("/company/relation")
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 5)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
public Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
||||||
return vehicleService.companyRelation(plateNum, ccode, cname);
|
return vehicleService.companyRelation(plateNum, ccode, cname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除关联公司")
|
@Operation(summary = "删除关联公司")
|
||||||
@PostMapping("/company/relation/del")
|
@PostMapping("/company/relation/del")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> delCompanyRelation(String plateNum) {
|
public Result<Integer> delCompanyRelation(String plateNum) {
|
||||||
return vehicleService.delCompanyRelation(plateNum);
|
return vehicleService.delCompanyRelation(plateNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "微信用户关联")
|
@Operation(summary = "微信用户关联")
|
||||||
@PostMapping("/wechatuser/relation/add")
|
@PostMapping("/wechatuser/relation/add")
|
||||||
@ApiOperationSupport(order = 7)
|
@ApiOperationSupport(order = 7)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> addWechatUserRelation(@Valid @ParameterObject VehicleWechatUserRelation relation) {
|
public Result<Integer> addWechatUserRelation(@Valid @ParameterObject VehicleWechatUserRelation relation) {
|
||||||
return vehicleService.addWechatUserRelation(relation);
|
return vehicleService.addWechatUserRelation(relation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ public class VehicleController {
|
|||||||
@Operation(summary = "删除微信用户关联")
|
@Operation(summary = "删除微信用户关联")
|
||||||
@PostMapping("/wechatuser/relation/del")
|
@PostMapping("/wechatuser/relation/del")
|
||||||
@ApiOperationSupport(order = 8)
|
@ApiOperationSupport(order = 8)
|
||||||
public com.evotech.hd.common.core.entity.Result<Integer> deleteWechatUserRelation(Integer id) {
|
public Result<Integer> deleteWechatUserRelation(Integer id) {
|
||||||
return vehicleService.deleteWechatUserRelation(id);
|
return vehicleService.deleteWechatUserRelation(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,14 +92,14 @@ public class VehicleController {
|
|||||||
@Operation(summary = "查询微信用户车辆")
|
@Operation(summary = "查询微信用户车辆")
|
||||||
@GetMapping("/wechatuser/relation/list")
|
@GetMapping("/wechatuser/relation/list")
|
||||||
@ApiOperationSupport(order = 9)
|
@ApiOperationSupport(order = 9)
|
||||||
public com.evotech.hd.common.core.entity.Result<List<VehicleInfo>> listWechatUserRelation(@NotBlank @RequestParam String wuid) {
|
public Result<List<VehicleInfo>> listWechatUserRelation(@NotBlank @RequestParam String wuid) {
|
||||||
return vehicleService.listWechatUserRelation(wuid, null);
|
return vehicleService.listWechatUserRelation(wuid, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询车辆的关联用户")
|
@Operation(summary = "查询车辆的关联用户")
|
||||||
@GetMapping("/relationuser/list")
|
@GetMapping("/relationuser/list")
|
||||||
@ApiOperationSupport(order = 10)
|
@ApiOperationSupport(order = 10)
|
||||||
public com.evotech.hd.common.core.entity.Result<List<VehicleWechatUserRelation>> listRelationUser(@NotBlank @RequestParam String PlantNo) {
|
public Result<List<VehicleWechatUserRelation>> listRelationUser(@NotBlank @RequestParam String PlantNo) {
|
||||||
return vehicleService.listRelationUser(PlantNo);
|
return vehicleService.listRelationUser(PlantNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +1,20 @@
|
|||||||
package com.evotech.hd.cloud.controller.customer;
|
package com.evotech.hd.cloud.controller.customer;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.evotech.hd.cloud.entity.request.PageListWechatUserRequest;
|
||||||
|
import com.evotech.hd.cloud.service.WechatUserService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.request.PageListWechatUserRequest;
|
|
||||||
import com.evotech.hd.cloud.service.WechatUserService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
@Tag(name = "微信用户")
|
@Tag(name = "微信用户")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/wechat/user")
|
@RequestMapping("/wechat/user")
|
||||||
@ -30,7 +27,7 @@ public class WechatUserController {
|
|||||||
|
|
||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<List<WechatUser>> list(@ParameterObject PageListWechatUserRequest plwur) {
|
public Result<Page<WechatUser>> list(@ParameterObject PageListWechatUserRequest plwur) {
|
||||||
return wechatUserService.list(plwur);
|
return wechatUserService.list(plwur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
package com.evotech.hd.cloud.controller.order;
|
package com.evotech.hd.cloud.controller.order;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
||||||
import com.evotech.hd.common.core.entity.cloud.request.PageListSwapOrderPreRequest;
|
import com.evotech.hd.common.core.entity.cloud.request.PageListSwapOrderPreRequest;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
@ -16,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预约订单管理类
|
* 预约订单管理类
|
||||||
@ -32,26 +34,30 @@ import java.util.List;
|
|||||||
@RequestMapping("/order/per")
|
@RequestMapping("/order/per")
|
||||||
public class OrderPerController {
|
public class OrderPerController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OrderSwapBatteryPreService orderSwapBatteryPreService;
|
||||||
|
|
||||||
|
@Operation(summary = "查询预约")
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperationSupport(order = 3)
|
||||||
|
public Result<Page<OrderSwapBatteryPre>> listPre(@ParameterObject PageListSwapOrderPreRequest plsopr) throws ParseException {
|
||||||
|
return orderSwapBatteryPreService.list(plsopr);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "增加预约")
|
@Operation(summary = "增加预约")
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
public Result<Integer> addPre(@Valid @ParameterObject OrderSwapBatteryPre osbp) {
|
public Result<Boolean> addPre(@Valid @ParameterObject OrderSwapBatteryPre osbp) {
|
||||||
return orderSwapBatteryService.addPre(osbp);
|
return orderSwapBatteryPreService.addOrderSwapBatteryPre(osbp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "取消预约")
|
@Operation(summary = "取消预约")
|
||||||
@PostMapping("/cancel")
|
@PostMapping("/cancel")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
public Result<Integer> cancelPre(@NotNull Integer id) {
|
public Result<Integer> cancelPre(@NotNull Integer id) {
|
||||||
return orderSwapBatteryService.cancelPre(id, null);
|
return orderSwapBatteryPreService.cancelPre(id, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询预约")
|
|
||||||
@GetMapping("/list")
|
|
||||||
@ApiOperationSupport(order = 3)
|
|
||||||
public Result<List<OrderSwapBatteryPre>> listPre(@ParameterObject PageListSwapOrderPreRequest plsopr) throws ParseException {
|
|
||||||
return orderSwapBatteryService.listPre(plsopr);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,20 @@
|
|||||||
package com.evotech.hd.cloud.controller.order;
|
package com.evotech.hd.cloud.controller.order;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.request.PageListRechargeOrderRequest;
|
import com.evotech.hd.cloud.entity.request.PageListRechargeOrderRequest;
|
||||||
import com.evotech.hd.cloud.service.OrderRechargeService;
|
import com.evotech.hd.cloud.service.OrderRechargeService;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderRecharge;
|
import com.evotech.hd.common.core.entity.order.OrderRecharge;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "充值订单")
|
@Tag(name = "充值订单")
|
||||||
@ -57,8 +53,17 @@ public class OrderRechargeController {
|
|||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public Result<List<OrderRecharge>> list(@ParameterObject PageListRechargeOrderRequest plror) {
|
public Result<Page<OrderRecharge>> list(@ParameterObject PageListRechargeOrderRequest plror) {
|
||||||
return orderRechargeService.list(plror);
|
return orderRechargeService.list(plror);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 待退款订单查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/refund/list")
|
||||||
|
public Result<List<OrderRecharge>> refundList(@RequestParam String wechatId) {
|
||||||
|
return orderRechargeService.refundList(wechatId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.evotech.hd.cloud.controller.order;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.evotech.hd.cloud.service.OrderRefundService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.evotech.hd.common.core.entity.order.OrderRefund;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款类
|
||||||
|
*
|
||||||
|
* @ClassName:OrderRefundController
|
||||||
|
* @date: 2025年06月30日 14:20
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/order/refund")
|
||||||
|
public class OrderRefundController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderRefundService orderRefundService;
|
||||||
|
|
||||||
|
@Operation(summary = "增加")
|
||||||
|
@PostMapping("/addAll")
|
||||||
|
public Result<Boolean> addAll(@RequestParam String listJson) {
|
||||||
|
return orderRefundService.addAll(JSONUtil.toList(listJson, OrderRefund.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "查询")
|
||||||
|
@PostMapping("/orderNo")
|
||||||
|
public Result<OrderRefund> orderNoOne(@RequestParam String orderNo) {
|
||||||
|
return orderRefundService.orderNoOne(orderNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,15 +1,14 @@
|
|||||||
package com.evotech.hd.cloud.controller.order;
|
package com.evotech.hd.cloud.controller.order;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.evotech.hd.cloud.entity.order.Order;
|
|
||||||
import com.evotech.hd.cloud.entity.vo.NativePayVO;
|
import com.evotech.hd.cloud.entity.vo.NativePayVO;
|
||||||
import com.evotech.hd.cloud.service.OrderService;
|
import com.evotech.hd.cloud.service.OrderService;
|
||||||
import com.evotech.hd.cloud.service.OrderSwapBatteryService;
|
|
||||||
import com.evotech.hd.common.core.Dto.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.Dto.order.OrderListVo;
|
import com.evotech.hd.common.core.Dto.order.OrderListVo;
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryStep;
|
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryStep;
|
||||||
import com.evotech.hd.common.core.entity.cloud.request.BatterySwapResponse;
|
import com.evotech.hd.common.core.entity.cloud.request.BatterySwapResponse;
|
||||||
import com.evotech.hd.common.core.entity.cloud.request.PageListSwapOrderRequest;
|
import com.evotech.hd.common.core.entity.cloud.request.PageListSwapOrderRequest;
|
||||||
|
import com.evotech.hd.common.core.entity.order.Order;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
@ -32,9 +31,6 @@ public class OrderSwapBatteryController {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
private OrderSwapBatteryService orderSwapBatteryService;
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 7)
|
@ApiOperationSupport(order = 7)
|
||||||
@ -42,6 +38,31 @@ public class OrderSwapBatteryController {
|
|||||||
return orderService.pageList(plsor);
|
return orderService.pageList(plsor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "查询换电步骤")
|
||||||
|
@GetMapping("/step/list")
|
||||||
|
@ApiOperationSupport(order = 9)
|
||||||
|
public Result<List<OrderSwapBatteryStep>> listStep(@NotBlank String orderNo) {
|
||||||
|
return orderService.listStep(orderNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "个人账户余额支付")
|
||||||
|
@PostMapping({"/one"})
|
||||||
|
@ApiOperationSupport(order = 11)
|
||||||
|
public Result<Order> one(@RequestParam String orderNo) {
|
||||||
|
return orderService.one(orderNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "个人账户余额支付")
|
||||||
|
@PostMapping({"/wallet/pay"})
|
||||||
|
@ApiOperationSupport(order = 11)
|
||||||
|
public Result<String> walletPay(@RequestParam String orderNo, String wuid, String uname) {
|
||||||
|
return orderService.walletPay(orderNo, wuid, uname);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "查询公司订单")
|
@Operation(summary = "查询公司订单")
|
||||||
@GetMapping("/listcompanyorder")
|
@GetMapping("/listcompanyorder")
|
||||||
@ApiOperationSupport(order = 8)
|
@ApiOperationSupport(order = 8)
|
||||||
@ -51,12 +72,7 @@ public class OrderSwapBatteryController {
|
|||||||
return orderService.listByCompany(plsor);
|
return orderService.listByCompany(plsor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询换电步骤")
|
|
||||||
@GetMapping("/step/list")
|
|
||||||
@ApiOperationSupport(order = 9)
|
|
||||||
public Result<List<OrderSwapBatteryStep>> listStep(@NotBlank String orderNo) {
|
|
||||||
return orderService.listStep(orderNo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "费用计算")
|
@Operation(summary = "费用计算")
|
||||||
@PostMapping({"/cost"})
|
@PostMapping({"/cost"})
|
||||||
@ -66,12 +82,6 @@ public class OrderSwapBatteryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "个人账户余额支付")
|
|
||||||
@PostMapping({"/wallet/pay"})
|
|
||||||
@ApiOperationSupport(order = 11)
|
|
||||||
public Result<String> walletPay(@RequestParam String orderNo, String wuid, String uname) {
|
|
||||||
return orderService.walletPay(orderNo, wuid, uname);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "公司订单余额支付")
|
@Operation(summary = "公司订单余额支付")
|
||||||
@ -106,8 +116,8 @@ public class OrderSwapBatteryController {
|
|||||||
@Operation(summary = "开始换电")
|
@Operation(summary = "开始换电")
|
||||||
@PostMapping("/startSwap")
|
@PostMapping("/startSwap")
|
||||||
@ApiOperationSupport(order = 16)
|
@ApiOperationSupport(order = 16)
|
||||||
public Result<Boolean> startSwap(@RequestParam String wuid,String orderId) {
|
public Result<Boolean> startSwap(@RequestParam String wuid,String orderNo) {
|
||||||
return orderService.startSwap(wuid,orderId);
|
return orderService.startSwap(wuid,orderNo);
|
||||||
}
|
}
|
||||||
@Operation(summary = "获取开始换电回复")
|
@Operation(summary = "获取开始换电回复")
|
||||||
@PostMapping("/getStartSwap")
|
@PostMapping("/getStartSwap")
|
||||||
|
|||||||
@ -1,26 +1,22 @@
|
|||||||
package com.evotech.hd.cloud.controller.order;
|
package com.evotech.hd.cloud.controller.order;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.request.PrePayRequest;
|
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.request.PageListTradeRequest;
|
import com.evotech.hd.cloud.entity.request.PageListTradeRequest;
|
||||||
import com.evotech.hd.cloud.service.TradeService;
|
import com.evotech.hd.cloud.service.TradeService;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.entity.cloud.TradeDetail;
|
import com.evotech.hd.common.core.entity.cloud.TradeDetail;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.request.PrePayRequest;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "交易详情")
|
@Tag(name = "交易详情")
|
||||||
@ -58,7 +54,7 @@ public class TradeController {
|
|||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public Result<List<TradeDetail>> list(@ParameterObject PageListTradeRequest pltr) {
|
public Result<Page<TradeDetail>> list(@ParameterObject PageListTradeRequest pltr) {
|
||||||
return tradeService.list(pltr);
|
return tradeService.list(pltr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +63,6 @@ public class TradeController {
|
|||||||
@PostMapping({"/wechatpay/notify"})
|
@PostMapping({"/wechatpay/notify"})
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 5)
|
||||||
@Hidden
|
@Hidden
|
||||||
|
|
||||||
public Result<String> wechatPayNotifyHandle(@ParameterObject TradeDetail tradeDetail) {
|
public Result<String> wechatPayNotifyHandle(@ParameterObject TradeDetail tradeDetail) {
|
||||||
return tradeService.wechatPayNotifyHandle(tradeDetail);
|
return tradeService.wechatPayNotifyHandle(tradeDetail);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,26 +1,22 @@
|
|||||||
package com.evotech.hd.cloud.controller.order;
|
package com.evotech.hd.cloud.controller.order;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.vo.WalletAccountVO;
|
|
||||||
import com.evotech.hd.common.core.entity.wechat.WechatPayAttach;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.service.WalletAccountService;
|
import com.evotech.hd.cloud.service.WalletAccountService;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.entity.cloud.WalletAccount;
|
import com.evotech.hd.common.core.entity.cloud.WalletAccount;
|
||||||
import com.evotech.hd.common.core.entity.cloud.WalletAccountDetail;
|
import com.evotech.hd.common.core.entity.cloud.WalletAccountDetail;
|
||||||
import com.evotech.hd.common.core.entity.cloud.request.PageListWalletRequest;
|
import com.evotech.hd.common.core.entity.cloud.request.PageListWalletRequest;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.vo.WalletAccountVO;
|
||||||
|
import com.evotech.hd.common.core.entity.wechat.WechatPayAttach;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
@Tag(name = "资金账户管理")
|
@Tag(name = "资金账户管理")
|
||||||
@ -57,7 +53,7 @@ public class WalletAccountController {
|
|||||||
@Operation(summary = "查询")
|
@Operation(summary = "查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
public Result<List<WalletAccountVO>> list(@ParameterObject PageListWalletRequest plwr) {
|
public Result<Page<WalletAccountVO>> list(@ParameterObject PageListWalletRequest plwr) {
|
||||||
return walletAccountService.list(plwr);
|
return walletAccountService.list(plwr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,12 +73,7 @@ public class WalletAccountController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "查询明细")
|
|
||||||
@GetMapping("/detail/list")
|
|
||||||
@ApiOperationSupport(order = 7)
|
|
||||||
public Result<List<WalletAccountDetail>> listDetail(@ParameterObject PageListWalletRequest plwr) {
|
|
||||||
return walletAccountService.listDetail(plwr);
|
|
||||||
}
|
|
||||||
@Operation(summary = "查询是否开通微信钱包")
|
@Operation(summary = "查询是否开通微信钱包")
|
||||||
@PostMapping("/isOpenAccount")
|
@PostMapping("/isOpenAccount")
|
||||||
@ApiOperationSupport(order = 8)
|
@ApiOperationSupport(order = 8)
|
||||||
@ -101,12 +92,15 @@ public class WalletAccountController {
|
|||||||
public Result<WechatPayAttach> getPayAttach(String wuid) {
|
public Result<WechatPayAttach> getPayAttach(String wuid) {
|
||||||
return walletAccountService.getPayAttach(wuid);
|
return walletAccountService.getPayAttach(wuid);
|
||||||
}
|
}
|
||||||
@Operation(summary = "更新账户姓名")
|
|
||||||
@PostMapping({"/updateName"})
|
|
||||||
@ApiOperationSupport(order = 11)
|
|
||||||
public Result<Integer> updateName(@ParameterObject WalletAccount wa) {
|
|
||||||
return walletAccountService.updateName(wa);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "获取钱包对象")
|
@Operation(summary = "获取钱包对象")
|
||||||
@PostMapping("/getDetailById")
|
@PostMapping("/getDetailById")
|
||||||
@ -114,4 +108,26 @@ public class WalletAccountController {
|
|||||||
public WalletAccount getDetailById(@NotBlank @RequestParam String outTradeNo) {
|
public WalletAccount getDetailById(@NotBlank @RequestParam String outTradeNo) {
|
||||||
return walletAccountService.getDetailById(outTradeNo);
|
return walletAccountService.getDetailById(outTradeNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/wechatId")
|
||||||
|
public com.evotech.hd.common.core.Dto.Result<WalletAccount> getWalletAccountByWechatId(@NotBlank @RequestParam String wechatId) {
|
||||||
|
return walletAccountService.getWalletAccountByWechatId(wechatId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新账户信息")
|
||||||
|
@PostMapping({"/update/wechat"})
|
||||||
|
@ApiOperationSupport(order = 11)
|
||||||
|
public com.evotech.hd.common.core.Dto.Result<Integer> updateWechat(@ParameterObject WalletAccount wa) {
|
||||||
|
return walletAccountService.updateWechat(wa);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "查询账户明细")
|
||||||
|
@GetMapping("/detail/list")
|
||||||
|
@ApiOperationSupport(order = 7)
|
||||||
|
public com.evotech.hd.common.core.Dto.Result<Page<WalletAccountDetail>> listDetail(@ParameterObject PageListWalletRequest plwr) {
|
||||||
|
return walletAccountService.listDetail(plwr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,17 @@
|
|||||||
package com.evotech.hd.cloud.controller.test;
|
package com.evotech.hd.cloud.controller.test;
|
||||||
|
|
||||||
|
import com.evotech.hd.cloud.service.HomeDataManualCollateService;
|
||||||
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.service.HomeDataManualCollateService;
|
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
@Tag(name = "首页数据手动整理中间表")
|
@Tag(name = "首页数据手动整理中间表")
|
||||||
@ApiSupport(order = 701)
|
@ApiSupport(order = 701)
|
||||||
@RestController
|
@RestController
|
||||||
|
|||||||
@ -1,12 +1,9 @@
|
|||||||
package com.evotech.hd.cloud.controller.test;
|
package com.evotech.hd.cloud.controller.test;
|
||||||
|
|
||||||
import java.util.Date;
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import cn.hutool.json.JSONUtil;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.controller.test.service.MqttTestUtil;
|
import com.evotech.hd.cloud.controller.test.service.MqttTestUtil;
|
||||||
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
||||||
import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
||||||
@ -16,17 +13,18 @@ import com.evotech.hd.cloud.mqtt.message.dto.newer.req.order.OrderByPlateNumReq;
|
|||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatus;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatus;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.SwapStep;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.SwapStep;
|
||||||
import com.evotech.hd.common.core.entity.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springdoc.core.annotations.ParameterObject;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Tag(name = "Mqtt消息测试")
|
@Tag(name = "Mqtt消息测试")
|
||||||
@ApiSupport(order = 700)
|
@ApiSupport(order = 700)
|
||||||
|
|||||||
@ -1,96 +1,100 @@
|
|||||||
//package com.evotech.hd.cloud.controller.test;
|
package com.evotech.hd.cloud.controller.test;
|
||||||
//
|
|
||||||
//import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
//import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
//import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
//import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
//import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.evotech.hd.cloud.dao.BatteryStationDao;
|
||||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.evotech.hd.cloud.dao.OrderSwapBatteryPreDao;
|
||||||
//import com.evotech.hd.cloud.dao.BatteryStationDao;
|
import com.evotech.hd.cloud.dao.VehicleWechatUserRelationDao;
|
||||||
//import com.evotech.hd.cloud.dao.OrderSwapBatteryPreDao;
|
import com.evotech.hd.cloud.device.dh.DHRequestUtil;
|
||||||
//import com.evotech.hd.cloud.dao.VehicleWechatUserRelationDao;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
//import com.evotech.hd.cloud.device.dh.DHRequestUtil;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
//import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.processor.strategy.MqttStrategyExchangeProcessor;
|
||||||
//import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.state.MqttStateChargingDataExchangeProcessor;
|
||||||
//import com.evotech.hd.cloud.mqtt.message.processor.strategy.MqttStrategyExchangeProcessor;
|
import com.evotech.hd.cloud.service.TradeService;
|
||||||
//import com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.state.MqttStateChargingDataExchangeProcessor;
|
import com.evotech.hd.cloud.utils.components.SwapOrderBasicFeeComponent;
|
||||||
//import com.evotech.hd.cloud.utils.components.SwapOrderBasicFeeComponent;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
//import com.evotech.hd.common.core.entity.Result;
|
import com.evotech.hd.common.core.utils.Collections;
|
||||||
//import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
import jakarta.annotation.Resource;
|
||||||
//import com.evotech.hd.common.core.entity.cloud.OrderSwapBattery;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
//import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
import org.springframework.context.ApplicationContext;
|
||||||
//import com.evotech.hd.common.core.utils.Collections;
|
import org.springframework.web.bind.annotation.*;
|
||||||
//import jakarta.annotation.Resource;
|
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
import java.util.Date;
|
||||||
//import org.springframework.context.ApplicationContext;
|
import java.util.Map;
|
||||||
//import org.springframework.web.bind.annotation.*;
|
|
||||||
//
|
/**
|
||||||
//import java.util.Date;
|
* @desc:
|
||||||
//import java.util.List;
|
* @ClassName:TestController
|
||||||
//import java.util.Map;
|
* @date: 2025年04月18日 14:40
|
||||||
//
|
* @author: andy.shi
|
||||||
///**
|
* @contact: 17330188597
|
||||||
// * @desc:
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
// * @ClassName:TestController
|
*/
|
||||||
// * @date: 2025年04月18日 14:40
|
@RestController
|
||||||
// * @author: andy.shi
|
@RequestMapping("/test")
|
||||||
// * @contact: 17330188597
|
public class TestController {
|
||||||
// * @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
|
||||||
// */
|
@Resource
|
||||||
//@RestController
|
private BatteryStationDao batteryStationDao;
|
||||||
//@RequestMapping("/test")
|
private VehicleWechatUserRelationDao vehicleWechatUserRelationDao;
|
||||||
//public class TestController {
|
@Resource
|
||||||
//
|
private OrderSwapBatteryPreDao orderSwapBatteryPreDao;
|
||||||
|
@Resource
|
||||||
|
private SwapOrderBasicFeeComponent orderBasicFeeComponent;
|
||||||
|
@Resource
|
||||||
|
MqttStateChargingDataExchangeProcessor mqttStateChargingDataRequestExchangeProcessor;
|
||||||
|
@Autowired
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
@Resource
|
||||||
|
TradeService tradeService;
|
||||||
// @Resource
|
// @Resource
|
||||||
// private BatteryStationDao batteryStationDao;
|
// MongoDBService mongoDBService;
|
||||||
// private VehicleWechatUserRelationDao vehicleWechatUserRelationDao;
|
|
||||||
// @Resource
|
@PostMapping("/mongodb/save")
|
||||||
// private OrderSwapBatteryPreDao orderSwapBatteryPreDao;
|
public Result mongodbSave() {
|
||||||
// @Resource
|
mqttStateChargingDataRequestExchangeProcessor.exchange(null,null,JSONUtil.parseObj("{batCode:123,orderNo:123321}"));
|
||||||
// private SwapOrderBasicFeeComponent orderBasicFeeComponent;
|
return new Result().success("搞定");
|
||||||
// @Resource
|
}
|
||||||
// MqttStateChargingDataExchangeProcessor mqttStateChargingDataRequestExchangeProcessor;
|
|
||||||
// @Autowired
|
@PostMapping("/mongodb/list")
|
||||||
// private ApplicationContext applicationContext;
|
public Result mongoList() {
|
||||||
//// @Resource
|
// mongoDBService.find("123", ChargingData.class, Collections.asMap(MongoConstant.REGEX+MongoConstant.SEPARATION+"value","\"batCode\":124"))
|
||||||
//// VehicleService vehicleService;
|
return new Result().success("");
|
||||||
//// @Resource
|
}
|
||||||
//// MongoDBService mongoDBService;
|
|
||||||
//
|
|
||||||
// @PostMapping("/mongodb/save")
|
@PostMapping("/mqtt/test")
|
||||||
// public Result mongodbSave() {
|
public Result mqttTest(@RequestBody JSONObject json) {
|
||||||
// mqttStateChargingDataRequestExchangeProcessor.exchange(null,null,JSONUtil.parseObj("{batCode:123,orderNo:123321}"));
|
MessageTopic topic = new MessageTopic();
|
||||||
// return new Result().success("搞定");
|
topic.setDataDirection(json.getString("dataDirection"));
|
||||||
// }
|
topic.setMessageType(json.getString("messageType"));
|
||||||
//
|
topic.setStationCode(json.getString("stationCode"));
|
||||||
// @PostMapping("/mongodb/list")
|
MqttMessageHeader header = new MqttMessageHeader();
|
||||||
// public Result mongoList() {
|
header.setFunction(json.getString("function"));
|
||||||
//// mongoDBService.find("123", ChargingData.class, Collections.asMap(MongoConstant.REGEX+MongoConstant.SEPARATION+"value","\"batCode\":124"))
|
cn.hutool.json.JSONObject dataBody = JSONUtil.parseObj(json.getJSONObject("dataBoy"));
|
||||||
// return new Result().success("");
|
|
||||||
// }
|
Map<String, MqttStrategyExchangeProcessor> mqttMessageRequestExchangeProcessorMap = applicationContext.getBeansOfType(MqttStrategyExchangeProcessor.class);
|
||||||
//
|
for (MqttStrategyExchangeProcessor processor : mqttMessageRequestExchangeProcessorMap.values()) {
|
||||||
//
|
if(processor.accept(header.getFunction())){
|
||||||
// @PostMapping("/mqtt/test")
|
processor.exchange(topic, header, dataBody);
|
||||||
// public Result mqttTest(@RequestBody JSONObject json) {
|
}
|
||||||
// MessageTopic topic = new MessageTopic();
|
}
|
||||||
// topic.setDataDirection(json.getString("dataDirection"));
|
return new Result().success("搞定");
|
||||||
// topic.setMessageType(json.getString("messageType"));
|
}
|
||||||
// topic.setStationCode(json.getString("stationCode"));
|
|
||||||
// MqttMessageHeader header = new MqttMessageHeader();
|
|
||||||
// header.setFunction(json.getString("function"));
|
@GetMapping("/trade/{tradeId}")
|
||||||
// cn.hutool.json.JSONObject dataBody = JSONUtil.parseObj(json.getJSONObject("dataBoy"));
|
public Result trade(@PathVariable(value = "tradeId") String tradeId) {
|
||||||
//
|
|
||||||
// Map<String, MqttStrategyExchangeProcessor> mqttMessageRequestExchangeProcessorMap = applicationContext.getBeansOfType(MqttStrategyExchangeProcessor.class);
|
return new Result().success(JSONUtil.toJsonStr(tradeService.getById(tradeId)));
|
||||||
// for (MqttStrategyExchangeProcessor processor : mqttMessageRequestExchangeProcessorMap.values()) {
|
}
|
||||||
// if(processor.accept(header.getFunction())){
|
|
||||||
// processor.exchange(topic, header, dataBody);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return new Result().success("搞定");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
//
|
||||||
// @GetMapping("/station")
|
// @GetMapping("/station")
|
||||||
// public Result list() {
|
// public Result list() {
|
||||||
@ -129,44 +133,44 @@
|
|||||||
// System.out.println(JSONUtil.toJsonStr(order));
|
// System.out.println(JSONUtil.toJsonStr(order));
|
||||||
// return new Result().success(order);
|
// return new Result().success(order);
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
//
|
|
||||||
// private String orderNo(String stationCode, Date d) {
|
private String orderNo(String stationCode, Date d) {
|
||||||
// String orderNoPrefix = "YTSO";
|
String orderNoPrefix = "YTSO";
|
||||||
// String orderNoMiddle1 = stationCode.length() <= 8?stationCode : stationCode.substring(stationCode.length() - 8);
|
String orderNoMiddle1 = stationCode.length() <= 8?stationCode : stationCode.substring(stationCode.length() - 8);
|
||||||
// String orderNoMiddle2 = DateUtil.format(d, DatePattern.PURE_DATETIME_MS_FORMATTER);
|
String orderNoMiddle2 = DateUtil.format(d, DatePattern.PURE_DATETIME_MS_FORMATTER);
|
||||||
// String orderNoSuffix = RandomUtil.randomNumbers(2) + RandomUtil.randomChar("ABCDEF");
|
String orderNoSuffix = RandomUtil.randomNumbers(2) + RandomUtil.randomChar("ABCDEF");
|
||||||
// return orderNoPrefix + orderNoMiddle1 + orderNoMiddle2 + orderNoSuffix;
|
return orderNoPrefix + orderNoMiddle1 + orderNoMiddle2 + orderNoSuffix;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/device/live")
|
@PostMapping("/device/live")
|
||||||
// public Result deviceLive(@RequestParam String deviceId, @RequestParam String channelId) {
|
public Result deviceLive(@RequestParam String deviceId, @RequestParam String channelId) {
|
||||||
// return new Result().success(DHRequestUtil.live(deviceId, channelId));
|
return new Result().success(DHRequestUtil.live(deviceId, channelId));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/device/liveInfo")
|
@PostMapping("/device/liveInfo")
|
||||||
// public Result deviceLiveInfo(@RequestParam String deviceId, @RequestParam String channelId) {
|
public Result deviceLiveInfo(@RequestParam String deviceId, @RequestParam String channelId) {
|
||||||
// return new Result().success(DHRequestUtil.liveInfo(deviceId, channelId));
|
return new Result().success(DHRequestUtil.liveInfo(deviceId, channelId));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/device/delLive")
|
@PostMapping("/device/delLive")
|
||||||
// public Result delLive(@RequestParam String liveToken) {
|
public Result delLive(@RequestParam String liveToken) {
|
||||||
// return new Result().success(DHRequestUtil.delLive(liveToken));
|
return new Result().success(DHRequestUtil.delLive(liveToken));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/device/list")
|
@PostMapping("/device/list")
|
||||||
// public Result deviceList(@RequestParam Integer page, @RequestParam Integer pageSize) {
|
public Result deviceList(@RequestParam Integer page, @RequestParam Integer pageSize) {
|
||||||
// return new Result().success(DHRequestUtil.deviceList(Collections.asMap("pageNum", page, "pageSize", pageSize)));
|
return new Result().success(DHRequestUtil.deviceList(Collections.asMap("pageNum", page, "pageSize", pageSize)));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/device/createDeviceStreamUrl")
|
@PostMapping("/device/createDeviceStreamUrl")
|
||||||
// public Result createDeviceStreamUrl(@RequestParam String deviceId, @RequestParam String channelId) {
|
public Result createDeviceStreamUrl(@RequestParam String deviceId, @RequestParam String channelId) {
|
||||||
// return new Result().success(DHRequestUtil.createDeviceStreamUrl(deviceId, channelId));
|
return new Result().success(DHRequestUtil.createDeviceStreamUrl(deviceId, channelId));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PostMapping("/store/list")
|
@PostMapping("/store/list")
|
||||||
// public Result storeList(@RequestParam Integer page, @RequestParam Integer pageSize) {
|
public Result storeList(@RequestParam Integer page, @RequestParam Integer pageSize) {
|
||||||
// return new Result().success(DHRequestUtil.storeList(page, pageSize));
|
return new Result().success(DHRequestUtil.storeList(page, pageSize));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|||||||
@ -1,18 +1,13 @@
|
|||||||
package com.evotech.hd.cloud.controller.test.service;
|
package com.evotech.hd.cloud.controller.test.service;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttDeliveryToken;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttTopic;
|
|
||||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -39,7 +34,7 @@ public class MqttConfigService {
|
|||||||
try {
|
try {
|
||||||
MqttClient testClient = new MqttClient(mqttUrl, clientId, new MemoryPersistence());
|
MqttClient testClient = new MqttClient(mqttUrl, clientId, new MemoryPersistence());
|
||||||
//连接设置
|
//连接设置
|
||||||
MqttConnectOptions options = connectOptions();
|
MqttConnectOptions options = connectOptions();
|
||||||
//设置回调
|
//设置回调
|
||||||
testClient.setCallback(mqttTestCallback);
|
testClient.setCallback(mqttTestCallback);
|
||||||
testClient.connect(options);
|
testClient.connect(options);
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.evotech.hd.cloud.dao;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.evotech.hd.common.core.constant.HDConstant;
|
import com.evotech.hd.common.core.constant.HDConstant;
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderRecharge;
|
import com.evotech.hd.common.core.entity.order.OrderRecharge;
|
||||||
import com.evotech.hd.common.core.permission.DataScope;
|
import com.evotech.hd.common.core.permission.DataScope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.evotech.hd.cloud.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.evotech.hd.common.core.entity.order.OrderRefund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口
|
||||||
|
*
|
||||||
|
* @ClassName:OrderRefundDao
|
||||||
|
* @date: 2025年06月30日 14:26
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
|
||||||
|
//@DataScope(permissionObject = HDConstant.COMPANY_ROLE_CODE, permissionScopeName = "station_code", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_STATION_CODE)
|
||||||
|
public interface OrderRefundDao extends BaseMapper<OrderRefund> {
|
||||||
|
}
|
||||||
@ -1,21 +0,0 @@
|
|||||||
package com.evotech.hd.cloud.entity.order;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 充值订单类
|
|
||||||
* @ClassName:RechargeOrder
|
|
||||||
* @date: 2025年05月16日 11:06
|
|
||||||
* @author: andy.shi
|
|
||||||
* @contact: 17330188597
|
|
||||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
|
||||||
*/
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
@TableName(value = "yt_t_recharge_order", schema = "hd_cloud_manage")
|
|
||||||
public class RechargeOrder extends BaseOrder {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -12,14 +12,13 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
|||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Component
|
//@Component
|
||||||
@Order(value = 20)
|
@Order(value = 20)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MqttConnectInit implements ApplicationRunner {
|
public class MqttConnectInit implements ApplicationRunner {
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.config;
|
package com.evotech.hd.cloud.mqtt.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@ConfigurationProperties(prefix = "mqtt", ignoreUnknownFields = true)
|
@ConfigurationProperties(prefix = "mqtt", ignoreUnknownFields = true)
|
||||||
@Data
|
@Data
|
||||||
@Component
|
@Component
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.config;
|
package com.evotech.hd.cloud.mqtt.config;
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttDeliveryToken;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttTopic;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|||||||
@ -1,19 +1,17 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.config;
|
package com.evotech.hd.cloud.mqtt.config;
|
||||||
|
|
||||||
import java.util.List;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.evotech.hd.cloud.dao.BatteryStationDao;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import java.util.List;
|
||||||
import com.evotech.hd.cloud.dao.BatteryStationDao;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
@ -38,19 +36,31 @@ public class MqttSubscribeService {
|
|||||||
}
|
}
|
||||||
List<String> stationCodeList = stationList.stream().map(i -> i.getCode()).toList();
|
List<String> stationCodeList = stationList.stream().map(i -> i.getCode()).toList();
|
||||||
for (int i = 0; i < stationCodeList.size(); i++) {
|
for (int i = 0; i < stationCodeList.size(); i++) {
|
||||||
String stationCode = stationCodeList.get(i);
|
subscribe(cloudClient, stationCodeList.get(i));
|
||||||
String topicPrefix = "YTHD/" + stationCode + "/S2M/";
|
|
||||||
for (int j = 0; j < mqttMessageTypeArr.length; j++) {
|
|
||||||
String topic = topicPrefix + mqttMessageTypeArr[j];
|
|
||||||
try {
|
|
||||||
cloudClient.subscribe(topic, mpProperties.getQos());
|
|
||||||
log.info("\r\n=====>>>MQTT订阅主题 {} 成功...", topic);
|
|
||||||
} catch (MqttException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
log.error("\r\n=====>>>MQTT订阅主题 {} 失败。。。", topic);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.info("\r\n=====>>>MQTT订阅完成<<<===");
|
log.info("\r\n=====>>>MQTT订阅完成<<<===");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Async("taskExecutor")
|
||||||
|
public void subscribeAdd(String stationCode) {
|
||||||
|
log.info("\r\n=====>>>MQTT新增站点订阅主题>>>");
|
||||||
|
// 订阅主题
|
||||||
|
subscribe(MqttConnectInit.mqttClientMap.get("cloudClient"), stationCode);
|
||||||
|
log.info("\r\n=====>>>MQTT新增站点订阅完成<<<===");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void subscribe(MqttClient cloudClient, String stationCode){
|
||||||
|
String topicPrefix = "YTHD/" + stationCode + "/S2M/";
|
||||||
|
for (int j = 0; j < mqttMessageTypeArr.length; j++) {
|
||||||
|
String topic = topicPrefix + mqttMessageTypeArr[j];
|
||||||
|
try {
|
||||||
|
cloudClient.subscribe(topic, mpProperties.getQos());
|
||||||
|
log.info("\r\n=====>>>MQTT订阅主题 {} 成功...", topic);
|
||||||
|
} catch (MqttException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("\r\n=====>>>MQTT订阅主题 {} 失败。。。", topic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.config;
|
package com.evotech.hd.cloud.mqtt.config;
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.handle.MqttMessageHandleService;
|
import com.evotech.hd.cloud.mqtt.message.handle.MqttMessageHandleService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.enums;
|
package com.evotech.hd.cloud.mqtt.enums;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public enum EventFunctionTypesEnum {
|
public enum EventFunctionTypesEnum {
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message;
|
package com.evotech.hd.cloud.mqtt.message;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class MessageTopic implements Serializable {
|
public class MessageTopic implements Serializable {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.battery;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.battery;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class BatteryInfoResponse {
|
public class BatteryInfoResponse {
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.carinfo;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.carinfo;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 云端回复站端用户车辆数据
|
* 云端回复站端用户车辆数据
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.order;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.order;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class OrderByPlateNumResponse implements Serializable {
|
public class OrderByPlateNumResponse implements Serializable {
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.order;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.order;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class OrderData {
|
public class OrderData {
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.preorder;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.req.preorder;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站端预约订单
|
* 站端预约订单
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.state;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.state;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单状态
|
* 订单状态
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.state;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.state;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class OrderStatusData {
|
public class OrderStatusData {
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.newer.state;
|
package com.evotech.hd.cloud.mqtt.message.dto.newer.state;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 换电步骤
|
* 换电步骤
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.older;
|
package com.evotech.hd.cloud.mqtt.message.dto.older;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.older.req;
|
package com.evotech.hd.cloud.mqtt.message.dto.older.req;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.older.RateMode;
|
import com.evotech.hd.cloud.mqtt.message.dto.older.RateMode;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.older.RateModeSync;
|
import com.evotech.hd.cloud.mqtt.message.dto.older.RateModeSync;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class RateModeSyncReq{
|
public class RateModeSyncReq{
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.older.req;
|
package com.evotech.hd.cloud.mqtt.message.dto.older.req;
|
||||||
|
|
||||||
|
import com.evotech.hd.cloud.mqtt.message.dto.older.VehicleSync;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.older.VehicleSync;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class VehicleSyncReq{
|
public class VehicleSyncReq{
|
||||||
// 1 添加 VIN存在时更新数据 2删除 3更新VIN不存在是失败 4全部同步 删除站端 存储本次下发
|
// 1 添加 VIN存在时更新数据 2删除 3更新VIN不存在是失败 4全部同步 删除站端 存储本次下发
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.older.state;
|
package com.evotech.hd.cloud.mqtt.message.dto.older.state;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(name = "电池箱实时信息", hidden = true)
|
@Schema(name = "电池箱实时信息", hidden = true)
|
||||||
public class ChargingData {
|
public class ChargingData {
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.dto.older.state;
|
package com.evotech.hd.cloud.mqtt.message.dto.older.state;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zls
|
* @author zls
|
||||||
* @date 2023-12-03
|
* @date 2023-12-03
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.handle;
|
package com.evotech.hd.cloud.mqtt.message.handle;
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import cn.hutool.json.JSONObject;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.entity.MessageMqtt;
|
import com.evotech.hd.cloud.entity.MessageMqtt;
|
||||||
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.service.MessageMqttService;
|
import com.evotech.hd.cloud.service.MessageMqttService;
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求密钥 处理
|
* 请求密钥 处理
|
||||||
|
|||||||
@ -1,189 +1,134 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.handle;
|
package com.evotech.hd.cloud.mqtt.message.handle;
|
||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.json.JSONConfig;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.evotech.hd.cloud.dao.BatteryStationDcDao;
|
|
||||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryPreDao;
|
|
||||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryStepDao;
|
|
||||||
import com.evotech.hd.cloud.dao.VehicleInfoDao;
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.ConfirmFunctionTypesEnum;
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.confirm.SwapCompleteConfirm;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.event.SwapComplete;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatus;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationDcService;
|
|
||||||
import com.evotech.hd.cloud.service.OrderSwapBatteryService;
|
|
||||||
import com.evotech.hd.cloud.utils.components.HDStepDictComponent;
|
|
||||||
import com.evotech.hd.common.core.dao.cloud.OrderSwapBatteryDao;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.*;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.EventFunctionTypesEnum;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
import cn.hutool.json.JSONObject;
|
import com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.event.MqttStrategyEventExchangeProcessor;
|
||||||
import jakarta.annotation.Resource;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class EventMessageService {
|
public class EventMessageService {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MessageUtilService messageUtilService;
|
|
||||||
|
|
||||||
@Resource
|
@Autowired
|
||||||
private OrderSwapBatteryDao orderSwapBatteryDao;
|
private ApplicationContext applicationContext;
|
||||||
@Resource
|
|
||||||
private OrderSwapBatteryStepDao orderSwapBatteryStepDao;
|
|
||||||
@Resource
|
|
||||||
private BatteryStationDcService batteryStationDcService;
|
|
||||||
@Resource
|
|
||||||
private HDStepDictComponent hdStepDictComponent;
|
|
||||||
@Resource
|
|
||||||
private VehicleInfoDao vehicleInfoDao;
|
|
||||||
@Resource
|
|
||||||
private BatteryStationDcDao batteryStationDcDao;
|
|
||||||
@Resource
|
|
||||||
private OrderSwapBatteryService orderSwapBatteryService;
|
|
||||||
/**
|
/**
|
||||||
* event消息 处理
|
* event消息 处理
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void event(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
public void event(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
||||||
switch (Objects.requireNonNull(EventFunctionTypesEnum.getFunctionType(header.getFunction()))) {
|
Map<String, MqttStrategyEventExchangeProcessor> mqttEventExchangeProcessorMap = applicationContext.getBeansOfType(MqttStrategyEventExchangeProcessor.class);
|
||||||
case FUN_WARN_RECORD:
|
if(CollectionUtils.isEmpty(mqttEventExchangeProcessorMap)){
|
||||||
// TODO 写预警记录表
|
log.error("mqttEventExchangeProcessorMap is empty, 没有找到当前的请求信息, 请求接口{}, 请求参数{}", JSONUtil.toJsonStr(header), JSONUtil.toJsonStr(dataBody));
|
||||||
// TODO 回复 confirm 消息
|
}
|
||||||
// TODO 业务处理
|
for (MqttStrategyEventExchangeProcessor processor : mqttEventExchangeProcessorMap.values()) {
|
||||||
break;
|
if(processor.accept(header.getFunction())){
|
||||||
// 站端反馈订单状态
|
processor.exchange(topic, header, dataBody);
|
||||||
case FUN_ORDEREVENT:
|
}
|
||||||
SwapComplete orderStatus = JSONUtil.toBean(dataBody, SwapComplete.class);
|
|
||||||
OrderStatusData statusData = JSONUtil.toBean(dataBody.getJSONObject("statusData"), OrderStatusData.class);
|
|
||||||
// 订单状态更新处理
|
|
||||||
handleOrderStatus(orderStatus, statusData);
|
|
||||||
Date d = new Date();
|
|
||||||
//回复 confirm 消息
|
|
||||||
SwapCompleteConfirm swapRecordConfirm = new SwapCompleteConfirm();
|
|
||||||
swapRecordConfirm.setAckStatus(1);
|
|
||||||
swapRecordConfirm.setOrderNo(orderStatus.getOrderNo());
|
|
||||||
swapRecordConfirm.setError("");
|
|
||||||
topic.setDataDirection("M2S");
|
|
||||||
topic.setMessageType(MqttMessageTypeEnum.CONFIRM.getType());
|
|
||||||
header.setFunction(ConfirmFunctionTypesEnum.FUN_SWAP_RECORD_CONF.getReFunction());
|
|
||||||
header.setTimeStamp(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMATTER));
|
|
||||||
log.info("\r\n=====>>>回复站端收到换电完成--MQTT发送到消息主题:{},头部信息:{}订单编码;{},message:{}", topic,header, orderStatus.getOrderNo(),JSONUtil.parseObj(swapRecordConfirm, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
messageUtilService.publishAESMessage(topic, header, JSONUtil.parseObj(swapRecordConfirm, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
// /**
|
||||||
* 订单最终状态的更新
|
// * 订单最终状态的更新
|
||||||
* @param orderStatus
|
// * @param orderStatus
|
||||||
* @param statusData
|
// * @param statusData
|
||||||
*/
|
// */
|
||||||
private void handleOrderStatus(SwapComplete orderStatus, OrderStatusData statusData) {
|
// private void handleOrderStatus(SwapComplete orderStatus, OrderStatusData statusData) {
|
||||||
// 换电步骤添加最后一条
|
// // 换电步骤添加最后一条
|
||||||
if (orderStatus.getStatus() == 3){
|
// if (orderStatus.getStatus() == 3){
|
||||||
OrderSwapBattery osb = alterOrderStatus(orderStatus, statusData);
|
// OrderSwapBattery osb = alterOrderStatus(orderStatus, statusData);
|
||||||
OrderSwapBatteryStep step = new OrderSwapBatteryStep();
|
// OrderSwapBatteryStep step = new OrderSwapBatteryStep();
|
||||||
step.setOrderNo(orderStatus.getOrderNo());
|
// step.setOrderNo(orderStatus.getOrderNo());
|
||||||
step.setStep(8);
|
// step.setStep(8);
|
||||||
step.setStepTime(orderStatus.getStatusTime());
|
// step.setStepTime(orderStatus.getStatusTime());
|
||||||
step.setCtime(new Date());
|
// step.setCtime(new Date());
|
||||||
step.setCreater("SYS");
|
// step.setCreater("SYS");
|
||||||
step.setStepName(hdStepDictComponent.hdStepDictName(step.getStep()));
|
// step.setStepName(hdStepDictComponent.hdStepDictName(step.getStep()));
|
||||||
orderSwapBatteryStepDao.insert(step);
|
// orderSwapBatteryStepDao.insert(step);
|
||||||
// 修改车上电池编码
|
// // 修改车上电池编码
|
||||||
VehicleInfo vi = new VehicleInfo();
|
// VehicleInfo vi = new VehicleInfo();
|
||||||
vi.setBatCode(statusData.getRentBatCode());
|
// vi.setBatCode(statusData.getRentBatCode());
|
||||||
vi.setBatSoc(statusData.getRentBatSoc());
|
// vi.setBatSoc(statusData.getRentBatSoc());
|
||||||
vehicleInfoDao.update(vi, new QueryWrapper<VehicleInfo>().eq("plate_num", osb.getPlateNum()));
|
// vehicleInfoDao.update(vi, new QueryWrapper<VehicleInfo>().eq("plate_num", osb.getPlateNum()));
|
||||||
// 修改2块电池的信息
|
// // 修改2块电池的信息
|
||||||
BatteryStationDc dc1 = new BatteryStationDc();
|
// BatteryStationDc dc1 = new BatteryStationDc();
|
||||||
BatteryStationDc dc2 = new BatteryStationDc();
|
// BatteryStationDc dc2 = new BatteryStationDc();
|
||||||
dc1.setStatus(1);
|
// dc1.setStatus(1);
|
||||||
dc1.setSourceFrom(1);
|
// dc1.setSourceFrom(1);
|
||||||
dc1.setPointType(2);
|
// dc1.setPointType(2);
|
||||||
dc1.setPointCode(osb.getPlateNum());
|
// dc1.setPointCode(osb.getPlateNum());
|
||||||
dc1.setPointName(osb.getPlateNum());
|
// dc1.setPointName(osb.getPlateNum());
|
||||||
dc1.setSoc(statusData.getRentBatSoc());
|
// dc1.setSoc(statusData.getRentBatSoc());
|
||||||
dc1.setDccNo(0);
|
// dc1.setDccNo(0);
|
||||||
batteryStationDcDao.update(dc1, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getRentBatCode()));
|
// batteryStationDcDao.update(dc1, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getRentBatCode()));
|
||||||
dc2.setStatus(2);
|
// dc2.setStatus(2);
|
||||||
dc2.setSourceFrom(1);
|
// dc2.setSourceFrom(1);
|
||||||
dc2.setPointType(1);
|
// dc2.setPointType(1);
|
||||||
dc2.setPointCode(osb.getStationCode());
|
// dc2.setPointCode(osb.getStationCode());
|
||||||
dc2.setPointName(osb.getStationName());
|
// dc2.setPointName(osb.getStationName());
|
||||||
dc2.setSoc(statusData.getReturnBatSoc());
|
// dc2.setSoc(statusData.getReturnBatSoc());
|
||||||
dc2.setDccNo(statusData.getReturnBatNo());
|
// dc2.setDccNo(statusData.getReturnBatNo());
|
||||||
batteryStationDcDao.update(dc2, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getReturnBatCode()));
|
// batteryStationDcDao.update(dc2, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getReturnBatCode()));
|
||||||
// 添加2块电池的溯源记录
|
// // 添加2块电池的溯源记录
|
||||||
addBatteryTrace(orderStatus, statusData, osb);
|
// addBatteryTrace(orderStatus, statusData, osb);
|
||||||
//计算费用方式
|
// //计算费用方式
|
||||||
log.info("\r\n=====>>>订单状态更新处理订单状态开始结算:{},{}",orderStatus.getOrderNo(),orderStatus.getStatus() );
|
// log.info("\r\n=====>>>订单状态更新处理订单状态开始结算:{},{}",orderStatus.getOrderNo(),orderStatus.getStatus() );
|
||||||
//费用结算
|
// //费用结算
|
||||||
orderSwapBatteryService.calculateCost1(orderStatus.getOrderNo(), statusData);
|
// orderSwapBatteryService.calculateCost1(orderStatus.getOrderNo(), statusData);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
/**
|
// /**
|
||||||
* 修改订单状态方法
|
// * 修改订单状态方法
|
||||||
*
|
// *
|
||||||
* @param orderStatus
|
// * @param orderStatus
|
||||||
* @param statusData
|
// * @param statusData
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
private OrderSwapBattery alterOrderStatus(SwapComplete orderStatus, OrderStatusData statusData) {
|
// private OrderSwapBattery alterOrderStatus(SwapComplete orderStatus, OrderStatusData statusData) {
|
||||||
OrderSwapBattery osb = orderSwapBatteryDao.selectOne(new QueryWrapper<OrderSwapBattery>().eq("order_no", orderStatus.getOrderNo()));
|
// OrderSwapBattery osb = orderSwapBatteryDao.selectOne(new QueryWrapper<OrderSwapBattery>().eq("order_no", orderStatus.getOrderNo()));
|
||||||
osb.setStatus(orderStatus.getStatus());
|
// osb.setStatus(orderStatus.getStatus());
|
||||||
if (orderStatus.getStatus() == 3) {
|
// if (orderStatus.getStatus() == 3) {
|
||||||
osb.setServiceTimeEnd(orderStatus.getStatusTime());
|
// osb.setServiceTimeEnd(orderStatus.getStatusTime());
|
||||||
BeanUtils.copyProperties(statusData, osb);
|
// BeanUtils.copyProperties(statusData, osb);
|
||||||
}
|
// }
|
||||||
osb.setUptime(null);
|
// osb.setUptime(null);
|
||||||
orderSwapBatteryDao.updateById(osb);
|
// orderSwapBatteryDao.updateById(osb);
|
||||||
return osb;
|
// return osb;
|
||||||
}
|
// }
|
||||||
/**
|
// /**
|
||||||
* 添加电池轨迹记录
|
// * 添加电池轨迹记录
|
||||||
*
|
// *
|
||||||
* @param orderStatus
|
// * @param orderStatus
|
||||||
* @param statusData
|
// * @param statusData
|
||||||
* @param osb
|
// * @param osb
|
||||||
*/
|
// */
|
||||||
private void addBatteryTrace(SwapComplete orderStatus, OrderStatusData statusData, OrderSwapBattery osb) {
|
// private void addBatteryTrace(SwapComplete orderStatus, OrderStatusData statusData, OrderSwapBattery osb) {
|
||||||
BatteryTrace bt1 = new BatteryTrace();
|
// BatteryTrace bt1 = new BatteryTrace();
|
||||||
bt1.setOrderNo(orderStatus.getOrderNo());
|
// bt1.setOrderNo(orderStatus.getOrderNo());
|
||||||
bt1.setBatCode(statusData.getRentBatCode());
|
// bt1.setBatCode(statusData.getRentBatCode());
|
||||||
bt1.setSoc(statusData.getRentBatSoc());
|
// bt1.setSoc(statusData.getRentBatSoc());
|
||||||
bt1.setBeginTime(orderStatus.getStatusTime());
|
// bt1.setBeginTime(orderStatus.getStatusTime());
|
||||||
bt1.setPointType(2);
|
// bt1.setPointType(2);
|
||||||
bt1.setPointCode(osb.getPlateNum());
|
// bt1.setPointCode(osb.getPlateNum());
|
||||||
bt1.setPointName(osb.getPlateNum());
|
// bt1.setPointName(osb.getPlateNum());
|
||||||
bt1.setCreater("SYS");
|
// bt1.setCreater("SYS");
|
||||||
BatteryTrace bt2 = new BatteryTrace();
|
// BatteryTrace bt2 = new BatteryTrace();
|
||||||
BeanUtils.copyProperties(bt1, bt2);
|
// BeanUtils.copyProperties(bt1, bt2);
|
||||||
bt2.setBatCode(statusData.getReturnBatCode());
|
// bt2.setBatCode(statusData.getReturnBatCode());
|
||||||
bt2.setSoc(statusData.getRentBatSoc());
|
// bt2.setSoc(statusData.getRentBatSoc());
|
||||||
bt2.setPointType(1);
|
// bt2.setPointType(1);
|
||||||
bt2.setPointCode(osb.getStationCode());
|
// bt2.setPointCode(osb.getStationCode());
|
||||||
bt2.setPointName(osb.getStationName());
|
// bt2.setPointName(osb.getStationName());
|
||||||
batteryStationDcService.addTrace(bt1);
|
// batteryStationDcService.addTrace(bt1);
|
||||||
batteryStationDcService.addTrace(bt2);
|
// batteryStationDcService.addTrace(bt2);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.handle;
|
package com.evotech.hd.cloud.mqtt.message.handle;
|
||||||
|
|
||||||
import java.util.Date;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.evotech.hd.cloud.mqtt.config.MqttPublishMessage;
|
||||||
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.config.MqttPublishMessage;
|
import java.util.Date;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class MessageUtilService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MqttPublishMessage publishMessage;
|
private MqttPublishMessage publishMessage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录MQTT消息
|
* 记录MQTT消息
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.handle;
|
package com.evotech.hd.cloud.mqtt.message.handle;
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import cn.hutool.json.JSONObject;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mqtt消息处理
|
* Mqtt消息处理
|
||||||
@ -57,7 +55,6 @@ public class MqttMessageHandleService {
|
|||||||
// 3.2 分类处理
|
// 3.2 分类处理
|
||||||
// 3.2.1 state
|
// 3.2.1 state
|
||||||
if (MqttMessageTypeEnum.STATE.getType().equals(topic.getMessageType())) {
|
if (MqttMessageTypeEnum.STATE.getType().equals(topic.getMessageType())) {
|
||||||
|
|
||||||
stateMessageService.state(topic, header, dataBody);
|
stateMessageService.state(topic, header, dataBody);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,17 +2,9 @@ package com.evotech.hd.cloud.mqtt.message.handle;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.evotech.hd.cloud.dao.BatteryStationDcDao;
|
|
||||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryPreDao;
|
|
||||||
import com.evotech.hd.cloud.dao.VehicleWechatUserRelationDao;
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
import com.evotech.hd.cloud.mqtt.message.processor.strategy.MqttStrategyExchangeProcessor;
|
import com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.request.MqttStrategyRequestExchangeProcessor;
|
||||||
import com.evotech.hd.cloud.service.WechatUserService;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.request.BatterySwapResponse;
|
|
||||||
import com.evotech.hd.common.redis.utils.RedisUtil;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
@ -21,7 +13,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* request消息 处理
|
* request消息 处理
|
||||||
@ -29,318 +20,20 @@ import java.util.Objects;
|
|||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RequestMessageService {
|
public class RequestMessageService {
|
||||||
@Resource
|
|
||||||
private WechatUserService wechatUserService;
|
|
||||||
@Resource
|
|
||||||
private VehicleWechatUserRelationDao vehicleWechatUserRelationDao;
|
|
||||||
@Resource
|
|
||||||
private MessageUtilService messageUtilService;
|
|
||||||
@Resource
|
|
||||||
private BatteryStationDcDao batteryStationDcDao;
|
|
||||||
// @Resource
|
|
||||||
// private OrderSwapBatteryDao orderSwapBatteryDao;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OrderSwapBatteryPreDao orderSwapBatteryPreDao;
|
|
||||||
// @Resource
|
|
||||||
// private OrderSwapBatteryService orderSwapBatteryService;
|
|
||||||
@Resource
|
|
||||||
private RedisUtil redisUtil;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@Async("taskExecutor")
|
@Async("taskExecutor")
|
||||||
public void request(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
public void request(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
||||||
switch (Objects.requireNonNull(RequestFunctionTypesEnum.getFunctionType(header.getFunction()))) {
|
|
||||||
// case FUN_CARINFO:
|
Map<String, MqttStrategyRequestExchangeProcessor> mqttMessageRequestExchangeProcessorMap = applicationContext.getBeansOfType(MqttStrategyRequestExchangeProcessor.class);
|
||||||
// CarInfoReq carInfoReq = JSONUtil.toBean(dataBody, CarInfoReq.class);
|
|
||||||
// handleCarInfo(topic, header, carInfoReq);
|
|
||||||
// break;
|
|
||||||
// case FUN_BATTERYINFO:
|
|
||||||
// BatteryInfoReq batteryInfoReq = JSONUtil.toBean(dataBody, BatteryInfoReq.class);
|
|
||||||
// handleBatteryInfo(topic, header, batteryInfoReq);
|
|
||||||
// break;
|
|
||||||
// case FUN_PREORDER:
|
|
||||||
// OrderSwapBatteryPre orderSwapBatteryPre = JSONUtil.toBean(dataBody, OrderSwapBatteryPre.class);
|
|
||||||
// handlOrderSwapBatteryPre(topic,header,orderSwapBatteryPre);
|
|
||||||
// break;
|
|
||||||
// case FUN_ORDERBYPLATENUM:
|
|
||||||
// OrderByPlateNumReq orderByPlateNumReq = JSONUtil.toBean(dataBody, OrderByPlateNumReq.class);
|
|
||||||
// handleOrderByPlateNum(topic, header, orderByPlateNumReq);
|
|
||||||
// break;
|
|
||||||
// case FUN_CANCELORDER:
|
|
||||||
// CancelOrderReq cancelOrder = JSONUtil.toBean(dataBody, CancelOrderReq.class);
|
|
||||||
// handlOrderCancel(topic,header,cancelOrder);
|
|
||||||
// break;
|
|
||||||
case FUN_STARTSWAP: //没搞明白干啥用了, 暂时不动
|
|
||||||
BatterySwapResponse battery = JSONUtil.toBean(dataBody, BatterySwapResponse.class);
|
|
||||||
handlStartSwap(topic,header,battery);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Map<String, MqttStrategyExchangeProcessor> mqttMessageRequestExchangeProcessorMap = applicationContext.getBeansOfType(MqttStrategyExchangeProcessor.class);
|
|
||||||
if(CollectionUtils.isEmpty(mqttMessageRequestExchangeProcessorMap)){
|
if(CollectionUtils.isEmpty(mqttMessageRequestExchangeProcessorMap)){
|
||||||
log.error("mqttRequestExchangeProcessorMap is empty, 没有找到当前的请求信息, 请求接口{}, 请求参数{}", JSONUtil.toJsonStr(header), JSONUtil.toJsonStr(dataBody));
|
log.error("mqttRequestExchangeProcessorMap is empty, 没有找到当前的请求信息, 请求接口{}, 请求参数{}", JSONUtil.toJsonStr(header), JSONUtil.toJsonStr(dataBody));
|
||||||
}
|
}
|
||||||
for (MqttStrategyExchangeProcessor processor : mqttMessageRequestExchangeProcessorMap.values()) {
|
for (MqttStrategyRequestExchangeProcessor processor : mqttMessageRequestExchangeProcessorMap.values()) {
|
||||||
if(processor.accept(header.getFunction())){
|
if(processor.accept(header.getFunction())){
|
||||||
processor.exchange(topic, header, dataBody);
|
processor.exchange(topic, header, dataBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 站端回复开始换电
|
|
||||||
* @param topic
|
|
||||||
* @param header
|
|
||||||
* @param battery
|
|
||||||
*/
|
|
||||||
private void handlStartSwap(MessageTopic topic, MqttMessageHeader header, BatterySwapResponse battery) {
|
|
||||||
// 校验 battery.getOrderId() 是否有效
|
|
||||||
String orderNo = battery.getOrderNo();
|
|
||||||
if (orderNo == null || orderNo.isEmpty()) {
|
|
||||||
log.error("电池订单编码无效: battery={}", battery);
|
|
||||||
throw new IllegalArgumentException("电池订单orderNo无效");
|
|
||||||
}
|
|
||||||
// 定义 Redis 过期时间(5分钟)
|
|
||||||
final int REDIS_EXPIRE_TIME_IN_SECONDS = 60 * 5; // 5分钟
|
|
||||||
// Redis 键值
|
|
||||||
String redisKey = "battery:" + orderNo;
|
|
||||||
// 将响应存到 Redis 里
|
|
||||||
redisUtil.set(redisKey, battery, REDIS_EXPIRE_TIME_IN_SECONDS);
|
|
||||||
// 记录成功日志
|
|
||||||
log.info("换电响应已成功存储到 Redis: key={}", redisKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 站端取消订单
|
|
||||||
* @param topic
|
|
||||||
* @param header
|
|
||||||
* @param cancelOrder
|
|
||||||
*/
|
|
||||||
// private void handlOrderCancel(MessageTopic topic, MqttMessageHeader header, CancelOrderReq cancelOrder) {
|
|
||||||
// Date d = new Date();
|
|
||||||
// CancelOrderResponse response = new CancelOrderResponse();
|
|
||||||
//
|
|
||||||
// Result<Integer> integerResult = orderSwapBatteryService.cancelOrder(cancelOrder.getOrderNo(), 9);
|
|
||||||
// if (integerResult.getStatus()==0){
|
|
||||||
// response.setCode(0);
|
|
||||||
// response.setMsg(integerResult.getMsg());
|
|
||||||
// response.setOrderNo(cancelOrder.getOrderNo());
|
|
||||||
// }else {
|
|
||||||
// response.setCode(1);
|
|
||||||
// response.setMsg(integerResult.getMsg());
|
|
||||||
// response.setOrderNo("OK");
|
|
||||||
// }
|
|
||||||
// // 发送
|
|
||||||
// topic.setDataDirection("M2S");
|
|
||||||
// topic.setMessageType(MqttMessageTypeEnum.RESPONSE.getType());
|
|
||||||
// header.setFunction(RequestFunctionTypesEnum.FUN_CANCELORDER.getReFunction());
|
|
||||||
// header.setTimeStamp(DateUtil.format(d, DatePattern.NORM_DATETIME_FORMATTER));
|
|
||||||
// log.info("\r\n=====>>>站端取消订单--MQTT发送到消息主题:{},头部信息:{}订单编码;{},message:{}", topic,header, cancelOrder.getOrderNo(),JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// messageUtilService.publishAESMessage(topic, header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 站端添加预约单
|
|
||||||
// * @param topic
|
|
||||||
// * @param header
|
|
||||||
// * @param orderSwapBatteryPre
|
|
||||||
// */
|
|
||||||
// private void handlOrderSwapBatteryPre(MessageTopic topic, MqttMessageHeader header, OrderSwapBatteryPre orderSwapBatteryPre) {
|
|
||||||
// OrdeSwapBatteryPreRespose response = new OrdeSwapBatteryPreRespose();
|
|
||||||
// Date d = new Date();
|
|
||||||
// // 1. 基础字段校验
|
|
||||||
// if (validateRequiredFields(orderSwapBatteryPre)) {
|
|
||||||
// // 返回错误消息
|
|
||||||
// response.setStationPreOrderId(orderSwapBatteryPre.getSourceId());
|
|
||||||
// response.setMsg("预约信息不完整");
|
|
||||||
// response.setCode(0);
|
|
||||||
// }else {
|
|
||||||
// //添加预约单
|
|
||||||
// WechatUser wechatUser =wechatUserService.selectUcode(orderSwapBatteryPre.getPhone(),orderSwapBatteryPre.getUname());
|
|
||||||
// //查询用户编码
|
|
||||||
// orderSwapBatteryPre.setUcode(wechatUser.getWuid());
|
|
||||||
// orderSwapBatteryPre.setSource(3);
|
|
||||||
// Result<Integer> integerResult = orderSwapBatteryService.addPre(orderSwapBatteryPre);
|
|
||||||
// //添加失败情况
|
|
||||||
// if (integerResult.getStatus()==0){
|
|
||||||
// response.setStationPreOrderId(orderSwapBatteryPre.getSourceId());
|
|
||||||
// //返回失败状态
|
|
||||||
// response.setMsg(integerResult.getMsg());
|
|
||||||
// response.setCode(0);
|
|
||||||
// }else{
|
|
||||||
// response.setStationPreOrderId(orderSwapBatteryPre.getSourceId());
|
|
||||||
// response.setCode(1);
|
|
||||||
// response.setMsg("OK");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // 发送
|
|
||||||
// topic.setDataDirection("M2S");
|
|
||||||
// topic.setMessageType(MqttMessageTypeEnum.RESPONSE.getType());
|
|
||||||
// header.setFunction(RequestFunctionTypesEnum.FUN_PREORDER.getReFunction());
|
|
||||||
// header.setTimeStamp(DateUtil.format(d, DatePattern.NORM_DATETIME_FORMATTER));
|
|
||||||
// log.info("\r\n=====>>>站端添加预约单--MQTT发送到消息主题:{},头部信息:{},message:{}", topic,header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// messageUtilService.publishAESMessage(topic, header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OrderByPlateNum请求处理
|
|
||||||
* @param topic
|
|
||||||
* @param header
|
|
||||||
* @param orderByPlateNumReq
|
|
||||||
*/
|
|
||||||
// private void handleOrderByPlateNum(MessageTopic topic, MqttMessageHeader header, OrderByPlateNumReq orderByPlateNumReq) {
|
|
||||||
// OrderByPlateNumResponse response = new OrderByPlateNumResponse();
|
|
||||||
// Date d = new Date();
|
|
||||||
// // 查预约
|
|
||||||
// OrderSwapBatteryPre osbp = orderSwapBatteryPreDao.selectOne(new QueryWrapper<OrderSwapBatteryPre>()
|
|
||||||
// .eq("plate_num", orderByPlateNumReq.getPlateNum())
|
|
||||||
// .eq("station_code", orderByPlateNumReq.getStationCode())
|
|
||||||
// .eq("status", 1)
|
|
||||||
// .eq("swap_day", DateUtil.format(d, DatePattern.PURE_DATE_FORMATTER))
|
|
||||||
// .last("limit 1"));
|
|
||||||
// if (osbp == null) {
|
|
||||||
// response.setOrderRequestId(orderByPlateNumReq.getOrderRequestId());
|
|
||||||
// response.setCode(0);
|
|
||||||
// response.setMsg("车辆未预约,请扫码进入");
|
|
||||||
// } else {
|
|
||||||
// OrderSwapBattery osb = orderSwapBatteryDao.selectOne(new QueryWrapper<OrderSwapBattery>()
|
|
||||||
// .eq("plate_num", orderByPlateNumReq.getPlateNum())
|
|
||||||
// .eq("station_code", orderByPlateNumReq.getStationCode())
|
|
||||||
// .eq("order_pre_id", osbp.getPkId())
|
|
||||||
// .eq("status", 1));
|
|
||||||
// if (osb == null) {
|
|
||||||
// // 生成订单
|
|
||||||
// osb = new OrderSwapBattery();
|
|
||||||
// osb.setOrderNo(CommonUtil.swapBatteryOrderNo(orderByPlateNumReq.getStationCode()));
|
|
||||||
// osb.setOrderPreId(osbp.getPkId());
|
|
||||||
// osb.setOrderPrePhone(osbp.getPhone());
|
|
||||||
// osb.setOrderPreUid(osbp.getUcode());
|
|
||||||
// osb.setOrderPreUname(osbp.getUname());
|
|
||||||
// osb.setPlateNum(osbp.getPlateNum());
|
|
||||||
// osb.setOrderTime(d);
|
|
||||||
// osb.setOrderType(1);
|
|
||||||
// osb.setStatus(1);
|
|
||||||
// osb.setStationCode(osbp.getStationCode());
|
|
||||||
// osb.setStationName(osbp.getStationName());
|
|
||||||
// // TODO 查询换电站信息,拿到计费方式,放到订单信息中
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//// // 加上费用标准 - 移到订单服务中了
|
|
||||||
//// osb = orderBasicFeeComponent.orderBasicFee(osb);
|
|
||||||
// log.info("\r\n=====>>>生成订单信息--MQTT发送到消息主题:{},订单编码:{}", topic,CommonUtil.swapBatteryOrderNo(orderByPlateNumReq.getStationCode()));
|
|
||||||
// orderSwapBatteryService.add(osb);
|
|
||||||
// }
|
|
||||||
// //走到此处, 证明上面逻辑没有问题, 需要删除预约单过期标识
|
|
||||||
// redisUtil.del("preorder:expire:"+osbp.getPkId());
|
|
||||||
// // 返回数据
|
|
||||||
// OrderData od = new OrderData();
|
|
||||||
// BeanUtils.copyProperties(osb, od);
|
|
||||||
// response.setOrderRequestId(orderByPlateNumReq.getOrderRequestId());
|
|
||||||
// response.setCode(1);
|
|
||||||
// response.setMsg("OK");
|
|
||||||
// response.setOrderData(od);
|
|
||||||
// }
|
|
||||||
// // 发送
|
|
||||||
// topic.setDataDirection("M2S");
|
|
||||||
// topic.setMessageType(MqttMessageTypeEnum.RESPONSE.getType());
|
|
||||||
// header.setFunction(RequestFunctionTypesEnum.FUN_ORDERBYPLATENUM.getReFunction());
|
|
||||||
// header.setTimeStamp(DateUtil.format(d, DatePattern.NORM_DATETIME_FORMATTER));
|
|
||||||
// log.info("\r\n=====>>>站端用车牌号查询订单--MQTT发送到消息主题:{},头部信息:{},message:{}", topic,header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// messageUtilService.publishAESMessage(topic, header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * BatteryInfo请求处理
|
|
||||||
// * @param topic
|
|
||||||
// * @param header
|
|
||||||
// * @param batteryInfoReq
|
|
||||||
// */
|
|
||||||
// private void handleBatteryInfo(MessageTopic topic, MqttMessageHeader header, BatteryInfoReq batteryInfoReq) {
|
|
||||||
// String batCode = batteryInfoReq.getBatCode();
|
|
||||||
// int pageNo = 0;
|
|
||||||
// int pageSize = 500;
|
|
||||||
// Page<BatteryStationDc> page = new Page<BatteryStationDc>(pageNo, pageSize);
|
|
||||||
// do {
|
|
||||||
// pageNo += 1;
|
|
||||||
// page = new Page<BatteryStationDc>(pageNo, pageSize);
|
|
||||||
// page = batteryStationDcDao.selectPage(page, new QueryWrapper<BatteryStationDc>().eq(StringUtils.hasText(batCode), "bat_code", batCode));
|
|
||||||
// BatteryInfoResponse response = new BatteryInfoResponse();
|
|
||||||
// response.setBatteryInfoRequestId(batteryInfoReq.getBatteryInfoRequestId());
|
|
||||||
// response.setPageNo(Integer.valueOf(page.getCurrent() + ""));
|
|
||||||
// response.setPageSize(Integer.valueOf(page.getSize() + ""));
|
|
||||||
// response.setTotal(Integer.valueOf(page.getTotal() + ""));
|
|
||||||
// response.setIsOver(page.getCurrent() < page.getPages()? 0 : 1);
|
|
||||||
// List<BatteryData> list = new ArrayList<BatteryData>();
|
|
||||||
// if (page.getCurrent() > 0) {
|
|
||||||
// list = page.getRecords().stream().map(i -> {
|
|
||||||
// BatteryData bd = new BatteryData();
|
|
||||||
// BeanUtils.copyProperties(i, bd);
|
|
||||||
// return bd;
|
|
||||||
// }).toList();
|
|
||||||
// response.setBatteryData(list);
|
|
||||||
// }
|
|
||||||
// topic.setDataDirection("M2S");
|
|
||||||
// topic.setMessageType(MqttMessageTypeEnum.RESPONSE.getType());
|
|
||||||
// header.setFunction(RequestFunctionTypesEnum.FUN_BATTERYINFO.getReFunction());
|
|
||||||
// header.setTimeStamp(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMATTER));
|
|
||||||
// log.info("\r\n=====>>>站端请求电池数据--MQTT发送到消息主题:{},头部信息:{},message:{}", topic,header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// messageUtilService.publishAESMessage(topic, header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// } while (page.getCurrent() < page.getPages());
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * CarInfo请求处理
|
|
||||||
// * @param topic
|
|
||||||
// * @param header
|
|
||||||
// * @param carInfoReq
|
|
||||||
// */
|
|
||||||
// private void handleCarInfo(MessageTopic topic, MqttMessageHeader header, CarInfoReq carInfoReq) {
|
|
||||||
// String plateNum = carInfoReq.getPlateNum();
|
|
||||||
// int pageNo = 0;
|
|
||||||
// int pageSize = 500;
|
|
||||||
// Page<VehicleWechatUserRelation> page = new Page<VehicleWechatUserRelation>(pageNo, pageSize);
|
|
||||||
// do {
|
|
||||||
// pageNo += 1;
|
|
||||||
// page = new Page<VehicleWechatUserRelation>(pageNo, pageSize);
|
|
||||||
// page = vehicleWechatUserRelationDao.selectPage(page, new QueryWrapper<VehicleWechatUserRelation>()
|
|
||||||
// .eq(StringUtils.hasText(plateNum), "plate_num", plateNum));
|
|
||||||
// CarInfoResponse response = new CarInfoResponse();
|
|
||||||
// response.setCarInfoRequestId(carInfoReq.getCarInfoRequestId());
|
|
||||||
// response.setPageNo(Integer.valueOf(page.getCurrent() + ""));
|
|
||||||
// response.setPageSize(Integer.valueOf(page.getSize() + ""));
|
|
||||||
// response.setTotal(Integer.valueOf(page.getTotal() + ""));
|
|
||||||
// response.setIsOver(page.getCurrent() < page.getPages()? 0 : 1);
|
|
||||||
// List<VehicleData> list = new ArrayList<VehicleData>();
|
|
||||||
// if (page.getCurrent() > 0) {
|
|
||||||
// list = page.getRecords().stream().map(i -> {
|
|
||||||
// VehicleData vd = new VehicleData();
|
|
||||||
// BeanUtils.copyProperties(i, vd);
|
|
||||||
// return vd;
|
|
||||||
// }).toList();
|
|
||||||
// response.setVehicleData(list);
|
|
||||||
// }
|
|
||||||
// topic.setDataDirection("M2S");
|
|
||||||
// topic.setMessageType(MqttMessageTypeEnum.RESPONSE.getType());
|
|
||||||
// header.setFunction(RequestFunctionTypesEnum.FUN_CARINFO.getReFunction());
|
|
||||||
// header.setTimeStamp(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMATTER));
|
|
||||||
// log.info("\r\n=====>>>站端请求用户车辆数据--MQTT发送到消息主题:{},头部信息:{},message:{}", topic,header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// messageUtilService.publishAESMessage(topic, header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
// } while (page.getCurrent() < page.getPages());
|
|
||||||
// }
|
|
||||||
// private boolean validateRequiredFields(OrderSwapBatteryPre order) {
|
|
||||||
// return Stream.of(
|
|
||||||
// order.getPlateNum(),
|
|
||||||
// order.getPhone(),
|
|
||||||
// order.getStationCode(),
|
|
||||||
// order.getStationName(),
|
|
||||||
// order.getUname(),
|
|
||||||
// order.getSwapDay(),
|
|
||||||
// order.getSwapDuration(),
|
|
||||||
// order.getReservationTime()
|
|
||||||
// ).anyMatch(StrUtil::isBlankIfStr);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,35 +2,17 @@ package com.evotech.hd.cloud.mqtt.message.handle;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryPreDao;
|
|
||||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryStepDao;
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.StateFunctionTypesEnum;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatus;
|
import com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.state.MqttStrategyStateExchangeProcessor;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.SwapStep;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.processor.strategy.MqttStrategyExchangeProcessor;
|
|
||||||
import com.evotech.hd.cloud.service.BatteryStationDcService;
|
|
||||||
import com.evotech.hd.cloud.utils.components.HDStepDictComponent;
|
|
||||||
import com.evotech.hd.common.core.dao.cloud.OrderSwapBatteryDao;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryTrace;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBattery;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryStep;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* state消息 处理
|
* state消息 处理
|
||||||
@ -39,203 +21,19 @@ import java.util.Objects;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class StateMessageService {
|
public class StateMessageService {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OrderSwapBatteryDao orderSwapBatteryDao;
|
|
||||||
@Resource
|
|
||||||
private OrderSwapBatteryPreDao orderSwapBatteryPreDao;
|
|
||||||
@Resource
|
|
||||||
private OrderSwapBatteryStepDao orderSwapBatteryStepDao;
|
|
||||||
@Resource
|
|
||||||
private BatteryStationDcService batteryStationDcService;
|
|
||||||
@Resource
|
|
||||||
private HDStepDictComponent hdStepDictComponent;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
|
||||||
@Async("taskExecutor")
|
@Async("taskExecutor")
|
||||||
public void state(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
public void state(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
||||||
switch (Objects.requireNonNull(StateFunctionTypesEnum.getFunctionType(header.getFunction()))) {
|
Map<String, MqttStrategyStateExchangeProcessor> mqttStateExchangeProcessorMap = applicationContext.getBeansOfType(MqttStrategyStateExchangeProcessor.class);
|
||||||
// 站端反馈订单状态
|
if(CollectionUtils.isEmpty(mqttStateExchangeProcessorMap)){
|
||||||
case FUN_ORDERSTATUS:
|
log.error("mqttStateExchangeProcessorMap is empty, 没有找到当前的请求信息, 请求接口{}, 请求参数{}", JSONUtil.toJsonStr(header), JSONUtil.toJsonStr(dataBody));
|
||||||
OrderStatus orderStatus = JSONUtil.toBean(dataBody, OrderStatus.class);
|
|
||||||
OrderStatusData statusData = JSONUtil.toBean(dataBody.getJSONObject("statusData"), OrderStatusData.class);
|
|
||||||
// 订单状态更新处理
|
|
||||||
handleOrderStatus(orderStatus);
|
|
||||||
break;
|
|
||||||
// 站端反馈换电步骤
|
|
||||||
case FUN_SWAPSTEP:
|
|
||||||
SwapStep swapStep = JSONUtil.toBean(dataBody, SwapStep.class);
|
|
||||||
// 记录换电步骤
|
|
||||||
OrderSwapBatteryStep step = new OrderSwapBatteryStep();
|
|
||||||
BeanUtils.copyProperties(swapStep, step);
|
|
||||||
step.setCtime(new Date());
|
|
||||||
step.setCreater("SYS");
|
|
||||||
step.setStepName(hdStepDictComponent.hdStepDictName(step.getStep()));
|
|
||||||
log.info("\r\n=====>>>站端反馈换电步骤--MQTT收到消息主题:{},换电步骤名称:{}",topic,hdStepDictComponent.hdStepDictName(step.getStep()) );
|
|
||||||
orderSwapBatteryStepDao.insert(step);
|
|
||||||
break;
|
|
||||||
case FUN_TEST:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Map<String, MqttStrategyExchangeProcessor> mqttRequestExchangeProcessorMap = applicationContext.getBeansOfType(MqttStrategyExchangeProcessor.class);
|
|
||||||
if(CollectionUtils.isEmpty(mqttRequestExchangeProcessorMap)){
|
|
||||||
log.error("mqttRequestExchangeProcessorMap is empty, 没有找到当前的请求信息, 请求接口{}, 请求参数{}", JSONUtil.toJsonStr(header), JSONUtil.toJsonStr(dataBody));
|
|
||||||
}
|
|
||||||
for (MqttStrategyExchangeProcessor processor : mqttRequestExchangeProcessorMap.values()) {
|
|
||||||
if(processor.accept(header.getFunction())){
|
|
||||||
processor.exchange(topic, header, dataBody);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
for (MqttStrategyStateExchangeProcessor processor : mqttStateExchangeProcessorMap.values()) {
|
||||||
}
|
if(processor.accept(header.getFunction())){
|
||||||
|
processor.exchange(topic, header, dataBody);
|
||||||
/**
|
}
|
||||||
* 订单状态更新处理
|
|
||||||
* @param orderStatus
|
|
||||||
|
|
||||||
*/
|
|
||||||
private void handleOrderStatus(OrderStatus orderStatus) {
|
|
||||||
switch (orderStatus.getStatus()) {
|
|
||||||
case 2:
|
|
||||||
orderStatus2(orderStatus);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
/* // 修改订单状态和数据
|
|
||||||
OrderSwapBattery osb = alterOrderStatus(orderStatus, statusData);
|
|
||||||
// 换电步骤添加最后一条
|
|
||||||
OrderSwapBatteryStep step = new OrderSwapBatteryStep();
|
|
||||||
step.setOrderNo(orderStatus.getOrderNo());
|
|
||||||
step.setStep(8);
|
|
||||||
step.setStepTime(orderStatus.getStatusTime());
|
|
||||||
step.setCtime(new Date());
|
|
||||||
step.setCreater("SYS");
|
|
||||||
step.setStepName(hdStepDictComponent.hdStepDictName(step.getStep()));
|
|
||||||
orderSwapBatteryStepDao.insert(step);
|
|
||||||
//计算费用方式
|
|
||||||
log.info("\r\n=====>>>订单状态更新处理订单状态开始结算:{},{}",orderStatus.getOrderNo(),orderStatus.getStatus() );
|
|
||||||
//费用结算
|
|
||||||
orderSwapBatteryService.calculateCost1(orderStatus.getOrderNo(), statusData);
|
|
||||||
// 修改车上电池编码
|
|
||||||
VehicleInfo vi = new VehicleInfo();
|
|
||||||
vi.setBatCode(statusData.getRentBatCode());
|
|
||||||
vi.setBatSoc(statusData.getRentBatSoc());
|
|
||||||
vehicleInfoDao.update(vi, new QueryWrapper<VehicleInfo>().eq("plate_num", osb.getPlateNum()));
|
|
||||||
// 修改2块电池的信息
|
|
||||||
BatteryStationDc dc1 = new BatteryStationDc();
|
|
||||||
BatteryStationDc dc2 = new BatteryStationDc();
|
|
||||||
dc1.setStatus(1);
|
|
||||||
dc1.setPointType(2);
|
|
||||||
dc1.setPointCode(osb.getPlateNum());
|
|
||||||
dc1.setPointName(osb.getPlateNum());
|
|
||||||
dc1.setSoc(statusData.getRentBatSoc());
|
|
||||||
dc1.setDccNo(0);
|
|
||||||
batteryStationDcDao.update(dc1,
|
|
||||||
new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getRentBatCode()));
|
|
||||||
dc2.setStatus(2);
|
|
||||||
dc2.setPointType(1);
|
|
||||||
dc2.setPointCode(osb.getStationCode());
|
|
||||||
dc2.setPointName(osb.getStationName());
|
|
||||||
dc2.setSoc(statusData.getReturnBatSoc());
|
|
||||||
dc2.setDccNo(statusData.getReturnBatNo());
|
|
||||||
batteryStationDcDao.update(dc2, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getReturnBatCode()));
|
|
||||||
// 添加2块电池的溯源记录
|
|
||||||
addBatteryTrace(orderStatus, statusData, osb);
|
|
||||||
break;*/
|
|
||||||
case 4:
|
|
||||||
// 修改订单状态
|
|
||||||
alterOrderStatus(orderStatus);
|
|
||||||
break;
|
|
||||||
/* case 5:
|
|
||||||
// 修改订单状态和数据
|
|
||||||
alterOrderStatus(orderStatus, statusData);
|
|
||||||
// 修改电池状态
|
|
||||||
BatteryStationDc dc = new BatteryStationDc();
|
|
||||||
dc.setStatus(3);
|
|
||||||
dc.setSoc(statusData.getSoc());
|
|
||||||
|
|
||||||
batteryStationDcDao.update(dc, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getBatCode()));
|
|
||||||
break;*/
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加电池轨迹记录
|
|
||||||
*
|
|
||||||
* @param orderStatus
|
|
||||||
* @param statusData
|
|
||||||
* @param osb
|
|
||||||
*/
|
|
||||||
private void addBatteryTrace(OrderStatus orderStatus, OrderStatusData statusData, OrderSwapBattery osb) {
|
|
||||||
BatteryTrace bt1 = new BatteryTrace();
|
|
||||||
bt1.setOrderNo(orderStatus.getOrderNo());
|
|
||||||
bt1.setBatCode(statusData.getRentBatCode());
|
|
||||||
bt1.setSoc(statusData.getRentBatSoc());
|
|
||||||
bt1.setBeginTime(orderStatus.getStatusTime());
|
|
||||||
bt1.setPointType(2);
|
|
||||||
bt1.setPointCode(osb.getPlateNum());
|
|
||||||
bt1.setPointName(osb.getPlateNum());
|
|
||||||
bt1.setCreater("SYS");
|
|
||||||
BatteryTrace bt2 = new BatteryTrace();
|
|
||||||
BeanUtils.copyProperties(bt1, bt2);
|
|
||||||
bt2.setBatCode(statusData.getReturnBatCode());
|
|
||||||
bt2.setSoc(statusData.getRentBatSoc());
|
|
||||||
bt2.setPointType(1);
|
|
||||||
bt2.setPointCode(osb.getStationCode());
|
|
||||||
bt2.setPointName(osb.getStationName());
|
|
||||||
batteryStationDcService.addTrace(bt1);
|
|
||||||
batteryStationDcService.addTrace(bt2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 换电开始时的处理
|
|
||||||
*
|
|
||||||
* @param orderStatus
|
|
||||||
*/
|
|
||||||
private void orderStatus2(OrderStatus orderStatus) {
|
|
||||||
// 修改订单状态
|
|
||||||
OrderSwapBattery osb = alterOrderStatus(orderStatus);
|
|
||||||
// 添加换电步骤1-车辆进站
|
|
||||||
OrderSwapBatteryStep step = new OrderSwapBatteryStep();
|
|
||||||
step.setOrderNo(orderStatus.getOrderNo());
|
|
||||||
step.setStep(1);
|
|
||||||
step.setStepTime(orderStatus.getStatusTime());
|
|
||||||
step.setCtime(new Date());
|
|
||||||
step.setCreater("SYS");
|
|
||||||
step.setStepName(hdStepDictComponent.hdStepDictName(step.getStep()));
|
|
||||||
orderSwapBatteryStepDao.insert(step);
|
|
||||||
// 修改预约订单为完成
|
|
||||||
OrderSwapBatteryPre osbp = new OrderSwapBatteryPre();
|
|
||||||
osbp.setStatus(2);
|
|
||||||
osbp.setPkId(osb.getOrderPreId());
|
|
||||||
orderSwapBatteryPreDao.updateById(osbp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单状态方法
|
|
||||||
*
|
|
||||||
* @param orderStatus
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private OrderSwapBattery alterOrderStatus(OrderStatus orderStatus) {
|
|
||||||
OrderSwapBattery osb = orderSwapBatteryDao
|
|
||||||
.selectOne(new QueryWrapper<OrderSwapBattery>().eq("order_no", orderStatus.getOrderNo()));
|
|
||||||
osb.setStatus(orderStatus.getStatus());
|
|
||||||
if (orderStatus.getStatus() == 2) {
|
|
||||||
osb.setServiceTimeBegin(orderStatus.getStatusTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (orderStatus.getStatus() == 4) {
|
|
||||||
osb.setChargeTimeBegin(orderStatus.getStatusTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
osb.setUptime(new Date());
|
|
||||||
orderSwapBatteryDao.updateById(osb);
|
|
||||||
return osb;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evotech.hd.cloud.mqtt.message.processor.observer.listener;
|
package com.evotech.hd.cloud.mqtt.message.processor.observer.listener;
|
||||||
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.processor.observer.event.BatteryStationStopServerEvent;
|
import com.evotech.hd.cloud.mqtt.message.processor.observer.event.BatteryStationStopServerEvent;
|
||||||
import com.evotech.hd.cloud.service.OrderSwapBatteryService;
|
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
||||||
import com.evotech.hd.cloud.service.newthread.GZHTemplateMessageService;
|
import com.evotech.hd.cloud.service.newthread.GZHTemplateMessageService;
|
||||||
import com.evotech.hd.cloud.service.rpc.ResourceService;
|
import com.evotech.hd.cloud.service.rpc.ResourceService;
|
||||||
import com.evotech.hd.common.core.Dto.ResultUtil;
|
import com.evotech.hd.common.core.Dto.ResultUtil;
|
||||||
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
|||||||
public class BatteryStationStopServerListener {
|
public class BatteryStationStopServerListener {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
OrderSwapBatteryService orderSwapBatteryService;
|
OrderSwapBatteryPreService orderSwapBatteryPre;
|
||||||
@Resource
|
@Resource
|
||||||
private GZHTemplateMessageService templateMessageService;
|
private GZHTemplateMessageService templateMessageService;
|
||||||
@Resource
|
@Resource
|
||||||
@ -45,12 +45,12 @@ public class BatteryStationStopServerListener {
|
|||||||
//监听站端运营状态状态, 如果不为运营状态
|
//监听站端运营状态状态, 如果不为运营状态
|
||||||
if(!Integer.valueOf(1).equals(batteryStation.getStatus())){
|
if(!Integer.valueOf(1).equals(batteryStation.getStatus())){
|
||||||
//不是营运状态, 获取当前站点是否存在预约单
|
//不是营运状态, 获取当前站点是否存在预约单
|
||||||
List<OrderSwapBatteryPre> preList = orderSwapBatteryService.findOrderSwapBatteryPreList(batteryStation.getCode());
|
List<OrderSwapBatteryPre> preList = orderSwapBatteryPre.findOrderSwapBatteryPreList(batteryStation.getCode());
|
||||||
Map<String, String> plateNum = new LinkedHashMap<>();
|
Map<String, String> plateNum = new LinkedHashMap<>();
|
||||||
//查询站点是否存在预约单, 存在的话. 通知客户,
|
//查询站点是否存在预约单, 存在的话. 通知客户,
|
||||||
if(Collections.isNotEmpty(preList)){
|
if(Collections.isNotEmpty(preList)){
|
||||||
//直接关闭预约单
|
//直接关闭预约单
|
||||||
orderSwapBatteryService.clearOrderSwapBatteryPre(preList.stream().map(OrderSwapBatteryPre::getPkId).collect(Collectors.toList()));
|
orderSwapBatteryPre.clearOrderSwapBatteryPre(preList.stream().map(com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre::getPkId).collect(Collectors.toList()));
|
||||||
plateNum = preList.stream().collect(Collectors.toMap(OrderSwapBatteryPre::getUcode, OrderSwapBatteryPre::getPlateNum, (k1, k2) -> k1));
|
plateNum = preList.stream().collect(Collectors.toMap(OrderSwapBatteryPre::getUcode, OrderSwapBatteryPre::getPlateNum, (k1, k2) -> k1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,30 +3,31 @@ package com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.event;
|
|||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.evotech.hd.cloud.entity.order.Order;
|
|
||||||
import com.evotech.hd.cloud.entity.order.OrderDetail;
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.EventFunctionTypesEnum;
|
import com.evotech.hd.cloud.mqtt.enums.EventFunctionTypesEnum;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.confirm.SwapCompleteConfirm;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.confirm.SwapCompleteConfirm;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.event.SwapComplete;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.event.SwapComplete;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatus;
|
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.state.OrderStatusData;
|
||||||
import com.evotech.hd.cloud.service.BatteryStationDcService;
|
import com.evotech.hd.cloud.service.*;
|
||||||
import com.evotech.hd.cloud.service.OrderDetailService;
|
import com.evotech.hd.cloud.service.rpc.WechatService;
|
||||||
import com.evotech.hd.cloud.service.OrderService;
|
import com.evotech.hd.cloud.utils.components.SwapOrderBasicFeeComponent;
|
||||||
|
import com.evotech.hd.common.core.constant.HDConstant;
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
|
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
|
||||||
import com.evotech.hd.common.core.entity.cloud.BatteryTrace;
|
import com.evotech.hd.common.core.entity.cloud.BatteryTrace;
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryStep;
|
|
||||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||||
|
import com.evotech.hd.common.core.entity.order.Order;
|
||||||
|
import com.evotech.hd.common.core.entity.order.OrderDetail;
|
||||||
|
import com.evotech.hd.common.core.enums.SwapBatteryStepEnum;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,6 +47,16 @@ public class MqttEventSwapCompleteExchangeProcessorImpl implements MqttStrategyE
|
|||||||
OrderService orderService;
|
OrderService orderService;
|
||||||
@Resource
|
@Resource
|
||||||
OrderDetailService orderDetailService;
|
OrderDetailService orderDetailService;
|
||||||
|
@Resource
|
||||||
|
private SwapOrderBasicFeeComponent orderBasicFeeComponent;
|
||||||
|
@Resource
|
||||||
|
private OrderSwapBatteryStepService orderSwapBatteryStepService;
|
||||||
|
@Resource
|
||||||
|
private VehicleService vehicleService;
|
||||||
|
@Resource
|
||||||
|
BatteryStationDcService batteryStationDcService;
|
||||||
|
@Resource
|
||||||
|
WechatService wechatService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(String functionName) {
|
public boolean accept(String functionName) {
|
||||||
@ -66,6 +77,7 @@ public class MqttEventSwapCompleteExchangeProcessorImpl implements MqttStrategyE
|
|||||||
swapRecordConfirm.setAckStatus(MqttResponse.PUBLIC_SUCCESS);
|
swapRecordConfirm.setAckStatus(MqttResponse.PUBLIC_SUCCESS);
|
||||||
swapRecordConfirm.setOrderNo(orderStatus.getOrderNo());
|
swapRecordConfirm.setOrderNo(orderStatus.getOrderNo());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
log.error("更新订单信息出现错误: {}", e.getMessage());
|
log.error("更新订单信息出现错误: {}", e.getMessage());
|
||||||
response.setCode(MqttResponse.PUBLIC_ERROR);
|
response.setCode(MqttResponse.PUBLIC_ERROR);
|
||||||
response.setMsg(orderStatus.getOrderNo());
|
response.setMsg(orderStatus.getOrderNo());
|
||||||
@ -84,174 +96,107 @@ public class MqttEventSwapCompleteExchangeProcessorImpl implements MqttStrategyE
|
|||||||
* @param statusData
|
* @param statusData
|
||||||
*/
|
*/
|
||||||
private void handleOrderStatus(SwapComplete orderStatus, OrderStatusData statusData) {
|
private void handleOrderStatus(SwapComplete orderStatus, OrderStatusData statusData) {
|
||||||
// 换电步骤添加最后一条
|
|
||||||
if (orderStatus.getStatus() == 3){
|
|
||||||
Order order = alterOrderStatus(orderStatus, statusData);
|
|
||||||
OrderSwapBatteryStep step = new OrderSwapBatteryStep();
|
|
||||||
step.setOrderNo(orderStatus.getOrderNo());
|
|
||||||
step.setStep(8);
|
|
||||||
step.setStepTime(orderStatus.getStatusTime());
|
|
||||||
step.setCtime(new Date());
|
|
||||||
step.setCreater("SYS");
|
|
||||||
step.setStepName(hdStepDictComponent.hdStepDictName(step.getStep()));
|
|
||||||
orderSwapBatteryStepDao.insert(step);
|
|
||||||
// 修改车上电池编码
|
|
||||||
VehicleInfo vi = new VehicleInfo();
|
|
||||||
vi.setBatCode(statusData.getRentBatCode());
|
|
||||||
vi.setBatSoc(statusData.getRentBatSoc());
|
|
||||||
vehicleInfoDao.update(vi, new QueryWrapper<VehicleInfo>().eq("plate_num", osb.getPlateNum()));
|
|
||||||
// 修改2块电池的信息
|
|
||||||
BatteryStationDc dc1 = new BatteryStationDc();
|
|
||||||
BatteryStationDc dc2 = new BatteryStationDc();
|
|
||||||
dc1.setStatus(1);
|
|
||||||
dc1.setSourceFrom(1);
|
|
||||||
dc1.setPointType(2);
|
|
||||||
dc1.setPointCode(osb.getPlateNum());
|
|
||||||
dc1.setPointName(osb.getPlateNum());
|
|
||||||
dc1.setSoc(statusData.getRentBatSoc());
|
|
||||||
dc1.setDccNo(0);
|
|
||||||
batteryStationDcDao.update(dc1, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getRentBatCode()));
|
|
||||||
dc2.setStatus(2);
|
|
||||||
dc2.setSourceFrom(1);
|
|
||||||
dc2.setPointType(1);
|
|
||||||
dc2.setPointCode(osb.getStationCode());
|
|
||||||
dc2.setPointName(osb.getStationName());
|
|
||||||
dc2.setSoc(statusData.getReturnBatSoc());
|
|
||||||
dc2.setDccNo(statusData.getReturnBatNo());
|
|
||||||
batteryStationDcDao.update(dc2, new QueryWrapper<BatteryStationDc>().eq("bat_code", statusData.getReturnBatCode()));
|
|
||||||
// 添加2块电池的溯源记录
|
|
||||||
addBatteryTrace(orderStatus, statusData, osb);
|
|
||||||
//计算费用方式
|
|
||||||
log.info("\r\n=====>>>订单状态更新处理订单状态开始结算:{},{}",orderStatus.getOrderNo(),orderStatus.getStatus() );
|
|
||||||
//费用结算
|
|
||||||
orderSwapBatteryService.calculateCost1(orderStatus.getOrderNo(), statusData);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 修改订单状态方法
|
|
||||||
*
|
|
||||||
* @param orderStatus
|
|
||||||
* @param statusData
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Order alterOrderStatus(SwapComplete orderStatus, OrderStatusData statusData) {
|
|
||||||
Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, orderStatus.getOrderNo()));
|
Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, orderStatus.getOrderNo()));
|
||||||
if(ObjectUtils.isEmpty(order)){
|
if(ObjectUtils.isEmpty(order)){
|
||||||
throw new RuntimeException("未找到订单信息");
|
throw new RuntimeException("未找到订单信息");
|
||||||
}
|
}
|
||||||
//更新订单状态
|
//更新订单状态
|
||||||
order.setStatus(orderStatus.getStatus());
|
order.setStatus(orderStatus.getStatus());
|
||||||
if (orderStatus.getStatus() == 3 || orderStatus.getStatus() == 5) {
|
orderService.updateById(order);
|
||||||
|
//修改订单状态及金额
|
||||||
|
alterOrderStatus(order, statusData);
|
||||||
|
//记录换电步骤
|
||||||
|
alterSwapBatteryStep(orderStatus, statusData, order);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单状态方法
|
||||||
|
* @param order
|
||||||
|
* @param statusData
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private void alterOrderStatus(Order order, OrderStatusData statusData) {
|
||||||
|
if (order.getStatus() == 3 || order.getStatus() == 5) {
|
||||||
//如果订单是完成. 查询订单详情
|
//如果订单是完成. 查询订单详情
|
||||||
OrderDetail orderDetail = orderDetailService.getOne(new LambdaQueryWrapper<OrderDetail>().eq(OrderDetail::getOrderId, order.getPkId()));
|
OrderDetail orderDetail = orderDetailService.getOne(new LambdaQueryWrapper<OrderDetail>().eq(OrderDetail::getOrderId, order.getPkId()));
|
||||||
|
orderDetail.setFeeType(HDConstant.OrderConstant.FEE_TYPE_SOC);
|
||||||
|
orderDetail.setOrderTimeEnd(new Date());
|
||||||
|
orderDetail.setServiceTimeEnd(new Date());
|
||||||
|
//copy属性
|
||||||
|
BeanUtils.copyProperties(statusData, orderDetail);
|
||||||
// /***
|
orderDetail.setRentBatSoc(Double.valueOf(statusData.getRentBatSoc()));
|
||||||
// * 计费类型, 具体参考 HDConstant.OrderConstant.FEE_TYPE_*
|
orderDetail.setReturnBatSoc(Double.valueOf(statusData.getReturnBatSoc()));
|
||||||
// */
|
switch (orderDetail.getFeeType()){
|
||||||
// private Integer feeType;
|
case HDConstant.OrderConstant.FEE_TYPE_DL:
|
||||||
// /***
|
orderDetail.setElectricityQuantity(statusData.getElectAmount().doubleValue());
|
||||||
// * 订单金额 (此金额是当前订单的金额, 不包含基础服务费, 所以不是订单总额)
|
break;
|
||||||
// */
|
case HDConstant.OrderConstant.FEE_TYPE_ODO:
|
||||||
// private Integer orderFee;
|
// orderDetail.setElectricityQuantity(new BigDecimal(statusData.getSoc()).doubleValue());
|
||||||
// /***
|
break;
|
||||||
// * 服务费
|
case HDConstant.OrderConstant.FEE_TYPE_SOC:
|
||||||
// */
|
default:
|
||||||
// private Integer serviceFee;
|
orderDetail.setElectricityQuantity(new BigDecimal(statusData.getRentBatSoc()).subtract(new BigDecimal(statusData.getReturnBatSoc())).doubleValue());
|
||||||
// /***
|
break;
|
||||||
// * 单价(分)
|
}
|
||||||
// */
|
//计算费用方式
|
||||||
// private Integer unitPrice;
|
log.info("\r\n=====>>>订单状态更新处理订单状态开始结算:{},{}",order.getOrderNo(),order.getStatus() );
|
||||||
// /***
|
//计算费用信息
|
||||||
// * 服务开始时间
|
orderBasicFeeComponent.orderBasicFee(order, orderDetail);
|
||||||
// */
|
//发送换电完成推送
|
||||||
// private Date serviceTimeBegin;
|
wechatService.sendGzhSwapOrderSuccessMessage(order);
|
||||||
// /***
|
orderService.calculateCost(order);
|
||||||
// * 服务结束时间
|
|
||||||
// */
|
|
||||||
// private Date serviceTimeEnd;
|
|
||||||
// /***
|
|
||||||
// * 订单开始时间
|
|
||||||
// */
|
|
||||||
// private Date orderTimeBegin;
|
|
||||||
// /***
|
|
||||||
// * 订单结束时间
|
|
||||||
// */
|
|
||||||
// private Date orderTimeEnd;
|
|
||||||
// /***
|
|
||||||
// * 费用标准详情
|
|
||||||
// */
|
|
||||||
// private String feeStandard;
|
|
||||||
// /***
|
|
||||||
// * 耗电量; 如果是soc结算 则是soc的差值, ODO则是里程
|
|
||||||
// */
|
|
||||||
// private Double electricityQuantity;
|
|
||||||
//
|
|
||||||
// /***
|
|
||||||
// * 开始充电的电量
|
|
||||||
// */
|
|
||||||
// private Double electStart;
|
|
||||||
// /***
|
|
||||||
// * 结束充电的电量
|
|
||||||
// */
|
|
||||||
// private Double electEnd;
|
|
||||||
// /***
|
|
||||||
// * 租借电池包仓位
|
|
||||||
// */
|
|
||||||
// private String rentBatNo;
|
|
||||||
// /***
|
|
||||||
// * 租借电池包编码
|
|
||||||
// */
|
|
||||||
// private String rentBatCode;
|
|
||||||
// /***
|
|
||||||
// * 租借电池包SOC
|
|
||||||
// */
|
|
||||||
// private Double rentBatSOC;
|
|
||||||
// /***
|
|
||||||
// * 归还电池包仓位
|
|
||||||
// */
|
|
||||||
// private String returnBatNo;
|
|
||||||
// /***
|
|
||||||
// * 归还电池包编码
|
|
||||||
// */
|
|
||||||
// private String returnBatCode;
|
|
||||||
// /***
|
|
||||||
// * 归还电池包SOC
|
|
||||||
// */
|
|
||||||
// private Double returnBatSOC;
|
|
||||||
// /***
|
|
||||||
// * 换电模式 HDConstant.OrderConstant.CHANGE_MODE_*
|
|
||||||
// */
|
|
||||||
// private Integer changeMode;
|
|
||||||
// /***
|
|
||||||
// * 换电车道 HDConstant.OrderConstant.CHANGE_LANE_*
|
|
||||||
// */
|
|
||||||
// private Integer changeLane;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
order.setServiceTimeEnd(orderStatus.getStatusTime());
|
|
||||||
BeanUtils.copyProperties(statusData, osb);
|
|
||||||
}
|
}
|
||||||
// order.setUptime(null);
|
|
||||||
orderService.updateById(order);
|
|
||||||
return order;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单费用
|
||||||
|
* @param order
|
||||||
|
* @param statusData
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private void alterSwapBatteryStep(SwapComplete orderStatus, OrderStatusData statusData, Order order) {
|
||||||
|
if (orderStatus.getStatus() == 3 || orderStatus.getStatus() == 5){
|
||||||
|
//生成步骤
|
||||||
|
orderSwapBatteryStepService.addOrderSwapBatteryStepBySwapComplete(orderStatus.getOrderNo(), SwapBatteryStepEnum.COMPLETED.getKey(), orderStatus.getStatusTime());
|
||||||
|
// 修改车上电池编码
|
||||||
|
vehicleService.update(new UpdateWrapper<VehicleInfo>()
|
||||||
|
.set("bat_code", statusData.getRentBatCode())
|
||||||
|
.set("bat_soc", statusData.getRentBatSoc())
|
||||||
|
.eq("plate_num", order.getPlateNum()));
|
||||||
|
//出租电池信息维护
|
||||||
|
batteryStationDcService.update(new UpdateWrapper<BatteryStationDc>()
|
||||||
|
.set("status", HDConstant.DcConstant.STATUS_CZ)
|
||||||
|
.set("source_from", HDConstant.DcConstant.SOURCE_FROM_STATION)
|
||||||
|
.set("point_type", HDConstant.DcConstant.POINT_TYPE_CAR)
|
||||||
|
.set("point_code", order.getPlateNum())
|
||||||
|
.set("point_name", order.getPlateNum())
|
||||||
|
.set("dcc_no", 0)
|
||||||
|
.eq("bat_code", statusData.getRentBatCode()));
|
||||||
|
//归还电池信息维护
|
||||||
|
batteryStationDcService.update(new UpdateWrapper<BatteryStationDc>()
|
||||||
|
.set("status", HDConstant.DcConstant.STATUS_CD)
|
||||||
|
.set("source_from", HDConstant.DcConstant.SOURCE_FROM_CAR)
|
||||||
|
.set("point_type", HDConstant.DcConstant.POINT_TYPE_STATION)
|
||||||
|
.set("point_code", order.getPlateNum())
|
||||||
|
.set("point_name", order.getPlateNum())
|
||||||
|
.set("soc", statusData.getReturnBatSoc())
|
||||||
|
.set("dcc_no", statusData.getReturnBatNo())
|
||||||
|
.eq("bat_code", statusData.getReturnBatCode()));
|
||||||
|
// 添加2块电池的溯源记录
|
||||||
|
addBatteryTrace(orderStatus, statusData, order);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加电池轨迹记录
|
* 添加电池轨迹记录
|
||||||
*
|
*
|
||||||
@ -259,7 +204,7 @@ public class MqttEventSwapCompleteExchangeProcessorImpl implements MqttStrategyE
|
|||||||
* @param statusData
|
* @param statusData
|
||||||
* @param osb
|
* @param osb
|
||||||
*/
|
*/
|
||||||
private void addBatteryTrace(SwapComplete orderStatus, OrderStatusData statusData, OrderSwapBattery osb) {
|
private void addBatteryTrace(SwapComplete orderStatus, OrderStatusData statusData, Order osb) {
|
||||||
BatteryTrace bt1 = new BatteryTrace();
|
BatteryTrace bt1 = new BatteryTrace();
|
||||||
bt1.setOrderNo(orderStatus.getOrderNo());
|
bt1.setOrderNo(orderStatus.getOrderNo());
|
||||||
bt1.setBatCode(statusData.getRentBatCode());
|
bt1.setBatCode(statusData.getRentBatCode());
|
||||||
|
|||||||
@ -61,6 +61,8 @@ public class MqttRequestBatteryInfoExchangeProcessorImpl implements MqttStrategy
|
|||||||
}else {
|
}else {
|
||||||
response.setMsg("未查询到电池信息");
|
response.setMsg("未查询到电池信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("\r\n站端请求电池数据: MqttRequestBatteryInfoExchangeProcessorImpl =====>>>message:{}", response.getMsg());
|
||||||
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_BATTERYINFO, response);
|
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_BATTERYINFO, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,79 @@
|
|||||||
|
package com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.request;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
||||||
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
|
||||||
|
import com.evotech.hd.cloud.service.OrderDetailService;
|
||||||
|
import com.evotech.hd.cloud.service.OrderService;
|
||||||
|
import com.evotech.hd.cloud.service.rpc.WechatService;
|
||||||
|
import com.evotech.hd.common.core.entity.cloud.request.BatterySwapResponse;
|
||||||
|
import com.evotech.hd.common.core.entity.order.Order;
|
||||||
|
import com.evotech.hd.common.core.entity.order.OrderDetail;
|
||||||
|
import com.evotech.hd.common.core.utils.Collections;
|
||||||
|
import com.evotech.hd.common.redis.utils.RedisServiceUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站端回复开始换电通知信息类
|
||||||
|
*
|
||||||
|
* @ClassName:MqttRequestBatterySwapExchangeProcessorImpl
|
||||||
|
* @date: 2025年06月20日 11:29
|
||||||
|
* @author: andy.shi
|
||||||
|
* @contact: 17330188597
|
||||||
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class MqttRequestBatterySwapExchangeProcessorImpl implements MqttStrategyRequestExchangeProcessor{
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
OrderService orderService;
|
||||||
|
@Resource
|
||||||
|
OrderDetailService orderDetailService;
|
||||||
|
@Resource
|
||||||
|
WechatService wechatService;
|
||||||
|
@Override
|
||||||
|
public boolean accept(String functionName) {
|
||||||
|
return RequestFunctionTypesEnum.FUN_STARTSWAP.getReFunction().equals(functionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exchange(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
||||||
|
BatterySwapResponse battery = JSONUtil.toBean(dataBody, BatterySwapResponse.class);
|
||||||
|
String orderNo = battery.getOrderNo();
|
||||||
|
if (orderNo == null || orderNo.isEmpty()) {
|
||||||
|
log.error("电池订单编码无效: battery={}", battery);
|
||||||
|
throw new IllegalArgumentException("电池订单orderNo无效");
|
||||||
|
}
|
||||||
|
// 定义 Redis 过期时间(5分钟)
|
||||||
|
final int REDIS_EXPIRE_TIME_IN_SECONDS = 60 * 5; // 5分钟
|
||||||
|
// Redis 键值
|
||||||
|
String redisKey = "battery:" + orderNo;
|
||||||
|
// 将响应存到 Redis 里
|
||||||
|
RedisServiceUtils.set(redisKey, battery, REDIS_EXPIRE_TIME_IN_SECONDS);
|
||||||
|
// 记录成功日志
|
||||||
|
log.info("换电响应已成功存储到 Redis: key={}", redisKey);
|
||||||
|
//解开线程
|
||||||
|
//TODO 待验证
|
||||||
|
Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, orderNo));
|
||||||
|
//如果是成功, 创建订单详情
|
||||||
|
if(MqttResponse.PUBLIC_SUCCESS.equals(battery.getCode())){
|
||||||
|
OrderDetail detail = new OrderDetail();
|
||||||
|
detail.setOrderId(order.getPkId());
|
||||||
|
detail.setServiceTimeBegin(new Date());
|
||||||
|
detail.setOrderTimeBegin(new Date());
|
||||||
|
orderDetailService.save(detail);
|
||||||
|
}else{
|
||||||
|
wechatService.sendClientMessage(order.getPreWechatId(), JSON.toJSONString(Collections.asMap("code",0, "msg", battery.getMsg())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -43,6 +43,8 @@ public class MqttRequestCancelOrderExchangeProcessorImpl implements MqttStrategy
|
|||||||
}else{
|
}else{
|
||||||
response = new MqttResponse().error(JSONUtil.toJsonStr(Collections.asMap("orderNo", orderNo)),updateResult.getMsg());
|
response = new MqttResponse().error(JSONUtil.toJsonStr(Collections.asMap("orderNo", orderNo)),updateResult.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("\r\n取消订单请求类: MqttRequestCancelOrderExchangeProcessorImpl =====>>>message:{}", response.getMsg());
|
||||||
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_CANCELORDER, response);
|
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_CANCELORDER, response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,6 +57,8 @@ public class MqttRequestCarInfoExchangeProcessorImpl implements MqttStrategyRequ
|
|||||||
response.setMsg("未查询到车辆信息");
|
response.setMsg("未查询到车辆信息");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("\r\n站端请求车辆信息: MqttRequestCarInfoExchangeProcessorImpl =====>>>message:{}", response.getMsg());
|
||||||
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_CARINFO, response);
|
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_CARINFO, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
|||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
|
||||||
import com.evotech.hd.cloud.mqtt.message.processor.strategy.MqttStrategyExchangeProcessor;
|
|
||||||
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
||||||
import com.evotech.hd.cloud.service.WechatUserService;
|
import com.evotech.hd.cloud.service.WechatUserService;
|
||||||
import com.evotech.hd.common.core.Dto.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
@ -66,6 +65,8 @@ public class MqttRequestPreOrderExchangeProcessorImpl implements MqttStrategyReq
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("\r\n站端请求创建预约单类: MqttRequestPreOrderExchangeProcessorImpl =====>>>message:{}", response.getMsg());
|
||||||
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_PREORDER, response);
|
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_PREORDER, response);
|
||||||
|
|
||||||
// 发送
|
// 发送
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
|||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.MqttResponse;
|
||||||
import com.evotech.hd.cloud.mqtt.message.processor.strategy.MqttStrategyExchangeProcessor;
|
|
||||||
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
||||||
import com.evotech.hd.cloud.service.VehicleService;
|
import com.evotech.hd.cloud.service.VehicleService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@ -66,6 +65,8 @@ public class MqttRequestPushCarInfoExchangeProcessorImpl implements MqttStrategy
|
|||||||
}else{
|
}else{
|
||||||
response = new MqttResponse().error("参数不全, 没有车牌号信息");
|
response = new MqttResponse().error("参数不全, 没有车牌号信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("\r\n接收站端推送的车牌照, 创建车辆信息和预约单: MqttRequestPushCarInfoExchangeProcessorImpl =====>>>message:{}", response.getMsg());
|
||||||
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_PUSH_CAR_INFO, response);
|
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_PUSH_CAR_INFO, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.evotech.hd.cloud.entity.order.Order;
|
|
||||||
import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
import com.evotech.hd.cloud.mqtt.enums.RequestFunctionTypesEnum;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||||
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
import com.evotech.hd.cloud.mqtt.message.MqttMessageHeader;
|
||||||
@ -14,10 +13,13 @@ import com.evotech.hd.cloud.mqtt.message.dto.newer.req.order.OrderByPlateNumReq;
|
|||||||
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.order.OrderData;
|
import com.evotech.hd.cloud.mqtt.message.dto.newer.req.order.OrderData;
|
||||||
import com.evotech.hd.cloud.service.OrderService;
|
import com.evotech.hd.cloud.service.OrderService;
|
||||||
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
||||||
|
import com.evotech.hd.cloud.service.OrderSwapBatteryStepService;
|
||||||
import com.evotech.hd.common.core.Dto.Result;
|
import com.evotech.hd.common.core.Dto.Result;
|
||||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
||||||
|
import com.evotech.hd.common.core.entity.order.Order;
|
||||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||||
import com.evotech.hd.common.core.enums.OrderStatusEnums;
|
import com.evotech.hd.common.core.enums.OrderStatusEnums;
|
||||||
|
import com.evotech.hd.common.core.enums.SwapBatteryStepEnum;
|
||||||
import com.evotech.hd.common.redis.utils.RedisServiceUtils;
|
import com.evotech.hd.common.redis.utils.RedisServiceUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -44,7 +46,8 @@ public class MqttRequestQueryOrderExchangeProcessorImpl implements MqttStrategyR
|
|||||||
OrderService orderService;
|
OrderService orderService;
|
||||||
@Resource
|
@Resource
|
||||||
OrderSwapBatteryPreService OrderSwapBatteryPreService;
|
OrderSwapBatteryPreService OrderSwapBatteryPreService;
|
||||||
|
@Resource
|
||||||
|
private OrderSwapBatteryStepService orderSwapBatteryStepService;
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(String functionName) {
|
public boolean accept(String functionName) {
|
||||||
return RequestFunctionTypesEnum.FUN_ORDERBYPLATENUM.getFunction().equals(functionName);
|
return RequestFunctionTypesEnum.FUN_ORDERBYPLATENUM.getFunction().equals(functionName);
|
||||||
@ -70,7 +73,9 @@ public class MqttRequestQueryOrderExchangeProcessorImpl implements MqttStrategyR
|
|||||||
.eq(Order::getStationCode, orderSwapBatteryPre.getStationCode())
|
.eq(Order::getStationCode, orderSwapBatteryPre.getStationCode())
|
||||||
.eq(Order::getOrderPreId, orderSwapBatteryPre.getPkId())
|
.eq(Order::getOrderPreId, orderSwapBatteryPre.getPkId())
|
||||||
.eq(Order::getStatus, OrderStatusEnums.CREATE.getCode()));
|
.eq(Order::getStatus, OrderStatusEnums.CREATE.getCode()));
|
||||||
if (order == null) {
|
if (ObjectUtils.isNotEmpty(order)) {
|
||||||
|
response.setCode(MqttResponse.PUBLIC_SUCCESS);
|
||||||
|
}else{
|
||||||
Result<Order> result = orderService.addOrderByPre(orderSwapBatteryPre);
|
Result<Order> result = orderService.addOrderByPre(orderSwapBatteryPre);
|
||||||
//如果不等于成功
|
//如果不等于成功
|
||||||
if(!CodeMsg.SUCCESS.getCode().equals(result.getCode())){
|
if(!CodeMsg.SUCCESS.getCode().equals(result.getCode())){
|
||||||
@ -80,15 +85,20 @@ public class MqttRequestQueryOrderExchangeProcessorImpl implements MqttStrategyR
|
|||||||
response.setCode(MqttResponse.PUBLIC_SUCCESS);
|
response.setCode(MqttResponse.PUBLIC_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(MqttResponse.PUBLIC_SUCCESS.equals(response.getCode())){
|
||||||
//走到此处, 证明上面逻辑没有问题, 需要删除预约单过期标识
|
//走到此处, 证明上面逻辑没有问题, 需要删除预约单过期标识
|
||||||
RedisServiceUtils.del("preorder:expire:"+orderSwapBatteryPre.getPkId());
|
RedisServiceUtils.del("preorder:expire:"+orderSwapBatteryPre.getPkId());
|
||||||
|
//更新预约单为到店使用
|
||||||
|
orderSwapBatteryPre.setStatus(2);
|
||||||
|
OrderSwapBatteryPreService.updateById(orderSwapBatteryPre);
|
||||||
|
orderSwapBatteryStepService.addOrderSwapBatteryStepBySwapComplete(order.getOrderNo(), SwapBatteryStepEnum.VEHICLES_ENTER_STATION.getKey(), new Date());
|
||||||
|
}
|
||||||
// 返回数据
|
// 返回数据
|
||||||
OrderData od = new OrderData();
|
OrderData od = new OrderData();
|
||||||
BeanUtils.copyProperties(order, od);
|
BeanUtils.copyProperties(order, od);
|
||||||
response.setData(od);
|
response.setData(od);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
logger.info("\r\n站端根据车牌号查询订单: MqttRequestQueryOrderExchangeProcessorImpl=====>>>message:{}", response.getMsg());
|
||||||
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_ORDERBYPLATENUM, response);
|
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_ORDERBYPLATENUM, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,8 @@ public class MqttRequestStrategyExchangeProcessorImpl implements MqttStrategyReq
|
|||||||
log.info("MqttRequestStrategyExchangeProcessorImpl-->>>>> 查询到的策略信息{}", JSONUtil.toJsonStr(list));
|
log.info("MqttRequestStrategyExchangeProcessorImpl-->>>>> 查询到的策略信息{}", JSONUtil.toJsonStr(list));
|
||||||
response = new MqttResponse<List<BatteryStationCdStrategy>>().success(list);
|
response = new MqttResponse<List<BatteryStationCdStrategy>>().success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("\r\nMqtt查询充电策略: MqttRequestStrategyExchangeProcessorImpl=====>>>message:{}", response.getMsg());
|
||||||
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_STRATEGY_INFO, response);
|
sendAESMessage(topic, header, RequestFunctionTypesEnum.FUN_STRATEGY_INFO, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user