1.提现
2.每个停车区单独设置还车误差 3.不骑行的心跳频率改成5分钟
This commit is contained in:
parent
e90cad2ab9
commit
1250c504b3
|
@ -332,16 +332,16 @@ public class AppVerifyController extends BaseController
|
|||
private Integer depositWithdraw(EtOrder etOrder1) {
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(etOrder1.getAreaId());
|
||||
BigDecimal deposit = new BigDecimal(area.getDeposit());
|
||||
if(deposit.compareTo(etOrder1.getTotalFee())!=0){
|
||||
throw new ServiceException("订单充值金额与系统押金不相等");
|
||||
}
|
||||
// if(deposit.compareTo(etOrder1.getTotalFee())!=0){
|
||||
// throw new ServiceException("订单充值金额与系统押金不相等");
|
||||
// }
|
||||
Long userId = etOrder1.getUserId();
|
||||
if(userId!=null){
|
||||
AsUser asUser = asUserService.selectUserById(userId);
|
||||
if(asUser!=null){
|
||||
int comparisonResult = deposit.compareTo(BigDecimal.ZERO);
|
||||
if (comparisonResult < 0) {
|
||||
throw new ServiceException("余额不足,扣除押金后余额小于0");
|
||||
throw new ServiceException("设置的押金不能小于0");
|
||||
}
|
||||
// 更新用户并更新缓存
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
@ -356,7 +356,7 @@ public class AppVerifyController extends BaseController
|
|||
}
|
||||
}
|
||||
logger.info("提现金额:【{}】", etOrder1.getTotalFee());
|
||||
return etOrderService.withdraw(etOrder1,deposit);
|
||||
return etOrderService.withdraw(etOrder1,etOrder1.getTotalFee());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -433,10 +433,10 @@ public class AppVerifyController extends BaseController
|
|||
*/
|
||||
@Log(title = "还车", businessType = BusinessType.RETURN_VEHICLE)
|
||||
@PostMapping("/device/return")
|
||||
public AjaxResult returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat)
|
||||
public AjaxResult returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat,String voltage)
|
||||
{
|
||||
logger.info("【接收还车请求参数】:{},是否辅助还车:{},是否蓝牙控制:{}", orderNo,returnType,isBluetooth,lon,lat);
|
||||
Boolean aBoolean = asDeviceService.returnVehicle(orderNo,returnType,isBluetooth,lon,lat);
|
||||
logger.info("【接收还车请求参数】:{},是否辅助还车:{},是否蓝牙控制:{},电压:{}", orderNo,returnType,isBluetooth,lon,lat,voltage);
|
||||
Boolean aBoolean = asDeviceService.returnVehicle(orderNo,returnType,isBluetooth,lon,lat,voltage);
|
||||
return success(aBoolean);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.vo.LabelVo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
@ -49,6 +50,16 @@ public class AsUserController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号快速搜索用户列表
|
||||
*/
|
||||
@GetMapping("/fast/search")
|
||||
public AjaxResult fastSearch(String phonenumber)
|
||||
{
|
||||
List<LabelVo> list = asUserService.fastSearch(phonenumber);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
|
|
|
@ -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.EtWithdraw;
|
||||
import com.ruoyi.system.service.IEtWithdrawService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 提现记录Controller
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-06-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/withdraw")
|
||||
public class EtWithdrawController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEtWithdrawService etWithdrawService;
|
||||
|
||||
/**
|
||||
* 查询提现记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:withdraw:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EtWithdraw etWithdraw)
|
||||
{
|
||||
startPage();
|
||||
List<EtWithdraw> list = etWithdrawService.selectEtWithdrawList(etWithdraw);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出提现记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:withdraw:export')")
|
||||
@Log(title = "提现记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EtWithdraw etWithdraw)
|
||||
{
|
||||
List<EtWithdraw> list = etWithdrawService.selectEtWithdrawList(etWithdraw);
|
||||
ExcelUtil<EtWithdraw> util = new ExcelUtil<EtWithdraw>(EtWithdraw.class);
|
||||
util.exportExcel(response, list, "提现记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提现记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:withdraw:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(etWithdrawService.selectEtWithdrawById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:withdraw:add')")
|
||||
@Log(title = "提现记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EtWithdraw etWithdraw)
|
||||
{
|
||||
return toAjax(etWithdrawService.insertEtWithdraw(etWithdraw));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:withdraw:edit')")
|
||||
@Log(title = "提现记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EtWithdraw etWithdraw)
|
||||
{
|
||||
return toAjax(etWithdrawService.updateEtWithdraw(etWithdraw));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除提现记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:withdraw:remove')")
|
||||
@Log(title = "提现记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(etWithdrawService.deleteEtWithdrawByIds(ids));
|
||||
}
|
||||
}
|
|
@ -1,25 +1,7 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.system.domain.EtAreaDept;
|
||||
import com.ruoyi.system.mapper.EtAreaDeptMapper;
|
||||
import com.ruoyi.system.mapper.EtOperatingAreaMapper;
|
||||
import com.ruoyi.system.service.IEtOperatingAreaService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
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.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
@ -27,9 +9,20 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.EtAreaDept;
|
||||
import com.ruoyi.system.mapper.EtAreaDeptMapper;
|
||||
import com.ruoyi.system.mapper.EtOperatingAreaMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.IEtOperatingAreaService;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运营商信息
|
||||
|
@ -52,6 +45,9 @@ public class SysDeptController extends BaseController
|
|||
@Resource
|
||||
private EtOperatingAreaMapper etOperatingAreaMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 获取运营商列表
|
||||
|
@ -173,4 +169,18 @@ public class SysDeptController extends BaseController
|
|||
deptService.checkDeptDataScope(deptId);
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询余额
|
||||
*/
|
||||
@GetMapping("/getBalance")
|
||||
public AjaxResult getBalance()
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
Long deptId = getDeptId();
|
||||
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||
ajax.put(AjaxResult.DATA_TAG, sysDept.getBalance());
|
||||
return ajax;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.stream.Collectors;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.system.domain.EtOperatingArea;
|
||||
import com.ruoyi.system.service.*;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -68,6 +69,16 @@ public class SysUserController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定APP用户
|
||||
*/
|
||||
@Log(title = "绑定APP用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/bandAppUser")
|
||||
public AjaxResult bandAppUser(@RequestBody SysUser user)
|
||||
{
|
||||
return toAjax(userService.bandAppUser(user));
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@PostMapping("/export")
|
||||
|
|
|
@ -129,7 +129,7 @@ public class IotConstants {
|
|||
/**
|
||||
* 命令 频率:一个小时
|
||||
*/
|
||||
public static final String COMMAND_FREQUENCY_3600 = "sub3600@";
|
||||
public static final String COMMAND_FREQUENCY_3600 = "sub300@";
|
||||
|
||||
|
||||
/**----------------------------命令end----------------------------*/
|
||||
|
|
|
@ -494,5 +494,22 @@ public class ServiceConstants {
|
|||
|
||||
|
||||
/**----------------------------退款类型end----------------------------*/
|
||||
/**----------------------------提现状态start----------------------------*/
|
||||
/** 提现状态:0-提现申请,1-通过,2-驳回 */
|
||||
/**
|
||||
* 提现状态:申请
|
||||
*/
|
||||
public static final String WITHDRAW_STATUS_APPLY = "0";
|
||||
|
||||
/**
|
||||
* 提现状态:通过
|
||||
*/
|
||||
public static final String WITHDRAW_STATUS_PASS = "1";
|
||||
|
||||
/**
|
||||
* 提现状态:驳回
|
||||
*/
|
||||
public static final String WITHDRAW_STATUS_REJECT = "2";
|
||||
/**----------------------------提现状态end----------------------------*/
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||
import com.ruoyi.common.annotation.Excel.Type;
|
||||
import com.ruoyi.common.annotation.Excels;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.xss.Xss;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户对象 sys_user
|
||||
|
@ -118,7 +121,7 @@ public class SysUser extends BaseEntity
|
|||
@Excel(name = "分账项目ids")
|
||||
private List<String> dividendItemIds;
|
||||
|
||||
/** app用户id */
|
||||
/** app用户id,用于分账或提现 */
|
||||
private Long appUserId;
|
||||
|
||||
public Long getAppUserId() {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.ruoyi.common.core.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class LabelVo {
|
||||
|
||||
/** 节点名称*/
|
||||
private String label;
|
||||
|
||||
/** 节点值*/
|
||||
private String value;
|
||||
|
||||
/** app名称*/
|
||||
private String appName;
|
||||
}
|
|
@ -52,6 +52,9 @@ public class EtParkingArea implements Serializable
|
|||
@Excel(name = "边界json")
|
||||
private String boundaryStr;
|
||||
|
||||
@Excel(name = "还车误差")
|
||||
private Integer error;
|
||||
|
||||
/** 经度 */
|
||||
private String longitude;
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 提现记录对象 et_withdraw
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-06-27
|
||||
*/
|
||||
@Data
|
||||
public class EtWithdraw extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 提现id */
|
||||
private Long id;
|
||||
|
||||
/** 提现单号 */
|
||||
@Excel(name = "提现单号")
|
||||
private String withdrawNo;
|
||||
|
||||
/** 提现金额:元 */
|
||||
@Excel(name = "提现金额:元")
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 运营商id */
|
||||
@Excel(name = "运营商id")
|
||||
private Long deptId;
|
||||
|
||||
/** 运营商 */
|
||||
@Excel(name = "运营商")
|
||||
private String deptName;
|
||||
|
||||
/** 申请状态 */
|
||||
@Excel(name = "申请状态")
|
||||
private String status;
|
||||
|
||||
/** 申请人 */
|
||||
@Excel(name = "申请人")
|
||||
private String applicant;
|
||||
|
||||
/** 微信openid */
|
||||
@Excel(name = "微信openid")
|
||||
private String wxopenid;
|
||||
|
||||
/** 回调状态 */
|
||||
@Excel(name = "回调状态")
|
||||
private String callStatus;
|
||||
|
||||
}
|
|
@ -36,4 +36,13 @@ public class EtOrderVo {
|
|||
|
||||
// /** 是否预约 */
|
||||
// private Boolean isAppointment;
|
||||
|
||||
/** 是否蓝牙控制 */
|
||||
private String isBluetooth;
|
||||
|
||||
/** 经度 */
|
||||
private String lon;
|
||||
|
||||
/** 纬度 */
|
||||
private String lat;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.vo.LabelVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -150,4 +151,9 @@ public interface AsUserMapper
|
|||
* 租赁用户
|
||||
*/
|
||||
String getLeaseUser(@Param("timeStart") String timeStart, @Param("timeEnd") String timeEnd, @Param("areaId") String areaId);
|
||||
|
||||
/**
|
||||
* 快速查询
|
||||
*/
|
||||
List<LabelVo> fastSearch(String phonenumber);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtWithdraw;
|
||||
|
||||
/**
|
||||
* 提现记录Mapper接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-06-27
|
||||
*/
|
||||
public interface EtWithdrawMapper
|
||||
{
|
||||
/**
|
||||
* 查询提现记录
|
||||
*
|
||||
* @param id 提现记录主键
|
||||
* @return 提现记录
|
||||
*/
|
||||
public EtWithdraw selectEtWithdrawById(Long id);
|
||||
|
||||
/**
|
||||
* 查询提现记录列表
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 提现记录集合
|
||||
*/
|
||||
public List<EtWithdraw> selectEtWithdrawList(EtWithdraw etWithdraw);
|
||||
|
||||
/**
|
||||
* 新增提现记录
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtWithdraw(EtWithdraw etWithdraw);
|
||||
|
||||
/**
|
||||
* 修改提现记录
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtWithdraw(EtWithdraw etWithdraw);
|
||||
|
||||
/**
|
||||
* 删除提现记录
|
||||
*
|
||||
* @param id 提现记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtWithdrawById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除提现记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtWithdrawByIds(Long[] ids);
|
||||
}
|
|
@ -192,7 +192,7 @@ public interface IAsDeviceService extends IService<AsDevice>
|
|||
/**
|
||||
* 还车
|
||||
*/
|
||||
Boolean returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat);
|
||||
Boolean returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat,String voltage);
|
||||
|
||||
/**
|
||||
* 管理员开锁
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.vo.LabelVo;
|
||||
import com.ruoyi.system.domain.vo.AuthenticationVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -224,4 +225,9 @@ public interface IAsUserService
|
|||
* @return
|
||||
*/
|
||||
boolean checkIsAuthentication(Long userId);
|
||||
|
||||
/**
|
||||
* 根据手机号快速搜索用户列表
|
||||
*/
|
||||
List<LabelVo> fastSearch(String phonenumber);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EtWithdraw;
|
||||
|
||||
/**
|
||||
* 提现记录Service接口
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-06-27
|
||||
*/
|
||||
public interface IEtWithdrawService
|
||||
{
|
||||
/**
|
||||
* 查询提现记录
|
||||
*
|
||||
* @param id 提现记录主键
|
||||
* @return 提现记录
|
||||
*/
|
||||
public EtWithdraw selectEtWithdrawById(Long id);
|
||||
|
||||
/**
|
||||
* 查询提现记录列表
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 提现记录集合
|
||||
*/
|
||||
public List<EtWithdraw> selectEtWithdrawList(EtWithdraw etWithdraw);
|
||||
|
||||
/**
|
||||
* 新增提现记录
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEtWithdraw(EtWithdraw etWithdraw);
|
||||
|
||||
/**
|
||||
* 修改提现记录
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEtWithdraw(EtWithdraw etWithdraw);
|
||||
|
||||
/**
|
||||
* 批量删除提现记录
|
||||
*
|
||||
* @param ids 需要删除的提现记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtWithdrawByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除提现记录信息
|
||||
*
|
||||
* @param id 提现记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEtWithdrawById(Long id);
|
||||
}
|
|
@ -5,14 +5,14 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|||
|
||||
/**
|
||||
* 用户 业务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysUserService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
|
@ -28,7 +28,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
|
@ -52,7 +52,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 根据用户ID查询用户所属角色组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -60,7 +60,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 根据用户ID查询用户所属岗位组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -68,7 +68,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -92,21 +92,21 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
public void checkUserAllowed(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void checkUserDataScope(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -114,7 +114,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -122,7 +122,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -130,7 +130,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
|
@ -138,7 +138,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -146,7 +146,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -154,7 +154,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
|
@ -163,7 +163,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -171,7 +171,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
|
@ -180,7 +180,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -188,7 +188,7 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -196,11 +196,16 @@ public interface ISysUserService
|
|||
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
*
|
||||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @param operName 操作用户
|
||||
* @return 结果
|
||||
*/
|
||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
/**
|
||||
* 绑定app用户
|
||||
*/
|
||||
int bandAppUser(SysUser user);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import com.wechat.pay.java.service.profitsharing.model.CreateOrderReceiver;
|
|||
import com.wechat.pay.java.service.profitsharing.model.DeleteReceiverResponse;
|
||||
import com.wechat.pay.java.service.profitsharing.model.OrdersEntity;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
import com.wechat.pay.java.service.transferbatch.model.InitiateBatchTransferResponse;
|
||||
import com.wechat.pay.java.service.transferbatch.model.TransferDetailInput;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
@ -57,6 +59,17 @@ public interface IWxPayService {
|
|||
*/
|
||||
Refund refund(EtOrder etOrder, String reason, BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 发起商家转账
|
||||
* @param areaId 区域id
|
||||
* @param batchName 批次名称
|
||||
* @param batchRemark 转账说明
|
||||
* @param totalAmount 转账总金额
|
||||
* @param totalNum 转账总笔数
|
||||
* @param transferDetailInputs 转账明细列表
|
||||
*/
|
||||
InitiateBatchTransferResponse transfer(Long areaId,String batchName,String batchRemark,BigDecimal totalAmount,Integer totalNum,List<TransferDetailInput> transferDetailInputs);
|
||||
|
||||
/**
|
||||
* 根据退款单号查询退款信息
|
||||
* @param outRefundNo 退款单号
|
||||
|
|
|
@ -535,11 +535,17 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
/** 1.获取token*/
|
||||
String token = Token.getToken();
|
||||
String finalOrderNo = orderNo;
|
||||
/** 2.发送命令*/
|
||||
ResponseVo responseVo = sendCommandWithResp(asDevice.getMac(), token, IotConstants.COMMAND_OPEN+IotConstants.COMMAND_FREQUENCY_5, "编号开锁");
|
||||
if(responseVo.getCode() != 0){
|
||||
asynchronousUpdateOnlineStatus(asDevice.getMac());
|
||||
throw new ServiceException("【扫码/编号开锁骑行】发送开锁命令失败");
|
||||
if(!"true".equals(orderVo.getIsBluetooth())){
|
||||
/** 2.发送命令*/
|
||||
ResponseVo responseVo = sendCommandWithResp(asDevice.getMac(), token, IotConstants.COMMAND_OPEN+IotConstants.COMMAND_FREQUENCY_5, "编号开锁");
|
||||
if(responseVo.getCode() != 0){
|
||||
asynchronousUpdateOnlineStatus(asDevice.getMac());
|
||||
throw new ServiceException("【扫码/编号开锁骑行】发送开锁命令失败");
|
||||
}
|
||||
}else{
|
||||
asDevice.setLongitude(orderVo.getLon());
|
||||
asDevice.setLatitude(orderVo.getLat());
|
||||
asDevice.setLastTime(DateUtils.getNowDate());
|
||||
}
|
||||
/** 3.更新车辆状态*/
|
||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
||||
|
@ -1124,7 +1130,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
@SneakyThrows
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat) {
|
||||
public Boolean returnVehicle(String orderNo,String returnType,String isBluetooth,String lon,String lat,String voltage) {
|
||||
if(StrUtil.isNotBlank(orderNo)){
|
||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||
if(ObjectUtil.isNull(order)){
|
||||
|
@ -1136,27 +1142,30 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
if(!ServiceConstants.ORDER_STATUS_RIDING.equals(order.getStatus())){
|
||||
throw new ServiceException("该订单状态非骑行中");
|
||||
}
|
||||
//断是否在禁停区内,如果在禁停区内,不能还车。 noParkingArea
|
||||
if(isNoParkingArea(order.getSn(), order.getAreaId())){
|
||||
throw new ServiceException("在禁停区内,不能还车");
|
||||
}
|
||||
// 停车点还车
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
|
||||
if(area.getParkingReturn().equals("1")){
|
||||
if(!isParkingZone(order.getSn(), order.getAreaId())){
|
||||
throw new ServiceException("不在停车点内,不能还车");
|
||||
if(ServiceConstants.RETURN_TYPE_NORMAL.equals(returnType)){
|
||||
//判断是否在禁停区内,如果在禁停区内,不能还车。 noParkingArea
|
||||
if(isNoParkingArea(order.getSn(), order.getAreaId())){
|
||||
throw new ServiceException("在禁停区内,不能还车");
|
||||
}
|
||||
}
|
||||
// 运营区外还车
|
||||
if(area.getAreaOutReturn().equals("0")){
|
||||
if(!isAreaZone(order.getSn(), area)){
|
||||
throw new ServiceException("在运营区外,不能还车");
|
||||
// 停车点还车
|
||||
if(area.getParkingReturn().equals("1")){
|
||||
if(!isParkingZone(order.getSn(), order.getAreaId())){
|
||||
throw new ServiceException("不在停车点内,不能还车");
|
||||
}
|
||||
}
|
||||
// 运营区外还车
|
||||
if(area.getAreaOutReturn().equals("0")){
|
||||
if(!isAreaZone(order.getSn(), area)){
|
||||
throw new ServiceException("在运营区外,不能还车");
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 1. 记录还车时间*/
|
||||
order.setReturnType(returnType);
|
||||
order.setStatus(ServiceConstants.ORDER_STATUS_RIDING_END);
|
||||
order.setReturnTime(DateUtils.getNowDate());
|
||||
// order.setReturnTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, "2024-06-28 18:15:56"));//2024-06-28 18:15:56
|
||||
String token = Token.getToken();
|
||||
AsDevice device = asDeviceMapper.selectAsDeviceBySn(order.getSn());
|
||||
if(ServiceConstants.RETURN_TYPE_NORMAL.equals(returnType)){
|
||||
|
@ -1171,6 +1180,18 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
// 更新定位
|
||||
device.setLongitude(lon);
|
||||
device.setLatitude(lat);
|
||||
if(StrUtil.isNotBlank(voltage)){
|
||||
BigDecimal divide = new BigDecimal(voltage).divide(new BigDecimal(10));
|
||||
device.setVoltage(divide.toString());
|
||||
EtModel model = etModelService.selectEtModelByModelId(device.getModelId());
|
||||
Integer remainingMileage = 0;
|
||||
if(StrUtil.isNotBlank(device.getVoltage())){
|
||||
remainingMileage = CommonUtil.getRemainingMileage(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage(), model.getFullEndurance());
|
||||
}
|
||||
Integer electricQuantity = CommonUtil.getElectricQuantity(device.getVoltage(), model.getFullVoltage(), model.getLowVoltage());//电量百分百
|
||||
device.setRemainingMileage(remainingMileage);
|
||||
device.setRemainingPower(electricQuantity.toString());
|
||||
}
|
||||
device.setLastTime(DateUtils.getNowDate());
|
||||
}
|
||||
}else{
|
||||
|
@ -1443,6 +1464,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
String latitude = device.getLatitude();
|
||||
String longitude = device.getLongitude();
|
||||
Geometry geometry = GeoUtils.fromWkt(etParkingArea.getBoundary());
|
||||
if(ObjectUtil.isNotNull(etParkingArea.getError())){
|
||||
tolerance = etParkingArea.getError();
|
||||
}
|
||||
inCircle = GeoUtils.isInPolygonWithTolerance(longitude, latitude, geometry, tolerance);
|
||||
if(inCircle){
|
||||
log.info("车辆【{}】在停车区【{}】内",sn,etParkingArea.getParkingName());
|
||||
|
@ -1470,6 +1494,9 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
double tolerance = area.getError(); // 误差距离
|
||||
for (EtParkingArea etParkingArea : parkingAreas) {
|
||||
Geometry geometry = GeoUtils.fromWkt(etParkingArea.getBoundary());
|
||||
if(ObjectUtil.isNotNull(etParkingArea.getError())){
|
||||
tolerance = etParkingArea.getError();
|
||||
}
|
||||
inCircle = GeoUtils.isInPolygonWithTolerance(longitude, latitude, geometry, tolerance);
|
||||
if(inCircle){
|
||||
log.info("位置【{},{}】在停车区【{}】内",longitude,latitude,etParkingArea.getParkingName());
|
||||
|
@ -1680,7 +1707,7 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
|||
}
|
||||
|
||||
/**
|
||||
* 判断是否在停车区
|
||||
* 判断是否在停车区申请人
|
||||
*/
|
||||
@Override
|
||||
public IsInParkingAreaVo isInParkingArea(String longitude, String latitude,String areaId){
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.ruoyi.common.constant.UserConstants;
|
|||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.entity.EtOrderDto;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.vo.LabelVo;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
@ -16,13 +17,15 @@ import com.ruoyi.common.utils.bean.BeanUtils;
|
|||
import com.ruoyi.common.utils.bean.BeanValidators;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.common.utils.verify.VerifyIdentityUtil;
|
||||
import com.ruoyi.system.domain.EtOperatingArea;
|
||||
import com.ruoyi.system.domain.EtOrder;
|
||||
import com.ruoyi.system.domain.vo.AuthenticationVo;
|
||||
import com.ruoyi.system.mapper.AsUserMapper;
|
||||
import com.ruoyi.system.mapper.EtOrderMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.*;
|
||||
import com.ruoyi.system.service.IAsUserService;
|
||||
import com.ruoyi.system.service.IEtOperatingAreaService;
|
||||
import com.ruoyi.system.service.IEtOrderService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -452,14 +455,14 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
public Boolean checkIsDeposit(Long userId) {
|
||||
AsUser asUser = asUserMapper.selectUserById(userId);
|
||||
BigDecimal balance = asUser.getBalance();
|
||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(asUser.getAreaId());
|
||||
BigDecimal deposit = new BigDecimal(area.getDeposit());
|
||||
// EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(asUser.getAreaId());
|
||||
// BigDecimal deposit = new BigDecimal(area.getDeposit());
|
||||
if(ObjectUtil.isNull(balance)){
|
||||
log.info("用户【{}】余额为空",userId);
|
||||
return false;
|
||||
}
|
||||
if(balance.compareTo(BigDecimal.ZERO)==0 || balance.compareTo(deposit)<0){//余额为0或者押金和余额不相等
|
||||
log.info("用户【{}】余额为0或者押金小于余额不相等",userId);
|
||||
if(balance.compareTo(BigDecimal.ZERO)==0){//余额为0
|
||||
log.info("用户【{}】余额为0",userId);
|
||||
return false;
|
||||
}
|
||||
// 判断是否有押金充值记录
|
||||
|
@ -541,4 +544,14 @@ public class AsUserServiceImpl implements IAsUserService
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号快速搜索用户列表
|
||||
*/
|
||||
@Override
|
||||
public List<LabelVo> fastSearch(String phonenumber) {
|
||||
/** 获取设备绑定数量*/
|
||||
List<LabelVo> users = asUserMapper.fastSearch(phonenumber);
|
||||
return users;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
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.entity.SysUser;
|
||||
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.EtWithdraw;
|
||||
import com.ruoyi.system.mapper.AsUserMapper;
|
||||
import com.ruoyi.system.mapper.EtWithdrawMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.IEtWithdrawService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 提现记录Service业务层处理
|
||||
*
|
||||
* @author 邱贞招
|
||||
* @date 2024-06-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EtWithdrawServiceImpl implements IEtWithdrawService
|
||||
{
|
||||
@Resource
|
||||
private EtWithdrawMapper etWithdrawMapper;
|
||||
|
||||
@Resource
|
||||
private AsUserMapper asUserMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
/**
|
||||
* 查询提现记录
|
||||
*
|
||||
* @param id 提现记录主键
|
||||
* @return 提现记录
|
||||
*/
|
||||
@Override
|
||||
public EtWithdraw selectEtWithdrawById(Long id)
|
||||
{
|
||||
return etWithdrawMapper.selectEtWithdrawById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询提现记录列表
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 提现记录
|
||||
*/
|
||||
@Override
|
||||
public List<EtWithdraw> selectEtWithdrawList(EtWithdraw etWithdraw)
|
||||
{
|
||||
return etWithdrawMapper.selectEtWithdrawList(etWithdraw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增提现记录
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEtWithdraw(EtWithdraw etWithdraw)
|
||||
{
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
user = userMapper.selectUserById(user.getUserId());
|
||||
etWithdraw.setCreateTime(DateUtils.getNowDate());
|
||||
etWithdraw.setWithdrawNo(IdUtils.getOrderNo("tx"));
|
||||
etWithdraw.setApplicant(user.getUserName());
|
||||
etWithdraw.setDeptId(user.getDeptId());
|
||||
if(ObjectUtil.isNull(user.getAppUserId())){
|
||||
throw new ServiceException("请先绑定微信");
|
||||
}
|
||||
AsUser asUser = asUserMapper.selectUserById(user.getAppUserId());
|
||||
log.info("获取到app用户:{}", JSON.toJSON(asUser));
|
||||
etWithdraw.setWxopenid(asUser.getWxopenid());
|
||||
etWithdraw.setStatus(ServiceConstants.WITHDRAW_STATUS_APPLY);
|
||||
return etWithdrawMapper.insertEtWithdraw(etWithdraw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改提现记录
|
||||
*
|
||||
* @param etWithdraw 提现记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEtWithdraw(EtWithdraw etWithdraw)
|
||||
{
|
||||
return etWithdrawMapper.updateEtWithdraw(etWithdraw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除提现记录
|
||||
*
|
||||
* @param ids 需要删除的提现记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtWithdrawByIds(Long[] ids)
|
||||
{
|
||||
return etWithdrawMapper.deleteEtWithdrawByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除提现记录信息
|
||||
*
|
||||
* @param id 提现记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEtWithdrawById(Long id)
|
||||
{
|
||||
return etWithdrawMapper.deleteEtWithdrawById(id);
|
||||
}
|
||||
}
|
|
@ -5,11 +5,14 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.ServiceConstants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.entity.AsUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
@ -24,6 +27,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.token.TokenService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -80,6 +84,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Resource
|
||||
private EtAreaDeptMapper etAreaDeptMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
|
@ -686,4 +693,19 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定app用户
|
||||
*/
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,10 @@ import com.wechat.pay.java.service.refund.model.AmountReq;
|
|||
import com.wechat.pay.java.service.refund.model.CreateRequest;
|
||||
import com.wechat.pay.java.service.refund.model.QueryByOutRefundNoRequest;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
import com.wechat.pay.java.service.transferbatch.TransferBatchService;
|
||||
import com.wechat.pay.java.service.transferbatch.model.InitiateBatchTransferRequest;
|
||||
import com.wechat.pay.java.service.transferbatch.model.InitiateBatchTransferResponse;
|
||||
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;
|
||||
|
@ -223,6 +227,47 @@ public class WxPayService implements IWxPayService {
|
|||
return new RefundService.Builder().config(config).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起商家转账
|
||||
* @param areaId 区域id
|
||||
* @param batchName 批次名称
|
||||
* @param batchRemark 转账说明
|
||||
* @param totalAmount 转账总金额
|
||||
* @param totalNum 转账总笔数
|
||||
* @param transferDetailInputs 转账明细列表
|
||||
*/
|
||||
@Override
|
||||
public InitiateBatchTransferResponse transfer(Long areaId,String batchName,String batchRemark,BigDecimal totalAmount,Integer totalNum,List<TransferDetailInput> transferDetailInputs) {
|
||||
SysDept sysDept = getDeptObjByAreaId(areaId);
|
||||
InitiateBatchTransferRequest request = new InitiateBatchTransferRequest();
|
||||
request.setAppid(sysDept.getAppid());
|
||||
request.setOutBatchNo(IdUtils.getOrderNo("tx"));//
|
||||
request.setBatchName(batchName);
|
||||
request.setBatchRemark(batchRemark);
|
||||
request.setTotalAmount(totalAmount.multiply(new BigDecimal(100)).longValue());
|
||||
request.setTotalNum(totalNum);
|
||||
request.setTransferDetailList(transferDetailInputs);
|
||||
log.info("【发起商家转账】请求微信参数:【{}】",JSON.toJSONString(request));
|
||||
TransferBatchService transferService = getTransferService(sysDept);
|
||||
InitiateBatchTransferResponse initiateBatchTransferResponse = transferService.initiateBatchTransfer(request);
|
||||
log.info("【发起商家转账】微信返回结果:【{}】",JSON.toJSONString(initiateBatchTransferResponse));
|
||||
return initiateBatchTransferResponse;
|
||||
}
|
||||
|
||||
private TransferBatchService getTransferService(SysDept sysDept){
|
||||
// 初始化商户配置
|
||||
Config config = new RSAAutoCertificateConfig.Builder()
|
||||
.merchantId(sysDept.getMerchantId())
|
||||
// 使用 com.wechat.pay.java.core.util 中的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
|
||||
.privateKeyFromPath(sysDept.getPrivateKeyPath())
|
||||
.merchantSerialNumber(sysDept.getMerchantSerialNumber())
|
||||
.apiV3Key(sysDept.getApiV3Key())
|
||||
.build();
|
||||
// 初始化服务
|
||||
return new TransferBatchService.Builder().config(config).build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据运营区id获取运营商对象
|
||||
* @param areaId
|
||||
|
|
|
@ -155,6 +155,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="fastSearch" resultType="com.ruoyi.common.core.domain.vo.LabelVo">
|
||||
select phonenumber label,user_id as `value`,app_name appName from et_user where phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="AsUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into et_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
|
|
|
@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="areaId" column="area_id" />
|
||||
<result property="boundary" column="boundary" />
|
||||
<result property="boundaryStr" column="boundary_str" />
|
||||
<result property="error" column="error" />
|
||||
<result property="longitude" column="longitude" />
|
||||
<result property="latitude" column="latitude" />
|
||||
<result property="picture" column="picture" />
|
||||
|
@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectEtParkingAreaVo">
|
||||
select parking_id, parking_name, type, area_id, AsText(boundary) boundary, boundary_str, longitude, latitude, picture, remark, create_by, create_time from et_parking_area
|
||||
select parking_id, parking_name, type, area_id, AsText(boundary) boundary, boundary_str, error, longitude, latitude, picture, remark, create_by, create_time from et_parking_area
|
||||
</sql>
|
||||
|
||||
<select id="selectEtParkingAreaList" parameterType="EtParkingArea" resultMap="EtParkingAreaResult">
|
||||
|
@ -49,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null">type,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="boundary != null">boundary,</if>
|
||||
<if test="error != null">error,</if>
|
||||
<if test="longitude != null">longitude,</if>
|
||||
<if test="latitude != null">latitude,</if>
|
||||
<if test="picture != null">picture,</if>
|
||||
|
@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null">#{type},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="boundary != null">#{boundary},</if>
|
||||
<if test="error != null">#{error},</if>
|
||||
<if test="longitude != null">#{longitude},</if>
|
||||
<if test="latitude != null">#{latitude},</if>
|
||||
<if test="picture != null">#{picture},</if>
|
||||
|
@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null">type = #{type},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="boundary != null">boundary = #{boundary},</if>
|
||||
<if test="error != null">error = #{error},</if>
|
||||
<if test="longitude != null">longitude = #{longitude},</if>
|
||||
<if test="latitude != null">latitude = #{latitude},</if>
|
||||
<if test="picture != null">picture = #{picture},</if>
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<?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.EtWithdrawMapper">
|
||||
|
||||
<resultMap type="EtWithdraw" id="EtWithdrawResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="withdrawNo" column="withdraw_no" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="status" column="status" />
|
||||
<result property="applicant" column="applicant" />
|
||||
<result property="wxopenid" column="wxopenid" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="callStatus" column="call_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEtWithdrawVo">
|
||||
select id, withdraw_no, amount, dept_id, status, applicant, wxopenid, create_time, call_status 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>
|
||||
|
||||
<select id="selectEtWithdrawById" parameterType="Long" resultMap="EtWithdrawResult">
|
||||
<include refid="selectEtWithdrawVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEtWithdraw" parameterType="EtWithdraw" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into et_withdraw
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="withdrawNo != null">withdraw_no,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="applicant != null">applicant,</if>
|
||||
<if test="wxopenid != null">wxopenid,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="callStatus != null">call_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="withdrawNo != null">#{withdrawNo},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="applicant != null">#{applicant},</if>
|
||||
<if test="wxopenid != null">#{wxopenid},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="callStatus != null">#{callStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEtWithdraw" parameterType="EtWithdraw">
|
||||
update et_withdraw
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="withdrawNo != null">withdraw_no = #{withdrawNo},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="applicant != null">applicant = #{applicant},</if>
|
||||
<if test="wxopenid != null">wxopenid = #{wxopenid},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="callStatus != null">call_status = #{callStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEtWithdrawById" parameterType="Long">
|
||||
delete from et_withdraw where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEtWithdrawByIds" parameterType="String">
|
||||
delete from et_withdraw where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user