1. 联调

This commit is contained in:
邱贞招 2024-06-06 22:07:28 +08:00
parent 6a4c3baf94
commit 7129d0aa5d
18 changed files with 187 additions and 48 deletions

View File

@ -1,9 +1,11 @@
package com.ruoyi.web.controller.app; package com.ruoyi.web.controller.app;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.CommonUtil; import com.ruoyi.common.utils.CommonUtil;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
@ -316,4 +318,13 @@ public class AppController extends BaseController
return AjaxResult.success(transaction); return AjaxResult.success(transaction);
} }
/**
* 删除订单
*/
@DeleteMapping("/{orderNo}")
public AjaxResult remove(@PathVariable String orderNo)
{
return toAjax(etOrderService.deleteEtOrderByOrderNo(orderNo));
}
} }

View File

@ -23,13 +23,17 @@ import com.ruoyi.system.domain.response.OrderResponse;
import com.ruoyi.system.domain.vo.*; import com.ruoyi.system.domain.vo.*;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse; import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Optional;
/** /**
* app接口需要登录校验的 * app接口需要登录校验的
@ -155,11 +159,17 @@ public class AppVerifyController extends BaseController
} }
//非正常状态不得骑行 //非正常状态不得骑行
String status = asDevice.getStatus(); String status = asDevice.getStatus();
if(!ServiceConstants.VEHICLE_STATUS_NORMAL.equals(status)){
EtOrder order1 = etOrderService.selectEtOrderByOrderNo(order.getOrderNo()); EtOrder order1 = etOrderService.selectEtOrderByOrderNo(order.getOrderNo());
if(!ServiceConstants.VEHICLE_STATUS_NORMAL.equals(status) && !order1.getSn().equals(order.getSn())){ if(ObjectUtil.isNotNull(order1)){
if(!order1.getSn().equals(order.getSn())){
//根据状态值返回不同的提示 //根据状态值返回不同的提示
return error(CommonUtil.format(status)); return error(CommonUtil.format(status));
} }
}else{
return error(CommonUtil.format(status));
}
}
//根据余额和充值记录判断是否有充值过押金没有充值过押金提示充值押金 //根据余额和充值记录判断是否有充值过押金没有充值过押金提示充值押金
if(!asUserService.checkIsDeposit(order.getUserId())){ if(!asUserService.checkIsDeposit(order.getUserId())){
return error("您还未充值押金,请先充值押金"); return error("您还未充值押金,请先充值押金");
@ -242,6 +252,7 @@ public class AppVerifyController extends BaseController
@PostMapping("/order/withdraw") @PostMapping("/order/withdraw")
public AjaxResult withdraw() public AjaxResult withdraw()
{ {
//根据订单号查询订单信息 //根据订单号查询订单信息
EtOrder etOrder = new EtOrder(); EtOrder etOrder = new EtOrder();
etOrder.setUserId(getUserId()); etOrder.setUserId(getUserId());
@ -252,14 +263,30 @@ public class AppVerifyController extends BaseController
if(etOrders.size()==0){ if(etOrders.size()==0){
throw new ServiceException("提现失败,未找到押金订单"); throw new ServiceException("提现失败,未找到押金订单");
} }
if(etOrders.size()>1){
throw new ServiceException("提现失败有多条status="+ServiceConstants.ORDER_STATUS_ORDER_END+"(已完成),paid="+ServiceConstants.ORDER_PAY_STATUS_PAID+"(已支付)的押金订单");
}
List<EtOrder> inOrder = etOrderService.isInOrder(etOrder.getUserId(), null); List<EtOrder> inOrder = etOrderService.isInOrder(etOrder.getUserId(), null);
if(inOrder.size()>0){ if(inOrder.size()>0){
throw new ServiceException("提现失败,用户还有未完成订单"); throw new ServiceException("提现失败,用户还有未完成订单");
} }
if(etOrders.size()>1){
logger.info("有多条status="+ServiceConstants.ORDER_STATUS_ORDER_END+"(已完成),paid="+ServiceConstants.ORDER_PAY_STATUS_PAID+"(已支付)的押金订单");
logger.info("获取最后一条押金充值记录");
Optional<EtOrder> latestOrder = etOrders.stream()
.max(Comparator.comparing(EtOrder::getPayTime));
if (latestOrder.isPresent()) {
EtOrder newestOrder = latestOrder.get();
return toAjax(depositWithdraw(newestOrder));
}
}
EtOrder etOrder1 = etOrders.get(0); EtOrder etOrder1 = etOrders.get(0);
Integer withdraw = depositWithdraw(etOrder1);
return toAjax(withdraw);
}
/**
* 押金提现
*/
@NotNull
private Integer depositWithdraw(EtOrder etOrder1) {
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(etOrder1.getAreaId()); EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(etOrder1.getAreaId());
BigDecimal deposit = new BigDecimal(area.getDeposit()); BigDecimal deposit = new BigDecimal(area.getDeposit());
if(deposit.compareTo(etOrder1.getTotalFee())!=0){ if(deposit.compareTo(etOrder1.getTotalFee())!=0){
@ -273,11 +300,10 @@ public class AppVerifyController extends BaseController
if (comparisonResult < 0) { if (comparisonResult < 0) {
throw new ServiceException("余额不足扣除押金后余额小于0"); throw new ServiceException("余额不足扣除押金后余额小于0");
} }
asUser.setBalance(deposit);//更新用余额
// 更新用户并更新缓存 // 更新用户并更新缓存
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
AsUser currentUser = loginUser.getAsUser(); AsUser currentUser = loginUser.getAsUser();
currentUser.setBalance(deposit); currentUser.setBalance(BigDecimal.ZERO);
if (asUserService.updateUserProfile(currentUser) > 0) if (asUserService.updateUserProfile(currentUser) > 0)
{ {
logger.info("【提现金额】更新用户缓存:"+ JSON.toJSON(currentUser)); logger.info("【提现金额】更新用户缓存:"+ JSON.toJSON(currentUser));
@ -287,7 +313,7 @@ public class AppVerifyController extends BaseController
} }
} }
logger.info("提现金额:【{}】", etOrder1.getTotalFee()); logger.info("提现金额:【{}】", etOrder1.getTotalFee());
return toAjax(etOrderService.withdraw(etOrder1,deposit)); return etOrderService.withdraw(etOrder1,deposit);
} }
/** /**

View File

@ -205,7 +205,7 @@ public class ReceiveController {
adminOrder.setDeviceMac(device.getMac()); adminOrder.setDeviceMac(device.getMac());
adminOrder.setSn(device.getSn()); adminOrder.setSn(device.getSn());
adminOrder.setBeforeElectric(Integer.parseInt(device.getRemainingPower())); adminOrder.setBeforeElectric(Integer.parseInt(device.getRemainingPower()));
adminOrder.setOrderNo(IdUtils.randomUUID2()); adminOrder.setOrderNo(IdUtils.getOrderNo("hd"));
adminOrder.setAreaId(area.getAreaId()); adminOrder.setAreaId(area.getAreaId());
adminOrder.setStatus(ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_UNDER_WAY); adminOrder.setStatus(ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_UNDER_WAY);
adminOrder.setIsEffective(ServiceConstants.REPLACEMENT_ELECTRICITY_IS_EFFECTIVE_YES); adminOrder.setIsEffective(ServiceConstants.REPLACEMENT_ELECTRICITY_IS_EFFECTIVE_YES);

View File

@ -142,7 +142,9 @@ public class SysDeptController extends BaseController
if (ObjectUtil.isNotNull(areaIds)) if (ObjectUtil.isNotNull(areaIds))
{ {
for (Long areaId:areaIds) { for (Long areaId:areaIds) {
List<EtAreaDept> areaId1 = etAreaDeptMapper.selectList(new QueryWrapper<EtAreaDept>().eq("area_id", areaId)); QueryWrapper<EtAreaDept> queryWrapper = new QueryWrapper<EtAreaDept>().eq("area_id", areaId);
queryWrapper.ne("dept_id", deptId);
List<EtAreaDept> areaId1 = etAreaDeptMapper.selectList(queryWrapper);
if (ObjectUtil.isNotEmpty(areaId1)){ if (ObjectUtil.isNotEmpty(areaId1)){
return error("运营区'" + etOperatingAreaMapper.selectById(areaId1.get(0)).getAreaName() + "'已经被绑定"); return error("运营区'" + etOperatingAreaMapper.selectById(areaId1.get(0)).getAreaName() + "'已经被绑定");
} }

View File

@ -233,3 +233,4 @@ et:
appcode: 32b6c6445b1a42ed862dd4202392c47d appcode: 32b6c6445b1a42ed862dd4202392c47d
repairAdmin: wx repairAdmin: wx
operateAdmin: root operateAdmin: root
profitSharing: true

View File

@ -142,4 +142,24 @@ public class CommonUtil {
// log.info("当前电量百分百:{}%",multiply); // log.info("当前电量百分百:{}%",multiply);
return multiply.intValue(); return multiply.intValue();
} }
/**
* 根据电压计算电量百分比
*
* 计算公示 ((高电压-低电压) * 百分比 / 100 ) + 低电压
*
* @param percentage 百分比
* @param fullVoltage 满电电压
* @param lowVoltage 亏电电压
* @author qzz
*/
public static Integer getElectricQuantityByPercentage(Integer percentage,Double fullVoltage,Double lowVoltage) {
BigDecimal lowVoltageBig = new BigDecimal(lowVoltage);
BigDecimal full = new BigDecimal(fullVoltage).subtract(lowVoltageBig);
BigDecimal multiply1 = full.multiply(new BigDecimal(percentage));
BigDecimal divide1 = multiply1.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
BigDecimal add = divide1.add(lowVoltageBig);
log.info("根据百分比计算出的电压:{}V",add);
return add.intValue();
}
} }

