Compare commits
No commits in common. "935416974199b29fb443c0d350ce95969fc5e82a" and "0eb4df7cf97e8bf59177f4fa05e16a1fa9417472" have entirely different histories.
9354169741
...
0eb4df7cf9
@ -48,8 +48,8 @@ public class LoginController {
|
||||
|
||||
@Operation(summary = "检验token")
|
||||
@PostMapping("/checktoken")
|
||||
public Result<Boolean> checkToken() {
|
||||
return loginService.checkToken();
|
||||
public Result<Boolean> checkToken(String token) throws AuthenticationException {
|
||||
return loginService.checkToken(token);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -13,5 +13,5 @@ public interface LoginService {
|
||||
|
||||
public Result<String> logout(HttpServletRequest request);
|
||||
|
||||
public Result<Boolean> checkToken();
|
||||
public Result<Boolean> checkToken(String token) throws AuthenticationException;
|
||||
}
|
||||
|
||||
@ -190,7 +190,10 @@ public class LoginServiceImpl implements LoginService {
|
||||
|
||||
|
||||
@Override
|
||||
public Result<Boolean> checkToken() {
|
||||
public Result<Boolean> checkToken(String token) throws AuthenticationException {
|
||||
// TODO 发送到自带的token验证接口 验证
|
||||
|
||||
|
||||
return new Result<Boolean>().success(true);
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ public class Oauth2AccessTokenUtil {
|
||||
tokenRes.setTokenType(jo1.getStr("token_type"));
|
||||
return tokenRes;
|
||||
} else {
|
||||
throw new RuntimeException("生成登陆令牌异常!");
|
||||
throw new RuntimeException("生成token出错");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -71,13 +71,6 @@ public class BatteryStation implements Serializable {
|
||||
|
||||
@Schema(description = "联系电话")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "服务车辆类型")
|
||||
private String carTypeCode;
|
||||
|
||||
@Schema(description = "是否适合该车辆")
|
||||
@TableField(exist = false)
|
||||
private Boolean isSuitable;
|
||||
|
||||
@Schema(description = "删除标识:1-已删除,0-未删除")
|
||||
private Integer delFlag;
|
||||
|
||||
@ -51,18 +51,17 @@ public class BatteryStationDc implements Serializable {
|
||||
@NotNull(message = "初始来源不能为空")
|
||||
private Integer sourceFrom;
|
||||
|
||||
@Schema(description = "站码或车牌照", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotBlank
|
||||
@Schema(description = "站码或车牌照")
|
||||
private String sourceCode;
|
||||
|
||||
@Schema(description = "状态:1-出租中,2-充电中,3-空闲,4-故障,5-其它", requiredMode = RequiredMode.REQUIRED)
|
||||
@Schema(description = "状态:1-出租中,2-充电中,3-充电完毕,4-故障,5-其它", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "换电站编码")
|
||||
private String stationCode;
|
||||
|
||||
@Schema(description = "换电站名称")
|
||||
@Schema(description = "换电站编码")
|
||||
private String stationName;
|
||||
|
||||
@Schema(description = "当前电量")
|
||||
|
||||
@ -54,15 +54,6 @@ public class BatteryStationHdFeeStandard implements Serializable {
|
||||
@Schema(description = "结束日期", requiredMode = RequiredMode.REQUIRED, example = DatePattern.PURE_DATE_PATTERN)
|
||||
@NotBlank(message = "结束时间不能为空")
|
||||
private String dayEnd;
|
||||
|
||||
@Schema(description = "每公里收费")
|
||||
private BigDecimal eachKmFee;
|
||||
|
||||
@Schema(description = "每SOC收费")
|
||||
private BigDecimal eachSocFee;
|
||||
|
||||
@Schema(description = "每度电收费")
|
||||
private BigDecimal eachKwhFee;
|
||||
|
||||
@Schema(description = "正常换电服务费")
|
||||
private BigDecimal commonRemainFee;
|
||||
|
||||
@ -81,7 +81,7 @@ public class OrderSwapBattery implements Serializable {
|
||||
private Integer feeType;
|
||||
|
||||
@Schema(description = "基础费用")
|
||||
private BigDecimal basicFee;
|
||||
private Integer basicFee;
|
||||
|
||||
@Schema(description = "服务开始时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ -94,7 +94,7 @@ public class OrderSwapBattery implements Serializable {
|
||||
private Date serviceTimeEnd;
|
||||
|
||||
@Schema(description = "服务费")
|
||||
private BigDecimal serviceFee;
|
||||
private Integer serviceFee;
|
||||
|
||||
@Schema(description = "上次租赁电池时车辆里程")
|
||||
private BigDecimal lastRentBatCarOdo;
|
||||
|
||||
@ -64,7 +64,6 @@ public class OrderSwapBatteryPre implements Serializable {
|
||||
private Date reservationTime;
|
||||
|
||||
@Schema(description = "预约换电日期", example = "yyyyMMdd", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotBlank
|
||||
private String swapDay;
|
||||
|
||||
@Schema(description = "预约换电时间段", example = "8:00-10:00")
|
||||
|
||||
@ -48,9 +48,6 @@ public class PageListSwapOrderRequest extends BasePageRequest {
|
||||
|
||||
@Schema(description = "交易编码")
|
||||
private String tradeNo;
|
||||
|
||||
@Schema(description = "订单状态:1-已创建,2-换电中,3-换电完成,4-充电中,5-充电完成,6-待结算,7-已完成,9-已取消")
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,62 +0,0 @@
|
||||
package com.evotech.hd.common.core.entity.cloud.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(name = "小程序查询换电站返回结果")
|
||||
public class BatteryStationVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4629351941147810984L;
|
||||
|
||||
@Schema(description = "站点名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "站点编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "状态:1-正常营业,2-正常停运,3-故障停运,4-指令停运,9-其它")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "站点类型ID")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "地址-省")
|
||||
private String addressProvince;
|
||||
|
||||
@Schema(description = "地址-市")
|
||||
private String addressCity;
|
||||
|
||||
@Schema(description = "地址-区县")
|
||||
private String addressArea;
|
||||
|
||||
@Schema(description = "注册日期")
|
||||
private String registerDate;
|
||||
|
||||
@Schema(description = "联系人")
|
||||
private String contacts;
|
||||
|
||||
@Schema(description = "联系电话")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "服务车辆类型")
|
||||
private String carTypeCode;
|
||||
|
||||
@Schema(description = "是否适合该车辆")
|
||||
private Boolean isSuitable;
|
||||
|
||||
@Schema(description = "激活日期")
|
||||
private String activeDate;
|
||||
|
||||
@Schema(description = "经纬度信息")
|
||||
private String locationPoint;
|
||||
|
||||
@Schema(description = "全天营业:1-是,0-否")
|
||||
private Integer openAllDay;
|
||||
|
||||
}
|
||||
@ -45,8 +45,7 @@ public class WechatAgreement implements Serializable {
|
||||
@NotBlank
|
||||
private String content;
|
||||
|
||||
@Schema(description = "版本", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotBlank
|
||||
@Schema(description = "版本")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "状态:1-可用,0-不可用")
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
package com.evotech.hd.common.mybatis.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 添加分页插件
|
||||
*/
|
||||
@Bean
|
||||
MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 如果配置多个插件, 切记分页最后添加
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,7 @@
|
||||
package com.evotech.hd.common.web.exception;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
@ -35,7 +32,7 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(value = NullPointerException.class)
|
||||
public Result<String> exceptionHandler(HttpServletRequest req, NullPointerException e) {
|
||||
log.error("\r\n===>>>空指针异常:", e);
|
||||
log.error("空指针异常:", e);
|
||||
return new Result<String>().bussinessException(CodeMsg.ERROR.getCode(), e.getMessage(), null);
|
||||
}
|
||||
|
||||
@ -45,7 +42,7 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(value = HttpMessageNotReadableException.class)
|
||||
public Result<String> exceptionHandler(HttpServletRequest req, HttpMessageNotReadableException e) {
|
||||
log.error("\r\n===>>>http请求参数解析异常:", e);
|
||||
log.error("http请求参数解析异常:", e);
|
||||
return new Result<String>().bussinessException(CodeMsg.PARAM_ERROR.getCode(), "http请求参数解析异常", e.getMessage());
|
||||
}
|
||||
|
||||
@ -56,7 +53,7 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(value = MyArgumentException.class)
|
||||
public Result<String> exceptionHandler(HttpServletRequest req, MyArgumentException e) {
|
||||
log.error("\r\n===>>>请求参数异常:", e);
|
||||
log.error("请求参数异常:", e);
|
||||
return new Result<String>().bussinessException(CodeMsg.PARAM_ERROR.getCode(), CodeMsg.PARAM_ERROR.getMsg(), e.getParamArr());
|
||||
}
|
||||
|
||||
@ -69,28 +66,18 @@ public class GlobalExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler(value = DataIntegrityViolationException.class)
|
||||
public Result<String> exceptionHandler(HttpServletRequest req, DataIntegrityViolationException e) {
|
||||
log.error("\r\n===>>>sql语句异常:", e);
|
||||
log.error("sql语句异常:", e);
|
||||
return new Result<String>().bussinessException(CodeMsg.SQL_RUN_ERROR.getCode(), e.getCause().toString(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Valid抛出的参数异常
|
||||
*/
|
||||
@ExceptionHandler(value = MethodArgumentNotValidException.class)
|
||||
public Result<String> exceptionHandler(HttpServletRequest req, MethodArgumentNotValidException e) {
|
||||
log.error("\r\n===>>>传参 自动检测出 错误:", e);
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 自己抛出的运行异常
|
||||
* @param req
|
||||
* @param e
|
||||
*/
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
public Result<String> exceptionHandler(HttpServletRequest req, Exception e) {
|
||||
log.error("\r\n===>>>捕获运行异常:", e);
|
||||
public Result<String> exceptionHandler(HttpServletRequest req, RuntimeException e) {
|
||||
log.error("捕获运行异常:", e);
|
||||
return new Result<String>().bussinessException(CodeMsg.ERROR.getCode(), e instanceof RuntimeException?e.getMessage():e.toString(), null);
|
||||
}
|
||||
|
||||
|
||||
@ -14,11 +14,9 @@ import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
||||
import com.evotech.hd.cloud.service.BatteryStationService;
|
||||
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.vo.BatteryStationVO;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -62,13 +60,6 @@ public class BatteryStationController {
|
||||
return batteryStationService.list(plbsr);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询2")
|
||||
@GetMapping("/liststation")
|
||||
@Hidden
|
||||
public Result<List<BatteryStationVO>> listStation(@RequestParam(required = false) String plateNum) {
|
||||
return batteryStationService.listStation(plateNum);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "站点秘钥")
|
||||
@PostMapping("/rsa_secret_key")
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.evotech.hd.cloud.controller.customer;
|
||||
package com.evotech.hd.cloud.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -21,7 +21,7 @@ import jakarta.annotation.Resource;
|
||||
@Tag(name = "微信用户")
|
||||
@RestController
|
||||
@RequestMapping("/wechat/user")
|
||||
@ApiSupport(order = 32)
|
||||
@ApiSupport(order = 11)
|
||||
public class WechatUserController {
|
||||
|
||||
@Resource
|
||||
@ -26,7 +26,7 @@ import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
@Tag(name = "车辆管理")
|
||||
@ApiSupport(order = 31)
|
||||
@ApiSupport(order = 21)
|
||||
@RestController
|
||||
@RequestMapping("/vehicle")
|
||||
public class VehicleController {
|
||||
@ -64,16 +64,9 @@ public class VehicleController {
|
||||
return vehicleService.list(plvr);
|
||||
}
|
||||
|
||||
@Operation(summary = "公司关联")
|
||||
@PostMapping("/company/relation")
|
||||
@ApiOperationSupport(order = 5)
|
||||
public Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
||||
return vehicleService.companyRelation(plateNum, ccode, cname);
|
||||
}
|
||||
|
||||
@Operation(summary = "微信用户关联")
|
||||
@PostMapping("/wechatuser/relation/add")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@ApiOperationSupport(order = 5)
|
||||
public Result<Integer> addWechatUserRelation(@Valid @ParameterObject VehicleWechatUserRelation relation) {
|
||||
return vehicleService.addWechatUserRelation(relation);
|
||||
}
|
||||
@ -81,7 +74,7 @@ public class VehicleController {
|
||||
|
||||
@Operation(summary = "删除微信用户关联")
|
||||
@PostMapping("/wechatuser/relation/del")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@ApiOperationSupport(order = 6)
|
||||
public Result<Integer> deleteWechatUserRelation(Integer id) {
|
||||
return vehicleService.deleteWechatUserRelation(id);
|
||||
}
|
||||
@ -89,12 +82,9 @@ public class VehicleController {
|
||||
|
||||
@Operation(summary = "查询微信用户车辆")
|
||||
@GetMapping("/wechatuser/relation/list")
|
||||
@ApiOperationSupport(order = 8)
|
||||
public Result<List<VehicleInfo>> listWechatUserRelation(@NotBlank @RequestParam String wuid) {
|
||||
return vehicleService.listWechatUserRelation(wuid, null);
|
||||
@ApiOperationSupport(order = 7)
|
||||
public Result<List<VehicleInfo>> listWechatUserRelation(@NotBlank @RequestParam String openid) {
|
||||
return vehicleService.listWechatUserRelation(openid, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ 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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.evotech.hd.cloud.service.OrderSwapBatteryService;
|
||||
@ -92,12 +91,5 @@ public class OrderSwapBatteryController {
|
||||
public Result<List<OrderSwapBatteryStep>> listStep(@NotBlank String orderNo) {
|
||||
return orderSwapBatteryService.listStep(orderNo);
|
||||
}
|
||||
|
||||
@Operation(summary = "费用计算")
|
||||
@PostMapping({"/cost"})
|
||||
@ApiOperationSupport(order = 9)
|
||||
public Result<String> calculateCost(@NotBlank @RequestParam String orderNo) {
|
||||
return orderSwapBatteryService.calculateCost(orderNo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,8 +2,6 @@ package com.evotech.hd.cloud.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandard;
|
||||
|
||||
@ -13,6 +11,6 @@ import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandard;
|
||||
*/
|
||||
public interface BatteryStationHdFeeStandardDao extends BaseMapper<BatteryStationHdFeeStandard> {
|
||||
|
||||
List<BatteryStationHdFeeStandard> listFeeStandard(@Param("stationCode") String stationCode, @Param("day") String day);
|
||||
List<BatteryStationHdFeeStandard> listFeeStandard(String stationCode);
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.evotech.hd.cloud.mqtt.message.handle;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -13,7 +12,6 @@ import org.springframework.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationDcDao;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationHdFeeStandardDao;
|
||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryDao;
|
||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryPreDao;
|
||||
import com.evotech.hd.cloud.dao.VehicleWechatUserRelationDao;
|
||||
@ -31,11 +29,10 @@ import com.evotech.hd.cloud.mqtt.message.dto.newer.req.order.OrderData;
|
||||
import com.evotech.hd.cloud.service.OrderSwapBatteryService;
|
||||
import com.evotech.hd.cloud.utils.CommonUtil;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationDc;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandard;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStationHdFeeStandardDetail;
|
||||
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.VehicleWechatUserRelation;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
@ -60,8 +57,6 @@ public class RequestMessageService {
|
||||
private OrderSwapBatteryPreDao orderSwapBatteryPreDao;
|
||||
@Resource
|
||||
private OrderSwapBatteryService orderSwapBatteryService;
|
||||
@Resource
|
||||
private BatteryStationHdFeeStandardDao batteryStationHdFeeStandardDao;
|
||||
|
||||
@Async("taskExecutor")
|
||||
public void request(MessageTopic topic, MqttMessageHeader header, JSONObject dataBody) {
|
||||
@ -107,7 +102,6 @@ public class RequestMessageService {
|
||||
OrderSwapBatteryPre osbp = orderSwapBatteryPreDao.selectOne(new QueryWrapper<OrderSwapBatteryPre>()
|
||||
.eq("plate_num", orderByPlateNumReq.getPlateNum())
|
||||
.eq("station_code", orderByPlateNumReq.getStationCode())
|
||||
.eq("status", 1)
|
||||
.last("limit 1"));
|
||||
if (osbp == null) {
|
||||
response.setOrderRequestId(orderByPlateNumReq.getOrderRequestId());
|
||||
@ -133,28 +127,6 @@ public class RequestMessageService {
|
||||
osb.setStatus(1);
|
||||
osb.setStationCode(osbp.getStationCode());
|
||||
osb.setStationName(osbp.getStationName());
|
||||
// 加上费用标准
|
||||
List<BatteryStationHdFeeStandard> list = batteryStationHdFeeStandardDao.listFeeStandard(osbp.getStationCode(), DateUtil.format(d, DatePattern.PURE_DATE_FORMATTER));
|
||||
if (!list.isEmpty()) {
|
||||
BatteryStationHdFeeStandard standard = list.get(0);
|
||||
List<BatteryStationHdFeeStandardDetail> detailList = standard.getDetailList();
|
||||
if (!detailList.isEmpty()) {
|
||||
detailList = detailList.stream().filter(i -> i.getTimeBegin().compareTo(LocalTime.now()) <= 0)
|
||||
.filter(i -> i.getTimeEnd().compareTo(LocalTime.now()) >= 0).toList();
|
||||
if (!detailList.isEmpty()) {
|
||||
BatteryStationHdFeeStandardDetail detail = detailList.get(0);
|
||||
osb.setBasicFee(detail.getEachKwhFee());
|
||||
osb.setServiceFee(detail.getTimeServiceFee());
|
||||
} else {
|
||||
osb.setBasicFee(standard.getEachKwhFee());
|
||||
osb.setServiceFee(standard.getCommonRemainFee());
|
||||
}
|
||||
} else {
|
||||
osb.setBasicFee(standard.getEachKwhFee());
|
||||
osb.setServiceFee(standard.getCommonRemainFee());
|
||||
}
|
||||
}
|
||||
|
||||
orderSwapBatteryService.add(osb);
|
||||
}
|
||||
// 返回数据
|
||||
|
||||
@ -119,7 +119,6 @@ public class StateMessageService {
|
||||
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);
|
||||
|
||||
@ -6,7 +6,6 @@ import java.util.Map;
|
||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
||||
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.vo.BatteryStationVO;
|
||||
|
||||
public interface BatteryStationService {
|
||||
|
||||
@ -18,8 +17,6 @@ public interface BatteryStationService {
|
||||
|
||||
public Result<List<BatteryStation>> list(PageListBatteryStationRequest plbsr);
|
||||
|
||||
public Result<List<BatteryStationVO>> listStation(String plateNum);
|
||||
|
||||
public Result<Map<String, String>> RsaSecretKey(String stationCode);
|
||||
|
||||
}
|
||||
|
||||
@ -25,7 +25,5 @@ public interface OrderSwapBatteryService {
|
||||
public Result<List<OrderSwapBattery>> list(PageListSwapOrderRequest plsor);
|
||||
|
||||
public Result<List<OrderSwapBatteryStep>> listStep(String orderNo);
|
||||
|
||||
public Result<String> calculateCost(String orderNo);
|
||||
|
||||
}
|
||||
|
||||
@ -17,8 +17,6 @@ public interface VehicleService {
|
||||
|
||||
public Result<List<VehicleInfo>> list(PageListVehicleRequest plvr);
|
||||
|
||||
public Result<Integer> companyRelation(String plateNum, String ccode, String cname);
|
||||
|
||||
public Result<Integer> addWechatUserRelation(VehicleWechatUserRelation relation);
|
||||
|
||||
public Result<Integer> deleteWechatUserRelation(Integer id);
|
||||
|
||||
@ -40,7 +40,7 @@ public class BatteryStationDcServiceImpl implements BatteryStationDcService {
|
||||
bt.setCreater("SYS");
|
||||
bt.setPointType(bsdc.getSourceFrom());
|
||||
bt.setPointCode(bt.getPointType() == 1? bsdc.getStationCode():bsdc.getSourceCode());
|
||||
bt.setPointName(bt.getPointType() == 1? bsdc.getStationName():bsdc.getSourceCode());
|
||||
bt.setPointName(bt.getPointType() == 1? bsdc.getStationName():"");
|
||||
addTrace(bt);
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
|
||||
@ -22,14 +22,6 @@ public class BatteryStationHdFeeStandardDetailServiceImpl implements BatteryStat
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(BatteryStationHdFeeStandardDetail bsfsd) {
|
||||
boolean b = batteryStationHdFeeStandardDetailDao.exists(new QueryWrapper<BatteryStationHdFeeStandardDetail>()
|
||||
.or(i -> i.and(j -> j.le("time_begin", bsfsd.getTimeBegin()).ge("time_end", bsfsd.getTimeBegin()))
|
||||
.or(j -> j.le("time_begin", bsfsd.getTimeEnd()).ge("time_end", bsfsd.getTimeEnd()))
|
||||
.or(j -> j.ge("day_begin", bsfsd.getTimeBegin()).le("day_end", bsfsd.getTimeEnd())))
|
||||
.eq("standard_id", bsfsd.getStandardId()));
|
||||
if (b) {
|
||||
return new Result<Integer>().error("换电站费用标准明细时间冲突!");
|
||||
}
|
||||
bsfsd.setCtime(new Date());
|
||||
int n = batteryStationHdFeeStandardDetailDao.insert(bsfsd);
|
||||
if (n == 1) {
|
||||
|
||||
@ -27,15 +27,6 @@ public class BatteryStationHdFeeStandardServiceImpl implements BatteryStationHdF
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(BatteryStationHdFeeStandard bsfs) {
|
||||
boolean b = batteryStationHdFeeStandardDao.exists(new QueryWrapper<BatteryStationHdFeeStandard>()
|
||||
.or(i -> i.and(j -> j.le("day_begin", bsfs.getDayBegin()).ge("day_end", bsfs.getDayBegin()))
|
||||
.or(j -> j.le("day_begin", bsfs.getDayEnd()).ge("day_end", bsfs.getDayEnd()))
|
||||
.or(j -> j.ge("day_begin", bsfs.getDayBegin()).le("day_end", bsfs.getDayEnd())))
|
||||
.eq("station_code", bsfs.getStationCode()));
|
||||
if (b) {
|
||||
return new Result<Integer>().error("换电站费用标准日期冲突!");
|
||||
}
|
||||
|
||||
bsfs.setCtime(new Date());
|
||||
int n = batteryStationHdFeeStandardDao.insert(bsfs);
|
||||
if (n == 1) {
|
||||
@ -66,7 +57,7 @@ public class BatteryStationHdFeeStandardServiceImpl implements BatteryStationHdF
|
||||
|
||||
@Override
|
||||
public Result<List<BatteryStationHdFeeStandard>> list(String stationCode) {
|
||||
List<BatteryStationHdFeeStandard> list = batteryStationHdFeeStandardDao.listFeeStandard(stationCode, null);
|
||||
List<BatteryStationHdFeeStandard> list = batteryStationHdFeeStandardDao.listFeeStandard(stationCode);
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<BatteryStationHdFeeStandard>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
|
||||
@ -7,23 +7,17 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationDao;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationSecretKeyDao;
|
||||
import com.evotech.hd.cloud.dao.VehicleInfoDao;
|
||||
import com.evotech.hd.cloud.entity.BatteryStationSecretKey;
|
||||
import com.evotech.hd.cloud.entity.request.PageListBatteryStationRequest;
|
||||
import com.evotech.hd.cloud.service.BatteryStationService;
|
||||
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.VehicleInfo;
|
||||
import com.evotech.hd.common.core.entity.cloud.vo.BatteryStationVO;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
|
||||
import cn.hutool.crypto.KeyUtil;
|
||||
@ -37,18 +31,10 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
private BatteryStationDao batteryStationDao;
|
||||
@Resource
|
||||
private BatteryStationSecretKeyDao batteryStationSecretKeyDao;
|
||||
@Resource
|
||||
private VehicleInfoDao vehicleInfoDao;
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(BatteryStation bs) {
|
||||
bs.setCtime(new Date());
|
||||
boolean b = batteryStationDao.exists(new QueryWrapper<BatteryStation>()
|
||||
.eq("del_flag", 0)
|
||||
.eq("code", bs.getCode()));
|
||||
if (b) {
|
||||
return new Result<Integer>().error("换电站已存在!");
|
||||
}
|
||||
int n = batteryStationDao.insert(bs);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
@ -119,37 +105,4 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
return new Result<Map<String,String>>().success(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<BatteryStationVO>> listStation(String plateNum) {
|
||||
|
||||
List<BatteryStation> list = batteryStationDao.selectList(new QueryWrapper<BatteryStation>().eq("del_flag", 0));
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<BatteryStationVO>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
List<BatteryStationVO> res = list.stream().map(i -> {
|
||||
BatteryStationVO vo = new BatteryStationVO();
|
||||
BeanUtils.copyProperties(i, vo);
|
||||
return vo;
|
||||
}).toList();
|
||||
|
||||
if (StringUtils.hasText(plateNum)) {
|
||||
VehicleInfo vi = vehicleInfoDao.selectOne(new QueryWrapper<VehicleInfo>()
|
||||
.eq("del_flag", 0)
|
||||
.eq("plate_num", plateNum));
|
||||
if (vi == null) {
|
||||
return new Result<List<BatteryStationVO>>().error("无车辆信息!");
|
||||
}
|
||||
res = res.stream().map(i -> {
|
||||
if (StringUtils.hasText(i.getCarTypeCode()) && i.getCarTypeCode().contains(vi.getTypeCode())) {
|
||||
i.setIsSuitable(true);
|
||||
}
|
||||
return i;
|
||||
})
|
||||
.sorted((i1, i2) -> i1.getIsSuitable().compareTo(i2.getIsSuitable()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
return new Result<List<BatteryStationVO>>().success(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
package com.evotech.hd.cloud.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -15,16 +12,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryDao;
|
||||
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.service.OrderSwapBatteryService;
|
||||
import com.evotech.hd.common.core.dao.wechat.WechatUserDao;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
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 com.evotech.hd.common.core.entity.cloud.PageListSwapOrderRequest;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
@ -38,32 +31,13 @@ public class OrderSwapBatteryServiceImpl implements OrderSwapBatteryService {
|
||||
private OrderSwapBatteryPreDao orderSwapBatteryPreDao;
|
||||
@Resource
|
||||
private OrderSwapBatteryStepDao orderSwapBatteryStepDao;
|
||||
@Resource
|
||||
private VehicleInfoDao vehicleInfoDao;
|
||||
@Resource
|
||||
private WechatUserDao wechatUserDao;
|
||||
|
||||
|
||||
@Override
|
||||
public Result<Integer> addPre(OrderSwapBatteryPre osbp) {
|
||||
// 1. 检查车辆
|
||||
boolean b1 = vehicleInfoDao.exists(new QueryWrapper<VehicleInfo>()
|
||||
.eq("del_flag", 0)
|
||||
.eq("plate_num", osbp.getPlateNum()));
|
||||
if (!b1) {
|
||||
return new Result<Integer>().error("车辆未注册!");
|
||||
}
|
||||
// 2. 检查预约人
|
||||
boolean b2 = wechatUserDao.exists(new QueryWrapper<WechatUser>()
|
||||
.ne("phone_number", "")
|
||||
.isNotNull("phone_number")
|
||||
.eq("wuid", osbp.getUcode()));
|
||||
if (!b2) {
|
||||
return new Result<Integer>().error("用户认证信息不全!");
|
||||
}
|
||||
// 是否需要验证人和车绑定关系
|
||||
|
||||
// 是否需要验证公司和车的绑定关系
|
||||
// 2. 检查预约人
|
||||
|
||||
// 3. 添加预约
|
||||
Date d = new Date();
|
||||
@ -138,29 +112,18 @@ public class OrderSwapBatteryServiceImpl implements OrderSwapBatteryService {
|
||||
public Result<List<OrderSwapBattery>> list(PageListSwapOrderRequest plsor) {
|
||||
Page<OrderSwapBattery> page = new Page<OrderSwapBattery>(plsor.getPageNo(), plsor.getPageSize());
|
||||
|
||||
List<String> plateNumList = new ArrayList<String>();
|
||||
if (StringUtils.hasText(plsor.getPlateNums())) {
|
||||
plateNumList = Arrays.asList(plsor.getPlateNums().split(","));
|
||||
}
|
||||
List<Integer> statusList = new ArrayList<Integer>();
|
||||
if (StringUtils.hasText(plsor.getStatus())) {
|
||||
statusList = Arrays.asList(plsor.getStatus().split(",")).stream().map(i -> Integer.valueOf(i)).toList();
|
||||
}
|
||||
|
||||
page = orderSwapBatteryDao.selectPage(page, new QueryWrapper<OrderSwapBattery>()
|
||||
.eq(StringUtils.hasText(plsor.getOrderNo()), "order_no", plsor.getOrderNo())
|
||||
.eq(StringUtils.hasText(plsor.getPlateNum()), "plate_num", plsor.getPlateNum())
|
||||
.in(!plateNumList.isEmpty(), "plate_num", plateNumList)
|
||||
.in(!statusList.isEmpty(), "status", statusList)
|
||||
.in(StringUtils.hasText(plsor.getPlateNums()), "plate_num", Arrays.asList(plsor.getPlateNums().split(",")))
|
||||
.ge(plsor.getOrderTimeBegin() != null, "order_time", plsor.getOrderTimeBegin())
|
||||
.le(plsor.getOrderTimeEnd() != null, "order_time", plsor.getOrderTimeEnd())
|
||||
.eq(StringUtils.hasText(plsor.getStationCode()), "station_code", plsor.getStationCode())
|
||||
.like(StringUtils.hasText(plsor.getStationName()), "station_name", plsor.getStationName())
|
||||
.eq(StringUtils.hasText(plsor.getUserId()), "order_pre_uid", plsor.getUserId())
|
||||
.eq(StringUtils.hasText(plsor.getUserId()), "user_id", plsor.getUserId())
|
||||
.eq(StringUtils.hasText(plsor.getTradeNo()), "trade_no", plsor.getTradeNo())
|
||||
.ne("del_flag", 1)
|
||||
.orderByDesc("pk_id"));
|
||||
System.out.println(page.getTotal());
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<List<OrderSwapBattery>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
@ -177,31 +140,4 @@ public class OrderSwapBatteryServiceImpl implements OrderSwapBatteryService {
|
||||
return new Result<List<OrderSwapBatteryStep>>().success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> calculateCost(String orderNo) {
|
||||
OrderSwapBattery order = orderSwapBatteryDao.selectOne(new QueryWrapper<OrderSwapBattery>().eq("order_no", orderNo));
|
||||
if (order == null) {
|
||||
return new Result<String>().error("无此订单!");
|
||||
}
|
||||
// 1. 检查状态
|
||||
if (order.getStatus() != 5) {
|
||||
return new Result<String>().error("订单状态异常!");
|
||||
}
|
||||
// 2. 检查数据
|
||||
if (order.getBasicFee() == null || order.getServiceFee() == null) {
|
||||
return new Result<String>().error("订单费用标准异常!");
|
||||
}
|
||||
// 3. 选择费用计算方式 计算费用
|
||||
// 先按电量计算
|
||||
if (order.getElectAmount() == null) {
|
||||
return new Result<String>().error("充电订单 充电量 异常!");
|
||||
}
|
||||
BigDecimal fee = order.getServiceFee().add(order.getBasicFee().multiply(order.getElectAmount())).setScale(0, RoundingMode.HALF_UP);
|
||||
// 4. 修改订单
|
||||
order.setAmount(fee.intValue());
|
||||
order.setStatus(6);
|
||||
orderSwapBatteryDao.updateById(order);
|
||||
return new Result<String>().success(fee);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -78,18 +78,6 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
}
|
||||
return new Result<List<VehicleInfo>>().success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> companyRelation(String plateNum, String ccode, String cname) {
|
||||
VehicleInfo vi = new VehicleInfo();
|
||||
vi.setCcode(ccode);
|
||||
vi.setCname(cname);
|
||||
int n = vehicleInfoDao.update(vi, new QueryWrapper<VehicleInfo>().eq("plate_num", plateNum));
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("关联公司失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> addWechatUserRelation(VehicleWechatUserRelation relation) {
|
||||
@ -111,8 +99,8 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<VehicleInfo>> listWechatUserRelation(String wuid, String plateNum) {
|
||||
List<VehicleWechatUserRelation> relationList = vehicleWechatUserRelationDao.selectList(new QueryWrapper<VehicleWechatUserRelation>().eq(StringUtils.hasText(wuid), "ucode", wuid));
|
||||
public Result<List<VehicleInfo>> listWechatUserRelation(String openid, String plateNum) {
|
||||
List<VehicleWechatUserRelation> relationList = vehicleWechatUserRelationDao.selectList(new QueryWrapper<VehicleWechatUserRelation>().eq(StringUtils.hasText(openid), "openid", openid));
|
||||
if (relationList.isEmpty()) {
|
||||
return new Result<List<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
@ -124,6 +112,4 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
return new Result<List<VehicleInfo>>().success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -8,9 +8,6 @@
|
||||
<result column="station_code" property="stationCode" />
|
||||
<result column="day_begin" property="dayBegin" />
|
||||
<result column="day_end" property="dayEnd" />
|
||||
<result column="each_km_fee" property="eachKmFee" />
|
||||
<result column="each_soc_fee" property="eachSocFee" />
|
||||
<result column="each_kwh_fee" property="eachKwhFee" />
|
||||
<result column="common_remain_fee" property="commonRemainFee" />
|
||||
<result column="common_remain_soc_range" property="commonRemainSocRange" />
|
||||
<result column="more_remain_soc" property="moreRemainSoc" />
|
||||
@ -29,7 +26,7 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
pk_id, station_code, day_begin, day_end, each_km_fee, each_soc_fee, each_kwh_fee, common_remain_fee, common_remain_soc_range, more_remain_soc, more_remain_fee, few_remain_soc, few_remain_fee, ctime, creater, uptime, updater
|
||||
pk_id, station_code, day_begin, day_end, common_remain_fee, common_remain_soc_range, more_remain_soc, more_remain_fee, few_remain_soc, few_remain_fee, ctime, creater, uptime, updater
|
||||
</sql>
|
||||
|
||||
<select id="listFeeStandard" resultMap="BaseResultMap">
|
||||
@ -39,12 +36,6 @@
|
||||
yt_t_battery_station_hd_fee_standard a
|
||||
where
|
||||
a.station_code = #{stationCode}
|
||||
<if test="day!= null and day != '' ">
|
||||
and a.day_begin <= #{day}
|
||||
</if>
|
||||
<if test="day!= null and day != '' ">
|
||||
and a.day_end >= #{day}
|
||||
</if>
|
||||
order by a.pk_id desc
|
||||
</select>
|
||||
|
||||
|
||||
@ -12,9 +12,6 @@ import org.springframework.web.reactive.config.WebFluxConfigurer;
|
||||
@Configuration
|
||||
public class CorsConfig implements WebFluxConfigurer {
|
||||
|
||||
/**
|
||||
* 这个是servlet里面的,不起作用
|
||||
*/
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
|
||||
@ -32,15 +32,11 @@ public class MyAccessDeniedHandler implements ServerAccessDeniedHandler {
|
||||
@Override
|
||||
public Mono<Void> handle(ServerWebExchange exchange, AccessDeniedException e) {
|
||||
// log.error("\r\n===>>>" + this.getClass().getName());
|
||||
System.out.println("6666666666");
|
||||
e.printStackTrace();
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
response.setStatusCode(HttpStatus.OK);
|
||||
response.getHeaders().add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
// 为了解决token过期时,前端不出现跨域错误,添加了一些header,注意Access-Control-Allow-Origin的值
|
||||
response.getHeaders().add("Access-Control-Allow-Origin", "*");
|
||||
response.getHeaders().add("Access-Control-Allow-Credentials", "true");
|
||||
response.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
|
||||
response.getHeaders().add("Access-Control-Allow-Headers", HttpHeaders.AUTHORIZATION);
|
||||
String body= JSONUtil.toJsonStr(new Result<String>().bussinessException(CodeMsg.ACCESS_DENY.getCode(), CodeMsg.ACCESS_DENY.getMsg(), e.getMessage()));
|
||||
DataBuffer buffer = response.bufferFactory().wrap(body.getBytes(Charset.forName("UTF-8")));
|
||||
return response.writeWith(Mono.just(buffer));
|
||||
|
||||
@ -55,7 +55,6 @@ public class MyAuthenticationEntryPoint implements ServerAuthenticationEntryPoin
|
||||
} else if (cause instanceof BadJwtException || cause instanceof JwtEncodingException) {
|
||||
res = new Result<String>().error(CodeMsg.TOKEN_INVALID.getCode(), CodeMsg.TOKEN_INVALID.getMsg(), cause.getMessage());
|
||||
} else if (cause instanceof InvalidBearerTokenException) {
|
||||
System.out.println("8888888");
|
||||
String token = exchange.getRequest().getHeaders().getFirst("Authorization").substring(7);
|
||||
String dateTime = DateUtil.formatDateTime(TokenUtil.getExp(token));
|
||||
res = new Result<String>().bussinessException(CodeMsg.TOKEN_EXPIRED.getCode(), CodeMsg.TOKEN_EXPIRED.getMsg(), "Jwt expired at " + dateTime);
|
||||
|
||||
@ -40,7 +40,6 @@ public class ResourceServerConfig {
|
||||
http.csrf(csrf -> csrf.disable());
|
||||
// 跨域处理
|
||||
http.cors(Customizer.withDefaults());
|
||||
// http.cors(cors -> cors.disable());
|
||||
http.httpBasic(httpBasicSpec -> httpBasicSpec.disable());
|
||||
// 资源服务器配置
|
||||
http.oauth2ResourceServer(server -> server
|
||||
|
||||
@ -6,7 +6,6 @@ import org.springframework.boot.autoconfigure.web.WebProperties.Resources;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
|
||||
import org.springframework.boot.web.reactive.error.ErrorAttributes;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
@ -49,17 +48,12 @@ public class GlobalExceptionHandler extends DefaultErrorWebExceptionHandler {
|
||||
@Override
|
||||
protected Mono<ServerResponse> renderErrorResponse(ServerRequest request) {
|
||||
// Map<String, Object> error = getErrorAttributes(request, getErrorAttributeOptions(request, MediaType.ALL));
|
||||
Throwable throwable = getError(request);
|
||||
return ServerResponse
|
||||
Throwable throwable = getError(request);
|
||||
return ServerResponse
|
||||
// .status(super.getHttpStatus(error))
|
||||
.status(HttpStatus.OK)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
// .body(BodyInserters.fromValue(new RuntimeException()))
|
||||
// 为了解决token过期时,前端不出现跨域错误,添加了一些header
|
||||
.header("Access-Control-Allow-Origin", "*")
|
||||
.header("Access-Control-Allow-Credentials", "true")
|
||||
.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD")
|
||||
.header("Access-Control-Allow-Headers", HttpHeaders.AUTHORIZATION)
|
||||
.body(BodyInserters.fromValue(globalExceptionType.handle(throwable)))
|
||||
;
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ public class GlobalExceptionType {
|
||||
|
||||
@ExceptionHandler(value = {OAuth2AuthorizationException.class})
|
||||
public Result<String> oAuth2AuthorizationHandle(OAuth2AuthorizationException e) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
OAuth2Error error = e.getError();
|
||||
return new Result<String>().bussinessException(error.getErrorCode(), error.getDescription(), error.getUri());
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.evotech.hd.cloud.controller.customer;
|
||||
package com.evotech.hd.resource.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -9,10 +8,10 @@ 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.service.CompanyService;
|
||||
import com.evotech.hd.common.core.entity.BasePageRequest;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.evotech.hd.resource.entity.Company;
|
||||
import com.evotech.hd.resource.service.CompanyService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
|
||||
@ -24,8 +23,8 @@ import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Tag(name = "公司管理")
|
||||
@RestController
|
||||
@RequestMapping("/company")
|
||||
@ApiSupport(order = 33)
|
||||
@RequestMapping("/system/company")
|
||||
@ApiSupport(order = 84)
|
||||
public class CompanyController {
|
||||
|
||||
|
||||
@ -60,10 +59,5 @@ public class CompanyController {
|
||||
public Result<List<Company>> list(@Valid @ParameterObject BasePageRequest bpr) {
|
||||
return companyService.list(bpr);
|
||||
}
|
||||
|
||||
@GetMapping("/companyByCode")
|
||||
public Result<Map<String, String>> companyByCode(String ccode) {
|
||||
return companyService.companyByCode(ccode);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,64 +1,6 @@
|
||||
package com.evotech.hd.resource.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
|
||||
import com.evotech.hd.resource.service.WechatAgreementService;
|
||||
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.NotNull;
|
||||
|
||||
@Tag(name = "微信协议")
|
||||
@RestController
|
||||
@RequestMapping("/wechat/agreement")
|
||||
@ApiSupport(order = 201)
|
||||
public class WechatAgreementController {
|
||||
|
||||
|
||||
@Resource
|
||||
private WechatAgreementService wechatAgreementService;
|
||||
|
||||
|
||||
@Operation(summary = "增加")
|
||||
@PostMapping("/add")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<Integer> add(@Valid @ParameterObject WechatAgreement wa) {
|
||||
return wechatAgreementService.add(wa);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(@NotNull Integer id) {
|
||||
return wechatAgreementService.delete(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> update(@ParameterObject WechatAgreement wa) {
|
||||
return wechatAgreementService.update(wa);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<List<WechatAgreement>> list(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status) {
|
||||
return wechatAgreementService.list(appid, type, status);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,63 +1,5 @@
|
||||
package com.evotech.hd.resource.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
|
||||
import com.evotech.hd.resource.service.WechatSwiperService;
|
||||
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.NotNull;
|
||||
|
||||
@Tag(name = "微信轮播图")
|
||||
@RestController
|
||||
@RequestMapping("/wechat/swiper")
|
||||
@ApiSupport(order = 202)
|
||||
public class WechatSwiperController {
|
||||
|
||||
@Resource
|
||||
private WechatSwiperService wechatSwiperService;
|
||||
|
||||
|
||||
@Operation(summary = "增加")
|
||||
@PostMapping("/add")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<Integer> add(@Valid @ParameterObject WechatSwiper ws) {
|
||||
return wechatSwiperService.add(ws);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(@NotNull Integer id) {
|
||||
return wechatSwiperService.delete(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping({"/update"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> update(@ParameterObject WechatSwiper ws) {
|
||||
return wechatSwiperService.update(ws);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
public Result<List<WechatSwiper>> list(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status) {
|
||||
return wechatSwiperService.list(appid, type, status);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.evotech.hd.cloud.dao;
|
||||
package com.evotech.hd.resource.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.evotech.hd.resource.entity.Company;
|
||||
|
||||
/**
|
||||
* @author zrb
|
||||
@ -1,4 +1,4 @@
|
||||
package com.evotech.hd.common.core.entity.cloud;
|
||||
package com.evotech.hd.resource.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@ -73,7 +73,7 @@ public class Company implements Serializable {
|
||||
@Schema(description = "状态:1-启用,0-禁用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "删除标识:1-已删除,0-未删除", hidden = true)
|
||||
@Schema(description = "删除标识:1-已删除,0-未删除")
|
||||
private Integer delFlag;
|
||||
|
||||
@Schema(description = "账户余额")
|
||||
@ -1,11 +1,10 @@
|
||||
package com.evotech.hd.cloud.service;
|
||||
package com.evotech.hd.resource.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.evotech.hd.common.core.entity.BasePageRequest;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.evotech.hd.resource.entity.Company;
|
||||
|
||||
public interface CompanyService {
|
||||
|
||||
@ -16,7 +15,5 @@ public interface CompanyService {
|
||||
public Result<Integer> update(Company company);
|
||||
|
||||
public Result<List<Company>> list(BasePageRequest bpr);
|
||||
|
||||
public Result<Map<String, String>> companyByCode(String ccode);
|
||||
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package com.evotech.hd.resource.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
|
||||
|
||||
public interface WechatAgreementService {
|
||||
|
||||
public Result<Integer> add(WechatAgreement wa);
|
||||
|
||||
|
||||
public Result<Integer> delete(Integer id);
|
||||
|
||||
public Result<Integer> update(WechatAgreement wa);
|
||||
|
||||
public Result<List<WechatAgreement>> list(String appid, Integer type, Integer status);
|
||||
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package com.evotech.hd.resource.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
|
||||
|
||||
public interface WechatSwiperService {
|
||||
|
||||
public Result<Integer> add(WechatSwiper ws);
|
||||
|
||||
|
||||
public Result<Integer> delete(Integer id);
|
||||
|
||||
public Result<Integer> update(WechatSwiper ws);
|
||||
|
||||
public Result<List<WechatSwiper>> list(String appid, Integer type, Integer status);
|
||||
|
||||
}
|
||||
@ -1,20 +1,19 @@
|
||||
package com.evotech.hd.cloud.service.impl;
|
||||
package com.evotech.hd.resource.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.cloud.dao.CompanyDao;
|
||||
import com.evotech.hd.cloud.service.CompanyService;
|
||||
import com.evotech.hd.common.core.entity.BasePageRequest;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.Company;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.resource.dao.CompanyDao;
|
||||
import com.evotech.hd.resource.entity.Company;
|
||||
import com.evotech.hd.resource.service.CompanyService;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
|
||||
@ -66,16 +65,4 @@ public class CompanyServiceImpl implements CompanyService {
|
||||
return new Result<List<Company>>().success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Map<String, String>> companyByCode(String ccode) {
|
||||
Company one = companyDao.selectOne(new QueryWrapper<Company>().eq("ccode", ccode));
|
||||
if (one == null) {
|
||||
return new Result<Map<String, String>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
m.put("ccode", one.getCcode());
|
||||
m.put("cname", one.getCname());
|
||||
return new Result<Map<String, String>>().success(m);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
package com.evotech.hd.resource.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.resource.dao.WechatAgreementDao;
|
||||
import com.evotech.hd.resource.service.WechatAgreementService;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class WechatAgreementServiceImpl implements WechatAgreementService {
|
||||
|
||||
@Resource
|
||||
private WechatAgreementDao wechatAgreementDao;
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(WechatAgreement wa) {
|
||||
wa.setCtime(new Date());
|
||||
int n = wechatAgreementDao.insert(wa);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加协议出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> delete(Integer id) {
|
||||
int n = wechatAgreementDao.deleteById(id);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("删除协议出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> update(WechatAgreement wa) {
|
||||
int n = wechatAgreementDao.updateById(wa);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("更新类型失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<WechatAgreement>> list(String appid, Integer type, Integer status) {
|
||||
List<WechatAgreement> list = wechatAgreementDao.selectList(new QueryWrapper<WechatAgreement>()
|
||||
.eq(type != null, "type", type)
|
||||
.eq(status != null, "status", status)
|
||||
.eq(StringUtils.hasText(appid), "appid", appid));
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<WechatAgreement>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
return new Result<List<WechatAgreement>>().success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
package com.evotech.hd.resource.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.resource.dao.WechatSwiperDao;
|
||||
import com.evotech.hd.resource.service.WechatSwiperService;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class WechatSwiperServiceImpl implements WechatSwiperService {
|
||||
|
||||
@Resource
|
||||
private WechatSwiperDao wechatSwiperDao;
|
||||
|
||||
@Override
|
||||
public Result<Integer> add(WechatSwiper ws) {
|
||||
ws.setCtime(new Date());
|
||||
int n = wechatSwiperDao.insert(ws);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("添加轮播图出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> delete(Integer id) {
|
||||
int n = wechatSwiperDao.deleteById(id);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("删除轮播图出错!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> update(WechatSwiper ws) {
|
||||
int n = wechatSwiperDao.updateById(ws);
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("更新类型失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<WechatSwiper>> list(String appid, Integer type, Integer status) {
|
||||
List<WechatSwiper> list = wechatSwiperDao.selectList(new QueryWrapper<WechatSwiper>()
|
||||
.eq(type != null, "type", type)
|
||||
.eq(status != null, "status", status)
|
||||
.eq(StringUtils.hasText(appid), "appid", appid));
|
||||
if (list.isEmpty()) {
|
||||
return new Result<List<WechatSwiper>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
return new Result<List<WechatSwiper>>().success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,14 +1,11 @@
|
||||
package com.evotech.hd.wechat.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.util.StringUtils;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
@ -16,7 +13,6 @@ 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 com.evotech.hd.common.core.entity.cloud.PageListSwapOrderRequest;
|
||||
import com.evotech.hd.common.core.entity.cloud.vo.BatteryStationVO;
|
||||
import com.evotech.hd.wechat.service.CloudService;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
@ -55,7 +51,7 @@ public class CloudServeController {
|
||||
@Operation(summary = "查询预约")
|
||||
@GetMapping("/order/swap/pre/list")
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<List<OrderSwapBatteryPre>> listPre(@RequestParam(required = false) String plateNum, @RequestParam(required = false) Integer status, @RequestParam(required = false) String ucode, @RequestParam(required = false) String stationCode) {
|
||||
public Result<List<OrderSwapBatteryPre>> listPre(String plateNum, Integer status, String ucode, String stationCode) {
|
||||
return cloudService.listPre(plateNum, status, ucode, stationCode);
|
||||
}
|
||||
|
||||
@ -63,9 +59,6 @@ public class CloudServeController {
|
||||
@GetMapping("/order/swap/list")
|
||||
@ApiOperationSupport(order = 7)
|
||||
public Result<List<OrderSwapBattery>> list(@ParameterObject PageListSwapOrderRequest plsor) {
|
||||
if (!StringUtils.hasText(plsor.getUserId())) {
|
||||
return null;
|
||||
}
|
||||
return cloudService.list(plsor);
|
||||
}
|
||||
|
||||
@ -75,19 +68,5 @@ public class CloudServeController {
|
||||
public Result<List<OrderSwapBatteryStep>> listStep(@NotBlank String orderNo) {
|
||||
return cloudService.listStep(orderNo);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询换电站")
|
||||
@GetMapping("/station/list")
|
||||
@ApiOperationSupport(order = 9)
|
||||
public Result<List<BatteryStationVO>> listStation(@RequestParam(required = false) String plateNum) {
|
||||
return cloudService.listStation(plateNum);
|
||||
}
|
||||
|
||||
@Operation(summary = "公司编码查询公司")
|
||||
@GetMapping("/company/companyByCode")
|
||||
@ApiOperationSupport(order = 10)
|
||||
public Result<Map<String, String>> companyByCode(String ccode) {
|
||||
return cloudService.companyByCode(ccode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
package com.evotech.hd.wechat.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
|
||||
import com.evotech.hd.wechat.service.ResourceService;
|
||||
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.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Tag(name = "资源服务API")
|
||||
@ApiSupport(order = 14)
|
||||
@RestController
|
||||
@RequestMapping("/resource")
|
||||
public class ResourceServerController {
|
||||
|
||||
@Resource
|
||||
private ResourceService resourceService;
|
||||
|
||||
|
||||
@Operation(summary = "小程序协议查询")
|
||||
@GetMapping("/agreement/list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
public Result<List<WechatAgreement>> listAgreement(@NotBlank @RequestParam String appid, @NotNull @RequestParam Integer type) {
|
||||
return resourceService.listAgreement(appid, type, 1);
|
||||
}
|
||||
|
||||
@Operation(summary = "小程序轮播图查询")
|
||||
@GetMapping("/swiper/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<List<WechatSwiper>> listSwiper(@NotBlank @RequestParam String appid, @NotNull @RequestParam Integer type) {
|
||||
return resourceService.listSwiper(appid, type, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@ -36,12 +36,5 @@ public class WechatUserController {
|
||||
public Result<WechatUser> userByUid(String wuid) {
|
||||
return wechatUserService.userByUid(wuid);
|
||||
}
|
||||
|
||||
@Operation(summary = "绑定公司")
|
||||
@PostMapping("/bindcompany")
|
||||
public Result<Integer> bindCompany(String wuid, String code, String name) {
|
||||
return wechatUserService.bindCompany(wuid, code, name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
package com.evotech.hd.wechat.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -15,7 +13,6 @@ 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 com.evotech.hd.common.core.entity.cloud.PageListSwapOrderRequest;
|
||||
import com.evotech.hd.common.core.entity.cloud.vo.BatteryStationVO;
|
||||
|
||||
@FeignClient(value = "cloud-server")
|
||||
public interface CloudService {
|
||||
@ -34,19 +31,10 @@ public interface CloudService {
|
||||
|
||||
@GetMapping(value = "/cloud/order/swap/list",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<List<OrderSwapBattery>> list(@SpringQueryMap PageListSwapOrderRequest plsor);
|
||||
public Result<List<OrderSwapBattery>> list(PageListSwapOrderRequest plsor);
|
||||
|
||||
@GetMapping(value = "/cloud/order/swap/step/list",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<List<OrderSwapBatteryStep>> listStep(@RequestParam String orderNo);
|
||||
|
||||
@GetMapping(value = "/cloud/batterystation/liststation",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<List<BatteryStationVO>> listStation(@RequestParam String plateNum);
|
||||
// public Result<List<BatteryStation>> listStation(@SpringQueryMap BasePageRequest bpr);
|
||||
|
||||
@GetMapping(value = "/cloud/company/companyByCode",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<Map<String, String>> companyByCode(@RequestParam String ccode);
|
||||
public Result<List<OrderSwapBatteryStep>> listStep(String orderNo);
|
||||
|
||||
}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
package com.evotech.hd.wechat.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.evotech.hd.common.core.entity.Result;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatAgreement;
|
||||
import com.evotech.hd.common.core.entity.resource.WechatSwiper;
|
||||
|
||||
@FeignClient(value = "resource-server")
|
||||
public interface ResourceService {
|
||||
|
||||
@GetMapping(value = "/resource/wechat/agreement/list",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<List<WechatAgreement>> listAgreement(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status);
|
||||
|
||||
@GetMapping(value = "/resource/wechat/swiper/list",
|
||||
consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE})
|
||||
public Result<List<WechatSwiper>> listSwiper(@RequestParam String appid, @RequestParam Integer type, @RequestParam Integer status);
|
||||
}
|
||||
@ -8,7 +8,5 @@ public interface WechatUserService {
|
||||
public Result<String> update(WechatUser wuser);
|
||||
|
||||
public Result<WechatUser> userByUid(String wuid);
|
||||
|
||||
public Result<Integer> bindCompany(String wuid, String code, String name);
|
||||
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.wechat.service.WechatUserService;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
|
||||
@ -22,17 +21,11 @@ public class WechatUserServiceImpl implements WechatUserService {
|
||||
|
||||
@Override
|
||||
public Result<String> update(WechatUser wuser) {
|
||||
WechatUser user = new WechatUser();
|
||||
user.setName(wuser.getName());
|
||||
user.setGender(wuser.getGender());
|
||||
user.setNickName(wuser.getNickName());
|
||||
user.setPhoneNumber(wuser.getPhoneNumber());
|
||||
user.setAvatarUrl(wuser.getAvatarUrl());
|
||||
int n = wechatUserDao.update(user, new QueryWrapper<WechatUser>().eq("wuid", wuser.getWuid()));
|
||||
int n = wechatUserDao.update(wuser, new QueryWrapper<WechatUser>().eq("wuid", wuser.getWuid()));
|
||||
if (n == 1) {
|
||||
return new Result<String>().success(1);
|
||||
}
|
||||
return new Result<String>().error("修改微信用户信息出错!");
|
||||
return new Result<String>().error("修改微信用户信息出错");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,22 +34,7 @@ public class WechatUserServiceImpl implements WechatUserService {
|
||||
if (user == null) {
|
||||
return new Result<WechatUser>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
user.setOpenid(DesensitizedUtil.idCardNum(user.getOpenid(), 5, 6));
|
||||
user.setPhoneNumber(DesensitizedUtil.mobilePhone(user.getPhoneNumber()));
|
||||
return new Result<WechatUser>().success(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> bindCompany(String wuid, String code, String name) {
|
||||
WechatUser user = new WechatUser();
|
||||
user.setType(2);
|
||||
user.setPcode(code);
|
||||
user.setPname(name);
|
||||
int n = wechatUserDao.update(user, new QueryWrapper<WechatUser>().eq("wuid", wuid));
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(1);
|
||||
}
|
||||
return new Result<Integer>().error("绑定出错!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user