1.提现扣款等
2.命令日志
This commit is contained in:
parent
d748a8cbe9
commit
7c401c0666
|
|
@ -295,10 +295,10 @@ public class AppController extends BaseController
|
|||
@GetMapping("/getAddress")
|
||||
public AjaxResult deviceList(String location)
|
||||
{
|
||||
logger.info("根据定位获取地址:【location="+location+"】");
|
||||
String address = CommonUtil.getAddressByGeo(location);
|
||||
logger.info("根据定位获取地址:【address="+address+"】");
|
||||
return AjaxResult.success("操作成功", address);
|
||||
// logger.info("根据定位获取地址:【location="+location+"】");
|
||||
// String address = CommonUtil.getAddressByGeo(location);
|
||||
// logger.info("根据定位获取地址:【address="+address+"】");
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ public class AppVerifyController extends BaseController
|
|||
* 押金抵扣
|
||||
*/
|
||||
@Log(title = "押金抵扣", businessType = BusinessType.DEDUCTION)
|
||||
@PutMapping("/order/deduction")
|
||||
@PostMapping("/order/deduction")
|
||||
public AjaxResult deduction(@RequestBody EtOrder etOrder)
|
||||
{
|
||||
logger.info("【押金抵扣请求】:{}", JSON.toJSON(etOrder));
|
||||
|
|
|
|||
|
|
@ -35,5 +35,9 @@ public class LogEntry {
|
|||
private Integer bat;//电池电压 "bat":571 ==> 57.1V
|
||||
|
||||
private Integer csq;//信号强度
|
||||
|
||||
private Integer s;//卫星数量
|
||||
|
||||
private Integer q;//质量
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,6 +202,8 @@ public class ReceiveController {
|
|||
device.setLastTime(DateUtils.getNowDate());
|
||||
// 信号强度
|
||||
device.setSignalStrength(value.getCsq());
|
||||
device.setSatellites(value.getS());
|
||||
device.setQuality(value.getQ());
|
||||
int i = asDeviceService.updateLocation(device);
|
||||
if(i>0){
|
||||
log.info("更新定位成功==========================>" +logEntry.getDevName());
|
||||
|
|
@ -225,7 +227,7 @@ public class ReceiveController {
|
|||
boolean inPolygon = asDeviceService.isNoRidingAreaWithTolerance(device.getSn(), device.getAreaId(),20);
|
||||
if (inPolygon) {
|
||||
log.info("距离禁行区20米内发送警告命令--SN:" + device.getSn());
|
||||
asDeviceService.sendCommand(device.getMac(), Token.getToken(), IotConstants.COMMAND_PLAY3, "距离禁行区20米内");
|
||||
asDeviceService.sendCommand(device.getMac(), Token.getToken(), IotConstants.COMMAND_PLAY2, "距离禁行区20米内");
|
||||
}
|
||||
}
|
||||
/** 3.超出运营区外断电*/
|
||||
|
|
@ -310,8 +312,8 @@ public class ReceiveController {
|
|||
adminOrder.setLatitude(device.getLatitude());
|
||||
adminOrder.setLongitude(device.getLongitude());
|
||||
adminOrder.setType("2");
|
||||
String location = device.getLongitude() + ","+device.getLatitude();
|
||||
adminOrder.setAddress(CommonUtil.getAddressByGeo(location));
|
||||
// String location = device.getLongitude() + ","+device.getLatitude();
|
||||
// adminOrder.setAddress(CommonUtil.getAddressByGeo(location));
|
||||
int i1 = etAdminOrderService.insertEtAdminOrder(adminOrder);
|
||||
if (i1 > 0) {
|
||||
log.info("生成换电工单成功");
|
||||
|
|
@ -352,6 +354,8 @@ public class ReceiveController {
|
|||
device.setRemainingPower(electricQuantity.toString());
|
||||
device.setLastTime(DateUtils.getNowDate());
|
||||
device.setSignalStrength(value.getCsq());
|
||||
device.setSatellites(value.getS());
|
||||
device.setQuality(value.getQ());
|
||||
int i = asDeviceService.updateLocation(device);
|
||||
if(i>0){
|
||||
log.info("未获取到定位===============保存电压等数值成功===========>" +logEntry.getDevName());
|
||||
|
|
|
|||
|
|
@ -1,27 +1,20 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.system.domain.AsDevice;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.service.IAsDeviceService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.AsDevice;
|
||||
import com.ruoyi.system.service.IAsDeviceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备Controller
|
||||
|
|
@ -102,7 +95,7 @@ public class AsDeviceController extends BaseController
|
|||
if(!asDeviceService.checkMACUnique(asDevice)){
|
||||
return error("修改车辆'" + asDevice.getDeviceName() + "'失败,MAC已存在");
|
||||
}
|
||||
return toAjax(asDeviceService.updateAsDevice(asDevice));
|
||||
return toAjax(asDeviceService.updateAsDevice2(asDevice));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.EtCommandLog;
|
||||
import com.ruoyi.system.service.IEtCommandLogService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 命令日志Controller
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-07-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/commandLog")
|
||||
public class EtCommandLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEtCommandLogService etCommandLogService;
|
||||
|
||||
/**
|
||||
* 查询命令日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:commandLog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EtCommandLog etCommandLog)
|
||||
{
|
||||
startPage();
|
||||
List<EtCommandLog> list = etCommandLogService.selectEtCommandLogList(etCommandLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出命令日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:commandLog:export')")
|
||||
@Log(title = "命令日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EtCommandLog etCommandLog)
|
||||
{
|
||||
List<EtCommandLog> list = etCommandLogService.selectEtCommandLogList(etCommandLog);
|
||||
ExcelUtil<EtCommandLog> util = new ExcelUtil<EtCommandLog>(EtCommandLog.class);
|
||||
util.exportExcel(response, list, "命令日志数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取命令日志详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:commandLog:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(etCommandLogService.selectEtCommandLogById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增命令日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:commandLog:add')")
|
||||
@Log(title = "命令日志", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EtCommandLog etCommandLog)
|
||||
{
|
||||
return toAjax(etCommandLogService.insertEtCommandLog(etCommandLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改命令日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:commandLog:edit')")
|
||||
@Log(title = "命令日志", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EtCommandLog etCommandLog)
|
||||
{
|
||||
return toAjax(etCommandLogService.updateEtCommandLog(etCommandLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除命令日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:commandLog:remove')")
|
||||
@Log(title = "命令日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(etCommandLogService.deleteEtCommandLogByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,25 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.constant.ServiceConstants;
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.domain.EtOperatingArea;
|
||||
import com.ruoyi.system.domain.vo.RechargeVo;
|
||||
import com.ruoyi.system.service.IAsUserService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
|
|
@ -36,6 +50,12 @@ public class EtOrderController extends BaseController
|
|||
@Autowired
|
||||
private IEtOrderService etOrderService;
|
||||
|
||||
@Autowired
|
||||
private IAsUserService asUserService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
*/
|
||||
|
|
@ -73,6 +93,36 @@ public class EtOrderController extends BaseController
|
|||
util.exportExcel(response, list, "订单数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 押金退款
|
||||
*/
|
||||
@Transactional
|
||||
@Log(title = "押金退款", businessType = BusinessType.REFUND)
|
||||
@PostMapping("/depositRefund/{orderNo}")
|
||||
public AjaxResult depositRefund(@PathVariable("orderNo") String orderNo)
|
||||
{
|
||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||
if(ObjectUtil.isNotNull(order)){
|
||||
Long userId = order.getUserId();
|
||||
if(userId!=null){
|
||||
AsUser asUser = asUserService.selectUserById(userId);
|
||||
if(asUser!=null){
|
||||
// 更新用户并更新缓存
|
||||
asUser.setBalance(BigDecimal.ZERO);
|
||||
if (asUserService.updateUserProfile(asUser) > 0)
|
||||
{
|
||||
logger.info("【提现金额】更新用户缓存:"+ JSON.toJSON(asUser));
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("押金退款:【{}】", order.getPayFee());
|
||||
int withdraw = etOrderService.withdraw(order, order.getPayFee());
|
||||
return toAjax(withdraw);
|
||||
}else{
|
||||
throw new ServiceException("订单不存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详细信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ public class SysDeptController extends BaseController
|
|||
@Resource
|
||||
private EtOperatingAreaMapper etOperatingAreaMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 获取运营商列表
|
||||
|
|
|
|||
|
|
@ -130,6 +130,13 @@ public class SysLoginController
|
|||
// 去掉 menus 中的名字为‘合伙人管理’的菜单
|
||||
menus.removeIf(menu -> menu.getMenuName().equals("合伙人管理"));
|
||||
}
|
||||
if(sysDept.getDeptId() == 101){
|
||||
// 找出 menus 中的名字为‘财务管理’的菜单,获取到它子菜单
|
||||
menus.stream().filter(menu -> menu.getMenuName().equals("财务管理")).forEach(menu -> {
|
||||
List<SysMenu> children = menu.getChildren();
|
||||
children.removeIf(child -> child.getMenuName().equals("提现记录"));
|
||||
});
|
||||
}
|
||||
return AjaxResult.success(menuService.buildMenus(menus));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ public class ServiceConstants {
|
|||
*/
|
||||
public static final String ORDER_TYPE_RIDING_REFUND = "4";
|
||||
|
||||
/**
|
||||
* 订单类型: 5-提现
|
||||
*/
|
||||
public static final String ORDER_TYPE_WITHDRAW = "5";
|
||||
|
||||
/**----------------------------订单类型end----------------------------*/
|
||||
/**----------------------------支付场景start----------------------------*/
|
||||
/** 支付场景: 1-骑行支付,2-取消预约支付,3-套餐支付,4-押金支付 */
|
||||
|
|
@ -123,18 +128,18 @@ public class ServiceConstants {
|
|||
/**----------------------------支付类型end----------------------------*/
|
||||
|
||||
/**----------------------------车辆状态start----------------------------*/
|
||||
/** 车辆状态: 0 未上架,1-正常,2-预约中,3-骑行中,4-临时锁车,8-下线;9-废弃 */
|
||||
/** 车辆状态: 7 未绑定 0 未上架,1-正常,2-预约中,3-骑行中,4-临时锁车,8-下线;9-废弃 */
|
||||
/**
|
||||
* 车辆状态: 7 未绑定
|
||||
*/
|
||||
public static final String VEHICLE_STATUS_NOT_BAND = "7";
|
||||
/**
|
||||
* 车辆状态: 0 未上架
|
||||
* 车辆状态: 0 未上架 回仓库
|
||||
*/
|
||||
public static final String VEHICLE_STATUS_NOT_LISTING = "0";
|
||||
|
||||
/**
|
||||
* 车辆状态: 1-正常
|
||||
* 车辆状态: 1-正常 待骑行
|
||||
*/
|
||||
public static final String VEHICLE_STATUS_NORMAL = "1";
|
||||
|
||||
|
|
@ -144,7 +149,7 @@ public class ServiceConstants {
|
|||
public static final String VEHICLE_STATUS_IN_APPOINTMENT = "2";
|
||||
|
||||
/**
|
||||
* 车辆状态: 3-使用中
|
||||
* 车辆状态: 3-使用中 骑行中
|
||||
*/
|
||||
public static final String VEHICLE_STATUS_IN_USING = "3";
|
||||
|
||||
|
|
@ -154,7 +159,7 @@ public class ServiceConstants {
|
|||
public static final String VEHICLE_STATUS_TEMPORARILY_LOCK = "4";
|
||||
|
||||
/**
|
||||
* 车辆状态: 8-下线
|
||||
* 车辆状态: 8-下线 禁用
|
||||
*/
|
||||
public static final String VEHICLE_STATUS_IN_OFFLINE = "8";
|
||||
|
||||
|
|
@ -357,6 +362,11 @@ public class ServiceConstants {
|
|||
*/
|
||||
public static final String REFUND_TYPE_DEPOSIT = "2";
|
||||
|
||||
/**
|
||||
* 退款类型:3-押金抵扣退款
|
||||
*/
|
||||
public static final String REFUND_TYPE_DEPOSIT_DEDUCTION = "3";
|
||||
|
||||
|
||||
/**----------------------------退款类型end----------------------------*/
|
||||
|
||||
|
|
@ -517,4 +527,16 @@ public class ServiceConstants {
|
|||
public static final String WITHDRAW_STATUS_REJECT = "2";
|
||||
/**----------------------------提现状态end----------------------------*/
|
||||
|
||||
/**----------------------------是否押金抵扣start----------------------------*/
|
||||
/** 是否押金抵扣:0-否;1-是 */
|
||||
/**
|
||||
* 是否押金抵扣:否
|
||||
*/
|
||||
public static final String NO_DEPOSIT_DEDUCTION = "0";
|
||||
/**
|
||||
* 是否押金抵扣:是
|
||||
*/
|
||||
public static final String IS_DEPOSIT_DEDUCTION = "1";
|
||||
/**----------------------------是否押金抵扣end----------------------------*/
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import com.ruoyi.common.utils.sql.SqlUtil;
|
|||
|
||||
/**
|
||||
* web层通用数据处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class BaseController
|
||||
|
|
@ -113,7 +113,7 @@ public class BaseController
|
|||
{
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*/
|
||||
|
|
@ -140,7 +140,7 @@ public class BaseController
|
|||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
*
|
||||
* @param rows 影响行数
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
|
@ -151,7 +151,7 @@ public class BaseController
|
|||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
*
|
||||
* @param result 结果
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -55,27 +55,27 @@ public class CommonUtil {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据定位获取地址
|
||||
* @author ruoyi
|
||||
*/
|
||||
public static String getAddressByGeo(String location) {
|
||||
String address = null;
|
||||
try {
|
||||
String url = StrUtil.format("https://restapi.amap.com/v3/geocode/regeo?key={}&location={}&&radius=1000&extensions=all", GEO_WEB_KEY, location);
|
||||
String result = HttpUtils.sendGet(url);
|
||||
log.info("【根据定位获取地址】请求结果result:{}",result);
|
||||
//将json字符串转换为Object
|
||||
JSONObject jsonObject = JSONObject.parseObject(result,JSONObject.class);
|
||||
JSONObject regeocode1 = jsonObject.getJSONObject("regeocode");
|
||||
address = regeocode1.getString("formatted_address");
|
||||
log.info("【根据定位获取地址】address=:【{}】",result);
|
||||
return address;
|
||||
} catch (Exception e) {
|
||||
log.error("【根据定位获取地址】转换地址报错", e);
|
||||
}
|
||||
return address;
|
||||
}
|
||||
// /**
|
||||
// * 根据定位获取地址
|
||||
// * @author ruoyi
|
||||
// */
|
||||
// public static String getAddressByGeo(String location) {
|
||||
// String address = null;
|
||||
// try {
|
||||
// String url = StrUtil.format("https://restapi.amap.com/v3/geocode/regeo?key={}&location={}&&radius=1000&extensions=all", GEO_WEB_KEY, location);
|
||||
// String result = HttpUtils.sendGet(url);
|
||||
// log.info("【根据定位获取地址】请求结果result:{}",result);
|
||||
// //将json字符串转换为Object
|
||||
// JSONObject jsonObject = JSONObject.parseObject(result,JSONObject.class);
|
||||
// JSONObject regeocode1 = jsonObject.getJSONObject("regeocode");
|
||||
// address = regeocode1.getString("formatted_address");
|
||||
// log.info("【根据定位获取地址】address=:【{}】",result);
|
||||
// return address;
|
||||
// } catch (Exception e) {
|
||||
// log.error("【根据定位获取地址】转换地址报错", e);
|
||||
// }
|
||||
// return address;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取省市县
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.ruoyi.common.utils.sql.SqlUtil;
|
|||
|
||||
/**
|
||||
* 分页工具类
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class PageUtils extends PageHelper
|
||||
|
|
|
|||
|
|
@ -168,4 +168,14 @@ public class AsDevice extends BaseEntityPlus implements Serializable {
|
|||
/** 信号强度 */
|
||||
private Integer signalStrength;
|
||||
|
||||
/** 质量*/
|
||||
private Integer quality;
|
||||
|
||||
/** 卫星数量 */
|
||||
private Integer satellites;
|
||||
|
||||
/** 查询未绑定车辆 */
|
||||
@TableField(exist = false)
|
||||
private String unBand;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ public class EtCapitalFlow extends BaseEntity
|
|||
@Excel(name = "手续费")
|
||||
private BigDecimal handlingCharge;
|
||||
|
||||
/** 平台服务费 */
|
||||
@Excel(name = "平台服务费")
|
||||
private BigDecimal platformServiceFee;
|
||||
|
||||
/** 运营商分账 */
|
||||
@Excel(name = "运营商分账")
|
||||
private BigDecimal operatorDividend;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* 命令日志对象 et_command_log
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-07-06
|
||||
*/
|
||||
@Data
|
||||
public class EtCommandLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 请求url */
|
||||
@Excel(name = "请求url")
|
||||
private String url;
|
||||
|
||||
/** 命令 */
|
||||
@Excel(name = "命令")
|
||||
private String command;
|
||||
|
||||
/** 类型 */
|
||||
@Excel(name = "类型")
|
||||
private String type;
|
||||
|
||||
/** mac */
|
||||
@Excel(name = "mac")
|
||||
private String mac;
|
||||
|
||||
/** sn */
|
||||
@Excel(name = "sn")
|
||||
private String sn;
|
||||
|
||||
/** 响应 */
|
||||
@Excel(name = "响应")
|
||||
private String result;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.ruoyi.common.annotation.Excel;
|
|||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆型号对象 et_model
|
||||
*
|
||||
|
|
@ -53,4 +55,7 @@ public class EtModel extends BaseEntity
|
|||
/** 已投放车辆数 */
|
||||
private Integer deviceNum;
|
||||
|
||||
@Excel(name = "运营区列表")
|
||||
private List<EtOperatingArea> areaList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,4 +204,7 @@ public class EtOperatingArea extends BaseEntityPlus implements Serializable
|
|||
|
||||
/** 运营区外还车:0-关闭;1-开启*/
|
||||
private String areaOutReturn;
|
||||
|
||||
/** 是否开启押金抵扣:0-否;1-是 */
|
||||
private String isDepositDeduction;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,4 +226,13 @@ public class EtOrder extends BaseEntity
|
|||
/** 1-预约超时,系统自动取消 */
|
||||
private String appointmentTimeout;
|
||||
|
||||
/** 是否押金抵扣:0-否;1-是 */
|
||||
@Excel(name = "是否押金抵扣")
|
||||
private String depositDeduction;
|
||||
|
||||
/** 是否开启押金抵扣:0-否;1-是 */
|
||||
@Excel(name = "是否开启押金抵扣")
|
||||
@TableField(exist = false)
|
||||
private String isDepositDeduction;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ public class EtRefund extends BaseEntity
|
|||
@Excel(name = "用户")
|
||||
private String userName;
|
||||
|
||||
/** 运营区id */
|
||||
@Excel(name = "运营区id")
|
||||
private Long areaId;
|
||||
|
||||
/** 运营区 */
|
||||
@Excel(name = "运营区")
|
||||
private String areaName;
|
||||
|
||||
/** 退款金额 */
|
||||
@Excel(name = "退款金额")
|
||||
private BigDecimal amount;
|
||||
|
|
|
|||
|
|
@ -52,4 +52,8 @@ public class EtWithdraw extends BaseEntity
|
|||
@Excel(name = "回调状态")
|
||||
private String callStatus;
|
||||
|
||||
/** 驳回原因 */
|
||||
@Excel(name = "驳回原因")
|
||||
private String rejectReason;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,14 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
|
|||
*/
|
||||
public int updateAsDevice(AsDevice asDevice);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*
|
||||
* @param asDevice 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsDevice2(AsDevice asDevice);
|
||||
|
||||
/**
|
||||
* 根据SN修改设备
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtCommandLog;
|
||||
|
||||
/**
|
||||
* 命令日志Mapper接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-07-06
|
||||
*/
|
||||
public interface EtCommandLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询命令日志
|
||||
*
|
||||
* @param id 命令日志主键
|
||||
* @return 命令日志
|
||||
*/
|
||||
public EtCommandLog selectEtCommandLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询命令日志列表
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 命令日志集合
|
||||
*/
|
||||
public List<EtCommandLog> selectEtCommandLogList(EtCommandLog etCommandLog);
|
||||
|
||||
/**
|
||||
* 新增命令日志
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtCommandLog(EtCommandLog etCommandLog);
|
||||
|
||||
/**
|
||||
* 修改命令日志
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtCommandLog(EtCommandLog etCommandLog);
|
||||
|
||||
/**
|
||||
* 删除命令日志
|
||||
*
|
||||
* @param id 命令日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCommandLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除命令日志
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCommandLogByIds(Long[] ids);
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ public interface EtRefundMapper
|
|||
* @param orderNo 订单号
|
||||
* @return 退款订单
|
||||
*/
|
||||
EtRefund selectEtRefundByOrderNo(String orderNo);
|
||||
List<EtRefund> selectEtRefundByOrderNo(String orderNo);
|
||||
|
||||
/**
|
||||
* 根据订单号查询退款订单对象
|
||||
|
|
|
|||
|
|
@ -75,6 +75,14 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
*/
|
||||
public int updateAsDevice(AsDevice asDevice);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*
|
||||
* @param asDevice 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAsDevice2(AsDevice asDevice);
|
||||
|
||||
/**
|
||||
* 根据SN修改设备
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtCommandLog;
|
||||
|
||||
/**
|
||||
* 命令日志Service接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-07-06
|
||||
*/
|
||||
public interface IEtCommandLogService
|
||||
{
|
||||
/**
|
||||
* 查询命令日志
|
||||
*
|
||||
* @param id 命令日志主键
|
||||
* @return 命令日志
|
||||
*/
|
||||
public EtCommandLog selectEtCommandLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询命令日志列表
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 命令日志集合
|
||||
*/
|
||||
public List<EtCommandLog> selectEtCommandLogList(EtCommandLog etCommandLog);
|
||||
|
||||
/**
|
||||
* 新增命令日志
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtCommandLog(EtCommandLog etCommandLog);
|
||||
|
||||
/**
|
||||
* 修改命令日志
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtCommandLog(EtCommandLog etCommandLog);
|
||||
|
||||
/**
|
||||
* 批量删除命令日志
|
||||
*
|
||||
* @param ids 需要删除的命令日志主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCommandLogByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除命令日志信息
|
||||
*
|
||||
* @param id 命令日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtCommandLogById(Long id);
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ public interface IEtOrderService
|
|||
/**
|
||||
* 订单支付
|
||||
*/
|
||||
public EtRefund createRefund(EtOrder etOrder, BigDecimal refundAmount, BigDecimal appointmentFee, BigDecimal dispatchFee, BigDecimal manageFee, BigDecimal ridingFee, Refund refund, String type);
|
||||
public EtRefund createRefund(EtOrder etOrder, BigDecimal refundAmount, BigDecimal appointmentFee, BigDecimal dispatchFee, BigDecimal manageFee, BigDecimal ridingFee,String outRefundNo, String type);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public interface IEtRefundService
|
|||
* @param orderNo 订单号
|
||||
* @return 退款订单
|
||||
*/
|
||||
public EtRefund selectEtRefundByOrderNo(String orderNo);
|
||||
public List<EtRefund> selectEtRefundByOrderNo(String orderNo);
|
||||
|
||||
/**
|
||||
* 根据退款单号查询退款订单对象
|
||||
|
|
|
|||
|
|
@ -56,8 +56,9 @@ public interface IWxPayService {
|
|||
* @param etOrder 原订单对象
|
||||
* @param reason 退款原因
|
||||
* @param amount 退款金额
|
||||
* @param outRefundNo 退款订单号
|
||||
*/
|
||||
Refund refund(EtOrder etOrder, String reason, BigDecimal amount);
|
||||
Refund refund(EtOrder etOrder, String reason, BigDecimal amount, String outRefundNo);
|
||||
|
||||
/**
|
||||
* 发起商家转账
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import com.ruoyi.system.domain.*;
|
|||
import com.ruoyi.system.domain.response.OrderResponse;
|
||||
import com.ruoyi.system.domain.vo.*;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.mapper.EtCommandLogMapper;
|
||||
import com.ruoyi.system.mapper.EtOrderMapper;
|
||||
import com.ruoyi.system.service.*;
|
||||
import lombok.SneakyThrows;
|
||||
|
|
@ -102,6 +103,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@Resource
|
||||
private EtOrderMapper etOrderMapper;
|
||||
|
||||
@Autowired
|
||||
private EtCommandLogMapper etCommandLogMapper;
|
||||
|
||||
@Value(value = "${iot.iotUrl}")
|
||||
private String iotUrl;
|
||||
|
||||
|
|
@ -152,7 +156,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
}
|
||||
Long areaId = asDevice.getAreaId();
|
||||
EtOperatingArea etOperatingArea;
|
||||
if (ObjectUtil.isNotNull(areaId)) {
|
||||
if (ObjectUtil.isNotNull(areaId) && areaId!=0) {
|
||||
etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
}else{
|
||||
throw new ServiceException("【selectAsDeviceBySn】区域信息不存在");
|
||||
|
|
@ -164,9 +168,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
if(ObjectUtil.isNotNull(model)){
|
||||
asDevice.setModel(model.getModel());
|
||||
}
|
||||
if(StrUtil.isNotBlank(asDevice.getLongitude()) && StrUtil.isNotBlank(asDevice.getLatitude())){
|
||||
asDevice.setLocation(CommonUtil.getAddressByGeo(asDevice.getLongitude() + ","+asDevice.getLatitude()));
|
||||
}
|
||||
// if(StrUtil.isNotBlank(asDevice.getLongitude()) && StrUtil.isNotBlank(asDevice.getLatitude())){
|
||||
// asDevice.setLocation(CommonUtil.getAddressByGeo(asDevice.getLongitude() + ","+asDevice.getLatitude()));
|
||||
// }
|
||||
if(StrUtil.isNotBlank(asDevice.getVoltage())){
|
||||
asDevice.setRemainingMileage(CommonUtil.getRemainingMileage(asDevice.getVoltage(),model.getFullVoltage(),model.getLowVoltage(),model.getFullEndurance()));
|
||||
}
|
||||
|
|
@ -190,7 +194,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
List<AsDevice> asDevices = asDeviceMapper.selectAsDeviceList(asDevice);
|
||||
for (AsDevice asDevice1:asDevices){
|
||||
Long areaId = asDevice1.getAreaId();
|
||||
if (ObjectUtil.isNotNull(areaId)){
|
||||
if (ObjectUtil.isNotNull(areaId) && areaId!=0){
|
||||
EtOperatingArea etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
asDevice1.setAreaName(etOperatingArea.getAreaName());
|
||||
}
|
||||
|
|
@ -220,10 +224,14 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@DataScope(deptAlias = "d")
|
||||
public List<AsDevice> selectAsDeviceListWithIsolate(AsDevice asDevice)
|
||||
{
|
||||
if(ServiceConstants.VEHICLE_STATUS_NOT_BAND.equals(asDevice.getStatus())){
|
||||
asDevice.setUnBand("1");
|
||||
asDevice.setStatus(null);
|
||||
}
|
||||
List<AsDevice> asDevices = asDeviceMapper.selectAsDeviceListWithIsolate(asDevice);
|
||||
for (AsDevice asDevice1:asDevices){
|
||||
Long areaId = asDevice1.getAreaId();
|
||||
if (ObjectUtil.isNotNull(areaId)){
|
||||
if (ObjectUtil.isNotNull(areaId) && areaId!=0){
|
||||
EtOperatingArea etOperatingArea = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
asDevice1.setAreaName(etOperatingArea.getAreaName());
|
||||
}
|
||||
|
|
@ -239,10 +247,15 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
String typeName = sysDictDataService.selectDictLabel("as_device_status", status);
|
||||
asDevice1.setStatusStr(typeName);
|
||||
if(status.equals(ServiceConstants.VEHICLE_STATUS_NOT_BAND) && ObjectUtil.isNotNull(asDevice1.getAreaId())){
|
||||
asDevice1.setStatus(ServiceConstants.VEHICLE_STATUS_IN_OFFLINE);
|
||||
asDevice1.setStatus(ServiceConstants.VEHICLE_STATUS_NOT_LISTING);
|
||||
int i = asDeviceMapper.updateAsDevice(asDevice1);
|
||||
}
|
||||
}
|
||||
if(ObjectUtil.isNotNull(areaId)){
|
||||
if(ObjectUtil.isNull(asDevice1.getAreaId())){
|
||||
asDevice1.setStatus(ServiceConstants.VEHICLE_STATUS_NOT_BAND);
|
||||
int i = asDeviceMapper.updateAsDevice(asDevice1);
|
||||
}
|
||||
if(ObjectUtil.isNotNull(areaId) && areaId!=0){
|
||||
SysDept sysDept = wxPayService.getDeptObjByAreaId(areaId);
|
||||
//https://dianche.chuantewulian.cn?sn=https://dche.ccttiot.com?sn=3000900
|
||||
asDevice1.setQrText(sysDept.getDomain()+"?sn="+asDevice1.getSn());
|
||||
|
|
@ -284,6 +297,24 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*
|
||||
* @param asDevice 设备
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAsDevice2(AsDevice asDevice)
|
||||
{
|
||||
asDevice.setUpdateTime(DateUtils.getNowDate());
|
||||
if(asDevice.getAreaId() == null){
|
||||
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NOT_BAND);
|
||||
asDevice.setOnlineStatus(ServiceConstants.VEHICLE_STATUS_OFFLINE);
|
||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
|
||||
}
|
||||
return asDeviceMapper.updateAsDevice2(asDevice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据SN修改设备
|
||||
*
|
||||
|
|
@ -781,6 +812,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
log.info("【"+type+"】===>IOT请求调用结果:【{}】",result);
|
||||
JSONObject paramsObj = JSON.parseObject(result);
|
||||
String code = paramsObj.getString("code");
|
||||
asynchronousSaveLog(sendUrl,command,mac,result,type);
|
||||
//记录命令
|
||||
if (!HttpStatus.IOT_SUCCESS.equals(code))
|
||||
{
|
||||
|
|
@ -806,6 +838,25 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/* 异步保存发送命令日志*/
|
||||
private void asynchronousSaveLog(String url,String command,String mac,String result,String type) {
|
||||
//异步保存发送命令日志
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
EtCommandLog etCommandLog = new EtCommandLog();
|
||||
etCommandLog.setUrl(url);
|
||||
etCommandLog.setCommand(command);
|
||||
etCommandLog.setType(type);
|
||||
etCommandLog.setMac(mac);
|
||||
etCommandLog.setSn(asDeviceMapper.selectAsDeviceByMac(mac).getSn());
|
||||
etCommandLog.setResult(result);
|
||||
etCommandLog.setCreateTime(DateUtils.getNowDate());
|
||||
int i = etCommandLogMapper.insertEtCommandLog(etCommandLog);
|
||||
if(i>0){
|
||||
log.info("【发送命令】异步保存发送命令日志");
|
||||
}
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
/** 发送命令*/
|
||||
public ResponseVo sendCommandWithResp(String mac, String token,String command,String type) {
|
||||
|
|
@ -817,6 +868,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
if(responseVo.getCode() != 0){
|
||||
asynchronousUpdateOnlineStatus(mac);
|
||||
}
|
||||
asynchronousSaveLog(sendUrl,command,mac,result,type);
|
||||
return JSON.parseObject(result,ResponseVo.class);
|
||||
}
|
||||
|
||||
|
|
@ -1482,6 +1534,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
Boolean inCircle = false;
|
||||
EtParkingArea parkingArea = new EtParkingArea();
|
||||
parkingArea.setAreaId(areaId);
|
||||
parkingArea.setStatus("0");
|
||||
List<EtParkingArea> parkingAreas = parkingAreaService.selectEtParkingAreaList(parkingArea);
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
if(ObjectUtil.isNull(parkingAreas) || parkingAreas.size() == 0){
|
||||
|
|
@ -1515,6 +1568,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
Boolean inCircle = false;
|
||||
EtParkingArea parkingArea = new EtParkingArea();
|
||||
parkingArea.setAreaId(areaId);
|
||||
parkingArea.setStatus("0");
|
||||
parkingArea.setType(ServiceConstants.PARKING_AREA_TYPE_PARKFING);
|
||||
List<EtParkingArea> parkingAreas = parkingAreaService.selectEtParkingAreaList(parkingArea);
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
|
|
@ -1567,6 +1621,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
Boolean inCircle = false;
|
||||
EtParkingArea parkingArea = new EtParkingArea();
|
||||
parkingArea.setAreaId(areaId);
|
||||
parkingArea.setStatus("0");
|
||||
List<EtParkingArea> parkingAreas = parkingAreaService.selectEtParkingAreaList(parkingArea);
|
||||
if(ObjectUtil.isNull(parkingAreas) || parkingAreas.size() == 0){
|
||||
log.info("运营区【{}】没有禁停区,",areaId);
|
||||
|
|
@ -1600,6 +1655,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
Boolean isNoRiding = false;
|
||||
EtParkingArea parkingArea = new EtParkingArea();
|
||||
parkingArea.setAreaId(areaId);
|
||||
parkingArea.setStatus("0");
|
||||
List<EtParkingArea> parkingAreas = parkingAreaService.selectEtParkingAreaList(parkingArea);
|
||||
if(ObjectUtil.isNull(parkingAreas) || parkingAreas.size() == 0){
|
||||
log.info("运营区【{}】没有禁行区,",areaId);
|
||||
|
|
@ -1632,6 +1688,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
Boolean isNoRiding = false;
|
||||
EtParkingArea parkingArea = new EtParkingArea();
|
||||
parkingArea.setAreaId(areaId);
|
||||
parkingArea.setStatus("0");
|
||||
List<EtParkingArea> parkingAreas = parkingAreaService.selectEtParkingAreaList(parkingArea);
|
||||
if(ObjectUtil.isNull(parkingAreas) || parkingAreas.size() == 0){
|
||||
log.info("运营区【{}】没有禁行区,",areaId);
|
||||
|
|
@ -1695,6 +1752,12 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
wrapper.eq("area_id",areaId);
|
||||
wrapper.eq("status","1");
|
||||
List<AsDevice> asDevices = asDeviceMapper.selectList(wrapper);
|
||||
// for循环
|
||||
for (AsDevice asDevice : asDevices) {
|
||||
EtModel model = etModelService.selectEtModelByModelId(asDevice.getModelId());
|
||||
Integer remainingMileage = CommonUtil.getRemainingMileage(asDevice.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance());
|
||||
asDevice.setRemainingMileage(remainingMileage);
|
||||
}
|
||||
return asDevices;
|
||||
}
|
||||
|
||||
|
|
@ -1710,6 +1773,8 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
.set("remaining_power",device.getRemainingPower())
|
||||
.set("last_time",device.getLastTime())
|
||||
.set("voltage",device.getVoltage())
|
||||
.set("satellites",device.getSatellites())
|
||||
.set("quality",device.getQuality())
|
||||
.set("signal_strength",device.getSignalStrength());
|
||||
return asDeviceMapper.update(null,wrapper);
|
||||
}
|
||||
|
|
@ -1784,6 +1849,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
String latitude1 = device.getLatitude();
|
||||
Boolean parkingZoneByLocation = isParkingZoneByLocation(longitude1, latitude1, Long.parseLong(areaId));
|
||||
if(parkingZoneByLocation){
|
||||
isInParkingAreaVo.setIsInParkingArea(parkingZoneByLocation);
|
||||
isInParkingAreaVo.setParkingReturn("1".equals(area.getParkingReturn()));
|
||||
return isInParkingAreaVo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.ruoyi.common.utils.DateUtils;
|
|||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.vo.AttachVo;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
|
|
@ -203,7 +204,7 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
order.setMark("押金支付");
|
||||
|
||||
// 新增资金流水记录
|
||||
capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_INCOME,ServiceConstants.ORDER_TYPE_DEPOSIT);
|
||||
// capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_INCOME,ServiceConstants.ORDER_TYPE_DEPOSIT);
|
||||
// 删除用户缓存
|
||||
String token = attachVo.getToken();
|
||||
logger.info("【微信支付回调】删除用户缓存:"+token);
|
||||
|
|
@ -397,8 +398,8 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
// 往后推autoRefundDeposit小时执行
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
// 如果退款成功直接返回
|
||||
EtRefund refund2 = etRefundMapper.selectEtRefundByOrderNo(order.getOrderNo());
|
||||
if(ObjectUtil.isNotNull(refund2) && refund2.getRefundResult().equals(Constants.SUCCESS2)){
|
||||
List<EtRefund> refund2 = etRefundMapper.selectEtRefundByOrderNo(order.getOrderNo());
|
||||
if(ObjectUtil.isNotNull(refund2) && refund2.size() == 1 && refund2.get(0).getRefundResult().equals(Constants.SUCCESS2)){
|
||||
return;
|
||||
}
|
||||
logger.info("【微信支付回调】退还押金定时任务开始执行!!!!!!!!");
|
||||
|
|
@ -423,15 +424,16 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
throw new ServiceException("押金充值记录与当前运营区的押金不同");
|
||||
}
|
||||
String reason = autoRefundDeposit + "个小时后自动退押金";
|
||||
Refund refund = wxPayService.refund(newestOrder,reason, newestOrder.getTotalFee());
|
||||
String outRefundNo = IdUtils.getOrderNo("ref");
|
||||
Refund refund = wxPayService.refund(newestOrder,reason, newestOrder.getTotalFee(), outRefundNo);
|
||||
newestOrder.setReason(reason);
|
||||
EtRefund refund1= orderService.createRefund(newestOrder, newestOrder.getTotalFee(), null, null, null, null, refund,ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
EtRefund refund1= orderService.createRefund(newestOrder, newestOrder.getTotalFee(), null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
int i = etRefundService.insertEtRefund(refund1);
|
||||
if(i>0){
|
||||
logger.info("【自动退款】保存退款对象成功");
|
||||
}
|
||||
// 新增资金流水记录
|
||||
capitalFlowRecords(newestOrder,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND);
|
||||
// capitalFlowRecords(newestOrder,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND);
|
||||
|
||||
// 更新用户信息,清除缓存
|
||||
asUser.setBalance(BigDecimal.ZERO);
|
||||
|
|
@ -457,9 +459,9 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
* */
|
||||
@Override
|
||||
public void capitalFlowRecords(EtOrder order,String type,String busType) {
|
||||
if(ObjectUtil.isNotNull(etCapitalFlowService.selectEtCapitalFlowByOutTradeNo(order.getOutTradeNo()))){
|
||||
return;
|
||||
}
|
||||
// if(ObjectUtil.isNotNull(etCapitalFlowService.selectEtCapitalFlowByOutTradeNo(order.getOutTradeNo()))){
|
||||
// return;
|
||||
// }
|
||||
SysDept sysDept = wxPayService.getDeptObjByAreaId(order.getAreaId());
|
||||
EtCapitalFlow capitalFlow = new EtCapitalFlow();
|
||||
capitalFlow.setAreaId(order.getAreaId());
|
||||
|
|
@ -471,15 +473,28 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
logger.info("【微信支付回调--保存资金流水记录】 获取到配置手续费==============handlingCharge=====================:"+handlingCharge);
|
||||
BigDecimal bigDecimal = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 6, BigDecimal.ROUND_HALF_UP);
|
||||
logger.info("【微信支付回调--保存资金流水记录】 转换后手续费==============bigDecimal=====================:"+bigDecimal);
|
||||
BigDecimal multiply = bigDecimal.multiply(order.getTotalFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
logger.info("【微信支付回调--保存资金流水记录】 计算出的手续费==============multiply=====================:"+multiply);
|
||||
if(busType.equals(ServiceConstants.ORDER_TYPE_DEPOSIT) || busType.equals(ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND)){
|
||||
capitalFlow.setOperatorDividend(BigDecimal.ZERO);
|
||||
BigDecimal handlingCharge = bigDecimal.multiply(order.getPayFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
logger.info("【微信支付回调--保存资金流水记录】 计算出的手续费==============handlingCharge=====================:"+handlingCharge);
|
||||
BigDecimal serviceFeeScale = new BigDecimal(sysDept.getPlatformServiceFee()).divide(new BigDecimal(100), 6, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal platformServiceFee = serviceFeeScale.multiply(order.getPayFee());
|
||||
logger.info("【微信支付回调--保存资金流水记录】 计算出的平台服务费==============platformServiceFee=====================:"+platformServiceFee);
|
||||
capitalFlow.setPlatformServiceFee(platformServiceFee);
|
||||
capitalFlow.setHandlingCharge(handlingCharge);//手续费
|
||||
if(busType.equals(ServiceConstants.ORDER_TYPE_WITHDRAW)){//提现,需要手续费,不需要平台服务费
|
||||
platformServiceFee = BigDecimal.ZERO;
|
||||
BigDecimal separateAccountFee = order.getPayFee().subtract(handlingCharge).subtract(platformServiceFee);
|
||||
capitalFlow.setPartnerDividend(BigDecimal.ZERO);
|
||||
capitalFlow.setPlatformServiceFee(platformServiceFee);
|
||||
capitalFlow.setOperatorDividend(separateAccountFee.negate());
|
||||
capitalFlow.setOperatorBalance(sysDept.getBalance().subtract(separateAccountFee));
|
||||
deptService.changeDeptBalance(separateAccountFee.negate(),sysDept.getDeptId());
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============支出=====================:");
|
||||
}else{
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============业务类型=====================:"+busType);
|
||||
BigDecimal partnerDividend = BigDecimal.ZERO;
|
||||
BigDecimal operatorDividend = order.getPayFee();
|
||||
BigDecimal separateAccountFee = order.getPayFee().subtract(handlingCharge).subtract(platformServiceFee);
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============扣掉手续费和服务费之后的金额,这个金额拿来分账=====================:"+separateAccountFee);
|
||||
BigDecimal operatorDividend = separateAccountFee;
|
||||
if(sysDept.getIsProfitSharing().equals("true")){//需要分账
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============需要分账====================="+sysDept.getIsProfitSharing());
|
||||
//获取所有合伙人列表
|
||||
|
|
@ -491,26 +506,25 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
.mapToDouble(SysUser::getDividendProportion)
|
||||
.sum();//算出总的分成比例
|
||||
BigDecimal decimal = new BigDecimal(totalDividendProportion).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
|
||||
partnerDividend = order.getTotalFee().multiply(decimal);
|
||||
operatorDividend = order.getTotalFee().subtract(partnerDividend);
|
||||
partnerDividend = operatorDividend.multiply(decimal);
|
||||
operatorDividend = operatorDividend.subtract(partnerDividend);
|
||||
}
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============partnerDividend=====================:"+partnerDividend);
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============operatorDividend=====================:"+operatorDividend);
|
||||
if(type.equals(ServiceConstants.FLOW_TYPE_INCOME)){
|
||||
capitalFlow.setPartnerDividend(partnerDividend);
|
||||
capitalFlow.setOperatorDividend(operatorDividend);
|
||||
capitalFlow.setOperatorBalance(sysDept.getBalance().add(operatorDividend).subtract(multiply));
|
||||
capitalFlow.setOperatorBalance(sysDept.getBalance().add(operatorDividend));
|
||||
deptService.changeDeptBalance(operatorDividend,sysDept.getDeptId());
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============收入=====================:");
|
||||
}else{
|
||||
capitalFlow.setPartnerDividend(partnerDividend.negate());
|
||||
capitalFlow.setOperatorDividend(operatorDividend.negate());
|
||||
capitalFlow.setOperatorBalance(sysDept.getBalance().subtract(operatorDividend).subtract(multiply));
|
||||
capitalFlow.setOperatorBalance(sysDept.getBalance().subtract(operatorDividend));
|
||||
deptService.changeDeptBalance(operatorDividend.negate(),sysDept.getDeptId());
|
||||
logger.info("【微信支付回调--保存资金流水记录】 ==============支出=====================:");
|
||||
}
|
||||
}
|
||||
capitalFlow.setHandlingCharge(multiply);//手续费
|
||||
capitalFlow.setPayType(ServiceConstants.PAY_TYPE_WX);
|
||||
capitalFlow.setCreateTime(DateUtils.getNowDate());
|
||||
logger.info("【微信支付回调】保存资金流水记录对象 : " + JSON.toJSONString(capitalFlow));
|
||||
|
|
@ -556,7 +570,9 @@ public class CallbackServiceImpl implements CallbackService {
|
|||
EtRefund refund = etRefundService.selectEtRefundByRefundNo(outRefundNo);
|
||||
EtOrder order = orderService.selectEtOrderByOrderNo(refund.getOrderNo());
|
||||
// 新增资金流水记录
|
||||
capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_RIDING_REFUND);
|
||||
// if(order.getOrderNo().contains("qx")){
|
||||
// capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_RIDING_REFUND);
|
||||
// }
|
||||
logger.info("【微信退款回调】全部结束!!!!!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.EtCommandLogMapper;
|
||||
import com.ruoyi.system.domain.EtCommandLog;
|
||||
import com.ruoyi.system.service.IEtCommandLogService;
|
||||
|
||||
/**
|
||||
* 命令日志Service业务层处理
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-07-06
|
||||
*/
|
||||
@Service
|
||||
public class EtCommandLogServiceImpl implements IEtCommandLogService
|
||||
{
|
||||
@Autowired
|
||||
private EtCommandLogMapper etCommandLogMapper;
|
||||
|
||||
/**
|
||||
* 查询命令日志
|
||||
*
|
||||
* @param id 命令日志主键
|
||||
* @return 命令日志
|
||||
*/
|
||||
@Override
|
||||
public EtCommandLog selectEtCommandLogById(Long id)
|
||||
{
|
||||
return etCommandLogMapper.selectEtCommandLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询命令日志列表
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 命令日志
|
||||
*/
|
||||
@Override
|
||||
public List<EtCommandLog> selectEtCommandLogList(EtCommandLog etCommandLog)
|
||||
{
|
||||
return etCommandLogMapper.selectEtCommandLogList(etCommandLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增命令日志
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEtCommandLog(EtCommandLog etCommandLog)
|
||||
{
|
||||
return etCommandLogMapper.insertEtCommandLog(etCommandLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改命令日志
|
||||
*
|
||||
* @param etCommandLog 命令日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEtCommandLog(EtCommandLog etCommandLog)
|
||||
{
|
||||
return etCommandLogMapper.updateEtCommandLog(etCommandLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除命令日志
|
||||
*
|
||||
* @param ids 需要删除的命令日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtCommandLogByIds(Long[] ids)
|
||||
{
|
||||
return etCommandLogMapper.deleteEtCommandLogByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除命令日志信息
|
||||
*
|
||||
* @param id 命令日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtCommandLogById(Long id)
|
||||
{
|
||||
return etCommandLogMapper.deleteEtCommandLogById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -136,9 +136,9 @@ public class EtFaultServiceImpl implements IEtFaultService
|
|||
throw new ServiceException("该设备不存在");
|
||||
}
|
||||
//解析地址,将地址保存数据库
|
||||
if(StrUtil.isNotBlank(asDevice.getLongitude()) && StrUtil.isNotBlank(asDevice.getLatitude())){
|
||||
etFault.setAddress(CommonUtil.getAddressByGeo(asDevice.getLongitude() + ","+asDevice.getLatitude()));
|
||||
}
|
||||
// if(StrUtil.isNotBlank(asDevice.getLongitude()) && StrUtil.isNotBlank(asDevice.getLatitude())){
|
||||
// etFault.setAddress(CommonUtil.getAddressByGeo(asDevice.getLongitude() + ","+asDevice.getLatitude()));
|
||||
// }
|
||||
etFault.setAreaId(asDevice.getAreaId());
|
||||
etFault.setCreateTime(DateUtils.getNowDate());
|
||||
setType(etFault);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||
import com.ruoyi.common.utils.onenet.ResponseVo;
|
||||
import com.ruoyi.common.utils.onenet.Token;
|
||||
import com.ruoyi.system.domain.AsDevice;
|
||||
import com.ruoyi.system.domain.EtOperatingArea;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.service.IAsDeviceService;
|
||||
import com.ruoyi.system.service.IEtOperatingAreaService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -54,6 +56,10 @@ public class EtModelServiceImpl implements IEtModelService
|
|||
@Resource
|
||||
private AsDeviceMapper asDeviceMapper;
|
||||
|
||||
@Resource
|
||||
private IEtOperatingAreaService etOperatingAreaService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆型号
|
||||
*
|
||||
|
|
@ -67,6 +73,10 @@ public class EtModelServiceImpl implements IEtModelService
|
|||
if(ObjectUtil.isNotNull(etModel)){
|
||||
Integer allNum = asDeviceService.selectCountByModelId(modelId);
|
||||
etModel.setDeviceNum(allNum);
|
||||
if(ObjectUtil.isNotNull(etModel.getOperator())){
|
||||
List<EtOperatingArea> areaList = etOperatingAreaService.selectAreaListByDeptId2(etModel.getOperator());
|
||||
etModel.setAreaList(areaList);
|
||||
}
|
||||
}
|
||||
return etModel;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,16 +8,17 @@ import com.ruoyi.common.constant.Constants;
|
|||
import com.ruoyi.common.constant.ServiceConstants;
|
||||
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.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.CommonUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.vo.*;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.mapper.EtOperatingAreaMapper;
|
||||
import com.ruoyi.system.mapper.EtOrderMapper;
|
||||
import com.ruoyi.system.mapper.EtRefundMapper;
|
||||
import com.ruoyi.system.service.*;
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
|
|
@ -29,6 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -86,15 +89,12 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
@Autowired
|
||||
private CallbackService callbackService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Value("${et.handlingCharge}")
|
||||
private String handlingCharge;
|
||||
|
||||
@Resource
|
||||
private EtRefundMapper etRefundMapper;
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
*
|
||||
|
|
@ -118,9 +118,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
order.setTripLogs(tripLogs);
|
||||
}
|
||||
// 退款记录
|
||||
EtRefund refund = etRefundService.selectEtRefundByOrderNo(order.getOrderNo());
|
||||
if(ObjectUtils.isNotEmpty(refund)){
|
||||
order.setEtRefund(refund);
|
||||
List<EtRefund> refunds = etRefundService.selectEtRefundByOrderNo(order.getOrderNo());
|
||||
if(ObjectUtils.isNotEmpty(refunds) && refunds.size() > 0){
|
||||
order.setEtRefund(refunds.get(0));
|
||||
}
|
||||
return order;
|
||||
}
|
||||
|
|
@ -223,9 +223,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
//如果查询押金则增加退款记录
|
||||
// if(ServiceConstants.ORDER_TYPE_DEPOSIT.equals(etOrder.getType())){
|
||||
etOrders.forEach(etOrder1 -> {
|
||||
EtRefund refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo());
|
||||
if(ObjectUtil.isNotNull(refund)){
|
||||
etOrder1.setEtRefund(refund);
|
||||
List<EtRefund> refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo());
|
||||
if(ObjectUtil.isNotNull(refund) && refund.size() > 0){
|
||||
etOrder1.setEtRefund(refund.get(0));
|
||||
}
|
||||
});
|
||||
// }
|
||||
|
|
@ -252,9 +252,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
//如果查询押金则增加退款记录
|
||||
if(ServiceConstants.ORDER_TYPE_DEPOSIT.equals(etOrder.getType())){
|
||||
etOrders.forEach(etOrder1 -> {
|
||||
EtRefund refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo());
|
||||
if(ObjectUtil.isNotNull(refund)){
|
||||
etOrder1.setEtRefund(refund);
|
||||
List<EtRefund> refund = etRefundService.selectEtRefundByOrderNo(etOrder1.getOrderNo());
|
||||
if(ObjectUtil.isNotNull(refund) && refund.size() > 0){
|
||||
etOrder1.setEtRefund(refund.get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -276,6 +276,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
BeanUtils.copyProperties(etOrder1,rechargeVo);
|
||||
rechargeVo.setRechargeStatus(ServiceConstants.RECHARGE_STATUS_SUCCESS);
|
||||
rechargeVo.setRechargeType(ServiceConstants.ORDER_TYPE_DEPOSIT);
|
||||
rechargeVo.setTotalFee(etOrder1.getPayFee());
|
||||
rechargeVoList.add(rechargeVo);
|
||||
});
|
||||
//如果查询押金则增加退款记录
|
||||
|
|
@ -283,7 +284,8 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
refund.setType(ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
refund.setRefundResult(Constants.SUCCESS2);
|
||||
refund.setUserName(etOrder.getUserName());
|
||||
List<EtRefund> etRefunds = etRefundService.selectEtRefundListWithIsolate(refund);
|
||||
PageUtils.startPage();
|
||||
List<EtRefund> etRefunds = etRefundMapper.selectEtRefundList(refund);;
|
||||
etRefunds.forEach(etRefund -> {
|
||||
AsUser asUser = asUserService.selectUserById(etRefund.getUserId());
|
||||
RechargeVo rechargeVo = new RechargeVo();
|
||||
|
|
@ -347,6 +349,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
* 5. 更新押金订单金额(做一个押金抵扣的标记)
|
||||
* 6. 更新骑行订单状态为已支付,支付方式为 押金抵扣
|
||||
* 7. 更新车辆信息
|
||||
* 8. 更新用户余额
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
|
@ -358,23 +361,58 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
EtOrder depositOrder = getDepositOrder(order.getUserId());
|
||||
BigDecimal deposit = depositOrder.getTotalFee();
|
||||
BigDecimal ridingFee = order.getTotalFee();
|
||||
if(deposit.compareTo(ridingFee) > 0){
|
||||
// 押金大于订单金额 扣除后
|
||||
BigDecimal afterDeductionFee = deposit.subtract(ridingFee);
|
||||
order.setTotalFee(afterDeductionFee);
|
||||
order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||
order.setPayTime(DateUtils.getNowDate());
|
||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||
order.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
||||
order.setMark("押金抵扣");
|
||||
int updateEtOrder = etOrderMapper.updateEtOrder(order);
|
||||
if(updateEtOrder == 0){
|
||||
throw new ServiceException("押金抵扣失败,更新订单失败");
|
||||
}
|
||||
BigDecimal afterDeductionFee;
|
||||
String mark;
|
||||
if(deposit.compareTo(ridingFee) <= 0){
|
||||
afterDeductionFee = BigDecimal.ZERO;
|
||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】大于押金【"+deposit+"】";
|
||||
}else{
|
||||
throw new ServiceException("押金抵扣失败,骑行费用大于押金");
|
||||
// 押金大于订单金额 扣除后
|
||||
afterDeductionFee = deposit.subtract(ridingFee);
|
||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】小于押金【"+deposit+"】,扣除后金额【"+afterDeductionFee+"】";
|
||||
}
|
||||
return 0;
|
||||
/** 更新骑行订单*/
|
||||
order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||
order.setPayTime(DateUtils.getNowDate());
|
||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||
order.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
||||
order.setMark(mark);
|
||||
order.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||
int updateEtOrder = etOrderMapper.updateEtOrder(order);
|
||||
if(updateEtOrder == 0){
|
||||
throw new ServiceException("押金抵扣失败,更新骑行订单失败");
|
||||
}
|
||||
/** 更新押金订单*/
|
||||
depositOrder.setPayFee(afterDeductionFee);
|
||||
// depositOrder.setTotalFee(afterDeductionFee);
|
||||
depositOrder.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||
int updateEtOrder1 = etOrderMapper.updateEtOrder(depositOrder);
|
||||
if(updateEtOrder1 == 0){
|
||||
throw new ServiceException("押金抵扣失败,更新押金订单失败");
|
||||
}
|
||||
/** 退款剩余押金*/
|
||||
Refund refund = wxPayService.refund(depositOrder, "押金抵扣退款",afterDeductionFee,IdUtils.getOrderNo("ref"));
|
||||
/** 2.记录退款表 创建退款对象*/
|
||||
depositOrder.setReason("押金提现");
|
||||
EtRefund refund1= createRefund(depositOrder, afterDeductionFee, null, null, null, null, refund.getOutRefundNo(),ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
int i = etRefundService.insertEtRefund(refund1);
|
||||
if(i == 0){
|
||||
log.info("【押金抵扣】保存退款对象失败");
|
||||
throw new ServiceException("【押金抵扣】,保存退款对象失败");
|
||||
}
|
||||
/** 更新用户余额*/
|
||||
AsUser asUser = asUserService.selectUserById(depositOrder.getUserId());
|
||||
if(asUser!=null){
|
||||
// 更新用户并更新缓存
|
||||
asUser.setBalance(BigDecimal.ZERO);
|
||||
if (asUserService.updateUserProfile(asUser) > 0)
|
||||
{
|
||||
log.info("【押金抵扣成功】更新用户信息成功:"+ JSON.toJSON(asUser));
|
||||
}else{
|
||||
throw new ServiceException("【押金抵扣】,更新用户信息失败");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private EtOrder getDepositOrder(Long userId) {
|
||||
|
|
@ -527,6 +565,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
}else{
|
||||
log.info("【预下单】支付场景为:骑行支付");
|
||||
etOrder = etOrderMapper.selectEtOrderByOrderNo(order.getOrderNo());
|
||||
if(!ServiceConstants.ORDER_STATUS_RIDING_END.equals(etOrder.getStatus())){
|
||||
throw new ServiceException("【预下单】该订单非‘待支付’状态,状态:"+etOrder.getStatus()+",请刷新页面!");
|
||||
}
|
||||
}
|
||||
//TODO 计算订单金额,更新订单金额 还要根据车辆定位,
|
||||
// 判断是否在停车区内,
|
||||
|
|
@ -884,9 +925,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
|
||||
BigDecimal payFee = defaultIfNull(etOrderMapper.getPayFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//新增
|
||||
BigDecimal refundFee = defaultIfNull(etOrderMapper.getRefundFee(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//退款
|
||||
BigDecimal incomeFee = defaultIfNull(etOrderMapper.getIncome(startDateStr, endDateStr, null, areaId), BigDecimal.ZERO);//营收
|
||||
BigDecimal divide = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 6, RoundingMode.HALF_UP);
|
||||
BigDecimal divide = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 4, RoundingMode.HALF_UP);
|
||||
BigDecimal serviceFee = payFee.multiply(divide).setScale(2, RoundingMode.HALF_UP);//手续费
|
||||
BigDecimal incomeFee = defaultIfNull(payFee.subtract(serviceFee).subtract(refundFee), BigDecimal.ZERO);//营收
|
||||
|
||||
reconciliation.setPayFee(payFee);
|
||||
reconciliation.setRefundFee(refundFee);
|
||||
|
|
@ -914,9 +955,14 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
private ReconciliationVo.Reconciliation createReconciliationByVehicle(String timeStart, String timeEnd, String sn) {
|
||||
ReconciliationVo.Reconciliation reconciliation = new ReconciliationVo.Reconciliation();
|
||||
reconciliation.setSn(sn);
|
||||
reconciliation.setPayFee(etOrderMapper.getPayFee(timeStart, timeEnd, sn, null));
|
||||
reconciliation.setRefundFee(etOrderMapper.getRefundFee(timeStart, timeEnd, sn, null));
|
||||
reconciliation.setIncome(etOrderMapper.getIncome(timeStart, timeEnd, sn, null));
|
||||
BigDecimal payFee = etOrderMapper.getPayFee(timeStart, timeEnd, sn, null);
|
||||
reconciliation.setPayFee(payFee);
|
||||
BigDecimal refundFee = etOrderMapper.getRefundFee(timeStart, timeEnd, sn, null);
|
||||
reconciliation.setRefundFee(refundFee);
|
||||
BigDecimal divide = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 4, RoundingMode.HALF_UP);
|
||||
BigDecimal serviceFee = payFee.multiply(divide).setScale(2, RoundingMode.HALF_UP);//手续费
|
||||
reconciliation.setIncome(payFee.subtract(refundFee).subtract(serviceFee));
|
||||
reconciliation.setServiceFee(serviceFee);
|
||||
return reconciliation;
|
||||
}
|
||||
|
||||
|
|
@ -991,18 +1037,19 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
if(ObjectUtil.isNotNull(ridingFee) && !ridingFee.equals(BigDecimal.ZERO)){
|
||||
refundAmount = refundAmount.add(ridingFee);
|
||||
}
|
||||
log.info("总金额:【{}】,退款金额:【{}】", etOrder1.getTotalFee(), refundAmount);
|
||||
Refund refund = wxPayService.refund(etOrder1, etOrder.getReason(), refundAmount);
|
||||
// 新增资金流水记录
|
||||
etOrder1.setPayFee(refundAmount);
|
||||
callbackService.capitalFlowRecords(etOrder1,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants. ORDER_TYPE_RIDING_REFUND);
|
||||
//todo 更新订单的payFee = totalFee - refundAmount
|
||||
|
||||
String outRefundNo = IdUtils.getOrderNo("ref");
|
||||
/** 2.记录退款表 创建退款对象*/
|
||||
EtRefund refund1= createRefund(etOrder1, refundAmount, appointmentFee, dispatchFee, manageFee, ridingFee, refund,ServiceConstants.REFUND_TYPE_SYSTEM);
|
||||
EtRefund refund1= createRefund(etOrder1, refundAmount, appointmentFee, dispatchFee, manageFee, ridingFee, outRefundNo,ServiceConstants.REFUND_TYPE_SYSTEM);
|
||||
int i = etRefundService.insertEtRefund(refund1);
|
||||
if(i>0){
|
||||
log.info("保存退款对象成功");
|
||||
}
|
||||
// 新增资金流水记录
|
||||
callbackService.capitalFlowRecords(etOrder1,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_RIDING_REFUND);
|
||||
log.info("总金额:【{}】,退款金额:【{}】", etOrder1.getTotalFee(), refundAmount);
|
||||
Refund refund = wxPayService.refund(etOrder1, etOrder.getReason(), refundAmount,outRefundNo);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -1012,19 +1059,20 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
@Transactional
|
||||
@Override
|
||||
public int withdraw(EtOrder etOrder1, BigDecimal deposit) {
|
||||
Refund refund = wxPayService.refund(etOrder1, "押金提现",deposit);
|
||||
String outRefundNo = IdUtils.getOrderNo("ref");
|
||||
/** 2.记录退款表 创建退款对象*/
|
||||
etOrder1.setReason("押金提现");
|
||||
EtRefund refund1= createRefund(etOrder1, deposit, null, null, null, null, refund,ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
EtRefund refund1= createRefund(etOrder1, deposit, null, null, null, null, outRefundNo,ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
int i = etRefundService.insertEtRefund(refund1);
|
||||
if(i>0){
|
||||
log.info("【提现金额】保存退款对象成功");
|
||||
}
|
||||
Refund refund = wxPayService.refund(etOrder1, "押金提现",deposit,outRefundNo);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EtRefund createRefund(EtOrder etOrder, BigDecimal refundAmount, BigDecimal appointmentFee, BigDecimal dispatchFee, BigDecimal manageFee, BigDecimal ridingFee, Refund refund,String type) {
|
||||
public EtRefund createRefund(EtOrder etOrder, BigDecimal refundAmount, BigDecimal appointmentFee, BigDecimal dispatchFee, BigDecimal manageFee, BigDecimal ridingFee, String outRefundNo,String type) {
|
||||
EtRefund etRefund = new EtRefund();
|
||||
etRefund.setAmount(refundAmount);
|
||||
etRefund.setReason(etOrder.getReason());
|
||||
|
|
@ -1034,7 +1082,7 @@ public class EtOrderServiceImpl implements IEtOrderService
|
|||
etRefund.setRidingFee(ridingFee);
|
||||
etRefund.setOrderNo(etOrder.getOrderNo());
|
||||
etRefund.setUserId(etOrder.getUserId());
|
||||
etRefund.setRefundNo(refund.getOutRefundNo());
|
||||
etRefund.setRefundNo(outRefundNo);
|
||||
etRefund.setType(type);
|
||||
if(type.equals(ServiceConstants.REFUND_TYPE_DEPOSIT)){
|
||||
etRefund.setItemDesc("押金自动退款");
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class EtRefundServiceImpl implements IEtRefundService
|
|||
* @return 退款订单
|
||||
*/
|
||||
@Override
|
||||
public EtRefund selectEtRefundByOrderNo(String orderNo)
|
||||
public List<EtRefund> selectEtRefundByOrderNo(String orderNo)
|
||||
{
|
||||
return etRefundMapper.selectEtRefundByOrderNo(orderNo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class EtTripLogServiceImpl implements IEtTripLogService
|
|||
etTripLog.setLatitude(asDevice.getLatitude());
|
||||
etTripLog.setLongitude(asDevice.getLongitude());
|
||||
String location = asDevice.getLongitude() + ","+asDevice.getLatitude();
|
||||
etTripLog.setAddress(CommonUtil.getAddressByGeo(location));
|
||||
// etTripLog.setAddress(CommonUtil.getAddressByGeo(location));
|
||||
etTripLog.setSn(sn);
|
||||
}
|
||||
log.info("创建行程记录:{}", JSON.toJSON(etTripLog));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.constant.ServiceConstants;
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
|
|
@ -10,17 +11,18 @@ import com.ruoyi.common.exception.ServiceException;
|
|||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.domain.EtOrder;
|
||||
import com.ruoyi.system.domain.EtWithdraw;
|
||||
import com.ruoyi.system.mapper.AsUserMapper;
|
||||
import com.ruoyi.system.mapper.EtWithdrawMapper;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.IEtWithdrawService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.IWxPayService;
|
||||
import com.ruoyi.system.service.*;
|
||||
import com.wechat.pay.java.service.transferbatch.model.TransferDetailInput;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -47,12 +49,17 @@ public class EtWithdrawServiceImpl implements IEtWithdrawService
|
|||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private IWxPayService wxPayService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private CallbackService callbackService;
|
||||
|
||||
@Resource
|
||||
private IEtOperatingAreaService etOperatingAreaService;
|
||||
|
||||
@Resource
|
||||
private SysDeptMapper deptMapper;
|
||||
/**
|
||||
* 查询提现记录
|
||||
*
|
||||
|
|
@ -72,6 +79,7 @@ public class EtWithdrawServiceImpl implements IEtWithdrawService
|
|||
* @return 提现记录
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<EtWithdraw> selectEtWithdrawList(EtWithdraw etWithdraw)
|
||||
{
|
||||
return etWithdrawMapper.selectEtWithdrawList(etWithdraw);
|
||||
|
|
@ -109,6 +117,7 @@ public class EtWithdrawServiceImpl implements IEtWithdrawService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateEtWithdraw(EtWithdraw etWithdraw)
|
||||
{
|
||||
//如果提现是通过,则发起商户转账到零钱
|
||||
|
|
@ -119,11 +128,30 @@ public class EtWithdrawServiceImpl implements IEtWithdrawService
|
|||
TransferDetailInput transferDetailInput = new TransferDetailInput();
|
||||
transferDetailInput.setOutDetailNo(IdUtils.getOrderNo("txd"));//明细订单号
|
||||
transferDetailInput.setTransferAmount(etWithdraw.getAmount().multiply(new BigDecimal(100)).longValue());
|
||||
transferDetailInput.setTransferRemark("创特共享电动车提现");
|
||||
transferDetailInput.setTransferRemark(sysDept.getDeptName()+"共享电动车提现");
|
||||
transferDetailInput.setOpenid(etWithdraw.getWxopenid());
|
||||
transferDetailInputs.add(transferDetailInput);
|
||||
log.info("【审核通过】发起转账到零钱:{}",JSON.toJSONString(transferDetailInputs));
|
||||
wxPayService.transfer(sysDept,etWithdraw.getWithdrawNo(),batchName,batchName,etWithdraw.getAmount(),1,transferDetailInputs);
|
||||
// todo 暂时先不发起真实提现
|
||||
// wxPayService.transfer(sysDept,etWithdraw.getWithdrawNo(),batchName,batchName,etWithdraw.getAmount(),1,transferDetailInputs);
|
||||
//扣余额并记录资金流水
|
||||
sysDept.getBalance().subtract(etWithdraw.getAmount());
|
||||
int result = deptMapper.updateDept(sysDept);
|
||||
if(result == 0){
|
||||
throw new ServiceException("【提现】提现失败,更新运营商余额失败");
|
||||
}else{
|
||||
EtOrder order = new EtOrder();
|
||||
order.setOrderNo(etWithdraw.getWithdrawNo());
|
||||
order.setPayFee(etWithdraw.getAmount());
|
||||
order.setTotalFee(etWithdraw.getAmount());
|
||||
List<Long> longs = etOperatingAreaService.selectAreaListByDeptId(etWithdraw.getDeptId());
|
||||
if(longs.size() == 0){
|
||||
throw new ServiceException("【提现】提现失败,未找到该运营区,运营商id:"+etWithdraw.getDeptId());
|
||||
}
|
||||
order.setAreaId(longs.get(0));
|
||||
//记录资金流水
|
||||
callbackService.capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_WITHDRAW);
|
||||
}
|
||||
}
|
||||
return etWithdrawMapper.updateEtWithdraw(etWithdraw);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
for (SysUser sysUser:sysUsers){
|
||||
sysUser.setDeviceNum(asDeviceService.selectCountByAreaId(sysUser.getAreaId()));
|
||||
Long areaId = sysUser.getAreaId();
|
||||
if(ObjectUtil.isNotNull(areaId)){
|
||||
if(ObjectUtil.isNotNull(areaId) && areaId!=0){
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(areaId);
|
||||
if(ObjectUtil.isNotNull(area)){
|
||||
sysUser.setAreaName(area.getAreaName());
|
||||
|
|
@ -345,7 +345,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
*/
|
||||
private void setOperatorId(SysUser user) {
|
||||
Long areaId = user.getAreaId();
|
||||
if(ObjectUtil.isNotNull(areaId)){
|
||||
if(ObjectUtil.isNotNull(areaId) && areaId!=0){
|
||||
List<EtAreaDept> areaId1 = etAreaDeptMapper.selectList(new QueryWrapper<EtAreaDept>().eq("area_id", areaId));
|
||||
if(ObjectUtil.isNotEmpty(areaId1)){
|
||||
user.setDeptId(areaId1.get(0).getDeptId());
|
||||
|
|
@ -701,11 +701,6 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
public int bandAppUser(SysUser user) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
user.setUserId(loginUser.getUserId());
|
||||
String token = loginUser.getToken();
|
||||
if (StringUtils.isNotNull(token))
|
||||
{
|
||||
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
||||
}
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,13 +197,14 @@ public class WxPayService implements IWxPayService {
|
|||
* @param etOrder 原订单对象
|
||||
* @param reason 退款原因
|
||||
* @param amount 退款金额
|
||||
* @param outRefundNo 退款订单号
|
||||
*/
|
||||
@Override
|
||||
public Refund refund(EtOrder etOrder,String reason,BigDecimal amount) {
|
||||
public Refund refund(EtOrder etOrder,String reason,BigDecimal amount,String outRefundNo) {
|
||||
SysDept sysDept = getDeptObjByAreaId(etOrder.getAreaId());
|
||||
CreateRequest request = new CreateRequest();
|
||||
request.setOutTradeNo(etOrder.getOutTradeNo());
|
||||
request.setOutRefundNo(IdUtils.getOrderNo("ref"));
|
||||
request.setOutRefundNo(outRefundNo);
|
||||
request.setReason(reason);
|
||||
request.setAmount(getAmountReq(etOrder.getTotalFee(),amount));
|
||||
request.setNotifyUrl(sysDept.getRefundNotifyUrl());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.ruoyi.common.core.redis.RedisCache;
|
|||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
||||
import com.ruoyi.system.mapper.AsUserMapper;
|
||||
|
|
@ -129,41 +130,45 @@ public class EtTask {
|
|||
log.info("【系统启动】最后一次押金充值记录 金额与押金不一致,订单押金:【{}】,区域押金:【{}】",lastOrder.getTotalFee(),area.getDeposit());
|
||||
}else{
|
||||
// 根据最新的订单号,查询是否有退款记录
|
||||
EtRefund etRefund = etRefundService.selectEtRefundByOrderNo(lastOrder.getOrderNo());
|
||||
// 没有退款记录,发起退款
|
||||
if(ObjectUtil.isNull(etRefund)){
|
||||
// 根据订单支付时间 autoRefundDeposit个小时后退押金
|
||||
String reason = autoRefundDeposit + "个小时后自动退押金";
|
||||
Date payTime = order.getPayTime();
|
||||
Date refundDepositTime = DateUtils.getTimeAfterXHours(payTime, autoRefundDeposit);
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
if (nowDate.after(refundDepositTime)) {
|
||||
log.info("【系统启动】用户【{}】押金充值订单【{}】已过期,开始自动退押金",asUser.getUserId(),lastOrder.getOrderNo());
|
||||
refundDeposit(asUser, lastOrder, reason);
|
||||
}else{
|
||||
int timeDifferenceInMinutes = DateUtils.timeDifferenceInMinutes(payTime, nowDate);
|
||||
int i = autoRefundDeposit * 60;
|
||||
int delay = i - timeDifferenceInMinutes;
|
||||
log.info("【系统启动】用户【{}】押金充值订单【{}】未过期,【{}】分钟后退押金",asUser.getUserId(),lastOrder.getOrderNo(),delay);
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
List<EtRefund> etRefunds = etRefundService.selectEtRefundByOrderNo(lastOrder.getOrderNo());
|
||||
if(etRefunds.size() == 1){
|
||||
EtRefund etRefund = etRefunds.get(0);
|
||||
// 没有退款记录,发起退款
|
||||
if(ObjectUtil.isNull(etRefund)){
|
||||
// 根据订单支付时间 autoRefundDeposit个小时后退押金
|
||||
String reason = autoRefundDeposit + "个小时后自动退押金";
|
||||
Date payTime = order.getPayTime();
|
||||
Date refundDepositTime = DateUtils.getTimeAfterXHours(payTime, autoRefundDeposit);
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
if (nowDate.after(refundDepositTime)) {
|
||||
log.info("【系统启动】用户【{}】押金充值订单【{}】已过期,开始自动退押金",asUser.getUserId(),lastOrder.getOrderNo());
|
||||
refundDeposit(asUser, lastOrder, reason);
|
||||
}, delay, TimeUnit.MINUTES);
|
||||
}
|
||||
}else{
|
||||
// 有退款记录,判断是否成功
|
||||
if(!Constants.SUCCESS2.equals(etRefund.getRefundResult())){
|
||||
log.info("【系统启动】押金退款未成功回调,退款单号:【{}】",etRefund.getRefundNo());
|
||||
// 根据退款单号查询退款信息
|
||||
Refund refund = wxPayService.queryByOutRefundNo(area.getAreaId(),etRefund.getRefundNo());
|
||||
if(ObjectUtil.isNotNull(refund) && Constants.SUCCESS2.equals(refund.getStatus().name())){
|
||||
// 更新退款记录
|
||||
etRefund.setRefundResult(Constants.SUCCESS2);
|
||||
etRefund.setUpdateTime(new Date());
|
||||
etRefundService.updateEtRefund(etRefund);
|
||||
log.info("【系统启动】更新押金退款回调成功,退款单号:【{}】",refund.getOutRefundNo());
|
||||
}else{
|
||||
int timeDifferenceInMinutes = DateUtils.timeDifferenceInMinutes(payTime, nowDate);
|
||||
int i = autoRefundDeposit * 60;
|
||||
int delay = i - timeDifferenceInMinutes;
|
||||
log.info("【系统启动】用户【{}】押金充值订单【{}】未过期,【{}】分钟后退押金",asUser.getUserId(),lastOrder.getOrderNo(),delay);
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
refundDeposit(asUser, lastOrder, reason);
|
||||
}, delay, TimeUnit.MINUTES);
|
||||
}
|
||||
}else{
|
||||
// 有退款记录,判断是否成功
|
||||
if(!Constants.SUCCESS2.equals(etRefund.getRefundResult())){
|
||||
log.info("【系统启动】押金退款未成功回调,退款单号:【{}】",etRefund.getRefundNo());
|
||||
// 根据退款单号查询退款信息
|
||||
Refund refund = wxPayService.queryByOutRefundNo(area.getAreaId(),etRefund.getRefundNo());
|
||||
if(ObjectUtil.isNotNull(refund) && Constants.SUCCESS2.equals(refund.getStatus().name())){
|
||||
// 更新退款记录
|
||||
etRefund.setRefundResult(Constants.SUCCESS2);
|
||||
etRefund.setUpdateTime(new Date());
|
||||
etRefundService.updateEtRefund(etRefund);
|
||||
log.info("【系统启动】更新押金退款回调成功,退款单号:【{}】",refund.getOutRefundNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -213,13 +218,13 @@ public class EtTask {
|
|||
|
||||
|
||||
private void refundDeposit(AsUser asUser, EtOrder lastOrder, String reason) {
|
||||
Refund refund = wxPayService.refund(lastOrder, reason, lastOrder.getTotalFee());
|
||||
String outRefundNo = IdUtils.getOrderNo("ref");
|
||||
lastOrder.setReason(reason);
|
||||
EtRefund refund1= etOrderService.createRefund(lastOrder, lastOrder.getTotalFee(), null, null, null, null, refund,ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
EtRefund refund1= etOrderService.createRefund(lastOrder, lastOrder.getTotalFee(), null, null, null, null, outRefundNo,ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||
if(etRefundService.insertEtRefund(refund1)>0){
|
||||
log.info("【自动退款】保存退款对象成功");
|
||||
// 新增资金流水记录
|
||||
callbackService.capitalFlowRecords(lastOrder,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND);
|
||||
// callbackService.capitalFlowRecords(lastOrder,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND);
|
||||
// 更新用户信息,清除缓存
|
||||
asUser.setBalance(BigDecimal.ZERO);
|
||||
int updateUser = asUserMapper.updateUser(asUser);
|
||||
|
|
@ -228,6 +233,7 @@ public class EtTask {
|
|||
// redisCache.deleteObject(keys);
|
||||
log.info("【系统启动】退还押金,更新用户余额成功!");
|
||||
}
|
||||
Refund refund = wxPayService.refund(lastOrder, reason, lastOrder.getTotalFee(),outRefundNo);
|
||||
log.info("=================【系统启动】退还押金定时任务结束!!!==================");
|
||||
}else{
|
||||
throw new ServiceException("【系统启动】保存退款对象失败");
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
a.tag,
|
||||
a.is_hot,
|
||||
a.introduction,
|
||||
a.content,
|
||||
-- a.content,
|
||||
a.author,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
|
|
@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
a.tag,
|
||||
a.is_hot,
|
||||
a.introduction,
|
||||
a.content,
|
||||
-- a.content,
|
||||
a.author,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select de.device_id, de.picture, de.device_name, de.mac, de.sn, de.model_id, de.vehicle_num, de.area_id,
|
||||
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,
|
||||
de.update_time, de.last_time, de.remark, de.status, de.lock_status, de.location,
|
||||
de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage, de.is_admin_unlocking, de.signal_strength from et_device de
|
||||
de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.is_area_out_outage, de.is_admin_unlocking, de.signal_strength, de.satellites, de.quality from et_device de
|
||||
left join et_area_dept ad on ad.area_id = de.area_id
|
||||
left join sys_dept d on d.dept_id = ad.dept_id
|
||||
where 1 = 1
|
||||
|
|
@ -76,8 +76,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptId != null "> and d.dept_id = #{deptId}</if>
|
||||
<if test="modelId != null and modelId != ''"> and de.model_id = #{modelId}</if>
|
||||
<if test="onlineStatus != null and onlineStatus != ''"> and de.online_status = #{onlineStatus}</if>
|
||||
<if test="status != null and status != ''"> and de.status = #{status}</if>
|
||||
<!-- <if test="status != null and status != ''"> and de.status = #{status}</if>-->
|
||||
<choose>
|
||||
<when test="status == '34'">
|
||||
and (de.status = '3' or de.status = '4')
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="status != null and status != ''">
|
||||
and de.status = #{status}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="lockStatus != null and lockStatus != ''"> and de.lock_status = #{lockStatus}</if>
|
||||
<!-- 查询areaId是null -->
|
||||
<if test="unBand != null">
|
||||
and de.area_id is null
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by de.sn
|
||||
|
|
@ -230,6 +244,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where device_id = #{deviceId}
|
||||
</update>
|
||||
|
||||
<update id="updateAsDevice2" parameterType="AsDevice">
|
||||
update et_device
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="picture != null">picture = #{picture},</if>
|
||||
<if test="deviceName != null">device_name = #{deviceName},</if>
|
||||
<if test="mac != null">mac = #{mac},</if>
|
||||
<if test="sn != null">sn = #{sn},</if>
|
||||
model_id = #{modelId},
|
||||
<if test="vehicleNum != null">vehicle_num = #{vehicleNum},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
area_id = #{areaId},
|
||||
<if test="activationTime != null">activation_time = #{activationTime},</if>
|
||||
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="lastTime != null">last_time = #{lastTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="lockStatus != null">lock_status = #{lockStatus},</if>
|
||||
<if test="location != null">location = #{location},</if>
|
||||
<if test="remainingPower != null">remaining_power = #{remainingPower},</if>
|
||||
<if test="voltage != null">voltage = #{voltage},</if>
|
||||
<if test="qrcode != null">qrcode = #{qrcode},</if>
|
||||
<if test="longitude != null">longitude = #{longitude},</if>
|
||||
<if test="latitude != null">latitude = #{latitude},</if>
|
||||
<if test="isAreaOutOutage != null">is_area_out_outage = #{isAreaOutOutage},</if>
|
||||
<if test="isAdminUnlocking != null">is_admin_unlocking = #{isAdminUnlocking},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
|
||||
<update id="updateAsDeviceBySn" parameterType="AsDevice">
|
||||
update et_device
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
|
|
|||
|
|
@ -63,12 +63,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectRepairNum" resultType="java.lang.Integer">
|
||||
select count(1) from et_admin_order where type = '1' and admin_id = #{adminId}
|
||||
select count(1) from et_admin_order where type = '1'
|
||||
<if test="adminId != null"> and admin_id = #{adminId}</if>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectPowerReplacementNum" resultType="java.lang.Integer">
|
||||
select count(1) from et_admin_order where type = '2' and admin_id = #{adminId}
|
||||
select count(1) from et_admin_order where type = '2'
|
||||
<if test="adminId != null"> and admin_id = #{adminId}</if>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="busType" column="bus_type" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="handlingCharge" column="handling_charge" />
|
||||
<result property="platformServiceFee" column="platform_service_fee" />
|
||||
<result property="operatorDividend" column="operator_dividend" />
|
||||
<result property="operatorBalance" column="operator_balance" />
|
||||
<result property="partnerDividend" column="partner_dividend" />
|
||||
|
|
@ -22,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectEtCapitalFlowVo">
|
||||
select flow_id, area_id, order_no, out_trade_no, type, bus_type, amount, handling_charge, operator_dividend, operator_balance, partner_dividend, pay_type, create_time from et_capital_flow
|
||||
select flow_id, area_id, order_no, out_trade_no, type, bus_type, amount, handling_charge, platform_service_fee, operator_dividend, operator_balance, partner_dividend, pay_type, create_time from et_capital_flow
|
||||
</sql>
|
||||
|
||||
<select id="selectEtCapitalFlowList" parameterType="EtCapitalFlow" resultMap="EtCapitalFlowResult">
|
||||
|
|
@ -35,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
cf.bus_type,
|
||||
cf.amount,
|
||||
cf.handling_charge,
|
||||
cf.platform_service_fee,
|
||||
cf.operator_dividend,
|
||||
cf.operator_balance,
|
||||
cf.partner_dividend,
|
||||
|
|
@ -90,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="busType != null">bus_type,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="handlingCharge != null">handling_charge,</if>
|
||||
<if test="platformServiceFee != null">platform_service_fee,</if>
|
||||
<if test="operatorDividend != null">operator_dividend,</if>
|
||||
<if test="operatorBalance != null">operator_balance,</if>
|
||||
<if test="partnerDividend != null">partner_dividend,</if>
|
||||
|
|
@ -105,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="busType != null">#{busType},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="handlingCharge != null">#{handlingCharge},</if>
|
||||
<if test="platformServiceFee != null">#{platformServiceFee},</if>
|
||||
<if test="operatorDividend != null">#{operatorDividend},</if>
|
||||
<if test="operatorBalance != null">#{operatorBalance},</if>
|
||||
<if test="partnerDividend != null">#{partnerDividend},</if>
|
||||
|
|
@ -123,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="busType != null">bus_type = #{busType},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="handlingCharge != null">handling_charge = #{handlingCharge},</if>
|
||||
<if test="platformServiceFee != null">platform_service_fee = #{platformServiceFee},</if>
|
||||
<if test="operatorDividend != null">operator_dividend = #{operatorDividend},</if>
|
||||
<if test="operatorBalance != null">operator_balance = #{operatorBalance},</if>
|
||||
<if test="partnerDividend != null">partner_dividend = #{partnerDividend},</if>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.EtCommandLogMapper">
|
||||
|
||||
<resultMap type="EtCommandLog" id="EtCommandLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="url" column="url" />
|
||||
<result property="command" column="command" />
|
||||
<result property="type" column="type" />
|
||||
<result property="mac" column="mac" />
|
||||
<result property="sn" column="sn" />
|
||||
<result property="result" column="result" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtCommandLogVo">
|
||||
select id, url, command, type, mac, sn, result, create_time from et_command_log
|
||||
</sql>
|
||||
|
||||
<select id="selectEtCommandLogList" parameterType="EtCommandLog" resultMap="EtCommandLogResult">
|
||||
<include refid="selectEtCommandLogVo"/>
|
||||
<where>
|
||||
<if test="url != null and url != ''"> and url like concat('%', #{url}, '%')</if>
|
||||
<if test="command != null and command != ''"> and command like concat('%', #{command}, '%')</if>
|
||||
<if test="mac != null and mac != ''"> and mac like concat('%', #{mac}, '%')</if>
|
||||
<if test="sn != null and sn != ''"> and sn like concat('%', #{sn}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type like concat('%', #{type}, '%')</if>
|
||||
<if test="result != null and result != ''"> and result like concat('%', #{result}, '%')</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectEtCommandLogById" parameterType="Long" resultMap="EtCommandLogResult">
|
||||
<include refid="selectEtCommandLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEtCommandLog" parameterType="EtCommandLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into et_command_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="url != null">url,</if>
|
||||
<if test="command != null">command,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="mac != null">mac,</if>
|
||||
<if test="sn != null">sn,</if>
|
||||
<if test="result != null">result,</if>
|
||||
create_time
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="url != null">#{url},</if>
|
||||
<if test="command != null">#{command},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="mac != null">#{mac},</if>
|
||||
<if test="sn != null">#{sn},</if>
|
||||
<if test="result != null">#{result},</if>
|
||||
sysdate()
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEtCommandLog" parameterType="EtCommandLog">
|
||||
update et_command_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="url != null">url = #{url},</if>
|
||||
<if test="command != null">command = #{command},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="mac != null">mac = #{mac},</if>
|
||||
<if test="sn != null">sn = #{sn},</if>
|
||||
<if test="result != null">result = #{result},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEtCommandLogById" parameterType="Long">
|
||||
delete from et_command_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEtCommandLogByIds" parameterType="String">
|
||||
delete from et_command_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="servicePhone2" column="service_phone2" />
|
||||
<result property="servicePhone3" column="service_phone3" />
|
||||
<result property="customService" column="custom_service" />
|
||||
<result property="isDepositDeduction" column="is_deposit_deduction" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtOperatingAreaVo">
|
||||
|
|
@ -59,7 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
county, area_out_outage, parking_out_dispatch, area_out_dispatch,
|
||||
no_riding_outage, authentication, msg_switch, undercharge, error, cast(agreement as char) as agreement, deposit,
|
||||
outage, appointment_service_fee, dispatch_fee, vehicle_management_fee, timeout_minutes,
|
||||
auto_replacement_order, area_time_start, area_time_end, area_out_return, parking_return, service_name1, service_name2, service_name3, service_phone1, service_phone2, service_phone3, custom_service from et_operating_area
|
||||
auto_replacement_order, area_time_start, area_time_end, area_out_return, parking_return, service_name1, service_name2,
|
||||
service_name3, service_phone1, service_phone2, service_phone3, custom_service, is_deposit_deduction from et_operating_area
|
||||
</sql>
|
||||
|
||||
<select id="selectEtOperatingAreaList" parameterType="EtOperatingArea" resultMap="EtOperatingAreaResult">
|
||||
|
|
@ -70,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
a.no_riding_outage, a.authentication, a.msg_switch, a.undercharge, a.error, a.agreement, a.deposit,
|
||||
a.outage, a.appointment_service_fee, a.dispatch_fee, a.vehicle_management_fee, a.timeout_minutes,
|
||||
a.auto_replacement_order, a.area_time_start, a.area_time_end, a.area_out_return, a.parking_return,
|
||||
a.service_name1, a.service_name2, a.service_name3, a.service_phone1, a.service_phone2, a.service_phone3, a.custom_service from et_operating_area a
|
||||
a.service_name1, a.service_name2, a.service_name3, a.service_phone1, a.service_phone2, a.service_phone3, a.custom_service, a.is_deposit_deduction from et_operating_area a
|
||||
left join et_area_dept ad on ad.area_id = a.area_id
|
||||
left join sys_dept d on d.dept_id = ad.dept_id
|
||||
where 1 = 1
|
||||
|
|
|
|||
|
|
@ -39,13 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="tripRoute" column="trip_route" />
|
||||
<result property="tripRouteStr" column="trip_route_str" />
|
||||
<result property="cycle" column="cycle" />
|
||||
<result property="depositDeduction" column="deposit_deduction" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtOrderVo">
|
||||
select order_id, area_id, order_no, out_trade_no, user_id, rule_id,
|
||||
device_mac, sn, pay_time, paid, pay_type, type, total_fee, pay_fee, dispatch_fee,
|
||||
manage_fee, riding_fee, appointment_fee, mark, duration, distance, status,
|
||||
create_time, appointment_start_time, appointment_end_time,appointment_timeout, unlock_time,return_time, rule_end_time, return_type, AsText(trip_route) trip_route,trip_route_str,cycle from et_order
|
||||
create_time, appointment_start_time, appointment_end_time,appointment_timeout, unlock_time,return_time, rule_end_time, return_type, AsText(trip_route) trip_route,trip_route_str,cycle,deposit_deduction from et_order
|
||||
</sql>
|
||||
|
||||
<select id="selectEtOrderList" parameterType="EtOrder" resultMap="EtOrderResult">
|
||||
|
|
@ -53,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
o.order_id,
|
||||
o.area_id,
|
||||
oa.area_name AS area,
|
||||
oa.is_deposit_deduction isDepositDeduction,
|
||||
u.user_name AS userName,
|
||||
u.phonenumber AS phonenumber,
|
||||
o.order_no,
|
||||
|
|
@ -104,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="phonenumber != null and phonenumber != ''"> and u.phonenumber like concat('%', #{phonenumber}, '%')</if>
|
||||
<if test="userId != null and userId != ''"> and o.user_id = #{userId}</if>
|
||||
<if test="deviceMac != null and deviceMac != ''"> and o.device_mac like concat('%', #{deviceMac}, '%')</if>
|
||||
<if test="vehicleNum != null and vehicleNum != ''"> and de.vehicle_num like concat('%', #{vehicleNum }, '%')</if>
|
||||
<if test="sn != null and sn != ''"> and o.sn like concat('%', #{sn}, '%')</if>
|
||||
<if test="type != null and type != ''"> and o.type = #{type}</if>
|
||||
<if test="status != null and status != ''"> and o.status = #{status}</if>
|
||||
|
|
@ -370,6 +373,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select COALESCE(SUM(pay_fee), 0) from et_order
|
||||
<where>
|
||||
<if test="sn != null and sn != ''"> and sn = #{sn}</if>
|
||||
<if test="areaId != null"> and area_id = #{areaId}</if>
|
||||
<if test="startDateStr != null and startDateStr != ''">
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
|
||||
</if>
|
||||
|
|
@ -409,14 +413,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectLatestOrderList" resultMap="EtOrderResult">
|
||||
SELECT *
|
||||
FROM et_order
|
||||
SELECT o.*,u.phonenumber,u.real_name realName
|
||||
FROM et_order o
|
||||
left join et_user u on u.user_id = o.user_id
|
||||
<where>
|
||||
<if test="userId != null"> and user_id = #{userId}</if>
|
||||
<if test="sn != null"> and sn = #{sn}</if>
|
||||
and type = 1
|
||||
<if test="userId != null"> and o.user_id = #{userId}</if>
|
||||
<if test="sn != null"> and o.sn = #{sn}</if>
|
||||
and o.type = 1
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
ORDER BY o.create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectAppointmentUnfinished" resultType="com.ruoyi.system.domain.EtOrder">
|
||||
|
|
@ -553,6 +558,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="tripRoute != null">trip_route = GeomFromText(#{tripRoute}),</if>
|
||||
<if test="tripRouteStr != null">trip_route_str = #{tripRouteStr},</if>
|
||||
<if test="cycle != null">cycle = #{cycle},</if>
|
||||
<if test="depositDeduction != null">deposit_deduction = #{depositDeduction},</if>
|
||||
</trim>
|
||||
where order_id = #{orderId}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<select id="selectEtRefundList" parameterType="EtRefund" resultMap="EtRefundResult">
|
||||
select r.id, r.refund_no, r.order_no, r.user_id, u.user_name userName, r.amount, r.dispatch_fee, r.manage_fee,
|
||||
select r.id, r.refund_no, o.area_id areaId,oa.area_name areaName,r.order_no, r.user_id, u.user_name userName, r.amount, r.dispatch_fee, r.manage_fee,
|
||||
r.riding_fee, r.appointment_fee, r.type, r.reason, r.create_time, r.item_desc,r.refund_result from et_refund r
|
||||
INNER JOIN et_order o on o.order_no = r.order_no
|
||||
left join et_user u on u.user_id = r.user_id
|
||||
|
|
@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="orderNo != null and orderNo != ''"> and r.order_no like concat('%', #{orderNo}, '%')</if>
|
||||
<if test="userId != null "> and r.user_id like concat('%', #{userId}, '%')</if>
|
||||
<if test="amount != null "> and r.amount = #{amount}</if>
|
||||
<if test="areaId != null"> and o.area_id = #{areaId}</if>
|
||||
<if test="itemDesc != null and itemDesc != ''"> and r.item_desc like concat('%', #{itemDesc}, '%')</if>
|
||||
<if test="refundResult != null "> and r.refund_result = #{refundResult}</if>
|
||||
<if test="type != null "> and r.type = #{type}</if>
|
||||
|
|
|
|||
|
|
@ -14,21 +14,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="wxopenid" column="wxopenid" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="callStatus" column="call_status" />
|
||||
<result property="rejectReason" column="reject_reason" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtWithdrawVo">
|
||||
select id, withdraw_no, amount, dept_id, status, applicant, wxopenid, create_time, call_status from et_withdraw
|
||||
select id, withdraw_no, amount, dept_id, status, applicant, wxopenid, create_time, call_status, reject_reason from et_withdraw
|
||||
</sql>
|
||||
|
||||
<select id="selectEtWithdrawList" parameterType="EtWithdraw" resultMap="EtWithdrawResult">
|
||||
select w.id, w.withdraw_no, w.amount, w.dept_id, d.dept_name,w.status, w.applicant, w.wxopenid, w.create_time, w.call_status from et_withdraw w
|
||||
left join sys_dept d on d.dept_id = w.dept_id
|
||||
<where>
|
||||
<if test="withdrawNo != null "> and w.withdraw_no like concat('%', #{withdrawNo}, '%')</if>
|
||||
<if test="deptId != null "> and w.dept_id = #{deptId}</if>
|
||||
<if test="status != null and status != ''"> and w.status = #{status}</if>
|
||||
<if test="applicant != null and applicant != ''"> and w.applicant = #{applicant}</if>
|
||||
</where>
|
||||
select w.id, w.withdraw_no, w.amount, w.dept_id, d.dept_name,w.status, w.applicant, w.wxopenid, w.create_time, w.call_status, w.reject_reason from et_withdraw w
|
||||
left join sys_dept d on d.dept_id = w.dept_id where 1 = 1
|
||||
<if test="withdrawNo != null "> and w.withdraw_no like concat('%', #{withdrawNo}, '%')</if>
|
||||
<if test="status != null and status != ''"> and w.status = #{status}</if>
|
||||
<if test="applicant != null and applicant != ''"> and w.applicant = #{applicant}</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectEtWithdrawById" parameterType="Long" resultMap="EtWithdrawResult">
|
||||
|
|
@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="wxopenid != null">wxopenid,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="callStatus != null">call_status,</if>
|
||||
<if test="rejectReason != null">reject_reason,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="withdrawNo != null">#{withdrawNo},</if>
|
||||
|
|
@ -57,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="wxopenid != null">#{wxopenid},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="callStatus != null">#{callStatus},</if>
|
||||
<if test="rejectReason != null">#{rejectReason},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -71,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="wxopenid != null">wxopenid = #{wxopenid},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="callStatus != null">call_status = #{callStatus},</if>
|
||||
<if test="rejectReason != null">reject_reason = #{rejectReason},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user