This commit is contained in:
邱贞招 2024-05-27 19:32:10 +08:00
parent 56030b9d41
commit eaa2f4d6a4
12 changed files with 129 additions and 146 deletions

View File

@ -163,40 +163,40 @@ public class AppController extends BaseController
return success(etFeeRuleService.selectEtFeeRuleByRuleId(ruleId));
}
/**
* 获取计费规则 多少分钟内 里程数
*/
@GetMapping(value = "/fee/rule")
public AjaxResult getRule()
{
String appointmentServiceFee = sysConfigService.selectConfigByKey("appointment.service.fee");//预约服务费
String dispatchFee = sysConfigService.selectConfigByKey("dispatch.fee");//调度费
String vehicleManagementFee = sysConfigService.selectConfigByKey("vehicle.management.fee");//车辆管理费
String startingPrice = sysConfigService.selectConfigByKey("starting.price");//起步价
String startingHowManyMinutes = sysConfigService.selectConfigByKey("starting.how.many.minutes");//多少分钟内按起步价
String timeFee = sysConfigService.selectConfigByKey("time.fee");//时长费
String timeMinutes = sysConfigService.selectConfigByKey("time.minutes");//时长分钟
String timeoutMinutes = sysConfigService.selectConfigByKey("timeout.minutes");//预约超时保留分钟
String deposit = sysConfigService.selectConfigByKey("deposit");//押金
String isMeal = sysConfigService.selectConfigByKey("is.meal");//是否有套餐 是否有套餐0-没有套餐1-有套餐
String cappingFee = sysConfigService.selectConfigByKey("order.capping.fee");//24小时内封顶费用
String forceParkingArea = sysConfigService.selectConfigByKey("force.parking.area");//是否强制在停车区内还车
FeeRuleVo build = FeeRuleVo.builder()
.appointmentServiceFee(appointmentServiceFee)
.dispatchFee(dispatchFee)
.vehicleManagementFee(vehicleManagementFee)
.startingPrice(startingPrice)
.startingHowManyMinutes(startingHowManyMinutes)
.timeFee(timeFee)
.timeMinutes(timeMinutes)
.timeoutMinutes(timeoutMinutes)
.deposit(deposit)
.isMeal(isMeal)
.cappingFee(cappingFee)
.forceParkingArea(forceParkingArea)
.build();
return success(build);
}
// /**
// * 获取计费规则 多少分钟内 里程数
// */
// @GetMapping(value = "/fee/rule")
// public AjaxResult getRule()
// {
// String appointmentServiceFee = sysConfigService.selectConfigByKey("appointment.service.fee");//预约服务费
// String dispatchFee = sysConfigService.selectConfigByKey("dispatch.fee");//调度费
// String vehicleManagementFee = sysConfigService.selectConfigByKey("vehicle.management.fee");//车辆管理费
// String startingPrice = sysConfigService.selectConfigByKey("starting.price");//起步价
// String startingHowManyMinutes = sysConfigService.selectConfigByKey("starting.how.many.minutes");//多少分钟内按起步价
// String timeFee = sysConfigService.selectConfigByKey("time.fee");//时长费
// String timeMinutes = sysConfigService.selectConfigByKey("time.minutes");//时长分钟
// String timeoutMinutes = sysConfigService.selectConfigByKey("timeout.minutes");//预约超时保留分钟
// String deposit = sysConfigService.selectConfigByKey("deposit");//押金
// String isMeal = sysConfigService.selectConfigByKey("is.meal");//是否有套餐 是否有套餐0-没有套餐1-有套餐
// String cappingFee = sysConfigService.selectConfigByKey("order.capping.fee");//24小时内封顶费用
// String forceParkingArea = sysConfigService.selectConfigByKey("force.parking.area");//是否强制在停车区内还车
// FeeRuleVo build = FeeRuleVo.builder()
// .appointmentServiceFee(appointmentServiceFee)
// .dispatchFee(dispatchFee)
// .vehicleManagementFee(vehicleManagementFee)
// .startingPrice(startingPrice)
// .startingHowManyMinutes(startingHowManyMinutes)
// .timeFee(timeFee)
// .timeMinutes(timeMinutes)
// .timeoutMinutes(timeoutMinutes)
// .deposit(deposit)
// .isMeal(isMeal)
// .cappingFee(cappingFee)
// .forceParkingArea(forceParkingArea)
// .build();
// return success(build);
// }
/**

View File

@ -188,7 +188,8 @@ wx:
# apiV3密钥 嵛山岛 yusandaowenlvyusandaowenlvyusand
apiV3Key: 49819e0f0abdb2df3246f7b27f264d75
# 通知回调地址
notifyUrl: https://dianche.chuantewulian.cn/prod-api/payment/callback/wechat/
# notifyUrl: https://dianche.chuantewulian.cn/prod-api/payment/callback/wechat/
notifyUrl: http://124.221.246.124:2289/payment/callback/wechat/
# 密钥所在位置
privateKeyPath: D:/wxpay/apiclient_key.pem
# 证书序列号 7DDDDEED9A8DF3DD8363E49D636D3F551FFC8A19

View File

@ -163,8 +163,8 @@ public class EtOrder extends BaseEntity
* 值为3 表示在第三个计费周期内最终结算费用为(封顶金额*(周期-1))+骑行费用*/
private Integer cycle;
/** 是否预约 */
private Boolean isAppointment;
// /** 是否预约 */
// private Boolean isAppointment;
/** 还车类型:type:1-正常还车2-辅助还车 */
private String returnType;

