优化 调整, 站控部分相关代码
This commit is contained in:
parent
eb64434b2c
commit
285c46024b
@ -6,18 +6,23 @@
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="common-mongodb" />
|
||||
<module name="cloud-manage-server" />
|
||||
<module name="common-redis" />
|
||||
<module name="common-mybatis" />
|
||||
<module name="authorization-server" />
|
||||
<module name="resource-server" />
|
||||
<module name="common-permission" />
|
||||
<module name="gateway-server" />
|
||||
<module name="admin-server" />
|
||||
<module name="common-web" />
|
||||
<module name="wechat-server" />
|
||||
<module name="cloud-manage-server" />
|
||||
<module name="common-redis" />
|
||||
<module name="common-core" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="common-websocket" target="17" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
@ -25,9 +30,12 @@
|
||||
<module name="authorization-server" options="-parameters" />
|
||||
<module name="cloud-manage-server" options="-parameters" />
|
||||
<module name="common-core" options="-parameters" />
|
||||
<module name="common-mongodb" options="-parameters" />
|
||||
<module name="common-mybatis" options="-parameters" />
|
||||
<module name="common-permission" options="-parameters" />
|
||||
<module name="common-redis" options="-parameters" />
|
||||
<module name="common-web" options="-parameters" />
|
||||
<module name="common-websocket" options="-parameters" />
|
||||
<module name="gateway-server" options="-parameters" />
|
||||
<module name="resource-server" options="-parameters" />
|
||||
<module name="wechat-server" options="-parameters" />
|
||||
|
||||
@ -4,9 +4,12 @@
|
||||
<file url="file://$PROJECT_DIR$/admin-server/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/authorization-server/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/common-core/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/common-mongodb/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/common-mybatis/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/common-permission/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/common-redis/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/common-web/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/common-websocket/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/base-commons/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/cloud-manage-server/src/main/java" charset="UTF-8" />
|
||||
|
||||
@ -7,6 +7,11 @@
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/base-commons/common-websocket/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" project-jdk-name="17 (2)" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
@ -28,7 +28,10 @@
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
||||
@ -22,4 +22,8 @@ public class ResultUtil {
|
||||
log.error("当前请求出现异常{}", result.getMsg());
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> Boolean verifyCode(Result<T> result){
|
||||
return CodeMsg.SUCCESS.getCode().equals(result.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
package com.evotech.hd.common.core.Dto.order;
|
||||
|
||||
import com.evotech.hd.common.core.excel.Excel;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类
|
||||
*
|
||||
* @ClassName:OrderListVo
|
||||
* @date: 2025年05月16日 13:54
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
@Schema(name = "电子账单")
|
||||
public class OrderBillListVo {
|
||||
/***
|
||||
* 结算总金额
|
||||
*/
|
||||
@Schema(description = "订单总额")
|
||||
Double orderTotalAmount;
|
||||
/***
|
||||
* 站点名称
|
||||
*/
|
||||
@Schema(description = "站点名称")
|
||||
@Excel(name="站点名称")
|
||||
String stationName;
|
||||
/***
|
||||
* 车牌号
|
||||
*/
|
||||
@Schema(description = "车牌号")
|
||||
@Excel(name="车牌号")
|
||||
String plateNum;
|
||||
/***
|
||||
* 换电人
|
||||
*/
|
||||
@Schema(description = "换电人")
|
||||
@Excel(name="换电人")
|
||||
String preName;
|
||||
|
||||
/***
|
||||
* 换电次数
|
||||
*/
|
||||
@Schema(description = "换电次数")
|
||||
Integer orderNum;
|
||||
/***
|
||||
* 换电时间
|
||||
*/
|
||||
@Schema(description = "换电时间")
|
||||
@Excel(name="换电时间", dateFormat ="yyyy-MM-dd HH:mm:ss")
|
||||
Date orderTime;
|
||||
/***
|
||||
* 订单金额
|
||||
*/
|
||||
@Schema(description = "订单金额")
|
||||
Integer orderAmount;
|
||||
|
||||
@Excel(name="订单金额", isStatistics = true)
|
||||
@JsonIgnore
|
||||
Double orderAmountExcel;
|
||||
/***
|
||||
* 订单状态
|
||||
*/
|
||||
@Schema(description = "订单状态")
|
||||
Integer status;
|
||||
@Schema(description = "换电订单详情")
|
||||
List<OrderBillListVo> childList = Collections.emptyList();;
|
||||
|
||||
|
||||
}
|
||||
@ -6,12 +6,14 @@ public interface HDConstant {
|
||||
* 全局删除标识-已删除
|
||||
*/
|
||||
final static Integer DELETE_YES = 1;
|
||||
|
||||
/***
|
||||
* 全局删除标识-未删除
|
||||
*/
|
||||
final static Integer DELETE_NO = 0;
|
||||
|
||||
final static String PUBLIC_KEY="public_key";
|
||||
final static String PRIVATE_KEY="private_key";
|
||||
|
||||
/***
|
||||
* 大华设备相关CONSTANT
|
||||
*/
|
||||
|
||||
@ -43,4 +43,6 @@ public interface OrderDao extends BaseMapper<Order> {
|
||||
Double homeFindOrderAmountData(@Param("date") Date date);
|
||||
|
||||
List<HomeOrderInfo> findOrderListByStatus(@Param("status") Integer status);
|
||||
|
||||
List<Order> findBillList(@Param("companyCode") String companyCode, @Param("orderTimeEnd")String orderTimeEnd);
|
||||
}
|
||||
|
||||
@ -1,38 +1,32 @@
|
||||
//package com.evotech.hd.common.core.dao.cloud;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
//import com.evotech.hd.common.core.Dto.request.HomeRequestDto;
|
||||
//import com.evotech.hd.common.core.Dto.result.home.*;
|
||||
//import com.evotech.hd.common.core.constant.HDConstant;
|
||||
//import com.evotech.hd.common.core.entity.cloud.OrderSwapBattery;
|
||||
//import com.evotech.hd.common.core.permission.DataScope;
|
||||
//import com.evotech.hd.common.core.permission.DataScopes;
|
||||
//import org.apache.ibatis.annotations.Param;
|
||||
//
|
||||
//import java.util.Date;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author zrb
|
||||
// * @since 2024-11-22
|
||||
// */
|
||||
//@DataScopes({
|
||||
// @DataScope(permissionObject = HDConstant.OPERATOR_ROLE_CODE, permissionScopeName = "station_code", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_STATION_CODE),
|
||||
// @DataScope(permissionObject = HDConstant.COMPANY_ROLE_CODE, permissionScopeName = "plate_num", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_CAR_CODE),
|
||||
//})
|
||||
////@DataScopeOpenMethod(openMethod = true, methodName = {"homeFindHalfYearAmountData"})
|
||||
//public interface OrderSwapBatteryDao extends BaseMapper<OrderSwapBattery> {
|
||||
//
|
||||
package com.evotech.hd.common.core.dao.cloud;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBattery;
|
||||
import com.evotech.hd.common.core.permission.DataScope;
|
||||
import com.evotech.hd.common.core.permission.DataScopes;
|
||||
|
||||
/**
|
||||
* @author zrb
|
||||
* @since 2024-11-22
|
||||
*/
|
||||
@DataScopes({
|
||||
@DataScope(permissionObject = HDConstant.OPERATOR_ROLE_CODE, permissionScopeName = "station_code", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_STATION_CODE),
|
||||
@DataScope(permissionObject = HDConstant.COMPANY_ROLE_CODE, permissionScopeName = "plate_num", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_CAR_CODE),
|
||||
})
|
||||
//@DataScopeOpenMethod(openMethod = true, methodName = {"homeFindHalfYearAmountData"})
|
||||
public interface OrderSwapBatteryDao extends BaseMapper<OrderSwapBattery> {
|
||||
|
||||
//
|
||||
// List<HomeOrderSwapBatteryProportionDto> homeFindProportionData(@Param("params") HomeRequestDto params);
|
||||
//
|
||||
// List<HomeOrderSwapBatteryAmountDto> homeFindAmountData(@Param("params") HomeRequestDto params);
|
||||
//
|
||||
// List<HomeOrderSwapBatteryHalfYearDto> homeFindHalfYearOrderData(@Param("params") HomeRequestDto params);
|
||||
//
|
||||
//// @DataScope(permissionObject = HDConstant.OPERATOR_ROLE_CODE, tableAlias = "osb", permissionScopeName = "station_code", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_STATION_CODE)
|
||||
|
||||
// @DataScope(permissionObject = HDConstant.OPERATOR_ROLE_CODE, tableAlias = "osb", permissionScopeName = "station_code", permissionScopeRedisKey = HDConstant.PermissionConstant.PERMISSION_STATION_CODE)
|
||||
// List<HomeOrderSwapBatteryHalfYearAmountDto> homeFindHalfYearAmountData(@Param("params") HomeRequestDto params);
|
||||
// //因为站端不需要显示金额, 所有重新写一个
|
||||
//因为站端不需要显示金额, 所有重新写一个
|
||||
// List<HomeOrderSwapBatteryHalfYearAmountDto> homeFindHalfYearStationAmountData(@Param("params") HomeRequestDto params);
|
||||
//
|
||||
// Long homeFindOrderCountData(@Param("date") Date date);
|
||||
@ -40,4 +34,4 @@
|
||||
// Double homeFindOrderAmountData(@Param("date") Date date);
|
||||
//
|
||||
// List<HomeOrderInfo> findOrderListByStatus(@Param("status") Integer status);
|
||||
//}
|
||||
}
|
||||
|
||||
@ -57,6 +57,10 @@ public class BatteryStation extends BaseEntity implements Serializable {
|
||||
@Schema(description = "地址-区县")
|
||||
private String addressArea;
|
||||
|
||||
@Schema(description = "区划编码", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "区划编码不能为空")
|
||||
private String divisionNo;
|
||||
|
||||
@Schema(description = "注册日期")
|
||||
private String registerDate;
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ public class BatteryStationDc extends BaseEntity implements Serializable {
|
||||
private Integer soc;
|
||||
|
||||
@Schema(description = "电池仓位号")
|
||||
private Integer dccNo;
|
||||
private String dccNo;
|
||||
|
||||
@Schema(description = "删除标志:1-已删除,0-未删除", hidden = true)
|
||||
private Integer delFlag;
|
||||
|
||||
@ -1,162 +1,162 @@
|
||||
//package com.evotech.hd.common.core.entity.cloud;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.annotation.TableField;
|
||||
//import com.baomidou.mybatisplus.annotation.TableName;
|
||||
//import com.evotech.hd.common.core.entity.BaseEntity;
|
||||
//import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
//import io.swagger.v3.oas.annotations.media.Schema;
|
||||
//import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
//import jakarta.validation.constraints.NotBlank;
|
||||
//import jakarta.validation.constraints.NotNull;
|
||||
//import lombok.Data;
|
||||
//import org.springframework.format.annotation.DateTimeFormat;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.math.BigDecimal;
|
||||
//import java.util.Date;
|
||||
//
|
||||
///**
|
||||
// * @author zrb
|
||||
// * @since 2024-11-22
|
||||
// */
|
||||
//@Data
|
||||
//@TableName("hd_cloud_manage.yt_t_order_swap_battery")
|
||||
//@Schema(name = "换电订单信息表")
|
||||
//public class OrderSwapBattery extends BaseEntity implements Serializable {
|
||||
//
|
||||
// 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;
|
||||
//
|
||||
// @Schema(description = "类型:1-换电,2-充电", requiredMode = RequiredMode.REQUIRED)
|
||||
// @NotNull(message = "订单类型不能为空")
|
||||
// private Integer orderType;
|
||||
//
|
||||
// @Schema(description = "订单编码", hidden = true)
|
||||
// private String orderNo;
|
||||
//
|
||||
// @Schema(description = "车牌号", requiredMode = RequiredMode.REQUIRED)
|
||||
// @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;
|
||||
//
|
||||
// @Schema(description = "换电站编码", requiredMode = RequiredMode.REQUIRED)
|
||||
// @NotBlank(message = "换电站编码不能为空")
|
||||
// private String stationCode;
|
||||
//
|
||||
// @Schema(description = "换电站名称", requiredMode = RequiredMode.REQUIRED)
|
||||
// @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;
|
||||
//}
|
||||
package com.evotech.hd.common.core.entity.cloud;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.evotech.hd.common.core.entity.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author zrb
|
||||
* @since 2024-11-22
|
||||
*/
|
||||
@Data
|
||||
@TableName("hd_cloud_manage.yt_t_order_swap_battery")
|
||||
@Schema(name = "换电订单信息表")
|
||||
public class OrderSwapBattery extends BaseEntity implements Serializable {
|
||||
|
||||
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;
|
||||
|
||||
@Schema(description = "类型:1-换电,2-充电", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotNull(message = "订单类型不能为空")
|
||||
private Integer orderType;
|
||||
|
||||
@Schema(description = "订单编码", hidden = true)
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "车牌号", requiredMode = RequiredMode.REQUIRED)
|
||||
@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;
|
||||
|
||||
@Schema(description = "换电站编码", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "换电站编码不能为空")
|
||||
private String stationCode;
|
||||
|
||||
@Schema(description = "换电站名称", requiredMode = RequiredMode.REQUIRED)
|
||||
@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;
|
||||
}
|
||||
|
||||
@ -24,6 +24,9 @@ public class TradeDetail extends BaseEntity implements Serializable {
|
||||
@Schema(description = "换电站编码")
|
||||
private String stationCode;
|
||||
|
||||
@Schema(description = "交易人微信Id")
|
||||
private String plateCompanyCode;
|
||||
|
||||
@Schema(description = "交易人name")
|
||||
private String trader;
|
||||
|
||||
@ -36,7 +39,7 @@ public class TradeDetail extends BaseEntity implements Serializable {
|
||||
@Schema(description = "交易类型:1-充值,2-订单消费,3-退款, 9-提现")
|
||||
private Integer tradeType;
|
||||
|
||||
@Schema(description = "支付方式:1-账户余额,2-微信,3-支付宝,4-网银,5 -充电补偿")
|
||||
@Schema(description = "支付方式:1-账户余额,2-微信,3-支付宝,4-网银,5 -充电补偿, 6-公对公转账")
|
||||
private Integer payType;
|
||||
@Schema(description = "微信支付API类型")
|
||||
private String wechatPayApiType;
|
||||
@ -68,7 +71,7 @@ public class TradeDetail extends BaseEntity implements Serializable {
|
||||
@Schema(description = "微信支付订单号")
|
||||
private String transactionId;
|
||||
|
||||
@Schema(description = "支付结果,暂用微信结果的枚举类型")
|
||||
@Schema(description = "支付结果,暂用微信结果的枚举类型, 新增 paymentInProgress 结算中类型")
|
||||
private String payResult;
|
||||
|
||||
@Schema(description = "付款人编码,对于个人账户,交易发起人和付款人一般是同一人。公司账户交易发起人是公司,付款人可能是 微信账户")
|
||||
@ -94,8 +97,8 @@ public class TradeDetail extends BaseEntity implements Serializable {
|
||||
@Schema(description = "订单总描述")
|
||||
private String description;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "状态: edit-编辑中, submit-提交. finish-完成, reject-打回")
|
||||
private String status;
|
||||
|
||||
|
||||
// @Schema(description = "在微信等支付网关创建支付订单时失败,返回的失败原因")
|
||||
|
||||
@ -28,4 +28,7 @@ public class PageListWalletRequest extends BasePageRequest {
|
||||
@Schema(description = "引入站点")
|
||||
private String stationCode;
|
||||
|
||||
@Schema(description = "客户电话")
|
||||
private String phone;
|
||||
|
||||
}
|
||||
|
||||
@ -56,4 +56,8 @@ public class BaseOrder extends IdEntity {
|
||||
* 支付的回调信息
|
||||
*/
|
||||
private String notifyInfo;
|
||||
/***
|
||||
* 交易编码
|
||||
*/
|
||||
private String tradeNo;
|
||||
}
|
||||
|
||||
@ -16,6 +16,8 @@ public enum OrderStatusEnums implements BaseEnum<Integer, String> {
|
||||
|
||||
FINISH(7, "已完成"),
|
||||
|
||||
SETTLEMENT_IN_PROGRESS(8, "结算中"),
|
||||
|
||||
CANCLE(9, "已取消"),
|
||||
|
||||
REFUND(-1, "订单退款"),
|
||||
|
||||
@ -9,6 +9,9 @@ public enum PayTypeEnums {
|
||||
ALIPAY(3, "支付宝"),
|
||||
|
||||
BANK(4, "网银"),
|
||||
CHARGING_COMPENSATION(5, "充电补偿"),
|
||||
|
||||
BUSINESS_TO_BUSINESS(6, "公对公"),
|
||||
|
||||
OTHER(9, "其他");
|
||||
|
||||
|
||||
@ -18,13 +18,13 @@ public enum SwapBatteryStepEnum implements BaseEnum<Integer, String>{
|
||||
|
||||
INSTITUTIONS_FOR_CHINA(3, "对中机构"),
|
||||
|
||||
GET_NEW_ELECTRICITY(4, "取新电"),
|
||||
DISMANTLE_OLD_ELECTRICITY(4, "拆旧电"),
|
||||
|
||||
DISMANTLE_OLD_ELECTRICITY(5, "拆旧电"),
|
||||
DISCHARGE_OLD_ELECTRICITY(5, "放旧电"),
|
||||
|
||||
INSTALL_NEW_ELECTRICITY(6, "装新电"),
|
||||
GET_NEW_ELECTRICITY(6, "取新电"),
|
||||
|
||||
DISCHARGE_OLD_ELECTRICITY(7, "放旧电"),
|
||||
INSTALL_NEW_ELECTRICITY(7, "装新电"),
|
||||
|
||||
COMPLETED(8, "完成"),
|
||||
|
||||
|
||||
@ -0,0 +1,203 @@
|
||||
package com.evotech.hd.common.core.excel;
|
||||
|
||||
import com.evotech.hd.common.core.excel.handler.ExcelFieldHandlerAdapter;
|
||||
import com.evotech.hd.common.core.excel.handler.ExcelHandlerAdapter;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 自定义导出Excel数据注解
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Excel
|
||||
{
|
||||
/**
|
||||
* 导出时在excel中排序
|
||||
*/
|
||||
public int sort() default Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 导出到Excel中的名字.
|
||||
*/
|
||||
public String name() default "";
|
||||
|
||||
/**
|
||||
* 日期格式, 如: yyyy-MM-dd
|
||||
*/
|
||||
public String dateFormat() default "";
|
||||
|
||||
/**
|
||||
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
|
||||
*/
|
||||
public String dictType() default "";
|
||||
|
||||
/**
|
||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||
*/
|
||||
public String readConverterExp() default "";
|
||||
|
||||
/**
|
||||
* 分隔符,读取字符串组内容
|
||||
*/
|
||||
public String separator() default ",";
|
||||
|
||||
/**
|
||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||
*/
|
||||
public int scale() default -1;
|
||||
|
||||
/**
|
||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||
*/
|
||||
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的高度
|
||||
*/
|
||||
public double height() default 14;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的宽度
|
||||
*/
|
||||
public double width() default 16;
|
||||
|
||||
/**
|
||||
* 文字后缀,如% 90 变成90%
|
||||
*/
|
||||
public String suffix() default "";
|
||||
|
||||
/**
|
||||
* 当值为空时,字段的默认值
|
||||
*/
|
||||
public String defaultValue() default "";
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
public String prompt() default "";
|
||||
|
||||
/**
|
||||
* 设置只能选择不能输入的列内容.
|
||||
*/
|
||||
public String[] combo() default {};
|
||||
|
||||
/**
|
||||
* 是否从字典读数据到combo,默认不读取,如读取需要设置dictType注解.
|
||||
*/
|
||||
public boolean comboReadDict() default false;
|
||||
|
||||
/**
|
||||
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||
*/
|
||||
public boolean needMerge() default false;
|
||||
|
||||
/**
|
||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||
*/
|
||||
public boolean isExport() default true;
|
||||
|
||||
/**
|
||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||
*/
|
||||
public String targetAttr() default "";
|
||||
|
||||
/**
|
||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||
*/
|
||||
public boolean isStatistics() default false;
|
||||
|
||||
/**
|
||||
* 导出类型(0数字 1字符串 2图片)
|
||||
*/
|
||||
public ColumnType cellType() default ColumnType.STRING;
|
||||
|
||||
/**
|
||||
* 导出列头背景颜色
|
||||
*/
|
||||
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||
|
||||
/**
|
||||
* 导出列头字体颜色
|
||||
*/
|
||||
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格背景颜色
|
||||
*/
|
||||
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格字体颜色
|
||||
*/
|
||||
public IndexedColors color() default IndexedColors.BLACK;
|
||||
|
||||
/**
|
||||
* 导出字段对齐方式
|
||||
*/
|
||||
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
public boolean customExcelField() default false;
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
public Class<?> excelFieldHandler() default ExcelFieldHandlerAdapter.class;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器参数
|
||||
*/
|
||||
public String[] args() default {};
|
||||
|
||||
/**
|
||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||
*/
|
||||
Type type() default Type.ALL;
|
||||
|
||||
public enum Type
|
||||
{
|
||||
ALL(0), EXPORT(1), IMPORT(2);
|
||||
private final int value;
|
||||
|
||||
Type(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ColumnType
|
||||
{
|
||||
NUMERIC(0), STRING(1), IMAGE(2), TEXT(3);
|
||||
private final int value;
|
||||
|
||||
ColumnType(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.evotech.hd.common.core.excel;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Excel注解集
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Excels
|
||||
{
|
||||
public Excel[] value();
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.evotech.hd.common.core.excel.handler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 特殊出具处理接口
|
||||
*
|
||||
* @ClassName:ExcelFieldHandlerAdapter
|
||||
* @date: 2025年07月12日 10:40
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
public interface ExcelFieldHandlerAdapter {
|
||||
|
||||
List<String> buildExcel();
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.evotech.hd.common.core.excel.handler;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
/**
|
||||
* Excel数据格式处理适配器
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public interface ExcelHandlerAdapter
|
||||
{
|
||||
/**
|
||||
* 格式化
|
||||
*
|
||||
* @param value 单元格数据值
|
||||
* @param args excel注解args参数组
|
||||
* @param cell 单元格对象
|
||||
* @param wb 工作簿对象
|
||||
*
|
||||
* @return 处理后的值
|
||||
*/
|
||||
Object format(Object value, String[] args, Cell cell, Workbook wb);
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.evotech.hd.common.core.utils;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 类
|
||||
*
|
||||
* @ClassName:DataUtils
|
||||
* @date: 2025年06月03日 10:25
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
|
||||
public class DataUtils {
|
||||
|
||||
public static final BigDecimal DEFAULT_VALUE = new BigDecimal(0);
|
||||
|
||||
|
||||
public static <T> T findDefaultValue(T v, T dv){
|
||||
if(ObjectUtils.isNotEmpty(v)){
|
||||
return v;
|
||||
}
|
||||
return dv;
|
||||
}
|
||||
|
||||
}
|
||||
@ -41,7 +41,7 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-integration</artifactId>
|
||||
|
||||
@ -3,13 +3,15 @@ package com.evotech.hd.cloud;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})
|
||||
@EnableDiscoveryClient
|
||||
@ComponentScan("com.evotech.hd.**")
|
||||
@MapperScan({"com.evotech.hd.cloud.dao.**", "com.evotech.hd.common.core.dao.**"})
|
||||
|
||||
@ -55,7 +55,7 @@ public class OrderPerController {
|
||||
@PostMapping("/cancel")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> cancelPre(@NotNull Integer id) {
|
||||
return orderSwapBatteryPreService.cancelPre(id, 3);
|
||||
return orderSwapBatteryPreService.updateStatusById(id, 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.evotech.hd.cloud.entity.vo.NativePayVO;
|
||||
import com.evotech.hd.cloud.service.OrderService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderBillListVo;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderDetailVo;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderListVo;
|
||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryStep;
|
||||
@ -83,22 +84,13 @@ public class OrderSwapBatteryController {
|
||||
|
||||
|
||||
|
||||
// @Operation(summary = "公司订单扫码支付")
|
||||
// @PostMapping({"/wechat/nativepay"})
|
||||
// @ApiOperationSupport(order = 13)
|
||||
// public Result<String> companyNativePay(@RequestBody NativePayVO prePay) {
|
||||
// return orderService.companyNativePay(prePay);
|
||||
// }
|
||||
|
||||
@Operation(summary = "公司订单余额支付")
|
||||
@PostMapping({"/companywallet/pay"})
|
||||
@ApiOperationSupport(order = 12)
|
||||
public Result<String> companyWalletPay(@RequestParam String orderNo, String wuid, String uname) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "公司订单扫码支付")
|
||||
@PostMapping({"/wechat/nativepay"})
|
||||
@ApiOperationSupport(order = 13)
|
||||
public Result<String> companyNativePay(@RequestBody NativePayVO prePay) {
|
||||
return orderService.companyNativePay(prePay);
|
||||
}
|
||||
|
||||
@Operation(summary = "扫码支付订单查询状态")
|
||||
@GetMapping("/paystatus/query")
|
||||
@ -141,4 +133,27 @@ public class OrderSwapBatteryController {
|
||||
return orderService.one(orderNo);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "电子对账单")
|
||||
@GetMapping("/bill/list")
|
||||
@ApiOperationSupport(order = 6)
|
||||
public Result<List<OrderBillListVo>> billList(String companyCode, String orderTimeEnd) {
|
||||
return orderService.billList(companyCode, orderTimeEnd);
|
||||
}
|
||||
|
||||
@Operation(summary = "下载电子对账单")
|
||||
@PostMapping("/bill/download")
|
||||
@ApiOperationSupport(order = 6)
|
||||
public void billDownload(String companyCode, String orderTimeEnd) {
|
||||
orderService.excelBillList(companyCode, orderTimeEnd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "公司订单扫码支付")
|
||||
@PostMapping({"/wechat/nativepay"})
|
||||
@ApiOperationSupport(order = 13)
|
||||
public Result<String> companyNativePay(@RequestBody NativePayVO prePay) {
|
||||
return orderService.companyNativePay(prePay);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,6 +50,20 @@ public class TradeController {
|
||||
public Result<Integer> update(@ParameterObject TradeDetail td) {
|
||||
return tradeService.update(td);
|
||||
}
|
||||
|
||||
@Operation(summary = "提交")
|
||||
@PostMapping({"/submit"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> submit(@ParameterObject TradeDetail td) {
|
||||
return tradeService.submit(td);
|
||||
}
|
||||
|
||||
@Operation(summary = "审核")
|
||||
@PostMapping({"/approve"})
|
||||
@ApiOperationSupport(order = 3)
|
||||
public Result<Integer> approve(Integer id, @RequestParam Integer type) {
|
||||
return tradeService.approve(id,type);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询")
|
||||
@GetMapping("/list")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,5 @@
|
||||
package com.evotech.hd.cloud.entity.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||
@ -12,6 +9,9 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(name = "Native下单参数")
|
||||
public class NativePayVO {
|
||||
@ -21,6 +21,7 @@ public class NativePayVO {
|
||||
|
||||
@Schema(description = "公司编码")
|
||||
private String ccode;
|
||||
private String companyCode;
|
||||
|
||||
@Schema(description = "订单总描述", requiredMode = RequiredMode.REQUIRED)
|
||||
@NotBlank
|
||||
@ -59,5 +60,7 @@ public class NativePayVO {
|
||||
|
||||
@Schema(description = "用户设备型号")
|
||||
private String deviceId;
|
||||
@Schema(description = "订单结束时间")
|
||||
String orderTimeEnd;
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,8 @@ public enum EventFunctionTypesEnum {
|
||||
FUN_CHARGE_RECORD("chargeRecord", "chargeRecordConf", "充电事件记录"),
|
||||
FUN_SWAP_RECORD("swapRecord", "swapRecordConf", "换电事件记录"),
|
||||
FUN_WARN_RECORD("faultRecord", "faultRecordConf", "故障告警事件记录"),
|
||||
FUN_ORDEREVENT("swapComplete", "swapCompleteConfirm", " 站端换电完成事件");
|
||||
FUN_ORDEREVENT("swapComplete", "swapCompleteConfirm", " 站端换电完成事件"),
|
||||
FUN_PUSH_STATION_CONTRNL_DATA("", "pushReservation", " 推送站端事件");
|
||||
String function;
|
||||
String reFunction;
|
||||
|
||||
|
||||
@ -19,6 +19,14 @@ public class MessageTopic implements Serializable {
|
||||
|
||||
private String messageType;
|
||||
|
||||
public MessageTopic() {
|
||||
}
|
||||
|
||||
public MessageTopic( String stationCode, String messageType) {
|
||||
this.stationCode = stationCode;
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return businessType + "/" + stationCode + "/" + dataDirection + "/" + messageType;
|
||||
|
||||
@ -23,7 +23,7 @@ public interface MqttStrategyEventExchangeProcessor extends MqttStrategyExchange
|
||||
|
||||
|
||||
default void sendAESMessage(MessageTopic topic, MqttMessageHeader header, EventFunctionTypesEnum typesEnum, MqttResponse response){
|
||||
topic.setMessageType(MqttMessageTypeEnum.CONFIRM.getType());
|
||||
topic.setMessageType(MqttMessageTypeEnum.EVENT.getType());
|
||||
header.setFunction(typesEnum.getReFunction());
|
||||
logger.info("\r\n=====>>>回复站端的EVENT消息--MQTT发送到消息主题:{},头部信息:{},message:{}", topic,header, JSONUtil.parseObj(response, new JSONConfig().setDateFormat(DatePattern.NORM_DATETIME_PATTERN)));
|
||||
sendAESMessage(topic, header, response);
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.evotech.hd.cloud.open;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类
|
||||
*
|
||||
* @ClassName:OpenParams
|
||||
* @date: 2025年08月19日 15:10
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Data
|
||||
public class OpenParams {
|
||||
|
||||
private String stationCode;
|
||||
private String sign;
|
||||
private String data;
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.evotech.hd.cloud.open;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.asymmetric.Sign;
|
||||
import cn.hutool.crypto.asymmetric.SignAlgorithm;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.evotech.hd.cloud.open.processor.StrategyFactory;
|
||||
import com.evotech.hd.cloud.service.BatteryStationSecretKeyService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 类
|
||||
*
|
||||
* @ClassName:OpenStationController
|
||||
* @date: 2025年08月19日 15:07
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/open/station")
|
||||
public class OpenStationController {
|
||||
@Autowired
|
||||
BatteryStationSecretKeyService batteryStationSecretKeyService;
|
||||
@Autowired
|
||||
private StrategyFactory strategyFactory;
|
||||
|
||||
@PostMapping("/message")
|
||||
public Result message(@Valid @RequestBody OpenParams params){
|
||||
Map<String, String> secretKeyMap = batteryStationSecretKeyService.getStationSecretKeyByStationCode(params.getStationCode());
|
||||
if(Collections.isEmpty(secretKeyMap)){
|
||||
return Result.getInstance().error("未找到当前站端的秘钥信息");
|
||||
}
|
||||
Sign verifier = SecureUtil.sign(SignAlgorithm.SHA256withRSA, null, secretKeyMap.get(HDConstant.PUBLIC_KEY));
|
||||
if(!verifier.verify(params.getData().getBytes(), Base64.getDecoder().decode(params.getSign()))){
|
||||
return Result.getInstance().error("当前信息已被篡改");
|
||||
}
|
||||
return strategyFactory.exchange(JSONObject.parseObject(params.getData()));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.evotech.hd.cloud.open.processor;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 站控消息处理接口
|
||||
*
|
||||
* @ClassName:StationMessageStrategyExchangeProcessor
|
||||
* @date: 2025年08月20日 10:16
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
|
||||
public interface StationMessageStrategyExchangeProcessor {
|
||||
|
||||
default boolean accept(String method){
|
||||
return getMethod().stream().filter(data-> data.equalsIgnoreCase(method)).count() > 0;
|
||||
}
|
||||
|
||||
/***
|
||||
* 默认读取子类除exchange 以外 所有的method
|
||||
* 可以继承复写
|
||||
* 如 StationRunningStatusProcessor 子类之有一个exchange 可以复写
|
||||
* @return
|
||||
*/
|
||||
default List<String> getMethod(){
|
||||
return Arrays.stream(this.getClass().getMethods()).filter(data-> !data.getName().equalsIgnoreCase("exchange")).map(data -> data.getName()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/***
|
||||
* 默认读取子类除exchange 以外 所有的method
|
||||
* 可以继承复写
|
||||
* 如 StationRunningStatusProcessor 子类之有一个exchange 可以复写
|
||||
* @return
|
||||
*/
|
||||
default Result exchange(JSONObject json) throws Exception{
|
||||
Method method = this.getClass().getMethod(json.getString("method"), JSONObject.class);
|
||||
return (Result) method.invoke(this, json);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.evotech.hd.cloud.open.processor;
|
||||
|
||||
/**
|
||||
* 类
|
||||
*
|
||||
* @ClassName:StrategyFactory
|
||||
* @date: 2025年08月21日 14:11
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* 策略工厂
|
||||
*/
|
||||
@Component
|
||||
public class StrategyFactory implements InitializingBean, ApplicationContextAware {
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private static final Map<String, StationMessageStrategyExchangeProcessor> CONTEXT = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet(){
|
||||
// 手动将所有实现注册到工厂容器
|
||||
applicationContext.getBeansOfType(StationMessageStrategyExchangeProcessor.class)
|
||||
.values()
|
||||
.forEach(exchange -> CONTEXT.putIfAbsent(exchange.getClass().getSimpleName().toLowerCase(), exchange));
|
||||
}
|
||||
|
||||
public Result exchange(JSONObject json) {
|
||||
try {
|
||||
StationMessageStrategyExchangeProcessor processor = CONTEXT.get(json.getString("class").toLowerCase());
|
||||
if (ObjectUtils.isEmpty(processor)){
|
||||
return Result.getInstance().error("当前接口不存在");
|
||||
}
|
||||
if(processor.accept(json.getString("method"))){
|
||||
return processor.exchange(json);
|
||||
}
|
||||
return Result.getInstance().error("当前method不存在");
|
||||
} catch (Exception e) {
|
||||
Throwable realException = e.getCause(); // 获取实际的异常
|
||||
realException.printStackTrace();
|
||||
e.printStackTrace();
|
||||
return Result.getInstance().error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.evotech.hd.cloud.open.processor.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.evotech.hd.cloud.mqtt.enums.StateFunctionTypesEnum;
|
||||
import com.evotech.hd.cloud.open.processor.StationMessageStrategyExchangeProcessor;
|
||||
import com.evotech.hd.cloud.service.BatteryStationService;
|
||||
import com.evotech.hd.common.constant.MongoConstant;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.evotech.hd.common.documnet.StationState;
|
||||
import com.evotech.hd.common.service.MongoDBService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 告警信息处理类
|
||||
*
|
||||
* @ClassName:AlarmProcessor
|
||||
* @date: 2025年08月23日 14:58
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AlarmProcessor implements StationMessageStrategyExchangeProcessor {
|
||||
|
||||
@Resource
|
||||
BatteryStationService batteryStationService;
|
||||
@Resource
|
||||
MongoDBService mongoDBService;
|
||||
|
||||
@Override
|
||||
public List<String> getMethod() {
|
||||
return Collections.asList("alarmMessage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result exchange(JSONObject json) {
|
||||
// BatteryStation batteryStation = batteryStationDao.selectOne(new LambdaQueryWrapper<BatteryStation>().eq(BatteryStation::getCode, json.getString("stationCode")), false);
|
||||
try {
|
||||
/***
|
||||
* state: 获取运行状态 1-运营;2-调试;3-检修;
|
||||
* smoke: 获取烟感告警信号, 多个烟感状态,分割, 每个代表一个烟感的状态 0-未知;1-正常;2-告警
|
||||
* fire: 获取消防告警信号 0-未知;1-正常;2-告警
|
||||
*/
|
||||
batteryStationService.updateStatusByAlarm(json.getString("stationCode"), json.getInteger("state"), json.getString("smoke"), json.getInteger("fire"));
|
||||
} catch (Exception e) {
|
||||
log.error("更改云端数据信息出错"+e.getMessage());
|
||||
}finally {
|
||||
StationState document = new StationState(json.toJSONString());
|
||||
document.setId(String.valueOf(System.currentTimeMillis()));
|
||||
document.setStationCode(json.getString("stationCode"));
|
||||
mongoDBService.save(MongoConstant.STATION_INFO_BASE, StateFunctionTypesEnum.FUN_STATION_STATE.getFunction(), document);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.evotech.hd.cloud.open.processor.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationDao;
|
||||
import com.evotech.hd.cloud.open.processor.StationMessageStrategyExchangeProcessor;
|
||||
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
||||
import com.evotech.hd.cloud.service.WechatUserService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站端新增预约订单
|
||||
*
|
||||
* @ClassName:AddOrderSwapBatteryPreProcessor
|
||||
* @date: 2025年08月20日 15:56
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Service
|
||||
public class OrderSwapBatteryPreProcessor implements StationMessageStrategyExchangeProcessor {
|
||||
@Resource
|
||||
WechatUserService wechatUserService;
|
||||
@Resource
|
||||
private BatteryStationDao batteryStationDao;
|
||||
@Resource
|
||||
OrderSwapBatteryPreService orderSwapBatteryPreService;
|
||||
|
||||
/***
|
||||
* 取消预约单, 禁止删除, 反射调用
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Result orderSwapBatteryPreUpdateStatus(JSONObject json){
|
||||
return orderSwapBatteryPreService.updateStatusById(json.getInteger("pkId"), json.getInteger("status"));
|
||||
}
|
||||
|
||||
/***
|
||||
* 新增预约单 禁止删除, 反射调用
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Result orderSwapBatteryPreAdd(JSONObject json){
|
||||
BatteryStation batteryStation = batteryStationDao.selectOne(new LambdaQueryWrapper<BatteryStation>().eq(BatteryStation::getCode, json.getString("stationCode")), false);
|
||||
if(ObjectUtils.isEmpty(batteryStation)){
|
||||
return Result.getInstance().error("未找到站点信息, 站端编码异常");
|
||||
}
|
||||
OrderSwapBatteryPre orderSwapBatteryPre = JSONObject.parseObject(json.toJSONString(), OrderSwapBatteryPre.class);
|
||||
//添加预约单
|
||||
WechatUser wechatUser =wechatUserService.selectUcode(orderSwapBatteryPre.getPhone(),orderSwapBatteryPre.getUname());
|
||||
if(ObjectUtils.isEmpty(wechatUser)){
|
||||
return Result.getInstance().error("未找到预约人信息");
|
||||
}
|
||||
orderSwapBatteryPre.setUcode(wechatUser.getWuid());
|
||||
orderSwapBatteryPre.setUname(wechatUser.getName());
|
||||
orderSwapBatteryPre.setSourceId(String.valueOf(batteryStation.getPkId()));
|
||||
Result<Boolean> saveResult = orderSwapBatteryPreService.addOrderSwapBatteryPre(orderSwapBatteryPre);
|
||||
if(saveResult.getData()){
|
||||
return Result.getInstance().build(JSONObject.class).success(JSONObject.parseObject(JSONObject.toJSONString(orderSwapBatteryPre)));
|
||||
}
|
||||
return Result.getInstance().build(JSONObject.class).error(saveResult.getMsg());
|
||||
}
|
||||
|
||||
/***
|
||||
* 查询预约单, 禁止删除, 反射调用
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Result findOrderSwapBatteryPre(JSONObject json){
|
||||
try {
|
||||
Date limitDate = json.getDate("limitDate");
|
||||
LambdaQueryWrapper<OrderSwapBatteryPre> query = new LambdaQueryWrapper<OrderSwapBatteryPre>().eq(OrderSwapBatteryPre::getStationCode, json.getString("stationCode")).eq(OrderSwapBatteryPre::getStatus,1).ne(OrderSwapBatteryPre::getSource,3);
|
||||
if(limitDate != null){
|
||||
query.apply(" DATE_FORMAT(reservation_time,'%Y-%m-%d') >= {0}", DateFormatUtils.format(limitDate, "yyyy-MM-dd"));
|
||||
}
|
||||
List<OrderSwapBatteryPre> orderSwapBatteryPre = orderSwapBatteryPreService.list(query);
|
||||
return Result.getInstance().build(JSONArray.class).success((JSONArray)JSONArray.toJSON(orderSwapBatteryPre));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.getInstance().build(JSONObject.class).error("查询云端预约单信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.evotech.hd.cloud.open.processor.impl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.evotech.hd.cloud.mqtt.message.MessageTopic;
|
||||
import com.evotech.hd.cloud.mqtt.message.processor.strategy.impl.state.MqttStateSwapStepDataExchangeProcessor;
|
||||
import com.evotech.hd.cloud.open.processor.StationMessageStrategyExchangeProcessor;
|
||||
import com.evotech.hd.cloud.service.OrderService;
|
||||
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.ResultUtil;
|
||||
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.OrderStatusEnums;
|
||||
import com.evotech.hd.common.core.enums.SwapBatteryStepEnum;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.evotech.hd.common.redis.utils.RedisServiceUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 换电订单类
|
||||
*
|
||||
* @ClassName:OrderSwapProcessor
|
||||
* @date: 2025年08月21日 13:19
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Service
|
||||
public class OrderSwapProcessor implements StationMessageStrategyExchangeProcessor {
|
||||
@Resource
|
||||
OrderSwapBatteryPreService orderSwapBatteryPreService;
|
||||
@Resource
|
||||
OrderService orderService;
|
||||
@Resource
|
||||
private OrderSwapBatteryStepService orderSwapBatteryStepService;
|
||||
@Resource
|
||||
private MqttStateSwapStepDataExchangeProcessor mqttStateSwapStepDataExchangeProcessor;
|
||||
|
||||
/***
|
||||
* 新增换电单 禁止删除, 反射调用
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Result orderSwapAdd(JSONObject json){
|
||||
String errorMsg = "";
|
||||
OrderSwapBatteryPre orderSwapBatteryPre = orderSwapBatteryPreService.getById(json.getInteger("preId"));
|
||||
Order order = orderService.getOne(new LambdaQueryWrapper<Order>()
|
||||
.eq(Order::getPlateNum, orderSwapBatteryPre.getPlateNum())
|
||||
.eq(Order::getStationCode, orderSwapBatteryPre.getStationCode())
|
||||
.eq(Order::getOrderPreId, orderSwapBatteryPre.getPkId())
|
||||
.in(Order::getStatus, Collections.asList(OrderStatusEnums.CREATE.getCode(), OrderStatusEnums.SWAP.getCode())));
|
||||
if (ObjectUtils.isNotEmpty(order)) {
|
||||
return Result.getInstance().build(JSONObject.class).success((JSONObject)JSONObject.toJSON(order));
|
||||
}else{
|
||||
Result<Order> result = orderService.addOrderByPre(orderSwapBatteryPre);
|
||||
//如果不等于成功
|
||||
if(ResultUtil.verifyCode(result)){
|
||||
order = result.getData();
|
||||
//走到此处, 证明上面逻辑没有问题, 需要删除预约单过期标识
|
||||
RedisServiceUtils.del("preorder:expire:"+orderSwapBatteryPre.getPkId());
|
||||
//更新预约单为到店使用
|
||||
orderSwapBatteryPre.setStatus(2);
|
||||
orderSwapBatteryPreService.updateById(orderSwapBatteryPre);
|
||||
orderSwapBatteryStepService.addOrderSwapBatteryStepBySwapComplete(order.getOrderNo(), SwapBatteryStepEnum.VEHICLES_ENTER_STATION.getKey(), new Date());
|
||||
return Result.getInstance().build(JSONObject.class).success((JSONObject)JSONObject.toJSON(order));
|
||||
}
|
||||
errorMsg = result.getMsg();
|
||||
}
|
||||
return Result.getInstance().build(JSONObject.class).error(errorMsg, null);
|
||||
}
|
||||
|
||||
/***
|
||||
* 车辆到位信息
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public Result arrivalSignal(JSONObject json){
|
||||
try {
|
||||
Order order = orderService.getById(json.getInteger("preId"));
|
||||
json.put("orderNo", order.getOrderNo());
|
||||
mqttStateSwapStepDataExchangeProcessor.exchange(new MessageTopic(json.getString("stationCode")+"_WEB站推送", "http"), null, JSONUtil.parseObj(json.toJSONString()));
|
||||
return Result.getInstance().build(Boolean.class).success(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();;
|
||||
return Result.getInstance().build(Boolean.class).error(e.getMessage(), null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.evotech.hd.cloud.open.processor.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationDao;
|
||||
import com.evotech.hd.cloud.open.processor.StationMessageStrategyExchangeProcessor;
|
||||
import com.evotech.hd.cloud.service.BatteryStationService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站端调整运行.停运状态
|
||||
*
|
||||
* @ClassName:StationRunningStatusProcessor
|
||||
* @date: 2025年08月20日 10:18
|
||||
* @author: andy.shi
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Service
|
||||
public class StationRunningStatusProcessor implements StationMessageStrategyExchangeProcessor {
|
||||
|
||||
@Autowired
|
||||
BatteryStationService batteryStationService;
|
||||
@Resource
|
||||
private BatteryStationDao batteryStationDao;
|
||||
|
||||
@Override
|
||||
public List<String> getMethod() {
|
||||
return Collections.asList("updateStationRunningStatus");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result exchange(JSONObject json) {
|
||||
BatteryStation batteryStation = batteryStationDao.selectOne(new LambdaQueryWrapper<BatteryStation>().eq(BatteryStation::getCode, json.getString("stationCode")), false);
|
||||
if(ObjectUtils.isEmpty(batteryStation)){
|
||||
return Result.getInstance().error("未找到站点信息, 站端编码异常");
|
||||
}
|
||||
//修改运行状态, 1为正常运营, 4为指令停运
|
||||
batteryStation.setStatus(json.getBoolean("status") ? 1 : 4);
|
||||
return batteryStationService.update(batteryStation);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.evotech.hd.cloud.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface BatteryStationSecretKeyService {
|
||||
|
||||
public Map<String, String> getStationSecretKeyByStationCode(String stationCode);
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.evotech.hd.cloud.entity.vo.NativePayVO;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderBillListVo;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderDetailVo;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderListVo;
|
||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
||||
@ -76,4 +77,8 @@ public interface OrderService extends IService<Order> {
|
||||
Result<Order> one(String orderNo);
|
||||
|
||||
Result<OrderDetailVo> getOneByOrderNo(String orderNo);
|
||||
|
||||
Result<List<OrderBillListVo>> billList(String companyCode, String orderTimeEnd);
|
||||
|
||||
void excelBillList(String companyCode, String orderTimeEnd);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ public interface OrderSwapBatteryPreService extends IService<OrderSwapBatteryPre
|
||||
|
||||
public Result<Page<OrderSwapBatteryPre>> list(PageListSwapOrderPreRequest plsopr);
|
||||
|
||||
public Result<Integer> cancelPre(Integer id, Integer status);
|
||||
public Result<Integer> updateStatusById(Integer id, Integer status);
|
||||
|
||||
List<OrderSwapBatteryPre> findOrderSwapBatteryPreList(String stationCode);
|
||||
|
||||
|
||||
@ -15,7 +15,11 @@ public interface TradeService extends IService<TradeDetail> {
|
||||
public Result<Integer> delete(Integer id);
|
||||
|
||||
public Result<Integer> update(TradeDetail td);
|
||||
|
||||
|
||||
public Result<Integer> submit(TradeDetail td);
|
||||
|
||||
public Result<Integer> approve(Integer id, Integer type);
|
||||
|
||||
public Result<Page<TradeDetail>> list(PageListTradeRequest pltr);
|
||||
|
||||
public List<TradeDetail> tradeList(PageListTradeRequest pltr);
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package com.evotech.hd.cloud.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationSecretKeyDao;
|
||||
import com.evotech.hd.cloud.entity.BatteryStationSecretKey;
|
||||
import com.evotech.hd.cloud.service.BatteryStationSecretKeyService;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BatteryStationSecretKeyServiceImpl implements BatteryStationSecretKeyService {
|
||||
|
||||
|
||||
@Resource
|
||||
private BatteryStationSecretKeyDao batteryStationSecretKeyDao;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, String> getStationSecretKeyByStationCode(String stationCode) {
|
||||
BatteryStationSecretKey existingKey = batteryStationSecretKeyDao.selectOne(
|
||||
new QueryWrapper<BatteryStationSecretKey>()
|
||||
.eq("type", 1)
|
||||
.eq("station_code", stationCode),
|
||||
false
|
||||
);
|
||||
if (existingKey != null) {
|
||||
// 如果存在密钥对,则直接返回
|
||||
return Collections.asMap(HDConstant.PUBLIC_KEY, existingKey.getPublicKey(),HDConstant.PRIVATE_KEY, existingKey.getPrivateKey());
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ package com.evotech.hd.cloud.service.impl;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.crypto.KeyUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.asymmetric.AsymmetricAlgorithm;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -188,7 +188,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
return new Result<Map<String, String>>().success(map);
|
||||
} else {
|
||||
// 如果不存在密钥对,则生成新的密钥对
|
||||
KeyPair keyPair = KeyUtil.generateKeyPair(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue());
|
||||
KeyPair keyPair = SecureUtil.generateKeyPair(AsymmetricAlgorithm.RSA.getValue());
|
||||
// 将私钥转换为Base64编码的字符串
|
||||
String privatekeyBase64String = Base64.getEncoder().encodeToString(keyPair.getPrivate().getEncoded());
|
||||
// 将公钥转换为Base64编码的字符串
|
||||
@ -373,7 +373,7 @@ public class BatteryStationServiceImpl implements BatteryStationService {
|
||||
//如果消防没有报警, 检查烟感
|
||||
if(!isAlarm){
|
||||
//因为烟感有多个, 所以一个烟感报警,及存在报警信息
|
||||
isAlarm = Collections.asList(smoke.split(",")).contains(MongoConstant.ErrorCode.STATION_ALARM_CODE);
|
||||
isAlarm = org.apache.commons.lang3.StringUtils.isNotEmpty(smoke) && Collections.asList(smoke.split(",")).contains(MongoConstant.ErrorCode.STATION_ALARM_CODE);
|
||||
if(isAlarm){
|
||||
alarmMsg.append("烟感报警");
|
||||
}
|
||||
|
||||
@ -21,11 +21,13 @@ import com.evotech.hd.common.core.entity.cloud.*;
|
||||
import com.evotech.hd.common.core.entity.resource.ProxyOperater;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.evotech.hd.common.core.utils.DataUtils;
|
||||
import com.evotech.hd.common.documnet.StationState;
|
||||
import com.evotech.hd.common.redis.utils.RedisUtil;
|
||||
import com.evotech.hd.common.service.MongoDBService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -235,7 +237,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
//待结算订单数量
|
||||
data.setPendingOrderNum(Long.valueOf(orderInfo.size()));
|
||||
//待结算订单金额
|
||||
data.setPendingOrderAmount(orderInfo.stream().collect(Collectors.summingDouble( i-> i.getSwapAmount())));
|
||||
data.setPendingOrderAmount(orderInfo.stream().collect(Collectors.summingDouble( i-> DataUtils.findDefaultValue(i.getSwapAmount(), DataUtils.DEFAULT_VALUE.doubleValue()))));
|
||||
//待结算订单信息
|
||||
data.setOrderList(orderInfo);
|
||||
|
||||
@ -253,16 +255,29 @@ public class HomeServiceImpl implements HomeService {
|
||||
if(Collections.isNotEmpty(alarmList)){
|
||||
StationState stationState= alarmList.get(0);
|
||||
//报警信息
|
||||
JSONObject alarmJSONObject = JSONObject.parseObject(alarmList.get(0).getValue());
|
||||
JSONObject alarmJSONObject = JSONObject.parseObject(stationState.getValue());
|
||||
Integer fire = alarmJSONObject.getInteger("fire");
|
||||
if(MongoConstant.ErrorCode.STATION_ALARM_CODE.equals(fire)){
|
||||
alarm.setAlarmType("消防告警");
|
||||
}else{
|
||||
String smoke = alarmJSONObject.getString("smoke");
|
||||
if(Collections.asList(smoke.split(",")).contains(String.valueOf(MongoConstant.ErrorCode.STATION_ALARM_CODE))){
|
||||
alarm.setAlarmType("烟感告警");
|
||||
}
|
||||
List<String> alarmMessage = Collections.emptyList();
|
||||
if(ObjectUtils.isNotEmpty(fire) && MongoConstant.ErrorCode.STATION_ALARM_CODE.equals(fire)){
|
||||
alarmMessage.add("消防告警");
|
||||
}
|
||||
String smoke = alarmJSONObject.getString("smoke");
|
||||
if(StringUtils.isNotEmpty(smoke) && Collections.asList(smoke.split(",")).contains(String.valueOf(MongoConstant.ErrorCode.STATION_ALARM_CODE))){
|
||||
alarmMessage.add("烟感告警");
|
||||
}
|
||||
Integer water = alarmJSONObject.getInteger("water");
|
||||
if(ObjectUtils.isNotEmpty(water) && MongoConstant.ErrorCode.STATION_ALARM_CODE.equals(water)){
|
||||
alarmMessage.add("水浸告警");
|
||||
}
|
||||
Integer thunder = alarmJSONObject.getInteger("thunder");
|
||||
if(ObjectUtils.isNotEmpty(thunder) && MongoConstant.ErrorCode.STATION_ALARM_CODE.equals(thunder)){
|
||||
alarmMessage.add("雷击信号");
|
||||
}
|
||||
Integer stop = alarmJSONObject.getInteger("stop");
|
||||
if(ObjectUtils.isNotEmpty(stop) && MongoConstant.ErrorCode.STATION_ALARM_CODE.equals(stop)){
|
||||
alarmMessage.add("急停信号");
|
||||
}
|
||||
alarm.setAlarmType(String.join(";", alarmMessage));
|
||||
alarm.setAlarmTime(DateUtil.format(new Date(Long.valueOf(stationState.getId())), "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
});
|
||||
|
||||
@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -28,9 +29,11 @@ import com.evotech.hd.cloud.service.TradeService;
|
||||
import com.evotech.hd.cloud.service.WalletAccountService;
|
||||
import com.evotech.hd.cloud.service.rpc.WechatService;
|
||||
import com.evotech.hd.cloud.utils.CommonUtil;
|
||||
import com.evotech.hd.cloud.utils.ExcelUtil;
|
||||
import com.evotech.hd.cloud.utils.ParamServiceUtils;
|
||||
import com.evotech.hd.cloud.utils.components.SwapOrderBasicFeeComponent;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderBillListVo;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderDetailVo;
|
||||
import com.evotech.hd.common.core.Dto.order.OrderListVo;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
@ -41,10 +44,15 @@ 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.order.Order;
|
||||
import com.evotech.hd.common.core.entity.order.OrderDetail;
|
||||
import com.evotech.hd.common.core.entity.resource.auth.AuthUser;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.common.core.enums.OrderStatusEnums;
|
||||
import com.evotech.hd.common.core.enums.PayTypeEnums;
|
||||
import com.evotech.hd.common.core.enums.TradeTypeEnums;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.evotech.hd.common.core.utils.DataUtils;
|
||||
import com.evotech.hd.common.permission.util.RedisPermissionUtils;
|
||||
import com.evotech.hd.common.permission.util.SpringUtil;
|
||||
import com.evotech.hd.common.redis.utils.RedisServiceUtils;
|
||||
import com.evotech.hd.common.web.util.EnumUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -115,8 +123,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements Or
|
||||
.ge(ObjectUtils.isNotEmpty(plsor.getOrderTimeBegin()), Order::getOrderTime, plsor.getOrderTimeBegin())
|
||||
.le(ObjectUtils.isNotEmpty(plsor.getOrderTimeEnd()), Order::getOrderTime, plsor.getOrderTimeEnd())
|
||||
.eq(StringUtils.isNotEmpty(plsor.getStationCode()), Order::getStationCode, plsor.getStationCode())
|
||||
.eq(StringUtils.isNotEmpty(plsor.getTradeNo()), Order::getNotifyOrderNo, plsor.getTradeNo())
|
||||
.eq(StringUtils.isNotEmpty(plsor.getTradeNo()), Order::getTradeNo, plsor.getTradeNo())
|
||||
.eq(StringUtils.isNotEmpty(plsor.getStatus()), Order::getStatus, plsor.getStatus())
|
||||
.eq(StringUtils.isNotEmpty(plsor.getUserId()), Order::getPreWechatId, plsor.getUserId())
|
||||
.ne(Order::getDelFlag, 1)
|
||||
.orderByDesc(Order::getOrderTime));
|
||||
|
||||
@ -379,7 +388,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements Or
|
||||
// 修改订单状态
|
||||
order.setStatus(OrderStatusEnums.FINISH.getCode());
|
||||
//交易编码
|
||||
//order.setTradeNo(trade.getOutTradeNo());
|
||||
order.setTradeNo(trade.getOutTradeNo());
|
||||
order.setUpdateTime(new Date());
|
||||
orderDao.updateById(order);
|
||||
log.info("订单支付成功, 订单编号: {}", order.getOrderNo());
|
||||
@ -393,8 +402,20 @@ public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements Or
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> companyNativePay(NativePayVO prePay) {
|
||||
return wechatService.wechatNativePay(prePay);
|
||||
public Result<String> companyNativePay(NativePayVO prePay) {
|
||||
|
||||
List<Order> list = getBaseMapper().findBillList(prePay.getCcode(), prePay.getOrderTimeEnd());
|
||||
if(Collections.isNotEmpty(list)){
|
||||
prePay.setTotal(list.stream().collect(Collectors.summingDouble(d-> DataUtils.findDefaultValue(d.getOrderAmount(), DataUtils.DEFAULT_VALUE.intValue()))).intValue());
|
||||
prePay.setTotal(1);
|
||||
Result<String> result = wechatService.wechatNativePay(prePay);
|
||||
if(CodeMsg.SUCCESS.getCode().equals(result.getCode())){
|
||||
JSONObject res = JSON.parseObject(result.getData());
|
||||
settlementInProgress(list, res.getString("OutTradeNo"), PayTypeEnums.WECHAT.getCode());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return Result.getInstance().build(String.class).error("为找到订单信息");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -427,21 +448,20 @@ public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements Or
|
||||
@Override
|
||||
public Result<Integer> checkList(PageListSwapOrderRequest plsor) {
|
||||
Page<Order> page = new Page<Order>(plsor.getPageNo(), plsor.getPageSize());
|
||||
List<Integer> statusList = new ArrayList<>();
|
||||
String strs = "1,2,3,4,5,6";
|
||||
if (StringUtils.isBlank(strs)) {//订单状态"已完成"之前的状态
|
||||
statusList = Arrays.asList(strs.split(",")).stream().map(Integer::valueOf).toList();
|
||||
}
|
||||
// String strs = "1,2,3,4,5,6";
|
||||
// if (StringUtils.isBlank(strs)) {//订单状态"已完成"之前的状态
|
||||
// statusList = Arrays.asList(strs.split(",")).stream().map(Integer::valueOf).toList();
|
||||
// }
|
||||
page = orderDao.selectPage(page, new QueryWrapper<Order>()
|
||||
.eq(StringUtils.isBlank(plsor.getOrderNo()), "order_no", plsor.getOrderNo())
|
||||
.eq(StringUtils.isBlank(plsor.getPlateNum()), "plate_num", plsor.getPlateNum())
|
||||
.in(!statusList.isEmpty(), "status", statusList)
|
||||
.eq(StringUtils.isNotBlank(plsor.getOrderNo()), "order_no", plsor.getOrderNo())
|
||||
.eq(StringUtils.isNotBlank(plsor.getPlateNum()), "plate_num", plsor.getPlateNum())
|
||||
.in("status", Collections.asList(1,2,3,4,5,6))
|
||||
.ge(plsor.getOrderTimeBegin() != null, "order_time", plsor.getOrderTimeBegin())
|
||||
.le(plsor.getOrderTimeEnd() != null, "order_time", plsor.getOrderTimeEnd())
|
||||
.eq(StringUtils.isBlank(plsor.getStationCode()), "station_code", plsor.getStationCode())
|
||||
.like(StringUtils.isBlank(plsor.getStationName()), "station_name", plsor.getStationName())
|
||||
.eq(StringUtils.isBlank(plsor.getUserId()), "order_pre_uid", plsor.getUserId())
|
||||
.eq(StringUtils.isBlank(plsor.getTradeNo()), "trade_no", plsor.getTradeNo())
|
||||
.eq(StringUtils.isNotBlank(plsor.getStationCode()), "station_code", plsor.getStationCode())
|
||||
.like(StringUtils.isNotBlank(plsor.getStationName()), "station_name", plsor.getStationName())
|
||||
.eq(StringUtils.isNotBlank(plsor.getUserId()), "pre_wechat_id", plsor.getUserId())
|
||||
.eq(StringUtils.isNotBlank(plsor.getTradeNo()), "trade_no", plsor.getTradeNo())
|
||||
.ne("del_flag", 1)
|
||||
.orderByDesc("pk_id"));
|
||||
if (!page.getRecords().isEmpty()) {
|
||||
@ -449,8 +469,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements Or
|
||||
}
|
||||
Page<OrderSwapBatteryPre> page1 = new Page<OrderSwapBatteryPre>(plsor.getPageNo(), plsor.getPageSize());
|
||||
page1 = orderSwapBatteryPreDao.selectPage(page1, new QueryWrapper<OrderSwapBatteryPre>()
|
||||
.eq(StringUtils.isBlank("1"), "status", "1")
|
||||
.eq(StringUtils.isBlank(plsor.getPlateNum()), "plate_num", plsor.getPlateNum())
|
||||
.eq("status", "1")
|
||||
.eq(StringUtils.isNotBlank(plsor.getPlateNum()), "plate_num", plsor.getPlateNum())
|
||||
.orderByDesc("pk_id"));
|
||||
if (!page1.getRecords().isEmpty()) {
|
||||
return new Result<Integer>().error("该车辆有预约成功的订单,请处理后重试!");
|
||||
@ -514,6 +534,90 @@ public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements Or
|
||||
BeanUtils.copyProperties(orderDetail, orderDetailVo);
|
||||
return new Result<OrderDetailVo>().success(orderDetailVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<OrderBillListVo>> billList(String companyCode, String orderTimeEnd) {
|
||||
|
||||
List<OrderBillListVo> resultList = Collections.emptyList();
|
||||
|
||||
List<Order> list = getBaseMapper().findBillList(companyCode, orderTimeEnd);
|
||||
if(Collections.isNotEmpty(list)){
|
||||
Map<String, List<Order>> dataMap = list.stream().collect(Collectors.groupingBy(d->d.getPlateNum()));
|
||||
|
||||
for(List<Order> mapList : dataMap.values()){
|
||||
OrderBillListVo result = new OrderBillListVo();
|
||||
result.setPlateNum(mapList.get(0).getPlateNum());
|
||||
result.setOrderTotalAmount(mapList.stream().collect(Collectors.summingDouble(d-> DataUtils.findDefaultValue(d.getOrderAmount(), DataUtils.DEFAULT_VALUE.intValue()))));
|
||||
result.setStatus(mapList.get(0).getStatus());
|
||||
result.setOrderNum(mapList.size());
|
||||
List<OrderBillListVo> childList = Collections.emptyList();
|
||||
for(Order order : mapList){
|
||||
OrderBillListVo resultChild = new OrderBillListVo();
|
||||
BeanUtils.copyProperties(order, resultChild);
|
||||
resultChild.setPreName(order.getOrderPreUname());
|
||||
childList.add(resultChild);
|
||||
}
|
||||
result.setChildList(childList);
|
||||
resultList.add(result);
|
||||
}
|
||||
}
|
||||
return Result.getInstance().buildList(OrderBillListVo.class).success(resultList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excelBillList(String companyCode, String orderTimeEnd) {
|
||||
List<OrderBillListVo> resultList = Collections.emptyList();
|
||||
|
||||
List<Order> list = getBaseMapper().findBillList(companyCode, orderTimeEnd);
|
||||
if(Collections.isNotEmpty(list)){
|
||||
list = list.stream().sorted(Comparator.comparing(Order::getStationName)).collect(Collectors.toList());
|
||||
|
||||
for(Order order : list){
|
||||
OrderBillListVo result = new OrderBillListVo();
|
||||
BeanUtils.copyProperties(order, result);
|
||||
result.setPreName(order.getOrderPreUname());
|
||||
result.setOrderAmountExcel((result.getOrderAmount() == null || result.getOrderAmount() == 0) ? 0d : new BigDecimal(result.getOrderAmount()).divide(new BigDecimal(100)).doubleValue());
|
||||
resultList.add(result);
|
||||
}
|
||||
}
|
||||
|
||||
ExcelUtil<OrderBillListVo> util = new ExcelUtil<OrderBillListVo>(OrderBillListVo.class);
|
||||
util.exportExcel(SpringUtil.getResponse(), resultList,"电子账单");
|
||||
|
||||
settlementInProgress(list, null, PayTypeEnums.BUSINESS_TO_BUSINESS.getCode());
|
||||
}
|
||||
|
||||
|
||||
public void settlementInProgress(List<Order> list, String outTradeNo, Integer payType){
|
||||
//执行完导出后. 所有的订单信息,全部更新为结算中
|
||||
AuthUser user = RedisPermissionUtils.getUser();
|
||||
TradeDetail trade = new TradeDetail();
|
||||
trade.setOutTradeNo(StringUtils.isEmpty(outTradeNo) ? com.evotech.hd.common.core.utils.CommonUtil.payTradeNo(2) : outTradeNo);
|
||||
trade.setTrader(user.getName());
|
||||
trade.setTraderCode(user.getUid());
|
||||
trade.setTradeType(TradeTypeEnums.PAYORDER.getCode());
|
||||
trade.setOrderCount(1);
|
||||
trade.setTradeAmount(list.stream().collect(Collectors.summingInt(d-> DataUtils.findDefaultValue(d.getOrderAmount(), DataUtils.DEFAULT_VALUE.intValue()))));
|
||||
trade.setPayType(payType);
|
||||
trade.setPayResult("paymentInProgress");
|
||||
trade.setPayTime(new Date());
|
||||
trade.setStatus("edit");
|
||||
tradeService.add(trade);
|
||||
// list.stream().forEach(data ->{
|
||||
// data.setTradeNo(trade.getOutTradeNo());
|
||||
// if(PayTypeEnums.BUSINESS_TO_BUSINESS.getCode() == payType){
|
||||
// data.setStatus(OrderStatusEnums.SETTLEMENT_IN_PROGRESS.getCode());
|
||||
// }
|
||||
// });
|
||||
// updateBatchById(list);
|
||||
Order order = list.get(0);
|
||||
order.setTradeNo(trade.getOutTradeNo());
|
||||
if(PayTypeEnums.BUSINESS_TO_BUSINESS.getCode() == payType){
|
||||
order.setStatus(OrderStatusEnums.SETTLEMENT_IN_PROGRESS.getCode());
|
||||
}
|
||||
updateById(order);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evotech.hd.cloud.dao.BatteryStationDao;
|
||||
import com.evotech.hd.cloud.dao.OrderSwapBatteryPreDao;
|
||||
import com.evotech.hd.cloud.dao.VehicleInfoDao;
|
||||
import com.evotech.hd.cloud.dao.VehicleWechatUserRelationDao;
|
||||
import com.evotech.hd.cloud.mqtt.enums.EventFunctionTypesEnum;
|
||||
import com.evotech.hd.cloud.mqtt.enums.MqttMessageTypeEnum;
|
||||
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.mqtt.message.processor.strategy.impl.event.MqttStrategyEventExchangeProcessor;
|
||||
import com.evotech.hd.cloud.service.OrderSwapBatteryPreService;
|
||||
import com.evotech.hd.cloud.utils.CloudTemplateMessageUtils;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
@ -17,6 +24,7 @@ import com.evotech.hd.common.core.dao.wechat.WechatUserDao;
|
||||
import com.evotech.hd.common.core.entity.cloud.BatteryStation;
|
||||
import com.evotech.hd.common.core.entity.cloud.OrderSwapBatteryPre;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleInfo;
|
||||
import com.evotech.hd.common.core.entity.cloud.VehicleWechatUserRelation;
|
||||
import com.evotech.hd.common.core.entity.cloud.request.PageListSwapOrderPreRequest;
|
||||
import com.evotech.hd.common.core.entity.order.Order;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||
@ -24,6 +32,7 @@ import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.common.redis.utils.RedisServiceUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@ -51,7 +60,10 @@ public class OrderSwapBatteryPreServiceImpl extends ServiceImpl<OrderSwapBattery
|
||||
private WechatUserDao wechatUserDao;
|
||||
@Resource
|
||||
private OrderDao orderDao;
|
||||
|
||||
@Resource
|
||||
private VehicleWechatUserRelationDao vehicleWechatUserRelationDao;
|
||||
@Resource
|
||||
MqttStrategyEventExchangeProcessor mqttStrategyEventExchangeProcessor;
|
||||
|
||||
@Override
|
||||
public Boolean addPreByPlateNum(String plateNum, String stationCode) {
|
||||
@ -88,11 +100,16 @@ public class OrderSwapBatteryPreServiceImpl extends ServiceImpl<OrderSwapBattery
|
||||
if (vehicleInfo == null) {
|
||||
return new Result<Boolean>().error("未找到车辆信息", false);
|
||||
}
|
||||
|
||||
// 2. 检查预约人
|
||||
if (!wechatUserDao.exists(new LambdaQueryWrapper<WechatUser>().ne(WechatUser::getPhoneNumber, " ").isNotNull(WechatUser::getPhoneNumber).eq(WechatUser::getWuid, orderSwapBatteryPre.getUcode()))) {
|
||||
return new Result<Boolean>().error("用户认证信息不全!", false);
|
||||
}
|
||||
|
||||
//检查用户是否拥有当前车辆换电的权限
|
||||
if (!vehicleWechatUserRelationDao.exists(new LambdaQueryWrapper<VehicleWechatUserRelation>().eq(VehicleWechatUserRelation::getPlateNum, orderSwapBatteryPre.getPlateNum()).eq(VehicleWechatUserRelation::getUcode, orderSwapBatteryPre.getUcode()))){
|
||||
return new Result<Boolean>().error("当前车辆不在您的名下!", false);
|
||||
}
|
||||
|
||||
//判断换电站是否运营 status 不等于 1 则证明换电站未运营
|
||||
if (batteryStationDao.exists(new LambdaQueryWrapper<BatteryStation>().eq(BatteryStation::getCode, orderSwapBatteryPre.getStationCode()).ne(BatteryStation::getStatus, 1))) {
|
||||
return new Result<Boolean>().error("该换电站未运营!", false);
|
||||
@ -132,11 +149,30 @@ public class OrderSwapBatteryPreServiceImpl extends ServiceImpl<OrderSwapBattery
|
||||
RedisServiceUtils.set(redisKey, expireTime);
|
||||
// 发送服务号消息,没有消息队列,先用接口吧
|
||||
CloudTemplateMessageUtils.sendPreOrderMessage(orderSwapBatteryPre);
|
||||
//同步下发到站控
|
||||
pushStationControl(orderSwapBatteryPre);
|
||||
return new Result<Boolean>().success(true);
|
||||
}
|
||||
return new Result<Boolean>().error("添加预约换电订单出错!", false);
|
||||
}
|
||||
|
||||
@Async
|
||||
void pushStationControl(OrderSwapBatteryPre orderSwapBatteryPre){
|
||||
MessageTopic topic = new MessageTopic();
|
||||
topic.setStationCode(orderSwapBatteryPre.getStationCode());
|
||||
|
||||
MqttResponse<OrderSwapBatteryPre> response = new MqttResponse();
|
||||
// 订单状态更新处理
|
||||
response.setCode(MqttResponse.PUBLIC_SUCCESS);
|
||||
response.setData(orderSwapBatteryPre);
|
||||
|
||||
MqttMessageHeader header = new MqttMessageHeader();
|
||||
header.setTimeStamp(String.valueOf(System.currentTimeMillis()));
|
||||
header.setIndex(String.valueOf(MqttMessageTypeEnum.EVENT.getId()));
|
||||
mqttStrategyEventExchangeProcessor.sendAESMessage(topic , header, EventFunctionTypesEnum.FUN_PUSH_STATION_CONTRNL_DATA, response);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result<Page<OrderSwapBatteryPre>> list(PageListSwapOrderPreRequest plsopr) {
|
||||
Page<OrderSwapBatteryPre> page = new Page<OrderSwapBatteryPre>(plsopr.getPageNo(), plsopr.getPageSize());
|
||||
@ -157,7 +193,7 @@ public class OrderSwapBatteryPreServiceImpl extends ServiceImpl<OrderSwapBattery
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> cancelPre(Integer id, Integer status) {
|
||||
public Result<Integer> updateStatusById(Integer id, Integer status) {
|
||||
OrderSwapBatteryPre osbp = new OrderSwapBatteryPre();
|
||||
osbp.setPkId(id);
|
||||
osbp.setStatus(status != null? status : 3);
|
||||
|
||||
@ -1,23 +1,30 @@
|
||||
package com.evotech.hd.cloud.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evotech.hd.cloud.dao.TradeDetailDao;
|
||||
import com.evotech.hd.cloud.entity.request.PageListTradeRequest;
|
||||
import com.evotech.hd.cloud.service.TaxPointService;
|
||||
import com.evotech.hd.cloud.service.TradeService;
|
||||
import com.evotech.hd.cloud.service.newthread.GZHTemplateMessageService;
|
||||
import com.evotech.hd.cloud.service.newthread.WechatPayNotifyHandleService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.constant.HDConstant;
|
||||
import com.evotech.hd.common.core.dao.cloud.OrderDao;
|
||||
import com.evotech.hd.common.core.entity.cloud.TradeDetail;
|
||||
import com.evotech.hd.common.core.entity.order.Order;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.common.core.enums.OrderStatusEnums;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
@ -34,6 +41,8 @@ public class TradeServiceImpl extends ServiceImpl<TradeDetailDao, TradeDetail> i
|
||||
@Resource
|
||||
private GZHTemplateMessageService gzhTemplateMessageService;
|
||||
@Resource
|
||||
TaxPointService taxPointService;
|
||||
@Resource
|
||||
private OrderDao orderDao;
|
||||
@Override
|
||||
public Result<Integer> add(TradeDetail td) {
|
||||
@ -66,6 +75,45 @@ public class TradeServiceImpl extends ServiceImpl<TradeDetailDao, TradeDetail> i
|
||||
return new Result<Integer>().error("更新交易失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> submit(TradeDetail td) {
|
||||
td.setStatus("submit");
|
||||
return update(td);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Integer> approve(Integer id, Integer type) {
|
||||
TradeDetail td = new TradeDetail();
|
||||
td.setStatus(type ==1 ? "finish" : "reject");
|
||||
td.setPkId(id);
|
||||
Result<Integer> result = update(td);
|
||||
if(result.getData() != null && result.getData() ==1){
|
||||
td = getById(id);
|
||||
List<Order> orderList = orderDao.selectList(new LambdaQueryWrapper<Order>().eq(Order::getTradeNo, td.getOutTradeNo()));
|
||||
if(Collections.isNotEmpty(orderList)){
|
||||
orderList.stream().forEach(data ->{
|
||||
data.setStatus(OrderStatusEnums.FINISH.getCode());
|
||||
});
|
||||
orderDao.updateById(orderList);
|
||||
//税点信息记录
|
||||
orderList.stream().forEach(order->{
|
||||
try {
|
||||
taxPointService.addTaxPoint(order.getPkId(), order.getOrderNo(), Double.valueOf(order.getOrderAmount()), order.getStationCode());
|
||||
} catch (Exception e) {
|
||||
log.error("生成税点信息异常,订单信息{}; 异常信息{}", JSON.toJSONString(order), e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<Page<TradeDetail> > list(PageListTradeRequest pltr) {
|
||||
Page<TradeDetail> page = new Page<TradeDetail>(pltr.getPageNo(), pltr.getPageSize());
|
||||
@ -120,7 +168,28 @@ public class TradeServiceImpl extends ServiceImpl<TradeDetailDao, TradeDetail> i
|
||||
Result<String> result = payNotifyHandleService.payNotifyBusinessHandle(tradeDetail);
|
||||
//只有当整体数据处理成功之后, 才保存交易记录, 防止出现异常,二次请求进来数据无法处理
|
||||
if(CodeMsg.SUCCESS.getCode().equals(result.getCode())){
|
||||
add(tradeDetail);
|
||||
TradeDetail detail = tradeDetailDao.selectOne(new LambdaQueryWrapper<TradeDetail>().eq(TradeDetail::getOutTradeNo, tradeDetail.getOutTradeNo()).eq(TradeDetail::getDelFlag, HDConstant.DELETE_NO));
|
||||
tradeDetail.setStatus("finish");
|
||||
if(ObjectUtils.isEmpty(detail)){
|
||||
add(tradeDetail);
|
||||
}else{
|
||||
detail.setStatus("finish");
|
||||
detail.setAppid(tradeDetail.getAppid());
|
||||
detail.setBankType(tradeDetail.getBankType());
|
||||
detail.setMchid(tradeDetail.getMchid());
|
||||
detail.setTransactionId(tradeDetail.getTransactionId());
|
||||
detail.setTradeAmount(tradeDetail.getTradeAmount());
|
||||
detail.setWechatPayApiType(tradeDetail.getWechatPayApiType());
|
||||
detail.setPayResult(tradeDetail.getPayResult());
|
||||
detail.setPayTime(tradeDetail.getPayTime());
|
||||
detail.setTradeMessage(tradeDetail.getTradeMessage());
|
||||
detail.setPayWechatId(tradeDetail.getPayWechatId());
|
||||
detail.setTrader(tradeDetail.getTrader());
|
||||
detail.setTraderCode(tradeDetail.getTraderCode());
|
||||
|
||||
update(detail);
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -92,7 +92,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleInfoDao, VehicleInfo>
|
||||
.eq(StringUtils.hasText(plvr.getPhone()), "phone", plvr.getPhone())
|
||||
.eq(StringUtils.hasText(plvr.getCcode()), "ccode", plvr.getCcode())
|
||||
.ne("del_flag", 1)
|
||||
.orderByAsc("plate_num"));
|
||||
.orderByDesc("ctime"));
|
||||
if (page.getRecords().isEmpty()) {
|
||||
return new Result<Page<VehicleInfo>>().error(CodeMsg.DATABASE_RESULT_NULL);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import com.evotech.hd.common.core.entity.cloud.vo.WalletAccountVO;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatPayAttach;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatUser;
|
||||
import com.evotech.hd.common.core.enums.CodeMsg;
|
||||
import com.evotech.hd.common.core.utils.DataUtils;
|
||||
import com.evotech.hd.common.core.utils.SnowflakeUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.slf4j.Logger;
|
||||
@ -119,8 +120,11 @@ public class WalletAccountServiceImpl extends ServiceImpl<WalletAccountDao, Wall
|
||||
wa1.setGiftAmount(wa.getGiftAmount());
|
||||
// wa1.setTotalAmount(wa.getTotalAmount());
|
||||
wa1.setRechargeAmount(wa.getRechargeAmount());
|
||||
int n = walletAccountDao.update(wa1, new QueryWrapper<WalletAccount>()
|
||||
.eq("code", wa.getCode())
|
||||
int n = walletAccountDao.update(wa1, new UpdateWrapper<WalletAccount>()
|
||||
.set(org.apache.commons.lang3.StringUtils.isNotEmpty(wa.getAccName()), "acc_name",wa.getAccName())
|
||||
.set("gift_amount",wa.getGiftAmount())
|
||||
.set("recharge_Amount",wa.getRechargeAmount())
|
||||
.eq(org.apache.commons.lang3.StringUtils.isNotEmpty(wa.getCode()), "code", wa.getCode())
|
||||
.eq("pk_id", wa.getPkId()));
|
||||
if (n == 1) {
|
||||
return new Result<Integer>().success(n);
|
||||
@ -131,10 +135,21 @@ public class WalletAccountServiceImpl extends ServiceImpl<WalletAccountDao, Wall
|
||||
|
||||
@Override
|
||||
public Result<Page<WalletAccountVO>> list(PageListWalletRequest plwr) {
|
||||
|
||||
if((org.apache.commons.lang3.StringUtils.isNotEmpty(plwr.getPhone()) || org.apache.commons.lang3.StringUtils.isNotEmpty(plwr.getAccName())) && org.apache.commons.lang3.StringUtils.isEmpty(plwr.getOwnerId())){
|
||||
plwr.setOwnerId("-1");
|
||||
WechatUser wechatUser = wechatUserDao.selectOne(new QueryWrapper<WechatUser>()
|
||||
.eq(StringUtils.hasText(plwr.getPhone()), "phone_number", plwr.getPhone())
|
||||
.or(StringUtils.hasText(plwr.getAccName()), i -> i.and(j -> j.eq("name", plwr.getAccName()))
|
||||
.or(j -> j.eq("nick_name", plwr.getAccName()))));
|
||||
if (wechatUser != null) {
|
||||
plwr.setOwnerId(wechatUser.getWuid());
|
||||
}
|
||||
}
|
||||
Page<WalletAccount> page = new Page<>(plwr.getPageNo(), plwr.getPageSize());
|
||||
QueryWrapper<WalletAccount> queryWrapper = new QueryWrapper<WalletAccount>()
|
||||
.eq(StringUtils.hasText(plwr.getCode()), "code", plwr.getCode())
|
||||
.like(StringUtils.hasText(plwr.getAccName()), "acc_name", plwr.getAccName())
|
||||
//.like(StringUtils.hasText(plwr.getAccName()), "acc_name", plwr.getAccName())
|
||||
.eq(StringUtils.hasText(plwr.getStationCode()), "station_code", plwr.getStationCode())
|
||||
.eq(plwr.getOwnerType() != null, "owner_type", plwr.getOwnerType())
|
||||
.eq(StringUtils.hasText(plwr.getOwnerId()), "owner_id", plwr.getOwnerId())
|
||||
@ -150,6 +165,7 @@ public class WalletAccountServiceImpl extends ServiceImpl<WalletAccountDao, Wall
|
||||
WalletAccountVO vo = new WalletAccountVO();
|
||||
// 复制基本属性
|
||||
BeanUtil.copyProperties(account, vo);
|
||||
vo.setTotalAmount(DataUtils.findDefaultValue(account.getGiftAmount(), DataUtils.DEFAULT_VALUE.intValue())+DataUtils.findDefaultValue(account.getRechargeAmount(), DataUtils.DEFAULT_VALUE.intValue()));
|
||||
// 查询微信用户信息
|
||||
if (StringUtils.hasText(account.getOwnerId())) {
|
||||
WechatUser wechatUser = wechatUserDao.selectOne(
|
||||
|
||||
@ -13,7 +13,6 @@ import com.evotech.hd.cloud.service.WalletAccountService;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.dao.cloud.OrderDao;
|
||||
import com.evotech.hd.common.core.dao.cloud.PreOrderRelationSwapOrderDao;
|
||||
import com.evotech.hd.common.core.entity.cloud.PreOrderRelationSwapOrder;
|
||||
import com.evotech.hd.common.core.entity.cloud.TradeDetail;
|
||||
import com.evotech.hd.common.core.entity.cloud.WalletAccount;
|
||||
import com.evotech.hd.common.core.entity.cloud.WalletAccountDetail;
|
||||
@ -87,7 +86,7 @@ public class WechatPayNotifyHandleService {
|
||||
}
|
||||
if (WechatPayApiTypeEnums.NATIVE.getCode().equals(tradeDetail.getWechatPayApiType())) {
|
||||
// native支付,企业
|
||||
nativePayHandle(tradeDetail);
|
||||
return nativePayHandle(tradeDetail);
|
||||
}
|
||||
return new Result<String>().error("未知的支付类型");
|
||||
} else if (tradeDetail.getTradeType() == 9) {
|
||||
@ -190,8 +189,40 @@ public class WechatPayNotifyHandleService {
|
||||
* 一般企业多条付款
|
||||
* @param tradeDetail
|
||||
*/
|
||||
private void nativePayHandle(TradeDetail tradeDetail) {
|
||||
List<PreOrderRelationSwapOrder> list = preOrderRelationSwapOrderDao.selectList(new QueryWrapper<PreOrderRelationSwapOrder>().eq("out_trade_no", tradeDetail.getOutTradeNo()));
|
||||
private Result<String> nativePayHandle(TradeDetail tradeDetail) {
|
||||
try {
|
||||
if (TradeResultEnums.SUCCESS.getName().equals(tradeDetail.getPayResult())) {
|
||||
List<Order> list = orderDao.selectList(new LambdaQueryWrapper<Order>().eq(Order::getTradeNo, tradeDetail.getOutTradeNo()).select(Order::getPkId));
|
||||
List<Integer> orderIdList = list.stream().map(i -> i.getPkId()).toList();
|
||||
orderDao.update(new UpdateWrapper<Order>().in("pk_id", orderIdList)
|
||||
.set("status", OrderStatusEnums.FINISH.getCode()));
|
||||
try {
|
||||
list.stream().forEach(order -> {
|
||||
//税点信息记录
|
||||
try {
|
||||
taxPointService.addTaxPoint(order.getPkId(), order.getOrderNo(), Double.valueOf(order.getOrderAmount()), order.getStationCode());
|
||||
} catch (Exception e) {
|
||||
log.error("生成税点信息异常,订单信息{}; 异常信息{}", JSON.toJSONString(order), e.getMessage());
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("nativePay 生成税点信息异常,异常信息{}", e.getMessage());
|
||||
}
|
||||
|
||||
return new Result<String>().success("ok");
|
||||
} else {
|
||||
return new Result<String>().error("微信支付结果未成功" + tradeDetail.getPayResult());
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.error("===>>>支付订单存在问题:{}", JSONUtil.toJsonStr(tradeDetail));
|
||||
return new Result<String>().error("支付订单存在问题"+ e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*List<PreOrderRelationSwapOrder> list = preOrderRelationSwapOrderDao.selectList(new QueryWrapper<PreOrderRelationSwapOrder>().eq("out_trade_no", tradeDetail.getOutTradeNo()));
|
||||
List<String> orderNoList = list.stream().map(i -> i.getOrderNo()).toList();
|
||||
List<Order> orderList = orderDao.selectList(new QueryWrapper<Order>()
|
||||
.eq("status", 6).in("order_no", orderNoList));
|
||||
@ -214,7 +245,10 @@ public class WechatPayNotifyHandleService {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("nativePay 生成税点信息异常,异常信息{}", e.getMessage());
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
// 发送公众号消息,发给企业绑定的微信号
|
||||
// templateMessageService.orderMessageSend(one, 3);
|
||||
}
|
||||
|
||||
@ -0,0 +1,321 @@
|
||||
package com.evotech.hd.cloud.utils;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 时间工具类
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
{
|
||||
public static String YYYY = "yyyy";
|
||||
|
||||
public static String YYYY_MM = "yyyy-MM";
|
||||
|
||||
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
|
||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
private static String[] parsePatterns = {
|
||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
||||
|
||||
/**
|
||||
* 获取当前Date型日期
|
||||
*
|
||||
* @return Date() 当前日期
|
||||
*/
|
||||
public static Date getNowDate()
|
||||
{
|
||||
return new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期, 默认格式为yyyy-MM-dd
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public static String getDate()
|
||||
{
|
||||
return dateTimeNow(YYYY_MM_DD);
|
||||
}
|
||||
|
||||
public static final String getTime()
|
||||
{
|
||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||
}
|
||||
|
||||
public static final String dateTimeNow()
|
||||
{
|
||||
return dateTimeNow(YYYYMMDDHHMMSS);
|
||||
}
|
||||
|
||||
public static final String dateTimeNow(final String format)
|
||||
{
|
||||
return parseDateToStr(format, new Date());
|
||||
}
|
||||
|
||||
public static final String dateTime(final Date date)
|
||||
{
|
||||
return parseDateToStr(YYYY_MM_DD, date);
|
||||
}
|
||||
|
||||
public static final String parseDateToStr(final String format, final Date date)
|
||||
{
|
||||
return new SimpleDateFormat(format).format(date);
|
||||
}
|
||||
|
||||
public static final Date dateTime(final String format, final String ts)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new SimpleDateFormat(format).parse(ts);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期路径 即年/月/日 如2018/08/08
|
||||
*/
|
||||
public static final String datePath()
|
||||
{
|
||||
Date now = new Date();
|
||||
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期路径 即年/月/日 如20180808
|
||||
*/
|
||||
public static final String dateTime()
|
||||
{
|
||||
Date now = new Date();
|
||||
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期型字符串转化为日期 格式
|
||||
*/
|
||||
public static Date parseDate(Object str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
return parseDate(str.toString(), parsePatterns);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器启动时间
|
||||
*/
|
||||
public static Date getServerStartDate()
|
||||
{
|
||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
return new Date(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算相差天数
|
||||
*/
|
||||
public static int differentDaysByMillisecond(Date date1, Date date2)
|
||||
{
|
||||
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算时间差
|
||||
*
|
||||
* @param endDate 最后时间
|
||||
* @param startTime 开始时间
|
||||
* @return 时间差(天/小时/分钟)
|
||||
*/
|
||||
public static String timeDistance(Date endDate, Date startTime)
|
||||
{
|
||||
long nd = 1000 * 24 * 60 * 60;
|
||||
long nh = 1000 * 60 * 60;
|
||||
long nm = 1000 * 60;
|
||||
// long ns = 1000;
|
||||
// 获得两个时间的毫秒时间差异
|
||||
long diff = endDate.getTime() - startTime.getTime();
|
||||
// 计算差多少天
|
||||
long day = diff / nd;
|
||||
// 计算差多少小时
|
||||
long hour = diff % nd / nh;
|
||||
// 计算差多少分钟
|
||||
long min = diff % nd % nh / nm;
|
||||
// 计算差多少秒//输出结果
|
||||
// long sec = diff % nd % nh % nm / ns;
|
||||
return day + "天" + hour + "小时" + min + "分钟";
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加 LocalDateTime ==> Date
|
||||
*/
|
||||
public static Date toDate(LocalDateTime temporalAccessor)
|
||||
{
|
||||
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加 LocalDate ==> Date
|
||||
*/
|
||||
public static Date toDate(LocalDate temporalAccessor)
|
||||
{
|
||||
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
|
||||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
|
||||
public static Integer getBetweenYear(Date start, Date end, Integer offsetDay){
|
||||
Calendar cal1 = Calendar.getInstance();
|
||||
cal1.setTime(start);
|
||||
Long days = new BigDecimal(getBetweenDays(start, end)).add(new BigDecimal(offsetDay)).longValue();
|
||||
int yearsDiff = 0;
|
||||
long remainingDays = days;
|
||||
while (remainingDays >= 365) {
|
||||
int year = cal1.get(Calendar.YEAR) + yearsDiff;
|
||||
//int daysInYear = ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) ? 366 : 365;
|
||||
int daysInYear = 365;
|
||||
if (remainingDays >= daysInYear) {
|
||||
remainingDays -= daysInYear;
|
||||
yearsDiff++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return yearsDiff;
|
||||
}
|
||||
|
||||
public static Integer getBetweenYearByDays(Date start, Date end){
|
||||
return getBetweenYear(start, end, 0);
|
||||
}
|
||||
|
||||
public static Integer getBetweenMonth(Date start, Date end){
|
||||
Calendar currentDate = Calendar.getInstance();
|
||||
currentDate.setTime(start);
|
||||
|
||||
// 将输入的Date转换为Calendar以便获取年月信息
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(end);
|
||||
// 计算年份差和月份差
|
||||
int yearsDiff = endCalendar.get(Calendar.YEAR) - currentDate.get(Calendar.YEAR);
|
||||
int monthsDiff = endCalendar.get(Calendar.MONTH) - currentDate.get(Calendar.MONTH);
|
||||
|
||||
// 调整月份差,考虑到年份差可能影响实际的月份数差异
|
||||
monthsDiff += yearsDiff * 12;
|
||||
|
||||
return monthsDiff;
|
||||
}
|
||||
|
||||
public static Date getMonthFirst(Date date){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getMonthEnd(Date date){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Integer getYear(Date date){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
public static Integer getMonth(Date date){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
return calendar.get(Calendar.MONTH)+1;
|
||||
}
|
||||
|
||||
public static Integer getMonthDays(Date date){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.DAY_OF_MONTH,1);
|
||||
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
public static Long getBetweenDays(Date start, Date end){
|
||||
Calendar currentDate = Calendar.getInstance();
|
||||
currentDate.setTime(start);
|
||||
|
||||
// 将输入的Date转换为Calendar以便获取年月信息
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(end);
|
||||
return calculateDifferenceInDays(endCalendar, currentDate);
|
||||
}
|
||||
|
||||
public static Long getBetweenMinutes(Date start, Date end){
|
||||
Calendar currentDate = Calendar.getInstance();
|
||||
currentDate.setTime(start);
|
||||
// 将输入的Date转换为Calendar以便获取年月信息
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
endCalendar.setTime(end);
|
||||
long diffInMillis = endCalendar.getTimeInMillis() - currentDate.getTimeInMillis();
|
||||
return diffInMillis / (60 * 1000);
|
||||
}
|
||||
|
||||
public static long calculateDifferenceInDays(Calendar date1, Calendar date2) {
|
||||
long diffInMillies = Math.abs(date1.getTimeInMillis() - date2.getTimeInMillis());
|
||||
return diffInMillies / (24 * 60 * 60 * 1000); // 将毫秒转换为天
|
||||
}
|
||||
|
||||
public static List<String> getCurrentMonthAndDays(){
|
||||
return getMonthAndDays(DateUtils.getNowDate());
|
||||
}
|
||||
public static List<String> getMonthAndDays(Date date){
|
||||
List<String> dayList = new ArrayList<String>();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
SimpleDateFormat sdfm = new SimpleDateFormat("yyyy-MM");
|
||||
for(int p=1;p<=days;p++){
|
||||
try{
|
||||
String rq = sdfm.format(date)+"-";
|
||||
if(p < 10){
|
||||
rq += "0" + p;
|
||||
}else {
|
||||
rq += p;
|
||||
}
|
||||
dayList.add(rq);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return dayList;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
||||
package com.evotech.hd.cloud.utils;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类
|
||||
*
|
||||
* @ClassName:YTConfig
|
||||
* @date: 2025年07月29日 10:32
|
||||
* @author: andy.shi
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "yt")
|
||||
public class YTConfig {
|
||||
|
||||
private static String profile;
|
||||
|
||||
public static String getProfile()
|
||||
{
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(String profile)
|
||||
{
|
||||
YTConfig.profile = profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载路径
|
||||
*/
|
||||
public static String getDownloadPath()
|
||||
{
|
||||
return getProfile() + "/download/";
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,7 @@
|
||||
<result column="source_code" property="sourceCode" />
|
||||
<result column="status" property="status" />
|
||||
<result column="point_type" property="pointType" />
|
||||
<result column="point_code" property="pointCode" />
|
||||
<result column="point_code" property="pointCode"/>
|
||||
<result column="point_name" property="pointName" />
|
||||
<result column="soc" property="soc" />
|
||||
<result column="dcc_no" property="dccNo" />
|
||||
@ -30,9 +30,9 @@
|
||||
</sql>
|
||||
|
||||
<select id="getDcByStationCode" resultMap="BaseResultMap">
|
||||
select dc.* from yt_t_battery_station_dc dc left join yt_t_battery_station_dcc dcc on dcc.dcc_no = dc.dcc_no
|
||||
WHERE
|
||||
dcc.station_code = #{stationCode}
|
||||
select DISTINCT dc.* from yt_t_battery_station_dc dc left join yt_t_battery_station_dcc dcc on dcc.dcc_no = dc.dcc_no
|
||||
WHERE dc.del_flag = 0 and
|
||||
(dcc.station_code = #{stationCode} OR dc.point_code= #{stationCode})
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
<result column="store_id" property="storeId" />
|
||||
<result column="org_code" property="orgCode" />
|
||||
<result column="alarm" property="alarm"/>
|
||||
<result column="division_no" property="divisionNo"/>
|
||||
|
||||
<collection property="dcList"
|
||||
select="com.evotech.hd.cloud.dao.BatteryStationDcDao.getDcByStationCode"
|
||||
column="code">
|
||||
@ -53,7 +55,7 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
pk_id, proxy_id, name, code, status, type, address, address_province, address_city, address_area, register_date, contacts, phone, del_flag, active_date, location_point, open_all_day, td_quantity, jqr_quantity, cdj_quantity, dcc_quantity, dc_quantity, ctime, creater, uptime, updater
|
||||
pk_id, proxy_id, name, code, status, type, address, address_province, address_city, address_area, register_date, contacts, phone, del_flag, active_date, location_point, open_all_day, td_quantity, jqr_quantity, cdj_quantity, dcc_quantity, dc_quantity, ctime, creater, uptime, updater, division_no
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
from hd_cloud_manage.yt_t_order osb
|
||||
where del_Flag = 0
|
||||
<if test="status!= null">
|
||||
and status !=#{status}
|
||||
and status =#{status}
|
||||
</if>
|
||||
order by order_time desc
|
||||
</select>
|
||||
@ -151,6 +151,23 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findBillList">
|
||||
select osb.pk_id, osb.order_amount, osb.plate_num, osb.order_time, osb.station_name, osb.order_pre_uname, osb.status
|
||||
from hd_cloud_manage.yt_t_order osb
|
||||
<if test="companyCode!= null and companyCode!= ''">
|
||||
left join hd_cloud_manage.yt_t_vehicle_info wi on wi.plate_num = osb.plate_num
|
||||
</if>
|
||||
where osb.del_flag = 0 and osb.order_amount is not null and osb.order_amount > 0 and osb.status=6
|
||||
<if test="companyCode!= null and companyCode!= ''">
|
||||
and wi.owner_id=#{companyCode}
|
||||
</if>
|
||||
<if test="orderTimeEnd!= null and orderTimeEnd!= '' ">
|
||||
and DATE_FORMAT(#{orderTimeEnd},"%Y-%m-%d") >= DATE_FORMAT(osb.order_time,"%Y-%m-%d")
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -187,11 +187,20 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
|
||||
//已授权接口,和无需授权接口
|
||||
if (!permList.contains(path) && !notPermissionUrlList.contains(path)) {
|
||||
Boolean notPermission = true;
|
||||
for (String notPermissionUrl : notPermissionUrlList)
|
||||
for (String notPermissionUrl : notPermissionUrlList){
|
||||
if(Pattern.compile(notPermissionUrl).matcher(path).find()){
|
||||
notPermission = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(notPermission) {
|
||||
for (String permUrl : permList){
|
||||
if (Pattern.compile(permUrl).matcher(path).find()) {
|
||||
notPermission = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//验证正则匹配是否通过
|
||||
if(notPermission){
|
||||
throw new OAuth2AuthorizationException(new OAuth2Error(CodeMsg.ACCESS_DENY.getCode(), CodeMsg.ACCESS_DENY.getMsg(), uri));
|
||||
|
||||
@ -36,8 +36,8 @@ public class RoleController {
|
||||
@Operation(summary = "删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<Integer> delete(Integer rid) {
|
||||
return roleService.delete(rid);
|
||||
public Result<Integer> delete(Integer rid, String rcode) {
|
||||
return roleService.delete(rid, rcode);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
|
||||
@ -3,11 +3,14 @@ package com.evotech.hd.resource.controller;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.utils.SnowflakeUtil;
|
||||
import com.evotech.hd.common.permission.util.SpringUtil;
|
||||
import com.evotech.hd.resource.utils.IpUtils;
|
||||
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 org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -24,6 +27,8 @@ public class UtilController {
|
||||
|
||||
@Value("${yt.util.ip-url1}")
|
||||
private String ipUrl;
|
||||
@Value("${yt.util.ip-url2}")
|
||||
private String ipUrl1;
|
||||
|
||||
|
||||
@Operation(description = "获取id")
|
||||
@ -42,7 +47,20 @@ public class UtilController {
|
||||
@GetMapping("/ip")
|
||||
@ApiOperationSupport(order = 2)
|
||||
public Result<String> getIp() {
|
||||
String res = HttpUtil.get(ipUrl);
|
||||
String res = null;
|
||||
try {
|
||||
res = HttpUtil.get(ipUrl);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
res = HttpUtil.get(ipUrl1);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
if(StringUtils.isEmpty(res)){
|
||||
res = IpUtils.getIpAddr(SpringUtil.getRequest());
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Result<String>().success(res.trim());
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ public interface RoleService {
|
||||
|
||||
public Result<Integer> add(AuthRole r);
|
||||
|
||||
public Result<Integer> delete(Integer rid);
|
||||
public Result<Integer> delete(Integer rid, String rcode);
|
||||
|
||||
public Result<Integer> update(AuthRole r);
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ public class AuthUserServiceImpl implements AuthUserService {
|
||||
@Transactional
|
||||
public Result<Integer> delete(String uid) {
|
||||
AuthUser u = new AuthUser();
|
||||
u.setUid(uid);
|
||||
u.setPkId(Integer.valueOf(uid));
|
||||
int n = userDao.deleteById(u);
|
||||
if (n == 1) {
|
||||
// 删除账号关联角色信息
|
||||
|
||||
@ -101,13 +101,13 @@ public class RoleServiceImpl implements RoleService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result<Integer> delete(Integer rid) {
|
||||
public Result<Integer> delete(Integer rid, String rcode) {
|
||||
int n = authRoleDao.deleteById(rid);
|
||||
if (n == 1) {
|
||||
// 删除角色和用户的关系
|
||||
authUserRoleDao.delete(new QueryWrapper<AuthUserRole>().eq("rid", rid));
|
||||
authUserRoleDao.delete(new QueryWrapper<AuthUserRole>().eq("rcode", rcode));
|
||||
// 删除角色权限
|
||||
authRoleResourceDao.delete(new QueryWrapper<AuthRoleResource>().eq("rid", rid));
|
||||
authRoleResourceDao.delete(new QueryWrapper<AuthRoleResource>().eq("rcode", rcode));
|
||||
return new Result<Integer>().success(n);
|
||||
}
|
||||
return new Result<Integer>().error("删除角色出错!");
|
||||
|
||||
@ -0,0 +1,379 @@
|
||||
package com.evotech.hd.resource.utils;
|
||||
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* 获取IP方法
|
||||
*
|
||||
* @author evo
|
||||
*/
|
||||
public class IpUtils
|
||||
{
|
||||
public final static String REGX_0_255 = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)";
|
||||
// 匹配 ip
|
||||
public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")";
|
||||
public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))";
|
||||
// 匹配网段
|
||||
public final static String REGX_IP_SEG = "(" + REGX_IP + "\\-" + REGX_IP + ")";
|
||||
|
||||
|
||||
/**
|
||||
* 获取客户端IP
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @return IP地址
|
||||
*/
|
||||
public static String getIpAddr(HttpServletRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
{
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
{
|
||||
ip = request.getHeader("X-Forwarded-For");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
{
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
{
|
||||
ip = request.getHeader("X-Real-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
||||
}
|
||||
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
|
||||
{
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
|
||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否为内部IP地址
|
||||
*
|
||||
* @param ip IP地址
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean internalIp(String ip)
|
||||
{
|
||||
byte[] addr = textToNumericFormatV4(ip);
|
||||
return internalIp(addr) || "127.0.0.1".equals(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否为内部IP地址
|
||||
*
|
||||
* @param addr byte地址
|
||||
* @return 结果
|
||||
*/
|
||||
private static boolean internalIp(byte[] addr)
|
||||
{
|
||||
if (ObjectUtils.isEmpty(addr) || addr.length < 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
final byte b0 = addr[0];
|
||||
final byte b1 = addr[1];
|
||||
// 10.x.x.x/8
|
||||
final byte SECTION_1 = 0x0A;
|
||||
// 172.16.x.x/12
|
||||
final byte SECTION_2 = (byte) 0xAC;
|
||||
final byte SECTION_3 = (byte) 0x10;
|
||||
final byte SECTION_4 = (byte) 0x1F;
|
||||
// 192.168.x.x/16
|
||||
final byte SECTION_5 = (byte) 0xC0;
|
||||
final byte SECTION_6 = (byte) 0xA8;
|
||||
switch (b0)
|
||||
{
|
||||
case SECTION_1:
|
||||
return true;
|
||||
case SECTION_2:
|
||||
if (b1 >= SECTION_3 && b1 <= SECTION_4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
case SECTION_5:
|
||||
switch (b1)
|
||||
{
|
||||
case SECTION_6:
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将IPv4地址转换成字节
|
||||
*
|
||||
* @param text IPv4地址
|
||||
* @return byte 字节
|
||||
*/
|
||||
public static byte[] textToNumericFormatV4(String text)
|
||||
{
|
||||
if (text.length() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[4];
|
||||
String[] elements = text.split("\\.", -1);
|
||||
try
|
||||
{
|
||||
long l;
|
||||
int i;
|
||||
switch (elements.length)
|
||||
{
|
||||
case 1:
|
||||
l = Long.parseLong(elements[0]);
|
||||
if ((l < 0L) || (l > 4294967295L))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bytes[0] = (byte) (int) (l >> 24 & 0xFF);
|
||||
bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF);
|
||||
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
|
||||
bytes[3] = (byte) (int) (l & 0xFF);
|
||||
break;
|
||||
case 2:
|
||||
l = Integer.parseInt(elements[0]);
|
||||
if ((l < 0L) || (l > 255L))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bytes[0] = (byte) (int) (l & 0xFF);
|
||||
l = Integer.parseInt(elements[1]);
|
||||
if ((l < 0L) || (l > 16777215L))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bytes[1] = (byte) (int) (l >> 16 & 0xFF);
|
||||
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
|
||||
bytes[3] = (byte) (int) (l & 0xFF);
|
||||
break;
|
||||
case 3:
|
||||
for (i = 0; i < 2; ++i)
|
||||
{
|
||||
l = Integer.parseInt(elements[i]);
|
||||
if ((l < 0L) || (l > 255L))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bytes[i] = (byte) (int) (l & 0xFF);
|
||||
}
|
||||
l = Integer.parseInt(elements[2]);
|
||||
if ((l < 0L) || (l > 65535L))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bytes[2] = (byte) (int) (l >> 8 & 0xFF);
|
||||
bytes[3] = (byte) (int) (l & 0xFF);
|
||||
break;
|
||||
case 4:
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
l = Integer.parseInt(elements[i]);
|
||||
if ((l < 0L) || (l > 255L))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bytes[i] = (byte) (int) (l & 0xFF);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取IP地址
|
||||
*
|
||||
* @return 本地IP地址
|
||||
*/
|
||||
public static String getHostIp()
|
||||
{
|
||||
try
|
||||
{
|
||||
return InetAddress.getLocalHost().getHostAddress();
|
||||
}
|
||||
catch (UnknownHostException e)
|
||||
{
|
||||
}
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取主机名
|
||||
*
|
||||
* @return 本地主机名
|
||||
*/
|
||||
public static String getHostName()
|
||||
{
|
||||
try
|
||||
{
|
||||
return InetAddress.getLocalHost().getHostName();
|
||||
}
|
||||
catch (UnknownHostException e)
|
||||
{
|
||||
}
|
||||
return "未知";
|
||||
}
|
||||
|
||||
/**
|
||||
* 从多级反向代理中获得第一个非unknown IP地址
|
||||
*
|
||||
* @param ip 获得的IP地址
|
||||
* @return 第一个非unknown IP地址
|
||||
*/
|
||||
public static String getMultistageReverseProxyIp(String ip)
|
||||
{
|
||||
// 多级反向代理检测
|
||||
if (ip != null && ip.indexOf(",") > 0)
|
||||
{
|
||||
final String[] ips = ip.trim().split(",");
|
||||
for (String subIp : ips)
|
||||
{
|
||||
if (false == isUnknown(subIp))
|
||||
{
|
||||
ip = subIp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringUtils.substring(ip, 0, 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测给定字符串是否为未知,多用于检测HTTP请求相关
|
||||
*
|
||||
* @param checkString 被检测的字符串
|
||||
* @return 是否未知
|
||||
*/
|
||||
public static boolean isUnknown(String checkString)
|
||||
{
|
||||
return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为IP
|
||||
*/
|
||||
public static boolean isIP(String ip)
|
||||
{
|
||||
return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为IP,或 *为间隔的通配符地址
|
||||
*/
|
||||
public static boolean isIpWildCard(String ip)
|
||||
{
|
||||
return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP_WILDCARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测参数是否在ip通配符里
|
||||
*/
|
||||
public static boolean ipIsInWildCardNoCheck(String ipWildCard, String ip)
|
||||
{
|
||||
String[] s1 = ipWildCard.split("\\.");
|
||||
String[] s2 = ip.split("\\.");
|
||||
boolean isMatchedSeg = true;
|
||||
for (int i = 0; i < s1.length && !s1[i].equals("*"); i++)
|
||||
{
|
||||
if (!s1[i].equals(s2[i]))
|
||||
{
|
||||
isMatchedSeg = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isMatchedSeg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为特定格式如:“10.10.10.1-10.10.10.99”的ip段字符串
|
||||
*/
|
||||
public static boolean isIPSegment(String ipSeg)
|
||||
{
|
||||
return StringUtils.isNotBlank(ipSeg) && ipSeg.matches(REGX_IP_SEG);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断ip是否在指定网段中
|
||||
*/
|
||||
public static boolean ipIsInNetNoCheck(String iparea, String ip)
|
||||
{
|
||||
int idx = iparea.indexOf('-');
|
||||
String[] sips = iparea.substring(0, idx).split("\\.");
|
||||
String[] sipe = iparea.substring(idx + 1).split("\\.");
|
||||
String[] sipt = ip.split("\\.");
|
||||
long ips = 0L, ipe = 0L, ipt = 0L;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
ips = ips << 8 | Integer.parseInt(sips[i]);
|
||||
ipe = ipe << 8 | Integer.parseInt(sipe[i]);
|
||||
ipt = ipt << 8 | Integer.parseInt(sipt[i]);
|
||||
}
|
||||
if (ips > ipe)
|
||||
{
|
||||
long t = ips;
|
||||
ips = ipe;
|
||||
ipe = t;
|
||||
}
|
||||
return ips <= ipt && ipt <= ipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验ip是否符合过滤串规则
|
||||
*
|
||||
* @param filter 过滤IP列表,支持后缀'*'通配,支持网段如:`10.10.10.1-10.10.10.99`
|
||||
* @param ip 校验IP地址
|
||||
* @return boolean 结果
|
||||
*/
|
||||
public static boolean isMatchedIp(String filter, String ip)
|
||||
{
|
||||
if (StringUtils.isEmpty(filter) || StringUtils.isEmpty(ip))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String[] ips = filter.split(";");
|
||||
for (String iStr : ips)
|
||||
{
|
||||
if (isIP(iStr) && iStr.equals(ip))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (isIpWildCard(iStr) && ipIsInWildCardNoCheck(iStr, ip))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (isIPSegment(iStr) && ipIsInNetNoCheck(iStr, ip))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -77,5 +77,4 @@ public class PayController {
|
||||
return wechatPayService.refundsBack(request);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.evotech.hd.wechat.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import cn.hutool.crypto.digest.HMac;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
@ -24,7 +22,6 @@ import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
@ -98,6 +95,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
String sessionKey = redisUtil.get(HDConstant.sessionKeyPrefix + wuid).toString();
|
||||
HMac hmac = DigestUtil.hmac(HmacAlgorithm.HmacSHA256, sessionKey.getBytes());
|
||||
String res = LoginUtil.checkSessionKey(accessTokenService.getAccessToken(), openid, hmac.digestHex(""));
|
||||
// String res = LoginUtil.code2Session(xcxProperties.getAppid(), openid, hmac.digestHex(""));
|
||||
JSONObject jo = JSONUtil.parseObj(res);
|
||||
if (jo.getInt("errcode") == 0) {
|
||||
Map<String, String> m = tokenBuilder(wuid);
|
||||
@ -134,18 +132,18 @@ public class LoginServiceImpl implements LoginService {
|
||||
@Override
|
||||
public Map<String, String> tokenBuilder(String wuid) {
|
||||
//获取redis中的token
|
||||
String wxToken = ((redisUtil.hasKey(HDConstant.wxToken + wuid) && !ObjectUtils.isEmpty(redisUtil.get(HDConstant.wxToken + wuid))) ? String.valueOf(redisUtil.get(HDConstant.wxToken + wuid)) : null);
|
||||
if(StringUtils.isEmpty(wxToken)) {
|
||||
String randomStr = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_FORMATTER);
|
||||
wxToken = XCXUtil.wechatToken(wuid, randomStr);
|
||||
redisUtil.set(HDConstant.tokenRandomStr + wuid, randomStr, 0);
|
||||
// 缓存数据
|
||||
}
|
||||
//刷新token
|
||||
redisUtil.set(HDConstant.wxToken + wuid, wxToken, 0);
|
||||
// String wxToken = ((redisUtil.hasKey(HDConstant.wxToken + wuid) && !ObjectUtils.isEmpty(redisUtil.get(HDConstant.wxToken + wuid))) ? String.valueOf(redisUtil.get(HDConstant.wxToken + wuid)) : null);
|
||||
// if(StringUtils.isEmpty(wxToken)) {
|
||||
// String randomStr = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_FORMATTER);
|
||||
// wxToken = XCXUtil.wechatToken(wuid, randomStr);
|
||||
// redisUtil.set(HDConstant.tokenRandomStr + wuid, randomStr, 0);
|
||||
// // 缓存数据
|
||||
// }
|
||||
// //刷新token
|
||||
// redisUtil.set(HDConstant.wxToken + wuid, wxToken, 0);
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
m.put("wuid", wuid);
|
||||
m.put("wxToken", wxToken);
|
||||
// m.put("wxToken", wxToken);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
@ -6,12 +6,12 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.evotech.hd.common.core.Dto.Result;
|
||||
import com.evotech.hd.common.core.dao.cloud.PreOrderRelationSwapOrderDao;
|
||||
import com.evotech.hd.common.core.dao.wechat.WechatUserDao;
|
||||
import com.evotech.hd.common.core.entity.cloud.PreOrderRelationSwapOrder;
|
||||
import com.evotech.hd.common.core.entity.wechat.WechatPayPreOrder;
|
||||
import com.evotech.hd.common.core.utils.XCXUtil;
|
||||
import com.evotech.hd.common.core.utils.Collections;
|
||||
import com.evotech.hd.wechat.config.XcxProperties;
|
||||
import com.evotech.hd.wechat.entity.NativePayVO;
|
||||
import com.evotech.hd.wechat.service.WechatNativePayService;
|
||||
@ -31,7 +31,6 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -59,23 +58,23 @@ public class WechatNativePayServiceImpl implements WechatNativePayService {
|
||||
// return new Result<String>().error("用户信息错误");
|
||||
// }
|
||||
// 处理附加数据
|
||||
String outTradeNo = XCXUtil.payOutTradeNo(22);
|
||||
JSONObject jo = JSONUtil.parseObj(prePay.getAttach());
|
||||
String[] orderNoArr = jo.getStr("orderNo").split(",");
|
||||
List<PreOrderRelationSwapOrder> list = new ArrayList<PreOrderRelationSwapOrder>();
|
||||
for (int i = 0; i < orderNoArr.length; i++) {
|
||||
PreOrderRelationSwapOrder relationOrder = new PreOrderRelationSwapOrder();
|
||||
relationOrder.setOrderNo(orderNoArr[i]);
|
||||
relationOrder.setCtime(new Date());
|
||||
relationOrder.setDescription(prePay.getDescription());
|
||||
relationOrder.setOutTradeNo(outTradeNo);
|
||||
list.add(relationOrder);
|
||||
}
|
||||
preOrderRelationSwapOrderDao.insert(list);
|
||||
|
||||
jo.remove("orderNo");
|
||||
prePay.setAttach(jo.toJSONString(0));
|
||||
String outTradeNo = com.evotech.hd.common.core.utils.CommonUtil.payTradeNo(2);
|
||||
// JSONObject jo = JSONUtil.parseObj(prePay.getAttach());
|
||||
// String[] orderNoArr = jo.getStr("orderNo").split(",");
|
||||
// List<PreOrderRelationSwapOrder> list = new ArrayList<PreOrderRelationSwapOrder>();
|
||||
// for (int i = 0; i < orderNoArr.length; i++) {
|
||||
// PreOrderRelationSwapOrder relationOrder = new PreOrderRelationSwapOrder();
|
||||
// relationOrder.setOrderNo(orderNoArr[i]);
|
||||
// relationOrder.setCtime(new Date());
|
||||
// relationOrder.setDescription(prePay.getDescription());
|
||||
// relationOrder.setOutTradeNo(outTradeNo);
|
||||
// list.add(relationOrder);
|
||||
// }
|
||||
// preOrderRelationSwapOrderDao.insert(list);
|
||||
|
||||
// jo.remove("orderNo");
|
||||
prePay.setAttach(JSON.toJSONString(Collections.asMap("type","2", "outTradeNo", outTradeNo)));
|
||||
|
||||
|
||||
WechatPayPreOrder preOrder = new WechatPayPreOrder();
|
||||
// 组装数据
|
||||
@ -88,12 +87,12 @@ public class WechatNativePayServiceImpl implements WechatNativePayService {
|
||||
request.setAppid(xcxProperties.getAppid());
|
||||
request.setMchid(xcxProperties.getMchid());
|
||||
request.setDescription(prePay.getDescription());
|
||||
request.setNotifyUrl(xcxProperties.getNativeNotifyUrl());
|
||||
//request.setNotifyUrl(xcxProperties.getNativeNotifyUrl());
|
||||
request.setNotifyUrl(xcxProperties.getNotifyUrl());
|
||||
request.setOutTradeNo(outTradeNo);
|
||||
// 金额
|
||||
Amount amount = new Amount();
|
||||
// amount.setTotal(prePay.getMoney());
|
||||
amount.setTotal(1);
|
||||
amount.setTotal(prePay.getTotal());
|
||||
request.setAmount(amount);
|
||||
preOrder.setTotal(amount.getTotal());
|
||||
// 付款人 不需要
|
||||
|
||||
@ -70,13 +70,13 @@ public class WechatPayServiceImpl implements WechatPayService {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public com.evotech.hd.common.core.Dto.Result<PrepayWithRequestPaymentResponse> xcxPrepay(PrePayVO prePay) {
|
||||
public Result<PrepayWithRequestPaymentResponse> xcxPrepay(PrePayVO prePay) {
|
||||
//首选检查支付类型
|
||||
JSONObject entries = JSONUtil.parseObj(prePay.getAttach());
|
||||
//判断是充值订单还是订单支付
|
||||
String payType = entries.getStr("type");
|
||||
if (StringUtils.isEmpty(payType)){
|
||||
return new com.evotech.hd.common.core.Dto.Result<PrepayWithRequestPaymentResponse>().error("请在正确途径支付");
|
||||
return new Result<PrepayWithRequestPaymentResponse>().error("请在正确途径支付");
|
||||
}
|
||||
|
||||
Map<String, PayExchangeProcessor> mqttRequestExchangeProcessorMap = applicationContext.getBeansOfType(PayExchangeProcessor.class);
|
||||
@ -85,7 +85,7 @@ public class WechatPayServiceImpl implements WechatPayService {
|
||||
return processor.exchange(prePay);
|
||||
}
|
||||
}
|
||||
return new com.evotech.hd.common.core.Dto.Result<PrepayWithRequestPaymentResponse>().error("请在正确途径支付");
|
||||
return new Result<PrepayWithRequestPaymentResponse>().error("请在正确途径支付");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -147,7 +147,8 @@ public interface PayExchangeProcessor {
|
||||
//交易类型
|
||||
tradeDetail.setTradeType(getAttach().getInt("type"));
|
||||
tradeDetail.setOrderNo(getAttach().getStr("orderNo"));
|
||||
tradeDetail.setOrderCount(tradeDetail.getOrderNo().split(",").length);
|
||||
tradeDetail.setOutTradeNo(getAttach().getStr("outTradeNo"));
|
||||
tradeDetail.setOrderCount(StringUtils.isNotEmpty(tradeDetail.getOrderNo()) ? tradeDetail.getOrderNo().split(",").length : 0);
|
||||
tradeDetail.setTradeAmount(transaction.getAmount().getPayerTotal());
|
||||
tradeDetail.setPayType(PayTypeEnums.WECHAT.getCode());
|
||||
tradeDetail.setWechatPayApiType(transaction.getTradeType().name());
|
||||
|
||||
@ -106,6 +106,7 @@ hbyt:
|
||||
-----END PUBLIC KEY-----
|
||||
# 支付回调地址
|
||||
notify_url: http://api.evo-techina.com/wechat/pay/wechatpay/notify
|
||||
#notify_url: http://y865f68d.natappfree.cc/wechat/pay/wechatpay/notify
|
||||
# Native支付回调地址
|
||||
native_notify_url: https://api.evo-techina.com/wechat/wechatpay/native/nativeback/msg
|
||||
# 退款回调地址
|
||||
|
||||
Loading…
Reference in New Issue
Block a user