View File

@ -1,10 +1,8 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
/** /**
* 车辆型号对象 et_model * 车辆型号对象 et_model
@ -28,9 +26,13 @@ public class EtModel extends BaseEntity
@Excel(name = "品牌商") @Excel(name = "品牌商")
private String brand; private String brand;
/** 运营商id */
@Excel(name = "运营商id")
private Long operator;
/** 运营商 */ /** 运营商 */
@Excel(name = "运营商") @Excel(name = "运营商")
private String operator; private String operatorName;
/** 满电电压 */ /** 满电电压 */
@Excel(name = "满电电压") @Excel(name = "满电电压")

View File

@ -227,4 +227,12 @@ public interface EtOrderMapper
* 待结算订单 * 待结算订单
*/ */
List<EtOrder> selectNeedDividendOrder(); List<EtOrder> selectNeedDividendOrder();
/**
* 根据订单号删除订单
*
* @param orderNo 订单号
* @return 结果
*/
int deleteEtOrderByOrderNo(String orderNo);
} }

View File

@ -166,4 +166,11 @@ public interface IEtOrderService
EtOrder getCurrentOrder(String sn); EtOrder getCurrentOrder(String sn);
/**
* 删除订单信息
*
* @param orderNo 订单号
* @return 结果
*/
int deleteEtOrderByOrderNo(String orderNo);
} }