View File

@ -19,10 +19,9 @@ public class AttachVo {
public AttachVo() {
}
public AttachVo(String type, Long userId, Boolean isAppointment, String token) {
public AttachVo(String type, Long userId, String token) {
this.type = type;
this.userId = userId;
this.isAppointment = isAppointment;
this.token = token;
}

View File

@ -31,6 +31,6 @@ public class EtOrderVo {
/** 备注 */
private String mark;
/** 是否预约 */
private Boolean isAppointment;
// /** 是否预约 */
// private Boolean isAppointment;
}

View File

@ -436,6 +436,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
*/
@SneakyThrows
@Override
@Transactional
public OrderResponse snSwitch(EtOrderVo orderVo) {
OrderResponse response = new OrderResponse();
String orderNo = "";
@ -465,14 +466,16 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
EtOrder order = etOrderService.selectEtOrderByOrderNo(finalOrderNo);
if(ObjectUtil.isNotNull(order)){//有订单号可能是套餐也可能是有预约
if(ObjectUtil.isNotNull(order.getRuleId())){//套餐
log.info("【扫码/编号开锁骑行】---有订单号,是套餐订单");
log.info("【扫码/编号开锁骑行】---预约扫码骑行");
order.setSn(asDevice.getSn());
}else{
log.info("【扫码/编号开锁骑行】---有订单号,有预约正常订单");
order.setAppointmentEndTime(DateUtils.getNowDate());
throw new ServiceException("ruleId未传");
}
order.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
order.setUnlockTime(DateUtils.getNowDate());
order.setAppointmentEndTime(DateUtils.getNowDate());
//计算预约费
calculateAppointmentFee(order);
int update = etOrderService.updateEtOrder(order);
if(update==0){
log.info("【扫码/编号开锁骑行】更新订单失败");
@ -508,7 +511,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
@Override
public Boolean unlocking(String sn) {
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
/** TODO 响铃寻车*/
/** 1.获取token*/
String token = Token.getToken();
Boolean execute = transactionTemplate.execute(e -> {
@ -777,32 +779,17 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
OrderResponse orderResponse = new OrderResponse();
String orderNo = IdUtils.randomUUID2();
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(appointmentVo.getSn());
//如果是套餐 则预约功能相当于临时锁车
if(ObjectUtil.isNotNull(appointmentVo.getRuleId())){
//临时锁车并更新车辆状态
// macSwitch(asDevice.getMac());
EtOrder order = etOrderService.selectEtOrderByOrderNo(appointmentVo.getOrderNo());
order.setStatus(ServiceConstants.ORDER_STATUS_IN_APPOINTMENT);
order.setSn(appointmentVo.getSn());
int i = etOrderService.updateEtOrder(order);
if(i==0){
throw new ServiceException("【车辆预约】:更新订单失败");
}
orderResponse.setSessionId(IdUtils.randomUUIDByDigit(8));
}else{
//如果是正常计费模式则按正常的订单走
EtOrder order = etOrderService.createOrder(appointmentVo, orderNo);
int i = etOrderService.insertEtOrder(order);
if(i==0){
throw new ServiceException("【车辆预约】:创建订单失败");
}
orderResponse.setOrderNo(orderNo);
orderResponse.setSessionId(IdUtils.randomUUIDByDigit(8));
return orderResponse;
}
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT);
int i = asDeviceMapper.updateAsDevice(asDevice);
//如果是正常计费模式则按正常的订单走
EtOrder order = etOrderService.createOrder(appointmentVo, orderNo);
int i = etOrderService.insertEtOrder(order);
if(i==0){
throw new ServiceException("【车辆预约】:创建订单失败");
}
orderResponse.setOrderNo(orderNo);
orderResponse.setSessionId(IdUtils.randomUUIDByDigit(8));
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT);
int u = asDeviceMapper.updateAsDevice(asDevice);
if(u==0){
throw new ServiceException("【车辆预约】:更新车辆状态失败");
}
return orderResponse;
@ -821,25 +808,20 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
OrderResponse orderResponse = new OrderResponse();
String orderNo = appointmentVo.getOrderNo();
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
//如果是套餐 则取消预约相当于开锁
if(ObjectUtil.isNotNull(appointmentVo.getRuleId())){
//1.发送开锁命令并更新车辆状态
String token = Token.getToken();
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_OPEN,"取消预约开锁");
order.setSn("");
//TODO 记录行程
/** 5.记录行程*/
int tripLog = tripLogService.tripLog(order.getOrderNo(),order.getSn(),ServiceConstants.TRIP_LOG_TYPE_UNLOCK_RIDE);
if(tripLog==0){
log.info("【套餐取消预约】记录行程失败");
throw new ServiceException("【套餐取消预约】记录行程失败");
}
}else{
//更新订单状态 status ServiceConstants.ORDER_STATUS_CANCEL_APPOINTMENT 记录预约结束时间计算并更新预约费
order.setAppointmentEndTime(DateUtils.getNowDate());
//计算预约费
calculateAppointmentFee(order);
//1.发送开锁命令并更新车辆状态
String token = Token.getToken();
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_CLOSE,"取消预约关锁");
/** 5.记录行程*/
int tripLog = tripLogService.tripLog(order.getOrderNo(),order.getSn(),ServiceConstants.TRIP_LOG_TYPE_UNLOCK_RIDE);
if(tripLog==0){
log.info("【套餐取消预约】记录行程失败");
throw new ServiceException("【套餐取消预约】记录行程失败");
}
//更新订单状态 status ServiceConstants.ORDER_STATUS_CANCEL_APPOINTMENT 记录预约结束时间计算并更新预约费
order.setAppointmentEndTime(DateUtils.getNowDate());
//计算预约费
calculateAppointmentFee(order);
order.setTotalFee(order.getAppointmentFee());
order.setStatus(ServiceConstants.ORDER_STATUS_CANCEL_APPOINTMENT);
int i = etOrderService.updateEtOrder(order);
if(i==0){
@ -912,10 +894,10 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
order.setStatus(ServiceConstants.ORDER_STATUS_RIDING_END);
order.setReturnTime(DateUtils.getNowDate());
String token = Token.getToken();
/** 2. 车辆远程关锁*/
sendCommand(order.getSn(), token,IotConstants.COMMAND_CLOSE,"还车关锁");
/** 4. 更新车辆状态*/
AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
/** 2. 车辆远程关锁*/
// sendCommand(device.getMac(), token,IotConstants.COMMAND_CLOSE,"还车关锁");
/** 4. 更新车辆状态*/
device.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
device.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
int deviceUpdate = asDeviceMapper.updateAsDevice(device);
@ -924,11 +906,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
throw new ServiceException("【还车关锁】更新车辆状态失败");
}
/** 3. 计算订单费用,保存订单总金额*/
if(ObjectUtil.isNotNull(order.getRuleId())){//套餐订单
order.setSn("");
}else{
order = calculateOrderFee(order);
}
order = calculateOrderFee(order);
int i = etOrderService.updateEtOrder(order);
if(i==0){
throw new ServiceException("更新订单状态失败");
@ -952,12 +930,12 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
private EtOrder calculateOrderFee(EtOrder order) {
String type = order.getType();
if(type.equals("1")){//骑行订单,正常骑行包含预约费计时收费根据开锁时间起步价和起步时长时长费和时长分钟等参数如果有预约还要加上预约费计算费用,还要判断封顶费用根据开锁时间
/** 预约费*/
Date appointmentStartTime = order.getAppointmentStartTime();
if(ObjectUtils.isNotEmpty(appointmentStartTime)){
//有预约根据开始时间和结束时间计算费用 预约费 = (预约结束时间 - 开始时间) * 预约服务费
calculateAppointmentFee(order);
}
// /** 预约费*/
// Date appointmentStartTime = order.getAppointmentStartTime();
// if(ObjectUtils.isNotEmpty(appointmentStartTime)){
// //有预约根据开始时间和结束时间计算费用 预约费 = (预约结束时间 - 开始时间) * 预约服务费
// calculateAppointmentFee(order);
// }
Long ruleId = order.getRuleId();
EtFeeRule rule = etFeeRuleService.selectEtFeeRuleByRuleId(ruleId);
String rentalUnit = rule.getRentalUnit();//租赁单位
@ -1152,6 +1130,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
// 将毫秒差转换为小时
long hours = TimeUnit.MILLISECONDS.toHours(diffInMillies);
if(hours==0){
return 1;
}
// 计算出在第几个计费周期中
BigDecimal cycle = BigDecimal.valueOf(hours).divide(new BigDecimal(chargingCycleValue), 0, RoundingMode.CEILING);
return cycle.intValue();

View File

@ -12,10 +12,12 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.common.utils.verify.VerifyIdentityUtil;
import com.ruoyi.system.domain.EtOperatingArea;
import com.ruoyi.system.domain.EtOrder;
import com.ruoyi.system.domain.vo.AuthenticationVo;
import com.ruoyi.system.mapper.AsUserMapper;
import com.ruoyi.system.service.IAsUserService;
import com.ruoyi.system.service.IEtOperatingAreaService;
import com.ruoyi.system.service.IEtOrderService;
import com.ruoyi.system.service.ISysConfigService;
import org.slf4j.Logger;
@ -53,7 +55,7 @@ public class AsUserServiceImpl implements IAsUserService
private IEtOrderService etOrderService;
@Autowired
private ISysConfigService sysConfigService;
private IEtOperatingAreaService etOperatingAreaService;
@Value("${et.verifyUrl}")
private String verifyUrl;
@ -432,13 +434,13 @@ public class AsUserServiceImpl implements IAsUserService
public Boolean checkIsDeposit(Long userId) {
AsUser asUser = asUserMapper.selectUserById(userId);
BigDecimal balance = asUser.getBalance();
String deposit = sysConfigService.selectConfigByKey("deposit");//押金
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(asUser.getAreaId());
BigDecimal deposit = new BigDecimal(area.getDeposit());
if(ObjectUtil.isNull(balance)){
log.info("用户【{}】余额为空",userId);
return false;
}
BigDecimal bigDecimal = new BigDecimal(deposit);
if(balance.compareTo(BigDecimal.ZERO)==0 || balance.compareTo(bigDecimal)<0){//余额为0或者押金和余额不相等
if(balance.compareTo(BigDecimal.ZERO)==0 || balance.compareTo(deposit)<0){//余额为0或者押金和余额不相等
log.info("用户【{}】余额为0或者押金小于余额不相等",userId);
return false;
}

View File

@ -130,7 +130,7 @@ public class CallbackServiceImpl implements CallbackService {
// 1-骑行支付 关锁
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
order.setMark("骑行支付");
asDeviceService.sendCommand(order.getSn(), iotToken, IotConstants.COMMAND_OPEN,"套餐开锁");
asDeviceService.sendCommand(asDevice.getMac(), iotToken, IotConstants.COMMAND_OPEN,"套餐开锁");
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//还车后车辆正常运营
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
@ -200,7 +200,7 @@ public class CallbackServiceImpl implements CallbackService {
order.setAppointmentStartTime(DateUtils.getNowDate());
order.setMark("套餐预约支付");
/** 2.发送命令*/
asDeviceService.sendCommand(order.getSn(), iotToken,IotConstants.COMMAND_CLOSE,"套餐预约");
asDeviceService.sendCommand(asDevice.getMac(), iotToken,IotConstants.COMMAND_CLOSE,"套餐预约");
/** 3.更新车辆状态*/
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT);//预约中
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
@ -209,7 +209,7 @@ public class CallbackServiceImpl implements CallbackService {
order.setMark("套餐骑行支付");
order.setStatus(ServiceConstants.ORDER_STATUS_RIDING);//骑行中
/** 2.发送命令*/
asDeviceService.sendCommand(order.getSn(), iotToken,IotConstants.COMMAND_OPEN,"套餐开锁");
asDeviceService.sendCommand(asDevice.getMac(), iotToken,IotConstants.COMMAND_OPEN,"套餐开锁");
/** 3.更新车辆状态*/
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING);

View File

@ -387,13 +387,13 @@ public class EtOrderServiceImpl implements IEtOrderService
/** 1.获取token*/
String token = Token.getToken();
AsDevice asDevice = asDeviceService.selectAsDeviceBySn(order.getSn());
if(order.getIsAppointment()){//购买完套餐后 预约车辆
// if(order.getIsAppointment()){//购买完套餐后 预约车辆
etOrder.setStatus(ServiceConstants.ORDER_STATUS_IN_APPOINTMENT);
etOrder.setAppointmentStartTime(DateUtils.getNowDate());
//校验 userI,snruleIdtype 3 isAppointment
Boolean execute = transactionTemplate.execute(e -> {
/** 2.发送命令*/
deviceService.sendCommand(order.getSn(), token, IotConstants.COMMAND_CLOSE,"套餐预约");
deviceService.sendCommand(asDevice.getMac(), token, IotConstants.COMMAND_CLOSE,"套餐预约");
/** 3.更新车辆状态*/
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK);//临时锁车
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
@ -406,24 +406,24 @@ public class EtOrderServiceImpl implements IEtOrderService
return Boolean.TRUE;
});
if(!execute)throw new ServiceException("套餐预约失败");
}else{//购买完套餐后 立即开锁骑行
etOrder.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
Boolean execute = transactionTemplate.execute(e -> {
/** 2.发送命令*/
deviceService.sendCommand(order.getSn(), token,IotConstants.COMMAND_OPEN,"套餐开锁");
/** 3.更新车辆状态*/
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING_STR);
int device = asDeviceService.updateAsDevice(asDevice);
if(device==0){
log.info("【套餐开锁】更新车辆状态失败");
return Boolean.FALSE;
}
log.info("套餐开锁成功");
return Boolean.TRUE;
});
if(!execute)throw new ServiceException("套餐开锁失败");
}
// }else{//购买完套餐后 立即开锁骑行
// etOrder.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
// Boolean execute = transactionTemplate.execute(e -> {
// /** 2.发送命令*/
// deviceService.sendCommand(order.getSn(), token,IotConstants.COMMAND_OPEN,"套餐开锁");
// /** 3.更新车辆状态*/
// asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
// asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING_STR);
// int device = asDeviceService.updateAsDevice(asDevice);
// if(device==0){
// log.info("【套餐开锁】更新车辆状态失败");
// return Boolean.FALSE;
// }
// log.info("套餐开锁成功");
// return Boolean.TRUE;
// });
// if(!execute)throw new ServiceException("套餐开锁失败");
// }
int i = etOrderMapper.insertEtOrder(etOrder);
if(i == 0){
throw new ServiceException("订单生成失败");
@ -479,6 +479,7 @@ public class EtOrderServiceImpl implements IEtOrderService
etOrder.setUserName(user.getUserName());
etOrder.setMark(order.getMark());
etOrder.setCreateTime(DateUtils.getNowDate());
etOrder.setRuleId(order.getRuleId());
/** 订单类型 1骑行 2预约 3套餐 4押金 根据类型不同下单的参数也不同,不同的参数有: 金额、类型、rule_id套餐id*/
String type = order.getType();
if(type.equals("1")){//骑行订单,正常骑行包含预约费计时收费根据开锁时间起步价和起步时长时长费和时长分钟等参数如果有预约还要加上预约费计算费用
@ -491,20 +492,11 @@ public class EtOrderServiceImpl implements IEtOrderService
etOrder.setType(ServiceConstants.ORDER_TYPE_RIDING);
etOrder.setStatus(ServiceConstants.ORDER_STATUS_IN_APPOINTMENT);//预约中
etOrder.setAppointmentStartTime(DateUtils.getNowDate());//预约开始时间
}else if(order.getType().equals("3")){//套餐创建初始订单根据计费规则id(rule_id)和支付时间计算费用 在订单表中通过是否有rule_id字段来判断是否是套餐订单
setAreaInfo(order.getSn(), etOrder);
Long ruleId = order.getRuleId();
EtFeeRule etFeeRule = etFeeRuleService.selectEtFeeRuleByRuleId(ruleId);
etOrder.setRuleId(ruleId);
// etOrder.setTotalFee(etFeeRule.getFee());
etOrder.setType(ServiceConstants.ORDER_TYPE_RIDING);
etOrder.setStatus(ServiceConstants.ORDER_STATUS_RIDING);
etOrder.setIsAppointment(order.getIsAppointment());
}else if(order.getType().equals("4")){//押金创建初始订单根据计费规则结算费用
etOrder.setType(ServiceConstants.ORDER_TYPE_DEPOSIT);
// etOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
String deposit = sysConfigService.selectConfigByKey("deposit");//押金
etOrder.setTotalFee(new BigDecimal(deposit));
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(user.getAreaId());
BigDecimal deposit = new BigDecimal(area.getDeposit());
etOrder.setTotalFee(deposit);
}else {
throw new ServiceException("订单类型错误");
}

View File

@ -100,7 +100,7 @@ public class WxPayService implements IWxPayService {
String description = type.equals(ServiceConstants.ORDER_TYPE_RIDING) ? "骑行订单-"+billNo : "押金充值-"+billNo;
LoginUser loginUser = SecurityUtils.getLoginUser();
log.info("【预下单】获取登录用户信息:"+JSON.toJSONString(loginUser));
request.setAttach(JSON.toJSONString(new AttachVo(payType,user.getUserId(),order.getIsAppointment(), loginUser.getToken())));
request.setAttach(JSON.toJSONString(new AttachVo(payType,user.getUserId(), loginUser.getToken())));
request.setDescription(description);
request.setNotifyUrl(wxPayConfig.getNotifyUrl());
request.setPayer(getPayer(user.getWxopenid()));

View File

@ -31,15 +31,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="role" column="role" />
<result property="isSign" column="is_sign" />
<result property="sysUserId" column="sys_user_id" />
<result property="areaId" column="area_id" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar, u.phonenumber, u.balance, u.birthday, u.password, u.pay_password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_sign,u.role,u.sys_user_id
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,
u.phonenumber, u.balance, u.birthday, u.password, u.pay_password, u.sex, u.status,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,
u.is_sign,u.role,u.sys_user_id,u.area_id
from et_user u
</sql>
<select id="selectUserList" parameterType="AsUser" resultMap="AsUserResult">
select u.user_id, u.nick_name, u.user_name, u.real_name,u.email, u.avatar, u.phonenumber, u.balance, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_sign,u.role,u.sys_user_id from et_user u
select u.user_id, u.nick_name, u.user_name, u.real_name,u.email, u.avatar, u.phonenumber, u.balance,
u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
u.wxopenid,u.is_sign,u.role,u.sys_user_id,u.area_id from et_user u
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
@ -157,6 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="role != null and role != ''">role,</if>
<if test="isSign != null and isSign != ''">is_sign,</if>
<if test="sysUserId != null and sysUserId != ''">sys_user_id,</if>
<if test="areaId != null">area_id,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
@ -177,6 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="role != null and role != ''">#{role},</if>
<if test="isSign != null and isSign != ''">#{isSign},</if>
<if test="sysUserId != null and sysUserId != ''">#{sysUserId},</if>
<if test="areaId != null">#{areaId},</if>
sysdate()
)
</insert>
@ -203,6 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="role != null">role = #{role},</if>
<if test="isSign != null">is_sign = #{isSign},</if>
<if test="sysUserId != null">sys_user_id = #{sysUserId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
update_time = sysdate()
</set>
where user_id = #{userId}

View File

@ -135,13 +135,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="orderNo != null and orderNo != ''"> and order_no != #{orderNo}</if>
and user_id = #{userId} and status !=4 and type = 1
and rule_end_time &gt; NOW()
</where>
</select>
<select id="checkIsUnique" resultType="Integer" parameterType="Long">
select count(1) from et_order
where user_id = #{userId} and status = 0
where user_id = #{userId} and status = 0 and type=1
</select>
<select id="getTotalIncome" resultType="java.lang.String">