From 7129d0aa5d64c55539771b3500c94d7cdbb44d70 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Thu, 6 Jun 2024 22:07:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/app/AppController.java | 11 +++++ .../controller/app/AppVerifyController.java | 46 ++++++++++++++---- .../iot/receive/ReceiveController.java | 2 +- .../controller/system/SysDeptController.java | 4 +- .../src/main/resources/application.yml | 1 + .../com/ruoyi/common/utils/CommonUtil.java | 20 ++++++++ .../java/com/ruoyi/system/domain/EtModel.java | 10 ++-- .../ruoyi/system/mapper/EtOrderMapper.java | 8 ++++ .../ruoyi/system/service/IEtOrderService.java | 7 +++ .../service/impl/AsDeviceServiceImpl.java | 5 +- .../service/impl/EtFaultServiceImpl.java | 2 +- .../service/impl/EtModelServiceImpl.java | 47 ++++++++++++++++--- .../service/impl/EtOrderServiceImpl.java | 16 ++++++- .../service/impl/SysUserServiceImpl.java | 30 +++++++----- .../system/service/impl/WxPayService.java | 6 ++- .../mapper/system/AsArticleClassifyMapper.xml | 2 +- .../resources/mapper/system/EtModelMapper.xml | 14 +++--- .../resources/mapper/system/EtOrderMapper.xml | 4 ++ 18 files changed, 187 insertions(+), 48 deletions(-) diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java index 76e2a00..ab8d939 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppController.java @@ -1,9 +1,11 @@ package com.ruoyi.web.controller.app; import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.CommonUtil; import com.ruoyi.system.domain.*; import com.ruoyi.system.service.*; @@ -316,4 +318,13 @@ public class AppController extends BaseController return AjaxResult.success(transaction); } + /** + * 删除订单 + */ + @DeleteMapping("/{orderNo}") + public AjaxResult remove(@PathVariable String orderNo) + { + return toAjax(etOrderService.deleteEtOrderByOrderNo(orderNo)); + } + } diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java index 5cc014a..2a709af 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java @@ -23,13 +23,17 @@ import com.ruoyi.system.domain.response.OrderResponse; import com.ruoyi.system.domain.vo.*; import com.ruoyi.system.service.*; 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.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.Optional; /** * app接口(需要登录校验的) @@ -155,10 +159,16 @@ public class AppVerifyController extends BaseController } //非正常状态不得骑行 String status = asDevice.getStatus(); - EtOrder order1 = etOrderService.selectEtOrderByOrderNo(order.getOrderNo()); - if(!ServiceConstants.VEHICLE_STATUS_NORMAL.equals(status) && !order1.getSn().equals(order.getSn())){ - //根据状态值返回不同的提示 - return error(CommonUtil.format(status)); + if(!ServiceConstants.VEHICLE_STATUS_NORMAL.equals(status)){ + EtOrder order1 = etOrderService.selectEtOrderByOrderNo(order.getOrderNo()); + if(ObjectUtil.isNotNull(order1)){ + if(!order1.getSn().equals(order.getSn())){ + //根据状态值返回不同的提示 + return error(CommonUtil.format(status)); + } + }else{ + return error(CommonUtil.format(status)); + } } //根据余额和充值记录判断是否有充值过押金,没有充值过押金,提示充值押金 if(!asUserService.checkIsDeposit(order.getUserId())){ @@ -242,6 +252,7 @@ public class AppVerifyController extends BaseController @PostMapping("/order/withdraw") public AjaxResult withdraw() { + //根据订单号查询订单信息 EtOrder etOrder = new EtOrder(); etOrder.setUserId(getUserId()); @@ -252,14 +263,30 @@ public class AppVerifyController extends BaseController if(etOrders.size()==0){ throw new ServiceException("提现失败,未找到押金订单"); } - if(etOrders.size()>1){ - throw new ServiceException("提现失败,有多条status="+ServiceConstants.ORDER_STATUS_ORDER_END+"(已完成),paid="+ServiceConstants.ORDER_PAY_STATUS_PAID+"(已支付)的押金订单"); - } List inOrder = etOrderService.isInOrder(etOrder.getUserId(), null); if(inOrder.size()>0){ throw new ServiceException("提现失败,用户还有未完成订单"); } + if(etOrders.size()>1){ + logger.info("有多条status="+ServiceConstants.ORDER_STATUS_ORDER_END+"(已完成),paid="+ServiceConstants.ORDER_PAY_STATUS_PAID+"(已支付)的押金订单"); + logger.info("获取最后一条押金充值记录"); + Optional latestOrder = etOrders.stream() + .max(Comparator.comparing(EtOrder::getPayTime)); + if (latestOrder.isPresent()) { + EtOrder newestOrder = latestOrder.get(); + return toAjax(depositWithdraw(newestOrder)); + } + } EtOrder etOrder1 = etOrders.get(0); + Integer withdraw = depositWithdraw(etOrder1); + return toAjax(withdraw); + } + + /** + * 押金提现 + */ + @NotNull + private Integer depositWithdraw(EtOrder etOrder1) { EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(etOrder1.getAreaId()); BigDecimal deposit = new BigDecimal(area.getDeposit()); if(deposit.compareTo(etOrder1.getTotalFee())!=0){ @@ -273,11 +300,10 @@ public class AppVerifyController extends BaseController if (comparisonResult < 0) { throw new ServiceException("余额不足,扣除押金后余额小于0"); } - asUser.setBalance(deposit);//更新用余额 // 更新用户并更新缓存 LoginUser loginUser = SecurityUtils.getLoginUser(); AsUser currentUser = loginUser.getAsUser(); - currentUser.setBalance(deposit); + currentUser.setBalance(BigDecimal.ZERO); if (asUserService.updateUserProfile(currentUser) > 0) { logger.info("【提现金额】更新用户缓存:"+ JSON.toJSON(currentUser)); @@ -287,7 +313,7 @@ public class AppVerifyController extends BaseController } } logger.info("提现金额:【{}】", etOrder1.getTotalFee()); - return toAjax(etOrderService.withdraw(etOrder1,deposit)); + return etOrderService.withdraw(etOrder1,deposit); } /** diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java index b7a3596..6ab63b0 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/iot/receive/ReceiveController.java @@ -205,7 +205,7 @@ public class ReceiveController { adminOrder.setDeviceMac(device.getMac()); adminOrder.setSn(device.getSn()); adminOrder.setBeforeElectric(Integer.parseInt(device.getRemainingPower())); - adminOrder.setOrderNo(IdUtils.randomUUID2()); + adminOrder.setOrderNo(IdUtils.getOrderNo("hd")); adminOrder.setAreaId(area.getAreaId()); adminOrder.setStatus(ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_UNDER_WAY); adminOrder.setIsEffective(ServiceConstants.REPLACEMENT_ELECTRICITY_IS_EFFECTIVE_YES); diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index e2f766f..9809f34 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -142,7 +142,9 @@ public class SysDeptController extends BaseController if (ObjectUtil.isNotNull(areaIds)) { for (Long areaId:areaIds) { - List areaId1 = etAreaDeptMapper.selectList(new QueryWrapper().eq("area_id", areaId)); + QueryWrapper queryWrapper = new QueryWrapper().eq("area_id", areaId); + queryWrapper.ne("dept_id", deptId); + List areaId1 = etAreaDeptMapper.selectList(queryWrapper); if (ObjectUtil.isNotEmpty(areaId1)){ return error("运营区'" + etOperatingAreaMapper.selectById(areaId1.get(0)).getAreaName() + "'已经被绑定"); } diff --git a/electripper-admin/src/main/resources/application.yml b/electripper-admin/src/main/resources/application.yml index e8d230b..bab787d 100644 --- a/electripper-admin/src/main/resources/application.yml +++ b/electripper-admin/src/main/resources/application.yml @@ -233,3 +233,4 @@ et: appcode: 32b6c6445b1a42ed862dd4202392c47d repairAdmin: wx operateAdmin: root + profitSharing: true diff --git a/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java b/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java index 3db2fc7..dee6511 100644 --- a/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java +++ b/electripper-common/src/main/java/com/ruoyi/common/utils/CommonUtil.java @@ -142,4 +142,24 @@ public class CommonUtil { // log.info("当前电量百分百:{}%",multiply); 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(); + } } diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtModel.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtModel.java index 4b917c4..d9fdb2a 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtModel.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtModel.java @@ -1,10 +1,8 @@ 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.core.domain.BaseEntity; +import lombok.Data; /** * 车辆型号对象 et_model @@ -28,9 +26,13 @@ public class EtModel extends BaseEntity @Excel(name = "品牌商") private String brand; + /** 运营商id */ + @Excel(name = "运营商id") + private Long operator; + /** 运营商 */ @Excel(name = "运营商") - private String operator; + private String operatorName; /** 满电电压 */ @Excel(name = "满电电压") diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java index 30a5d10..9a27e28 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtOrderMapper.java @@ -227,4 +227,12 @@ public interface EtOrderMapper * 待结算订单 */ List selectNeedDividendOrder(); + + /** + * 根据订单号删除订单 + * + * @param orderNo 订单号 + * @return 结果 + */ + int deleteEtOrderByOrderNo(String orderNo); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java index 2b89a04..cf31db8 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IEtOrderService.java @@ -166,4 +166,11 @@ public interface IEtOrderService EtOrder getCurrentOrder(String sn); + /** + * 删除订单信息 + * + * @param orderNo 订单号 + * @return 结果 + */ + int deleteEtOrderByOrderNo(String orderNo); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java index dae535e..7dad74e 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsDeviceServiceImpl.java @@ -234,6 +234,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i public int insertAsDevice(AsDevice asDevice) { asDevice.setCreateTime(DateUtils.getNowDate()); +// asDevice.setAreaId(); return asDeviceMapper.insertAsDevice(asDevice); } @@ -426,7 +427,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i OrderResponse response = new OrderResponse(); String orderNo = ""; if(ObjectUtil.isNull(orderVo.getOrderNo())){ - orderNo = IdUtils.randomUUID2(); + orderNo = IdUtils.getOrderNo("qx"); }else{ orderNo = orderVo.getOrderNo(); } @@ -790,7 +791,7 @@ public class AsDeviceServiceImpl extends ServiceImpl i @Override public OrderResponse deviceAppointment(EtOrderVo appointmentVo) { OrderResponse orderResponse = new OrderResponse(); - String orderNo = IdUtils.randomUUID2(); + String orderNo = IdUtils.getOrderNo("qx");; AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(appointmentVo.getSn()); //创建订单 EtOrder order = etOrderService.createOrder(appointmentVo, orderNo); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFaultServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFaultServiceImpl.java index 4d5fc36..3fdb450 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFaultServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFaultServiceImpl.java @@ -169,7 +169,7 @@ public class EtFaultServiceImpl implements IEtFaultService { //如果工单通过后,创建维修工单并自动分配维修员 if("2".equals(etFault.getStatus())){ - String orderNo = IdUtils.randomUUID2(); + String orderNo = IdUtils.getOrderNo("wx"); EtAdminOrder adminOrder = new EtAdminOrder(); adminOrder.setOrderNo(orderNo); adminOrder.setDeviceMac(etFault.getDeviceMac()); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java index 212af84..7972931 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtModelServiceImpl.java @@ -6,11 +6,18 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.SecurityUtils; import com.ruoyi.common.utils.onenet.Token; import com.ruoyi.system.domain.AsDevice; import com.ruoyi.system.mapper.AsDeviceMapper; import com.ruoyi.system.service.IAsDeviceService; +import com.ruoyi.system.service.ISysDeptService; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -32,12 +39,18 @@ import javax.annotation.Resource; @Service public class EtModelServiceImpl implements IEtModelService { - @Autowired + @Resource private EtModelMapper etModelMapper; @Autowired private IAsDeviceService asDeviceService; + @Autowired + private ISysDeptService deptService; + + @Resource + private AsDeviceMapper asDeviceMapper; + /** * 查询车辆型号 * @@ -56,7 +69,7 @@ public class EtModelServiceImpl implements IEtModelService } /** - * 查询车辆型号列表 合伙人 Partner + * 查询车辆型号列表 * * @param etModel 车辆型号 * @return 车辆型号 @@ -66,10 +79,16 @@ public class EtModelServiceImpl implements IEtModelService { List etModels = etModelMapper.selectEtModelList(etModel); for(EtModel model: etModels){ + // 投放数量统计 AsDevice device = new AsDevice(); device.setModelId(model.getModelId()); List asDevices = asDeviceService.selectAsDeviceList(device); model.setDeviceNum(asDevices.size()); + // 运营商名称 + SysDept sysDept = deptService.selectDeptById(model.getOperator()); + if(ObjectUtil.isNotNull(sysDept)){ + model.setOperatorName(sysDept.getDeptName()); + } } return etModels; } @@ -85,6 +104,12 @@ public class EtModelServiceImpl implements IEtModelService @Transactional 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()); int i = etModelMapper.insertEtModel(etModel); // 发送设置低电压命令 @@ -92,9 +117,11 @@ public class EtModelServiceImpl implements IEtModelService if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){ AsDevice device = new AsDevice(); device.setModelId(etModel.getModelId()); - List asDevices = asDeviceService.selectAsDeviceList(device); + List asDevices = asDeviceMapper.selectAsDeviceList(device); 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); asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报"); } @@ -113,6 +140,12 @@ public class EtModelServiceImpl implements IEtModelService @Transactional 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()); int i = etModelMapper.updateEtModel(etModel); // 发送设置低电压命令 @@ -120,9 +153,11 @@ public class EtModelServiceImpl implements IEtModelService if(ObjectUtil.isNotNull(lowBatteryReminder) && lowBatteryReminder > 0){ AsDevice device = new AsDevice(); device.setModelId(etModel.getModelId()); - List asDevices = asDeviceService.selectAsDeviceList(device); + List asDevices = asDeviceMapper.selectAsDeviceList(device); 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); asDeviceService.sendCommand(asDevice.getMac(), Token.getToken(), lowVoltageCommand,"发送低电压播报"); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java index a9a363b..19b60be 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java @@ -271,6 +271,20 @@ public class EtOrderServiceImpl implements IEtOrderService 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) { boolean hasOne = false; boolean hasThree = false; @@ -382,7 +396,7 @@ public class EtOrderServiceImpl implements IEtOrderService if(isExitDepositOrder(order.getUserId())){ throw new ServiceException("您已经充值押金,请勿重复充值"); } - String orderNo = IdUtils.randomUUID2(); + String orderNo = IdUtils.getOrderNo("yj"); // 押金订单,直接生成订单 etOrder = createOrder(order, orderNo); int i = etOrderMapper.insertEtOrder(etOrder); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 3902041..3e446dd 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -312,11 +312,13 @@ public class SysUserServiceImpl implements ISysUserService // 分账项目 setDividendItem(user); // 添加分账接收方 - AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber()); - if(ObjectUtils.isNotEmpty(asUser)){ - addReceiver(user,asUser); - }else{ - throw new ServiceException("未查询到APP用户,请登录小程序"); + if(user.getUserType().equals("03")){ + AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber()); + if(ObjectUtils.isNotEmpty(asUser)){ + addReceiver(user,asUser); + }else{ + throw new ServiceException("未查询到APP用户,请登录小程序"); + } } //根据运营区id查询运营商id, 运营商与运营区是一对多关系 setOperatorId(user); @@ -393,14 +395,16 @@ public class SysUserServiceImpl implements ISysUserService insertUserPost(user); // 分账项目 setDividendItem(user); - AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber()); - if(ObjectUtils.isNotEmpty(asUser)){ - // 删除分账接收方 - deleteReceiver(asUser.getWxopenid()); - // 添加分账接收方 - addReceiver(user,asUser); - }else{ - throw new ServiceException("未查询到APP用户,请登录小程序"); + if(user.getUserType().equals("03")){ + AsUser asUser = asUserService.selectUserByPhone(user.getPhonenumber()); + if(ObjectUtils.isNotEmpty(asUser)){ + // 删除分账接收方 + deleteReceiver(asUser.getWxopenid()); + // 添加分账接收方 + addReceiver(user,asUser); + }else{ + throw new ServiceException("未查询到APP用户,请登录小程序"); + } } //根据运营区id查询运营商id, 运营商与运营区是一对多关系 setOperatorId(user); diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/WxPayService.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/WxPayService.java index 79d52ab..d7a73bb 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/WxPayService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/WxPayService.java @@ -32,6 +32,7 @@ import com.wechat.pay.java.service.refund.model.QueryByOutRefundNoRequest; import com.wechat.pay.java.service.refund.model.Refund; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.support.TransactionTemplate; @@ -83,6 +84,9 @@ public class WxPayService implements IWxPayService { @Autowired private RedisLock redisLock; + @Value("${et.profitSharing}") + private Boolean profitSharing; + private static final String CNY = "CNY"; private static final String PREPAY_LOCK = "prepay:"; @@ -114,7 +118,7 @@ public class WxPayService implements IWxPayService { request.setNotifyUrl(wxPayConfig.getNotifyUrl()); request.setPayer(getPayer(user.getWxopenid())); SettleInfo settleInfo = new SettleInfo(); - settleInfo.setProfitSharing(Boolean.TRUE); + settleInfo.setProfitSharing(profitSharing); request.setSettleInfo(settleInfo); PrepayWithRequestPaymentResponse res = jsapiServiceExtension.prepayWithRequestPayment(request); return res; diff --git a/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml b/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml index d8a4885..9846f28 100644 --- a/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsArticleClassifyMapper.xml @@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/electripper-system/src/main/resources/mapper/system/EtModelMapper.xml b/electripper-system/src/main/resources/mapper/system/EtModelMapper.xml index 7edfed8..a6bdd15 100644 --- a/electripper-system/src/main/resources/mapper/system/EtModelMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtModelMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -26,19 +26,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - - + + insert into et_model model_id, @@ -96,9 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from et_model where model_id in + delete from et_model where model_id in #{modelId} - \ No newline at end of file + diff --git a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml index 935c25d..424f0a0 100644 --- a/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtOrderMapper.xml @@ -120,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} + order by o.create_time desc