View File

@ -234,6 +234,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
public int insertAsDevice(AsDevice asDevice) public int insertAsDevice(AsDevice asDevice)
{ {
asDevice.setCreateTime(DateUtils.getNowDate()); asDevice.setCreateTime(DateUtils.getNowDate());
// asDevice.setAreaId();
return asDeviceMapper.insertAsDevice(asDevice); return asDeviceMapper.insertAsDevice(asDevice);
} }
@ -426,7 +427,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
OrderResponse response = new OrderResponse(); OrderResponse response = new OrderResponse();
String orderNo = ""; String orderNo = "";
if(ObjectUtil.isNull(orderVo.getOrderNo())){ if(ObjectUtil.isNull(orderVo.getOrderNo())){
orderNo = IdUtils.randomUUID2(); orderNo = IdUtils.getOrderNo("qx");
}else{ }else{
orderNo = orderVo.getOrderNo(); orderNo = orderVo.getOrderNo();
} }
@ -790,7 +791,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
@Override @Override
public OrderResponse deviceAppointment(EtOrderVo appointmentVo) { public OrderResponse deviceAppointment(EtOrderVo appointmentVo) {
OrderResponse orderResponse = new OrderResponse(); OrderResponse orderResponse = new OrderResponse();
String orderNo = IdUtils.randomUUID2(); String orderNo = IdUtils.getOrderNo("qx");;
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(appointmentVo.getSn()); AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(appointmentVo.getSn());
//创建订单 //创建订单
EtOrder order = etOrderService.createOrder(appointmentVo, orderNo); EtOrder order = etOrderService.createOrder(appointmentVo, orderNo);

View File

@ -169,7 +169,7 @@ public class EtFaultServiceImpl implements IEtFaultService
{ {
//如果工单通过后创建维修工单并自动分配维修员 //如果工单通过后创建维修工单并自动分配维修员
if("2".equals(etFault.getStatus())){ if("2".equals(etFault.getStatus())){
String orderNo = IdUtils.randomUUID2(); String orderNo = IdUtils.getOrderNo("wx");
EtAdminOrder adminOrder = new EtAdminOrder(); EtAdminOrder adminOrder = new EtAdminOrder();
adminOrder.setOrderNo(orderNo); adminOrder.setOrderNo(orderNo);
adminOrder.setDeviceMac(etFault.getDeviceMac()); adminOrder.setDeviceMac(etFault.getDeviceMac());

View File

@ -6,11 +6,18 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.constant.IotConstants; import com.ruoyi.common.constant.IotConstants;
import com.ruoyi.common.core.domain.entity.AsUser;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.CommonUtil;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.onenet.Token; import com.ruoyi.common.utils.onenet.Token;
import com.ruoyi.system.domain.AsDevice; import com.ruoyi.system.domain.AsDevice;
import com.ruoyi.system.mapper.AsDeviceMapper; import com.ruoyi.system.mapper.AsDeviceMapper;
import com.ruoyi.system.service.IAsDeviceService; import com.ruoyi.system.service.IAsDeviceService;
import com.ruoyi.system.service.ISysDeptService;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -32,12 +39,18 @@ import javax.annotation.Resource;
@Service @Service
public class EtModelServiceImpl implements IEtModelService public class EtModelServiceImpl implements IEtModelService
{ {
@Autowired @Resource
private EtModelMapper etModelMapper; private EtModelMapper etModelMapper;
@Autowired @Autowired
private IAsDeviceService asDeviceService; private IAsDeviceService asDeviceService;
@Autowired
private ISysDeptService deptService;
@Resource
private AsDeviceMapper asDeviceMapper;
/** /**
* 查询车辆型号 * 查询车辆型号
* *
@ -56,7 +69,7 @@ public class EtModelServiceImpl implements IEtModelService
} }
/** /**
* 查询车辆型号列表 合伙人 Partner * 查询车辆型号列表
* *
* @param etModel 车辆型号 * @param etModel 车辆型号
* @return 车辆型号 * @return 车辆型号
@ -66,10 +79,16 @@ public class EtModelServiceImpl implements IEtModelService
{ {
List<EtModel> etModels = etModelMapper.selectEtModelList(etModel); List<EtModel> etModels = etModelMapper.selectEtModelList(etModel);
for(EtModel model: etModels){ for(EtModel model: etModels){
// 投放数量统计
AsDevice device = new AsDevice(); AsDevice device = new AsDevice();
device.setModelId(model.getModelId()); device.setModelId(model.getModelId());
List<AsDevice> asDevices = asDeviceService.selectAsDeviceList(device); List<AsDevice> asDevices = asDeviceService.selectAsDeviceList(device);
model.setDeviceNum(asDevices.size()); model.setDeviceNum(asDevices.size());
// 运营商名称
SysDept sysDept = deptService.selectDeptById(model.getOperator());
if(ObjectUtil.isNotNull(sysDept)){
model.setOperatorName(sysDept.getDeptName());
}
} }
return etModels; return etModels;
} }
@ -85,6 +104,12 @@ public class EtModelServiceImpl implements IEtModelService
@Transactional @Transactional
public int insertEtModel(EtModel etModel) public int insertEtModel(EtModel etModel)
{ {
if(etModel.getOperator() != null){
SysUser currentUser = SecurityUtils.getLoginUser().getUser();//获取当前系统用户
if(!currentUser.isAdmin()){
etModel.setOperator(currentUser.getDeptId());
}
}
etModel.setCreateTime(DateUtils.getNowDate()); etModel.setCreateTime(DateUtils.getNowDate());
int i = etModelMapper.insertEtModel(etModel); int i = etModelMapper.insertEtModel(etModel);
// 发送设置低电压命令 // 发送设置低电压命令
@ -92,9 +117,11 @@ public class EtModelServiceImpl implements IEtModelService
if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){ if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){
AsDevice device = new AsDevice(); AsDevice device = new AsDevice();
device.setModelId(etModel.getModelId()); device.setModelId(etModel.getModelId());
List<AsDevice> asDevices = asDeviceService.selectAsDeviceList(device); List<AsDevice> asDevices = asDeviceMapper.selectAsDeviceList(device);
for(AsDevice asDevice: asDevices){ for(AsDevice asDevice: asDevices){
String lowVoltageCommand = IotConstants.COMMAND_BAT + lowBatteryReminder * 10 + "@"; // 根据百分比计算提醒电压值
Integer quantityByPercentage = CommonUtil.getElectricQuantityByPercentage(lowBatteryReminder, etModel.getFullVoltage(), etModel.getLowVoltage());
String lowVoltageCommand = IotConstants.COMMAND_BAT + quantityByPercentage * 10 + "@";
log.info("发送低电压命令:" + lowVoltageCommand); log.info("发送低电压命令:" + lowVoltageCommand);
asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报"); asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报");
} }
@ -113,6 +140,12 @@ public class EtModelServiceImpl implements IEtModelService
@Transactional @Transactional
public int updateEtModel(EtModel etModel) public int updateEtModel(EtModel etModel)
{ {
if(etModel.getOperator() != null){
SysUser currentUser = SecurityUtils.getLoginUser().getUser();//获取当前系统用户
if(!currentUser.isAdmin()){
etModel.setOperator(currentUser.getDeptId());
}
}
etModel.setUpdateTime(DateUtils.getNowDate()); etModel.setUpdateTime(DateUtils.getNowDate());
int i = etModelMapper.updateEtModel(etModel); int i = etModelMapper.updateEtModel(etModel);
// 发送设置低电压命令 // 发送设置低电压命令
@ -120,9 +153,11 @@ public class EtModelServiceImpl implements IEtModelService
if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){ if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){
AsDevice device = new AsDevice(); AsDevice device = new AsDevice();
device.setModelId(etModel.getModelId()); device.setModelId(etModel.getModelId());
List<AsDevice> asDevices = asDeviceService.selectAsDeviceList(device); List<AsDevice> asDevices = asDeviceMapper.selectAsDeviceList(device);
for(AsDevice asDevice: asDevices){ for(AsDevice asDevice: asDevices){
String lowVoltageCommand = IotConstants.COMMAND_BAT + lowBatteryReminder * 10 + "@"; // 根据百分比计算提醒电压值
Integer quantityByPercentage = CommonUtil.getElectricQuantityByPercentage(lowBatteryReminder, etModel.getFullVoltage(), etModel.getLowVoltage());
String lowVoltageCommand = IotConstants.COMMAND_BAT + quantityByPercentage * 10 + "@";
log.info("发送低电压命令:" + lowVoltageCommand); log.info("发送低电压命令:" + lowVoltageCommand);
asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报"); asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报");
} }

View File

@ -271,6 +271,20 @@ public class EtOrderServiceImpl implements IEtOrderService
return null; return null;
} }
/**
* 删除订单信息
*
* @param orderNo 订单号
* @return 结果
*/
@Override
public int deleteEtOrderByOrderNo(String orderNo) {
if(ObjectUtil.isNotNull(etOrderMapper.selectEtOrderByOrderNo(orderNo))){
return etOrderMapper.deleteEtOrderByOrderNo(orderNo);
}
return 1;
}
private boolean toBePaid(String[] statusList) { private boolean toBePaid(String[] statusList) {
boolean hasOne = false; boolean hasOne = false;
boolean hasThree = false; boolean hasThree = false;
@ -382,7 +396,7 @@ public class EtOrderServiceImpl implements IEtOrderService
if(isExitDepositOrder(order.getUserId())){ if(isExitDepositOrder(order.getUserId())){
throw new ServiceException("您已经充值押金,请勿重复充值"); throw new ServiceException("您已经充值押金,请勿重复充值");
} }
String orderNo = IdUtils.randomUUID2(); String orderNo = IdUtils.getOrderNo("yj");
// 押金订单直接生成订单 // 押金订单直接生成订单
etOrder = createOrder(order, orderNo); etOrder = createOrder(order, orderNo);
int i = etOrderMapper.insertEtOrder(etOrder); int i = etOrderMapper.insertEtOrder(etOrder);

View File

@ -312,12 +312,14 @@ public class SysUserServiceImpl implements ISysUserService
// 分账项目 // 分账项目
setDividendItem(user); setDividendItem(user);
// 添加分账接收方 // 添加分账接收方
if(user.getUserType().equals("03")){
AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber()); AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber());
if(ObjectUtils.isNotEmpty(asUser)){ if(ObjectUtils.isNotEmpty(asUser)){
addReceiver(user,asUser); addReceiver(user,asUser);
}else{ }else{
throw new ServiceException("未查询到APP用户,请登录小程序"); throw new ServiceException("未查询到APP用户,请登录小程序");
} }
}
//根据运营区id查询运营商id 运营商与运营区是一对多关系 //根据运营区id查询运营商id 运营商与运营区是一对多关系
setOperatorId(user); setOperatorId(user);
// 新增用户信息 // 新增用户信息
@ -393,6 +395,7 @@ public class SysUserServiceImpl implements ISysUserService
insertUserPost(user); insertUserPost(user);
// 分账项目 // 分账项目
setDividendItem(user); setDividendItem(user);
if(user.getUserType().equals("03")){
AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber()); AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber());
if(ObjectUtils.isNotEmpty(asUser)){ if(ObjectUtils.isNotEmpty(asUser)){
// 删除分账接收方 // 删除分账接收方
@ -402,6 +405,7 @@ public class SysUserServiceImpl implements ISysUserService
}else{ }else{
throw new ServiceException("未查询到APP用户,请登录小程序"); throw new ServiceException("未查询到APP用户,请登录小程序");
} }
}
//根据运营区id查询运营商id 运营商与运营区是一对多关系 //根据运营区id查询运营商id 运营商与运营区是一对多关系
setOperatorId(user); setOperatorId(user);
return userMapper.updateUser(user); return userMapper.updateUser(user);

View File

@ -32,6 +32,7 @@ import com.wechat.pay.java.service.refund.model.QueryByOutRefundNoRequest;
import com.wechat.pay.java.service.refund.model.Refund; import com.wechat.pay.java.service.refund.model.Refund;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
@ -83,6 +84,9 @@ public class WxPayService implements IWxPayService {
@Autowired @Autowired
private RedisLock redisLock; private RedisLock redisLock;
@Value("${et.profitSharing}")
private Boolean profitSharing;
private static final String CNY = "CNY"; private static final String CNY = "CNY";
private static final String PREPAY_LOCK = "prepay:"; private static final String PREPAY_LOCK = "prepay:";
@ -114,7 +118,7 @@ public class WxPayService implements IWxPayService {
request.setNotifyUrl(wxPayConfig.getNotifyUrl()); request.setNotifyUrl(wxPayConfig.getNotifyUrl());
request.setPayer(getPayer(user.getWxopenid())); request.setPayer(getPayer(user.getWxopenid()));
SettleInfo settleInfo = new SettleInfo(); SettleInfo settleInfo = new SettleInfo();
settleInfo.setProfitSharing(Boolean.TRUE); settleInfo.setProfitSharing(profitSharing);
request.setSettleInfo(settleInfo); request.setSettleInfo(settleInfo);
PrepayWithRequestPaymentResponse res = jsapiServiceExtension.prepayWithRequestPayment(request); PrepayWithRequestPaymentResponse res = jsapiServiceExtension.prepayWithRequestPayment(request);
return res; return res;

View File

@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectClassifyById" parameterType="Long" resultMap="AsArticleClassifyResult"> <select id="selectClassifyById" parameterType="Long" resultMap="AsArticleClassifyResult">
select ac.classify_id, ac.parent_id, ac.ancestors, ac.classify_name, ac.order_num, ac.status, select ac.classify_id, ac.parent_id, ac.ancestors, ac.classify_name, ac.order_num, ac.status,
(select classify_name from et_article_classify where classify_id = ac.parent_id) parent_name (select classify_name from et_article_classify where classify_id = ac.parent_id) parent_name
from et_article_classify d from et_article_classify ac
where ac.classify_id = #{classifyId} where ac.classify_id = #{classifyId}
</select> </select>

View File

@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where model_id = #{modelId} where model_id = #{modelId}
</select> </select>
<insert id="insertEtModel" parameterType="EtModel"> <insert id="insertEtModel" parameterType="EtModel" keyProperty="modelId" useGeneratedKeys="true">
insert into et_model insert into et_model
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelId != null">model_id,</if> <if test="modelId != null">model_id,</if>

View File

@ -120,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
order by o.create_time desc
</select> </select>
<select id="selectEtOrderByOrderId" parameterType="Long" resultMap="EtOrderResult"> <select id="selectEtOrderByOrderId" parameterType="Long" resultMap="EtOrderResult">
@ -471,4 +472,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{orderId} #{orderId}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteEtOrderByOrderNo" parameterType="String">
delete from et_order where order_no = #{orderNo}
</delete>
</mapper> </mapper>