定位日志

商家还车
This commit is contained in:
邱贞招 2024-10-25 11:30:23 +08:00
parent 68c33f753b
commit e97086b70b
47 changed files with 1066 additions and 146 deletions

View File

@ -295,6 +295,20 @@ public class AppController extends BaseController
return success(i);
}
/**
* 响铃寻车用mac
*/
@PostMapping("/device/ringByMac")
public AjaxResult ringByMac(String mac)
{
if(StrUtil.isBlank(mac)){
logger.info("没有mac号参数【mac={}】",mac);
return error("请传mac号参数"+"【mac="+mac+"");
}
Boolean i =eDeviceService.ringByMac(mac);
return success(i);
}
/**
* 计算距离
*/

View File

@ -434,18 +434,36 @@ public class AppVerifyController extends BaseController
return error();
}
// /**
// * 押金退款
// */
// @Log(title = "押金退款", businessType = BusinessType.DEPOSITREFUND)
// @PostMapping("/depositRefund")
// public AjaxResult depositRefund(String orderNo)
// {
// logger.info("【押金退款】请求参数orderNo={}", orderNo);
// if(StrUtil.isEmpty(orderNo)){
// return error("订单号不能为空");
// }
// Boolean aBoolean = orderService.depositRefund(orderNo);
// if(aBoolean){
// return success();
// }
// return error();
// }
/**
* 押金退款
* 商家还车
*/
@Log(title = "押金退款", businessType = BusinessType.DEPOSITREFUND)
@PostMapping("/depositRefund")
public AjaxResult depositRefund(String orderNo)
@Log(title = "商家还车", businessType = BusinessType.MERCHANT_RETURN)
@PostMapping("/merchantReturn")
public AjaxResult merchantReturn(String orderNo)
{
logger.info("【押金退款】请求参数orderNo={}", orderNo);
logger.info("商家还车】请求参数orderNo={}", orderNo);
if(StrUtil.isEmpty(orderNo)){
return error("订单号不能为空");
}
Boolean aBoolean = orderService.depositRefund(orderNo);
Boolean aBoolean = orderService.merchantReturn(orderNo);
if(aBoolean){
return success();
}

View File

@ -100,10 +100,11 @@ public class AppAdminController extends BaseController
* 首页统计
*/
@GetMapping(value = { "/index" })
public AjaxResult index()
public AjaxResult index(String startTime,String endTime)
{
logger.info("【首页统计/index】参数startTime={},endTime={}", startTime,endTime);
AjaxResult ajax = AjaxResult.success();
IndexAdminVo incomeVos = orderService.indexStatistics(getUserId());
IndexAdminVo incomeVos = orderService.indexStatistics(startTime, endTime,getUserId());
ajax.put(AjaxResult.DATA_TAG, incomeVos);
return ajax;
}

View File

@ -38,7 +38,7 @@ public class RlDeviceController extends BaseController
public TableDataInfo list(RlDevice rlDevice)
{
startPage();
List<RlDevice> list = eDeviceService.selectDeviceListWithIsolate(rlDevice);
List<RlDeviceVO> list = eDeviceService.selectDeviceListWithIsolate(rlDevice);
return getDataTable(list);
}

View File

@ -0,0 +1,99 @@
package com.ruoyi.web.controller.rl;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.RlLocationLog;
import com.ruoyi.system.service.IRlLocationLogService;
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
*
* @author ruoyi
* @date 2024-09-12
*/
@RestController
@RequestMapping("/system/locationLog")
public class RlLocationLogController extends BaseController
{
@Autowired
private IRlLocationLogService etLocationLogService;
/**
* 查询定位日志列表
*/
@PreAuthorize("@ss.hasPermi('system:locationLog:list')")
@GetMapping("/list")
public TableDataInfo list(RlLocationLog rlLocationLog)
{
startPage();
List<RlLocationLog> list = etLocationLogService.selectEtLocationLogList(rlLocationLog);
etLocationLogService.analytic(list);
return getDataTable(list);
}
/**
* 导出定位日志列表
*/
@PreAuthorize("@ss.hasPermi('system:locationLog:export')")
@Log(title = "定位日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RlLocationLog rlLocationLog)
{
List<RlLocationLog> list = etLocationLogService.selectEtLocationLogList(rlLocationLog);
ExcelUtil<RlLocationLog> util = new ExcelUtil<RlLocationLog>(RlLocationLog.class);
util.exportExcel(response, list, "定位日志数据");
}
/**
* 获取定位日志详细信息
*/
@PreAuthorize("@ss.hasPermi('system:locationLog:query')")
@GetMapping(value = "/{locationId}")
public AjaxResult getInfo(@PathVariable("locationId") Long locationId)
{
return success(etLocationLogService.selectEtLocationLogByLocationId(locationId));
}
/**
* 新增定位日志
*/
@PreAuthorize("@ss.hasPermi('system:locationLog:add')")
@Log(title = "定位日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RlLocationLog rlLocationLog)
{
return toAjax(etLocationLogService.insertEtLocationLog(rlLocationLog));
}
/**
* 修改定位日志
*/
@PreAuthorize("@ss.hasPermi('system:locationLog:edit')")
@Log(title = "定位日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RlLocationLog rlLocationLog)
{
return toAjax(etLocationLogService.updateEtLocationLog(rlLocationLog));
}
/**
* 删除定位日志
*/
@PreAuthorize("@ss.hasPermi('system:locationLog:remove')")
@Log(title = "定位日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{locationIds}")
public AjaxResult remove(@PathVariable Long[] locationIds)
{
return toAjax(etLocationLogService.deleteEtLocationLogByLocationIds(locationIds));
}
}

View File

@ -130,10 +130,10 @@ public class RlStoreController extends BaseController
}
/**
* 删除商户
* 删除店铺
*/
@PreAuthorize("@ss.hasPermi('ss.store:remove')")
@Log(title = "商户", businessType = BusinessType.DELETE)
@Log(title = "删除店铺", businessType = BusinessType.DELETE)
@DeleteMapping("/{storeIds}")
public AjaxResult remove(@PathVariable Long[] storeIds)
{

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.rl;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -15,12 +16,12 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.agent.RlAgentVO;
import com.ruoyi.system.domain.userExt.RlUserExt;
import com.ruoyi.system.domain.userWithdraw.RlUserWithdraw;
import com.ruoyi.system.domain.vo.RlUserQuery;
import com.ruoyi.system.service.IRlAgentService;
import com.ruoyi.system.service.IRlUserExtService;
import com.ruoyi.system.service.IRlUserService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.*;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -55,6 +56,9 @@ public class RlUserController extends BaseController
@Autowired
private ISysRoleService roleService;
@Autowired
private IRlUserWithdrawService userWithdrawService;
/**
* 获取用户列表
*/
@ -66,6 +70,17 @@ public class RlUserController extends BaseController
return getDataTable(list);
}
/**
* 获取app用户列表
*/
@GetMapping("/appList")
public TableDataInfo appList(RlUserQuery rlUser)
{
startPage();
List<RlUserVO> list = userService.selectAppUserList(rlUser);
return getDataTable(list);
}
// /**
// * 根据手机号快速搜索用户列表
// */
@ -106,7 +121,7 @@ public class RlUserController extends BaseController
ajax.put("roles", RlUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
if (StringUtils.isNotNull(userId))
{
RlUser rlUser = userService.selectUserById(userId);
RlUserVO rlUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, rlUser);
ajax.put("roleIds", rlUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
}
@ -133,7 +148,7 @@ public class RlUserController extends BaseController
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setCreateBy(getUsername());
user.setUserType(ServiceConstants.USER_TYPE_MERCHANT);
setUserType(user);
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
Boolean execute = transactionTemplate.execute(e -> {
int i = userService.insertUser(user);
@ -154,7 +169,7 @@ public class RlUserController extends BaseController
userExt.setDividendProportion(user.getDividendProportion().divide(BigDecimal.valueOf(100)));
userExt.setCooperationTime(user.getCooperationTime());
userExt.setDividendStatus(user.getDividendStatus());
RlAgentVO agentVO = agentService.selectRlAgentByCityId(user.getCityId());
RlAgentVO agentVO = agentService.selectRlAgentByAgentId(user.getAgentId());
userExt.setAgentId(agentVO.getAgentId());
int i1 = userExtService.insertRlUserExt(userExt);
if(i1 == 0){
@ -169,16 +184,8 @@ public class RlUserController extends BaseController
@PutMapping
public AjaxResult edit(@Validated @RequestBody RlUserQuery user)
{
if (!userService.checkUserNameUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(getUsername());
user.setUserType(ServiceConstants.USER_TYPE_MERCHANT);
setUserType(user);
Boolean execute = transactionTemplate.execute(e -> {
int i = userService.updateUser(user);
if(i == 0){
@ -197,6 +204,24 @@ public class RlUserController extends BaseController
return toAjax(1);
}
private void setUserType(RlUserQuery user) {
Long[] roleIds = user.getRoleIds();
if (roleIds != null && roleIds.length > 0) {
for (Long roleId : roleIds) {
if (roleId == 5L) {
user.setUserType("04"); // 配送员
break;
} else if (roleId == 4L) {
user.setUserType("03"); // 商户
break;
} else if (roleId == 3L) {
user.setUserType("02"); // 代理商
break;
}
}
}
}
// /**
// * 绑定系统用户
@ -208,19 +233,19 @@ public class RlUserController extends BaseController
// return toAjax(eUserService.bandSystemUser(user));
// }
// /**
// * 删除用户
// */
// @Log(title = "用户管理", businessType = BusinessType.DELETE)
// @DeleteMapping("/{userIds}")
// public AjaxResult remove(@PathVariable Long[] userIds)
// {
// if (ArrayUtils.contains(userIds, getUserId()))
// {
// return error("当前用户不能删除");
// }
// return toAjax(eUserService.deleteUserByIds(userIds));
// }
/**
* 删除用户
*/
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
if (ArrayUtils.contains(userIds, getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds));
}
// /**
// * 重置密码
@ -245,5 +270,25 @@ public class RlUserController extends BaseController
return toAjax(userService.updateUserStatus(user));
}
/**
* 根据userid获取提现渠道的列表
*/
@GetMapping("/getUserWithdrawChannelList")
public AjaxResult getUserWithdrawChannelList(Long userId)
{
logger.info("根据token获取提现渠道列表【userId="+userId+"");
return AjaxResult.success(userWithdrawService.selectRlUserWithdrawListByUserId(userId));
}
/**
* 修改用户提现渠道
*/
@Log(title = "用户提现渠道", businessType = BusinessType.UPDATE)
@PutMapping("/eidtUserWithdrawChannel")
public AjaxResult edit(@RequestBody RlUserWithdraw rlUserWithdraw)
{
logger.info("修改用户提现渠道rlUserWithdraw【"+ JSON.toJSONString(rlUserWithdraw)+"");
return toAjax(userWithdrawService.updateRlUserWithdraw(rlUserWithdraw));
}
}

View File

@ -152,11 +152,6 @@ public class ServiceConstants {
*/
public static final String VEHICLE_STATUS_NORMAL = "1";
/**
* 车辆状态: 2-预约中
*/
public static final String VEHICLE_STATUS_IN_APPOINTMENT = "2";
/**
* 车辆状态: 3-使用中 骑行中
*/
@ -177,11 +172,6 @@ public class ServiceConstants {
*/
public static final String VEHICLE_STATUS_IN_OFFLINE = "8";
/**
* 车辆状态: 9-废弃
*/
public static final String VEHICLE_STATUS_ABANDON = "9";
/**----------------------------车辆状态中文start----------------------------*/

View File

@ -108,6 +108,13 @@ public class RlUser extends BaseEntity
/** 小程序类型:1-用户端;2-商家端 */
private String appletType;
public RlUser() {
}
public RlUser(Long userId) {
this.userId = userId;
}
public boolean isAdmin()
{
return isAdmin(this.userId);

View File

@ -34,4 +34,7 @@ public class RlUserVO extends RlUser{
/** 可提现金额 */
private BigDecimal withdrawableAmount;
/** 代理商id */
private Long agentId;
}

View File

@ -109,6 +109,11 @@ public enum BusinessType
*/
DEPOSITREFUND,
/**
* 商家还车
*/
MERCHANT_RETURN,
/**
* 改价
*/

View File

@ -38,8 +38,6 @@ public class CommonUtil {
switch (status) {
case ServiceConstants.VEHICLE_STATUS_NOT_LISTING:
return msg + ServiceConstants.VEHICLE_STATUS_NOT_LISTING_STR;
case ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT:
return msg + ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT_STR;
case ServiceConstants.VEHICLE_STATUS_IN_USING:
return msg + ServiceConstants.VEHICLE_STATUS_IN_USING_STR;
case ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK:
@ -48,8 +46,6 @@ public class CommonUtil {
// return msg + ServiceConstants.VEHICLE_STATUS_IN_REPAIR_STR;
case ServiceConstants.VEHICLE_STATUS_IN_OFFLINE:
return msg + ServiceConstants.VEHICLE_STATUS_IN_CHANGING_STR;
case ServiceConstants.VEHICLE_STATUS_ABANDON:
return msg + ServiceConstants.VEHICLE_STATUS_ABANDON_STR;
default:
// 处理未知或新增的状态
return "Unknown vehicle status: " + status;

View File

@ -365,7 +365,7 @@ public class SysLoginService
rlUserWithdraw.setWithdrawHandlingCharge(channelWithdrawVO.getWithdrawHandlingCharge());
rlUserWithdraw.setUserId(rlUserExt.getUserId());
rlUserWithdraw.setChannelId(channelWithdrawVO.getChannelId());
rlUserWithdraw.setIsOpen("1");
rlUserWithdraw.setIsOpen(true);
rlUserWithdraw.setMaxAmount(channelWithdrawVO.getMaxAmount());
rlUserWithdraw.setMinAmount(channelWithdrawVO.getMinAmount());
rlUserWithdraw.setName(channelWithdrawVO.getName());
@ -456,6 +456,10 @@ public class SysLoginService
asUser.setAppletType(appletType);
log.info("【微信登录/wxlogin】用户不存在自动注册用户【{}】", JSON.toJSON(asUser));
int i = userService.insertUser(asUser);
if(i>0 && ServiceConstants.APPLET_TYPE_MERCHANT.equals(appletType)){
/** 创建用户扩展表内容,默认的用户角色是00未分配*/
int i1= insertUserExt(asUser);
}
user = asUser;
}else{
user.setLoginIp(IpUtils.getIpAddr());

View File

@ -0,0 +1,65 @@
package com.ruoyi.system.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 定位日志对象 et_location_log
*
* @author ruoyi
* @date 2024-08-20
*/
@Data
public class RlLocationLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 定位id */
private Long locationId;
/** mac */
@Excel(name = "mac")
private String mac;
/** onenet接收到的消息 */
@Excel(name = "onenet接收到的消息")
private String onenetMsg;
/** 经度 */
@Excel(name = "经度")
private String longitude;
/** 纬度 */
@Excel(name = "纬度")
private String latitude;
@Excel(name = "onenet消息时间")
private Date at;
/** 车辆状态 */
@Excel(name = "车辆状态")
private String status;
/** 锁状态 */
@Excel(name = "锁状态")
private String lockStatus;
@Excel(name = "电动车状态")
private Integer status2;//电动车状态 0断电1上电运行 2轮动抱死 3超出区域断电远程下发了qlose 解析参数
@Excel(name = "电池电压")
private Integer bat;//电池电压 "bat":571 ==> 57.1V
@Excel(name = "信号强度")
private Integer csq;//信号强度
@Excel(name = "卫星数量")
private Integer s;//卫星数量
@Excel(name = "钥匙")
private Integer q;//钥匙
}

View File

@ -62,6 +62,10 @@ public class RlChangeBalance extends BaseEntity implements ChangeBalanceInterfac
@Excel(name = "手机号")
private String ownerPhone;
/** 所属人类型00系统用户,01普通用户,02代理商,03商户04配送员 */
@Excel(name = "所属人类型00系统用户,01普通用户,02代理商,03商户04配送员")
private String ownerType;
/** 变动原因 */
@Excel(name = "变动原因")
private String reason;

View File

@ -55,6 +55,6 @@ public class ChannelWithdraw extends BaseEntity
/** 是否需要上传收款码0-不需要1-需要 */
@Excel(name = "是否需要上传收款码")
private String isNeedCode;
private Boolean isNeedCode;
}

View File

@ -128,12 +128,15 @@ public class RlDevice extends BaseEntityPlus implements Serializable {
private Long hardwareVersionId;
/** 设备版本 */
@Excel(name = "设备版本")
private String version;
/** 车牌号 */
@Excel(name = "车牌号")
private String vehicleNum;
/** 信号强度 */
@Excel(name = "信号强度")
private Integer signalStrength;
/** 质量*/
@ -145,4 +148,12 @@ public class RlDevice extends BaseEntityPlus implements Serializable {
/** 是否是管理员开锁0-否1-是(用于控制运营区外是否断电判断) */
private String isAdminUnlocking;
/** 商户id */
@Excel(name = "商户id")
private Long merchantId;
/** 代理商 */
@Excel(name = "代理商")
private Long agentId;
}

View File

@ -52,7 +52,7 @@ public class RlUserWithdraw extends BaseEntity
/** 是否开通 */
@Excel(name = "是否开通")
private String isOpen;
private Boolean isOpen;
/** 渠道图片 */
@Excel(name = "渠道图片")
@ -64,6 +64,6 @@ public class RlUserWithdraw extends BaseEntity
/** 是否需要上传收款码0-不需要1-需要 */
@Excel(name = "是否需要上传收款码")
private String isNeedCode;
private Boolean isNeedCode;
}

View File

@ -17,6 +17,9 @@ public class IndexAdminVo {
/** 收入统计list */
private List<IncomeVo> incomeVoList;
/** 车辆统计 */
private DeviceVO deviceVO;
/**
* 7日营收
*/
@ -30,6 +33,16 @@ public class IndexAdminVo {
private Integer orderNum;
}
@Data
public static class DeviceVO {
/** 车辆总数 */
private Integer total;
/** 空闲中 */
private Integer idle;
/** 出租中 */
private Integer rent;
}
/** 今日营收 */
private BigDecimal todayIncome;

View File

@ -55,7 +55,7 @@ public interface RlDeviceMapper extends BaseMapper<RlDevice>
* @param RlDevice 设备
* @return 设备集合
*/
public List<RlDevice> selectDeviceListWithIsolate(RlDevice RlDevice);
public List<RlDeviceVO> selectDeviceListWithIsolate(RlDevice RlDevice);
/**
* 新增设备
@ -156,4 +156,9 @@ public interface RlDeviceMapper extends BaseMapper<RlDevice>
* 根据店铺id查询所有车辆数
*/
Integer selectAllDeviceCountByStoreId(Long storeId);
/**
* 获取到该代理商下所有的车辆数
*/
Integer getTatalDeviceCount(@Param("agentId")Long agentId,@Param("merchantId") Long merchantId, @Param("status")String status,@Param("statusList")String[] statusList);
}

View File

@ -0,0 +1,86 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.RlLocationLog;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 定位日志Mapper接口
*
* @author ruoyi
* @date 2024-08-20
*/
public interface RlLocationLogMapper
{
/**
* 查询定位日志
*
* @param locationId 定位日志主键
* @return 定位日志
*/
public RlLocationLog selectEtLocationLogByLocationId(Long locationId);
/**
* 查询定位日志列表
*
* @param rlLocationLog 定位日志
* @return 定位日志集合
*/
public List<RlLocationLog> selectEtLocationLogList(RlLocationLog rlLocationLog);
/**
* 查询定位日志列表
*
* @param mac
* @return 定位日志集合
*/
public List<RlLocationLog> selectEtLocationLogListByCreateTime(@Param("mac") String mac, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 新增定位日志
*
* @param rlLocationLog 定位日志
* @return 结果
*/
public int insertEtLocationLog(RlLocationLog rlLocationLog);
/**
* 修改定位日志
*
* @param rlLocationLog 定位日志
* @return 结果
*/
public int updateEtLocationLog(RlLocationLog rlLocationLog);
/**
* 删除定位日志
*
* @param locationId 定位日志主键
* @return 结果
*/
public int deleteEtLocationLogByLocationId(Long locationId);
/**
* 批量删除定位日志
*
* @param locationIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteEtLocationLogByLocationIds(Long[] locationIds);
/**
* 删除7天之前的定位日志
*
* @return 结果
*/
int deleteLocationLogByCreateTime();
/**
* 获取最后一条消息
*
* @return 结果
*/
String getLastMsg(String mac);
}

View File

@ -5,6 +5,7 @@ import com.ruoyi.system.domain.order.RlOrderQuery;
import com.ruoyi.system.domain.order.RlOrderVO;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@ -101,6 +102,16 @@ public interface RlOrderMapper
*/
List<RlOrderVO> getInProgressOrder(String sn);
/**
* 订单金额
*/
BigDecimal getOrderFee(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr ,@Param("agentId") Long agentId,@Param("merchantId") Long merchantId);
/**
* 订单数量
*/
Integer getOrderNum(@Param("startDateStr") String startDateStr , @Param("endDateStr") String endDateStr ,@Param("agentId") Long agentId,@Param("merchantId") Long merchantId);
// /**
// * 扫码绑定车辆
// */

View File

@ -205,4 +205,9 @@ public interface RlUserMapper
* 获取今日订单金额
*/
BigDecimal selectTodayOrderAmount(Long userId);
/**
* 获取app用户列表
*/
List<RlUserVO> selectAppUserList(RlUserQuery user);
}

View File

@ -83,7 +83,8 @@ public interface IRlChangeBalanceService
* @param userId 用户id
* @param userName 用户名称
* @param phone 用户电话
* @param userType 用户类型
* @return 结果
*/
public int generateChanggeBalance(String orderNo, String outTradeNo, String type, String busType, BigDecimal payFee, Long userId, String userName, String phone);
public int generateChanggeBalance(String orderNo, String outTradeNo, String type, String busType, BigDecimal payFee, Long userId, String userName, String phone,String userType);
}

View File

@ -68,7 +68,7 @@ public interface IRlDeviceService extends IService<RlDevice>
* @param device 设备
* @return 设备集合
*/
public List<RlDevice> selectDeviceListWithIsolate(RlDevice device);
public List<RlDeviceVO> selectDeviceListWithIsolate(RlDevice device);
/**
* 新增设备
@ -405,4 +405,7 @@ public interface IRlDeviceService extends IService<RlDevice>
/** 计算逾期费用 */
public BigDecimal computeOverdueFee(RlOrderVO order, RlOrder updateOrder);
/** 获取到该代理商下所有的车辆数 */
Integer getTatalDeviceCount(Long agentId,Long merchantId, String status,String[] statusList);
}

View File

@ -0,0 +1,70 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.RlLocationLog;
import java.util.List;
/**
* 定位日志Service接口
*
* @author ruoyi
* @date 2024-08-20
*/
public interface IRlLocationLogService
{
/**
* 查询定位日志
*
* @param locationId 定位日志主键
* @return 定位日志
*/
public RlLocationLog selectEtLocationLogByLocationId(Long locationId);
/**
* 查询定位日志列表
*
* @param rlLocationLog 定位日志
* @return 定位日志集合
*/
public List<RlLocationLog> selectEtLocationLogList(RlLocationLog rlLocationLog);
/**
* 新增定位日志
*
* @param rlLocationLog 定位日志
* @return 结果
*/
public int insertEtLocationLog(RlLocationLog rlLocationLog);
/**
* 修改定位日志
*
* @param rlLocationLog 定位日志
* @return 结果
*/
public int updateEtLocationLog(RlLocationLog rlLocationLog);
/**
* 批量删除定位日志
*
* @param locationIds 需要删除的定位日志主键集合
* @return 结果
*/
public int deleteEtLocationLogByLocationIds(Long[] locationIds);
/**
* 删除定位日志信息
*
* @param locationId 定位日志主键
* @return 结果
*/
public int deleteEtLocationLogByLocationId(Long locationId);
/**
* 解析参数
*
* @param list
* @return 结果
*/
public List<RlLocationLog> analytic(List<RlLocationLog> list);
}

View File

@ -139,10 +139,15 @@ public interface IRlOrderService
*/
Boolean deductMoney(BigDecimal money, String orderNo);
// /**
// * 押金退款
// */
// Boolean depositRefund(String orderNo);
/**
* 押金退款
* 商家还车
*/
Boolean depositRefund(String orderNo);
Boolean merchantReturn(String orderNo);
/**
* 订单退款
@ -182,5 +187,5 @@ public interface IRlOrderService
/**
* app首页统计
*/
IndexAdminVo indexStatistics(Long userId);
IndexAdminVo indexStatistics(String startTime,String endTime,Long userId);
}

View File

@ -27,6 +27,15 @@ public interface IRlUserService
*/
public List<RlUserVO> selectUserList(RlUserQuery user);
/**
* 获取app用户列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<RlUserVO> selectAppUserList(RlUserQuery user);
/**
* 根据条件分页查询已分配用户角色列表
*
@ -57,7 +66,7 @@ public interface IRlUserService
* @param userId 用户ID
* @return 用户对象信息
*/
public RlUser selectUserById(Long userId);
public RlUserVO selectUserById(Long userId);
/**
* 通过用户ID查询账户

View File

@ -206,7 +206,7 @@ public class CallbackServiceImpl implements CallbackService {
}
// 用户生成账变
int i = changeBalanceService.generateChanggeBalance(originalOrder.getOrderNo(), originalOrder.getOutTradeNo(), ServiceConstants.FLOW_TYPE_INCOME,
busType, dividendDetail.getDividendAmount(), dividendDetail.getPartnerId(), dividendDetail.getPartnerName(), dividendDetail.getPartnerPhone());
busType, dividendDetail.getDividendAmount(), dividendDetail.getPartnerId(), dividendDetail.getPartnerName(), dividendDetail.getPartnerPhone(),dividendDetail.getPartnerType());
if(i==0){
throw new ServiceException("【微信支付回调】用户【"+dividendDetail.getPartnerName()+"】生成账变失败");
}

View File

@ -130,10 +130,11 @@ public class RlChangeBalanceServiceImpl implements IRlChangeBalanceService
* @param userId 用户id
* @param userName 用户名称
* @param phone 用户电话
* @param userType 用户类型
* @return 结果
*/
@Override
public int generateChanggeBalance(String orderNo,String outTradeNo,String type,String busType,BigDecimal payFee,Long userId,String userName,String phone) {
public int generateChanggeBalance(String orderNo,String outTradeNo,String type,String busType,BigDecimal payFee,Long userId,String userName,String phone,String userType) {
RlChangeBalance rlChangeBalance = new RlChangeBalance();
rlChangeBalance.setOrderNo(orderNo);
rlChangeBalance.setOutTradeNo(outTradeNo);
@ -149,6 +150,7 @@ public class RlChangeBalanceServiceImpl implements IRlChangeBalanceService
rlChangeBalance.setAmount(payFee);
rlChangeBalance.setOwnerId(userId);
rlChangeBalance.setOwnerName(userName);
rlChangeBalance.setOwnerType(userType);
rlChangeBalance.setOwnerPhone(phone);
rlChangeBalance.setCreateTime(DateUtils.getNowDate());
// 根据 busType 生成不同的 reason 描述

View File

@ -265,12 +265,12 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
*/
@Override
@DataScope(deptAlias = "d")
public List<RlDevice> selectDeviceListWithIsolate(RlDevice asDevice)
public List<RlDeviceVO> selectDeviceListWithIsolate(RlDevice asDevice)
{
if(ServiceConstants.VEHICLE_STATUS_NOT_BAND.equals(asDevice.getStatus())){
asDevice.setStatus(null);
}
List<RlDevice> asDevices = deviceMapper.selectDeviceListWithIsolate(asDevice);
List<RlDeviceVO> asDevices = deviceMapper.selectDeviceListWithIsolate(asDevice);
// for (EDevice asDevice1:asDevices){
// Long areaId = asDevice1.getAreaId();
// if (ObjectUtil.isNotNull(areaId) && areaId!=0){
@ -319,9 +319,21 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
public int insertDevice(RlDevice asDevice)
{
asDevice.setCreateTime(DateUtils.getNowDate());
setAgentAndMerchant(asDevice);
return deviceMapper.insertDevice(asDevice);
}
private void setAgentAndMerchant(RlDevice asDevice) {
if(asDevice.getStoreId() != null){
Long storeId = asDevice.getStoreId();
StoreVo storeVo = storeService.selectSmStoreById(storeId);
if(ObjectUtil.isNotNull(storeVo)){
asDevice.setMerchantId(storeVo.getMerchantId());
asDevice.setAgentId(storeVo.getAgentId());
}
}
}
/**
* 修改设备
*
@ -332,6 +344,7 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
public int updateDevice(RlDevice asDevice)
{
asDevice.setUpdateTime(DateUtils.getNowDate());
setAgentAndMerchant(asDevice);
int i = deviceMapper.updateDevice(asDevice);
return i;
}
@ -856,9 +869,6 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
@Override
public Boolean offline(String sn,String status) {
RlDevice rlDevice = deviceMapper.selectDeviceBySn(sn);
if(ServiceConstants.VEHICLE_STATUS_IN_APPOINTMENT.equals(rlDevice.getStatus())){
throw new ServiceException("车辆处于预约中,不能下线");
}
if(ServiceConstants.VEHICLE_STATUS_IN_USING.equals(rlDevice.getStatus())){
throw new ServiceException("车辆使用中,不能下线");
}
@ -1590,6 +1600,12 @@ public class RlDeviceServiceImpl extends ServiceImpl<RlDeviceMapper, RlDevice> i
updateOrder.setOverdueFee(overdueFee);
return overdueFee;
}
/** 获取到该代理商下所有的车辆数 */
@Override
public Integer getTatalDeviceCount(Long agentId,Long merchantId,String status,String[] statusList) {
return deviceMapper.getTatalDeviceCount(agentId,merchantId,status,statusList);
}
//
// /** 押金抵扣 */
// private void depositDeduction(EtOrder order) {

View File

@ -0,0 +1,145 @@
package com.ruoyi.system.service.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.RlLocationLog;
import com.ruoyi.system.mapper.RlLocationLogMapper;
import com.ruoyi.system.service.IRlLocationLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 定位日志Service业务层处理
*
* @author ruoyi
* @date 2024-08-20
*/
@Service
public class RlLocationLogServiceImpl implements IRlLocationLogService
{
@Resource
private RlLocationLogMapper rlLocationLogMapper;
/**
* 查询定位日志
*
* @param locationId 定位日志主键
* @return 定位日志
*/
@Override
public RlLocationLog selectEtLocationLogByLocationId(Long locationId)
{
return rlLocationLogMapper.selectEtLocationLogByLocationId(locationId);
}
/**
* 查询定位日志列表
*
* @param rlLocationLog 定位日志
* @return 定位日志
*/
@Override
public List<RlLocationLog> selectEtLocationLogList(RlLocationLog rlLocationLog)
{
return rlLocationLogMapper.selectEtLocationLogList(rlLocationLog);
}
/**
* 新增定位日志
*
* @param rlLocationLog 定位日志
* @return 结果
*/
@Override
public int insertEtLocationLog(RlLocationLog rlLocationLog)
{
rlLocationLog.setCreateTime(DateUtils.getNowDate());
return rlLocationLogMapper.insertEtLocationLog(rlLocationLog);
}
/**
* 修改定位日志
*
* @param rlLocationLog 定位日志
* @return 结果
*/
@Override
public int updateEtLocationLog(RlLocationLog rlLocationLog)
{
return rlLocationLogMapper.updateEtLocationLog(rlLocationLog);
}
/**
* 批量删除定位日志
*
* @param locationIds 需要删除的定位日志主键
* @return 结果
*/
@Override
public int deleteEtLocationLogByLocationIds(Long[] locationIds)
{
return rlLocationLogMapper.deleteEtLocationLogByLocationIds(locationIds);
}
/**
* 删除定位日志信息
*
* @param locationId 定位日志主键
* @return 结果
*/
@Override
public int deleteEtLocationLogByLocationId(Long locationId)
{
return rlLocationLogMapper.deleteEtLocationLogByLocationId(locationId);
}
/**
* 解析参数
*
* @param list
* @return 结果
*/
@Override
public List<RlLocationLog> analytic(List<RlLocationLog> list) {
// 创建 ObjectMapper 实例用于解析 JSON
ObjectMapper objectMapper = new ObjectMapper();
for (RlLocationLog log : list) {
try {
// 解析 onenetMsg 字段中的 JSON 字符串
JsonNode rootNode = objectMapper.readTree(log.getOnenetMsg());
JsonNode valueNode = rootNode.path("value");
// 提取各个字段的值并填充到 EtLocationLog 对象中
if (valueNode.has("status")) {
log.setStatus2(valueNode.get("status").asInt());
}
if (valueNode.has("bat")) {
// 电池电压例如 bat: 511 表示 51.1V
log.setBat(valueNode.get("bat").asInt());
}
if (valueNode.has("csq")) {
// 信号强度
log.setCsq(valueNode.get("csq").asInt());
}
if (valueNode.has("s")) {
// 卫星数量
log.setS(valueNode.get("s").asInt());
}
if (valueNode.has("q")) {
// 钥匙状态
log.setQ(valueNode.get("q").asInt());
}
} catch (Exception e) {
// 捕获并打印解析异常信息
e.printStackTrace();
}
}
return list;
}
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.core.domain.entity.RlUser;
@ -36,6 +37,7 @@ import com.ruoyi.system.mapper.RlOrderMapper;
import com.ruoyi.system.service.*;
import com.ruoyi.system.service.store.RlStoreService;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import org.apache.ibatis.annotations.Param;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -47,6 +49,9 @@ import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
/**
@ -168,6 +173,9 @@ public class RlOrderServiceImpl implements IRlOrderService
public RlOrderVO getOrderInfoByOrderNo(String orderNo)
{
RlOrderVO order = orderMapper.selectRlOrderByOrderNo(orderNo);
if(ObjectUtil.isNull(order)){
throw new ServiceException("订单不存在");
}
if(order.getModelId() == null){
throw new ServiceException("订单中没有车型id");
}
@ -191,7 +199,7 @@ public class RlOrderServiceImpl implements IRlOrderService
/** 操作记录*/
RlOrderOper orderOper = new RlOrderOper();
orderOper.setOrderNo(orderNo);
List<RlOrderOper> rlOrderOpers = rlOrderOperService.selectRlOrderOperList(new RlOrderOper());
List<RlOrderOper> rlOrderOpers = rlOrderOperService.selectRlOrderOperList(orderOper);
order.setOrderOpers(rlOrderOpers);
/** 收益明细*/
RlDividendDetail rlDividendDetail = new RlDividendDetail();
@ -572,10 +580,11 @@ public class RlOrderServiceImpl implements IRlOrderService
}
/**
* 押金退款
* 商家还车
*
*/
@Override
public Boolean depositRefund(String orderNo) {
public Boolean merchantReturn(String orderNo) {
RlOrderVO order = orderMapper.selectRlOrderByOrderNo(orderNo);
if(ObjectUtil.isNull(order)){
throw new ServiceException("订单不存在");
@ -584,29 +593,54 @@ public class RlOrderServiceImpl implements IRlOrderService
BigDecimal overdueFee = order.getOverdueFee();
BigDecimal deductionAmount = order.getDeductionAmount();
BigDecimal remainingDeposit = deposit.subtract(overdueFee).subtract(deductionAmount);
if(remainingDeposit.compareTo(BigDecimal.ZERO) <= 0){
return true;
}
if(!ServiceConstants.ORDER_PAY_STATUS_PAID.equals(order.getPaid())){
throw new ServiceException("订单未支付,不能退款", HttpStatus.ERROR);
throw new ServiceException("订单未支付,不能还车", HttpStatus.ERROR);
}
if(!ServiceConstants.ORDER_STATUS_ORDER_END.equals(order.getStatus())){
throw new ServiceException("订单状态异常,不能退款", HttpStatus.ERROR);
if(!(ServiceConstants.ORDER_STATUS_TO_BE_AUDITED.equals(order.getStatus()) || ServiceConstants.ORDER_STATUS_IN_USE.equals(order.getStatus()))){
throw new ServiceException("订单非待审核或骑行中状态,不能还车", HttpStatus.ERROR);
}
// /** 更新订单信息*/
// RlOrder updateOrder = new RlOrder();
// updateOrder.setOrderNo(orderNo);
// updateOrder.setRefundAmount(remainingDeposit);
// updateOrder.setStatus(ServiceConstants.ORDER_STATUS_REFUND);
// int i = orderMapper.updateRlOrderByOrderNo(updateOrder);
/** 记录订单履历*/
if(!orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_RETURN_END,
order.getStatus(),order.getStatus(),order.getPayFee(),order.getPayFee(),order.getUserId(),order.getPhone(),"已退款:-"+remainingDeposit+"")){
throw new ServiceException("【记录订单履历失败】");
Boolean execute = transactionTemplate.execute(e -> {
/** 1.更新订单信息*/
updateOrderStatus(orderNo);
/** 2.更新车辆状态*/
updateDeviceInfo(order.getSn());
/** 3.记录订单履历*/
if(!orderOperService.recordOrderHistory(orderNo,ServiceConstants.ORDER_OPERATION_RETURN_END,
order.getStatus(),order.getStatus(),order.getPayFee(),order.getPayFee(),order.getUserId(),order.getPhone(),"已退款:-"+remainingDeposit+"")){
throw new ServiceException("【记录订单履历失败】");
}
return Boolean.TRUE;
});
if(!execute)throw new ServiceException("商家还车失败");
if(remainingDeposit.compareTo(BigDecimal.ZERO) > 0){
/** 4.执行退还剩余押金操作*/
logger.info("【商家还车】退还剩余押金:"+remainingDeposit);
wxPayService.refund(order, "审核后退押金",remainingDeposit,order.getOutTradeNo());
}
return true;
}
private void updateOrderStatus(String orderNo) {
RlOrder updateOrder = new RlOrder();
updateOrder.setOrderNo(orderNo);
updateOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
int i = orderMapper.updateRlOrderByOrderNo(updateOrder);
if(i==0){
logger.info("【商家还车】更新订单信息失败");
throw new ServiceException("【商家还车】更新订单信息失败");
}
}
private void updateDeviceInfo(String sn) {
RlDevice updateDevice = new RlDevice();
updateDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);
updateDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
updateDevice.setSn(sn);
int deviceUpdate = deviceService.updateDeviceBySn(updateDevice);
if(deviceUpdate==0){
logger.info("【商家还车】更新车辆状态失败");
throw new ServiceException("【商家还车】更新车辆状态失败");
}
// 执行退还剩余押金操作
wxPayService.refund(order, "审核后退押金",remainingDeposit,order.getOutTradeNo());
return null;
}
/**
@ -691,7 +725,7 @@ public class RlOrderServiceImpl implements IRlOrderService
}
/** 4.2 新增账变 */
int i = changeBalanceService.generateChanggeBalance(rlOrderVO.getOrderNo(), rlOrderVO.getOutTradeNo(), ServiceConstants.FLOW_TYPE_DISBURSE,
ServiceConstants.ORDER_REFUND, userRefundAmount, rlUserExt.getUserId(), user.getUserName(), user.getPhonenumber());
ServiceConstants.ORDER_REFUND, userRefundAmount, rlUserExt.getUserId(), user.getUserName(), user.getPhonenumber(),user.getUserType());
if(i<=0)throw new ServiceException("用户【"+user.getPhonenumber()+"】新增账变失败");
/** todo 4.3 更新分成表中的退款金额 */
int i1 = rlDividendDetailService.updateRefundAmount(detail.getId(), userRefundAmount);
@ -826,22 +860,73 @@ public class RlOrderServiceImpl implements IRlOrderService
* 首页统计
*/
@Override
public IndexAdminVo indexStatistics(Long userId) {
IndexAdminVo indexAdminVo = new IndexAdminVo();
ArrayList<IndexAdminVo.IncomeVo> incomeVos = new ArrayList<>();
for (int i = 1; i < 7; i++) {
IndexAdminVo.IncomeVo orderFee = new IndexAdminVo.IncomeVo();
orderFee.setDay("2024-10-0"+i);
orderFee.setOrderFee(BigDecimal.valueOf(i*100));
orderFee.setOrderNum(i*10);
incomeVos.add(orderFee);
public IndexAdminVo indexStatistics(String startTime,String endTime,Long userId) {
// 定义统一的日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 根据用户id查询代理商根据代理商做数据权限隔离
RlUser rlUser = userService.selectUserById(userId);
Long agentId = null;
Long merchantId = null;
if(ServiceConstants.USER_TYPE_MERCHANT.equals(rlUser.getUserType())){
merchantId = userId;
return getIndexAdminVoByAgentId(startTime, endTime, formatter, agentId,merchantId);
}else if(ServiceConstants.USER_TYPE_AGENT.equals(rlUser.getUserType())){
RlAgentVO agentVO = agentService.selectRlAgentByUserId(userId);
agentId = agentVO.getAgentId();
return getIndexAdminVoByAgentId(startTime, endTime, formatter, agentId,merchantId);
}else{
throw new ServiceException("用户类型错误:非商户或代理商");
}
indexAdminVo.setIncomeVoList(incomeVos);
indexAdminVo.setTodayOrderNum(new BigDecimal(10));
indexAdminVo.setTodayIncome(new BigDecimal(100));
indexAdminVo.setComparedYesterdayIncome(new BigDecimal(5));
indexAdminVo.setComparedYesterdayOrderNum(new BigDecimal(5));
return indexAdminVo;
}
@NotNull
private IndexAdminVo getIndexAdminVoByAgentId(String startTime, String endTime, DateTimeFormatter formatter, Long agentId,Long merchantId) {
// 校验输入时间格式并判断时间区间是否超过15天
if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)) {
// 使用LocalDate统一日期处理
LocalDate startDate = LocalDate.parse(startTime, formatter);
LocalDate endDate = LocalDate.parse(endTime, formatter);
// 计算两者之间的天数差异
long daysBetween = ChronoUnit.DAYS.between(startDate, endDate);
if (daysBetween > 15) {
throw new ServiceException("时间范围不能超过15天");
}
// 创建结果对象
IndexAdminVo indexAdminVo = new IndexAdminVo();
ArrayList<IndexAdminVo.IncomeVo> incomeVos = new ArrayList<>();
// 遍历从 startDate endDate 的每一天生成订单数据
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
IndexAdminVo.IncomeVo orderFee = new IndexAdminVo.IncomeVo();
String day = date.format(formatter);
String startDateStr = day + " "+ Constants.DATE_FORMAT_START_PEREND;
String endDateStr = day + " " +Constants.DATE_FORMAT_END_PEREND;
orderFee.setDay(day); // 设置每一天的日期
BigDecimal orderFee1 = orderMapper.getOrderFee(startDateStr, endDateStr, agentId,merchantId);//订单金额
orderFee.setOrderFee(orderFee1);
orderFee.setOrderNum(orderMapper.getOrderNum(startDateStr, endDateStr, agentId,merchantId));//订单数量
incomeVos.add(orderFee);
}
// 设置收入数据
indexAdminVo.setIncomeVoList(incomeVos);
indexAdminVo.setTodayOrderNum(new BigDecimal(10));
indexAdminVo.setTodayIncome(new BigDecimal(100));
indexAdminVo.setComparedYesterdayIncome(new BigDecimal(5));
indexAdminVo.setComparedYesterdayOrderNum(new BigDecimal(5));
// 设置车辆统计数据
IndexAdminVo.DeviceVO deviceVO = new IndexAdminVo.DeviceVO();
deviceVO.setTotal(deviceService.getTatalDeviceCount(agentId, merchantId,null,null));
deviceVO.setIdle(deviceService.getTatalDeviceCount(agentId, merchantId,ServiceConstants.VEHICLE_STATUS_NORMAL,null));
String[] statusList = new String[] { ServiceConstants.VEHICLE_STATUS_IN_USING,ServiceConstants.VEHICLE_STATUS_TEMPORARILY_LOCK };
deviceVO.setRent(deviceService.getTatalDeviceCount(agentId, merchantId,null,statusList));
indexAdminVo.setDeviceVO(deviceVO);
return indexAdminVo;
}
throw new ServiceException("开始时间和结束时间不能为空");
}
private BigDecimal deposit(Long modelId, PriceVO priceVO) {

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
@ -13,6 +14,7 @@ import com.ruoyi.common.core.domain.entity.RlUser;
import com.ruoyi.common.core.domain.entity.RlUserVO;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.common.utils.verify.VerifyIdentityUtil;
import com.ruoyi.system.domain.RlMsgLog;
@ -144,6 +146,18 @@ public class RlUserServiceImpl implements IRlUserService{
return users;
}
/**
* 获取app用户列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<RlUserVO> selectAppUserList(RlUserQuery user) {
List<RlUserVO> users = rlUserMapper.selectAppUserList(user);
return users;
}
/**
* 根据条件分页查询已分配用户角色列表
*
@ -313,6 +327,12 @@ public class RlUserServiceImpl implements IRlUserService{
@Transactional
public int updateUser(RlUser user)
{
// 删除用户与角色关联
if (StringUtils.isNotEmpty(user.getRoleIds())){
userRoleMapper.deleteUserRoleByUserId(user.getUserId());
// 新增用户与角色管理
insertUserRole(user.getUserId(),user.getRoleIds());
}
return rlUserMapper.updateUser(user);
}
@ -623,7 +643,16 @@ public class RlUserServiceImpl implements IRlUserService{
@Override
public void checkUserDataScope(Long userId) {
if (!RlUser.isAdmin(SecurityUtils.getUserId()))
{
RlUserQuery user = new RlUserQuery();
user.setUserId(userId);
List<RlUserVO> users = SpringUtils.getAopProxy(this).selectUserList(user);
if (StringUtils.isEmpty(users))
{
throw new ServiceException("没有权限访问用户数据!");
}
}
}
@Override
@ -691,12 +720,24 @@ public class RlUserServiceImpl implements IRlUserService{
@Override
public void checkUserAllowed(RlUser user) {
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
{
throw new ServiceException("不允许操作超级管理员用户");
}
}
@Override
public int deleteUserByIds(Long[] userIds) {
return 0;
for (Long userId : userIds)
{
checkUserAllowed(new RlUser(userId));
checkUserDataScope(userId);
}
// 删除用户与角色关联
userRoleMapper.deleteUserRole(userIds);
// 删除用户与岗位关联
userPostMapper.deleteUserPost(userIds);
return rlUserMapper.deleteUserByIds(userIds);
}
@Override
@ -756,7 +797,7 @@ public class RlUserServiceImpl implements IRlUserService{
withdrawalRecord(withdraw, orderNo, user);
/** 3. 扣余额,记录账变 */
int i = changeBalanceService.generateChanggeBalance(orderNo, null, ServiceConstants.FLOW_TYPE_DISBURSE,
ServiceConstants.WITHDRAWAL, withdraw.getAmount(), user.getUserId(), user.getUserName(), user.getPhonenumber());
ServiceConstants.WITHDRAWAL, withdraw.getAmount(), user.getUserId(), user.getUserName(), user.getPhonenumber(),user.getUserType());
if(i<=0)throw new ServiceException("【提现】记录账变失败");
// 发短信通知转账人
asynchronousMsg(user.getUserName());

View File

@ -319,7 +319,7 @@ public class WxPayService implements IWxPayService {
*/
@Override
public void refund(RlOrder etOrder,String reason,BigDecimal amount,String outRefundNo) {
if(!etOrder.getStatus().equals(ServiceConstants.ORDER_STATUS_ORDER_END)) throw new ServiceException("订单状态异常");
if(!etOrder.getPaid().equals(ServiceConstants.ORDER_PAY_STATUS_PAID)) throw new ServiceException("订单状态异常");
ChannelVO channelVO = etChannelService.selectSmChannelByChannelId(etOrder.getPayChannel());
if (channelVO == null) {
throw new ServiceException("支付渠道不存在: " + etOrder.getPayChannel());

View File

@ -53,9 +53,9 @@ public class StoreValidatorImpl extends BaseValidator implements StoreValidator
// }
// 判断是否正在审核中
if (this.hasApproving(ids)) {
return error("当前有店铺正在审核中,请稍后重试");
}
// if (this.hasApproving(ids)) {
// return error("当前有店铺正在审核中,请稍后重试");
// }
return success();
}

View File

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RlChangeBalanceVO" id="RlChangeBalanceResult" autoMapping="true"/>
<sql id="selectRlChangeBalanceVo">
select change_id, order_no, out_trade_no, type, bus_type, before_balance, after_balance, amount, owner_name, owner_id, owner_phone, create_time, reason from rl_change_balance
select change_id, order_no, out_trade_no, type, bus_type, before_balance, after_balance, amount, owner_name, owner_id, owner_phone, owner_type, create_time, reason from rl_change_balance
</sql>
<select id="selectRlChangeBalanceList" parameterType="RlChangeBalance" resultMap="RlChangeBalanceResult">
@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null and ownerName != ''"> and owner_name like concat('%', #{ownerName}, '%')</if>
<if test="ownerId != null "> and owner_id = #{ownerId}</if>
<if test="ownerPhone != null and ownerPhone != ''"> and owner_phone = #{ownerPhone}</if>
<if test="ownerType != null and ownerType != ''"> and owner_type = #{ownerType}</if>
<if test="reason != null and reason != ''"> and reason = #{reason}</if>
</where>
order by create_time desc
@ -46,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null">owner_name,</if>
<if test="ownerId != null">owner_id,</if>
<if test="ownerPhone != null">owner_phone,</if>
<if test="ownerType != null">owner_type,</if>
<if test="createTime != null">create_time,</if>
<if test="reason != null">reason,</if>
</trim>
@ -60,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null">#{ownerName},</if>
<if test="ownerId != null">#{ownerId},</if>
<if test="ownerPhone != null">#{ownerPhone},</if>
<if test="ownerType != null">#{ownerType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="reason != null">#{reason},</if>
</trim>
@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownerName != null">owner_name = #{ownerName},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if>
<if test="ownerPhone != null">owner_phone = #{ownerPhone},</if>
<if test="ownerType != null">owner_type = #{ownerType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="reason != null">reason = #{reason},</if>
</trim>

View File

@ -45,10 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeviceListWithIsolate" parameterType="RlDeviceQuery" resultMap="DeviceResult">
select de.device_id, de.picture, de.device_name, de.mac, de.sn, de.model_id, de.hardware_version_id, de.vehicle_num,
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,
de.activation_time, de.online_status, de.create_by, de.create_time, de.update_by,m.model,
de.update_time, de.last_time, de.last_location_time, de.gps, de.remark, de.status, de.lock_status, de.location,
de.remaining_power, de.voltage, de.version, de.qrcode, de.longitude, de.latitude, de.signal_strength, de.satellites, de.quality, de.is_admin_unlocking, de.store_id from rl_device de
left join rl_hardware_version hv on hv.id = de.hardware_version_id
left join rl_model m on m.model_id = de.model_id
where 1 = 1
<if test="deviceName != null and deviceName != ''"> and de.device_name like concat('%', #{deviceName}, '%')</if>
<if test="mac != null and mac != ''"> and de.mac like concat('%', #{mac}, '%')</if>
@ -107,6 +108,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storeId != null"> and store_id = #{storeId}</if>
</select>
<select id="getTatalDeviceCount" resultType="java.lang.Integer">
select count(1) from rl_device where 1=1
<if test="agentId != null"> and agent_id = #{agentId}</if>
<if test="merchantId != null"> and merchant_id = #{merchantId}</if>
<if test="status != null"> and status = #{status}</if>
<if test="statusList != null and statusList !=''">
AND status IN
<foreach item="item" index="index" collection="statusList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<insert id="insertDevice" parameterType="RlDeviceQuery" useGeneratedKeys="true" keyProperty="deviceId">
insert into rl_device
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -34,12 +34,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRlFeeRuleListByModelId" parameterType="Long" resultMap="RlFeeRuleResult">
<include refid="selectRlFeeRuleVo"/>
where model_id = #{modelId}
where mr.model_id = #{modelId}
</select>
<select id="selectRlFeeRuleByRuleId" parameterType="Long" resultMap="RlFeeRuleResult">
<include refid="selectRlFeeRuleVo"/>
where rule_id = #{ruleId}
where r.rule_id = #{ruleId}
GROUP BY rule_id
</select>
<select id="selectRlFeeRuleLongListByModelId" resultType="java.lang.Long">

View File

@ -0,0 +1,121 @@
<?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.RlLocationLogMapper">
<resultMap type="RlLocationLog" id="EtLocationLogResult">
<result property="locationId" column="location_id" />
<result property="mac" column="mac" />
<result property="onenetMsg" column="onenet_msg" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="createTime" column="create_time" />
<result property="at" column="at" />
<result property="status" column="status" />
<result property="lockStatus" column="lock_status" />
</resultMap>
<sql id="selectEtLocationLogVo">
select location_id, mac, onenet_msg, longitude, latitude, create_time, at, status, lock_status from rl_location_log
</sql>
<sql id="selectEtLocationLogVoNoMsg">
select location_id, mac, longitude, latitude, create_time, at, status, lock_status from rl_location_log
</sql>
<select id="selectEtLocationLogList" parameterType="RlLocationLog" resultMap="EtLocationLogResult">
<include refid="selectEtLocationLogVo"/>
<where>
<if test="mac != null and mac != ''"> and mac = #{mac}</if>
<if test="onenetMsg != null and onenetMsg != ''"> and onenet_msg = #{onenetMsg}</if>
<if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if>
<if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="lockStatus != null and lockStatus != ''"> and lock_status = #{lockStatus}</if>
</where>
order by create_time desc
</select>
<select id="selectEtLocationLogListByCreateTime" parameterType="RlLocationLog" resultMap="EtLocationLogResult">
<include refid="selectEtLocationLogVoNoMsg"/>
where longitude != '0E-8' and latitude != '0E-8'
<if test="mac != null and mac != ''"> and mac = #{mac}</if>
<if test="startTime != null and startTime != ''">
AND date_format(`AT`,'%Y%m%d%H%i%s') &gt;= date_format(#{startTime},'%Y%m%d%H%i%s')
</if>
<if test="endTime != null and endTime != ''">
AND date_format(`AT`,'%Y%m%d%H%i%s') &lt;= date_format(#{endTime},'%Y%m%d%H%i%s')
</if>
order by `AT`
</select>
<select id="selectEtLocationLogByLocationId" parameterType="Long" resultMap="EtLocationLogResult">
<include refid="selectEtLocationLogVo"/>
where location_id = #{locationId}
</select>
<select id="getLastMsg" resultType="java.lang.String">
SELECT onenet_msg
FROM rl_location_log
WHERE mac = #{mac}
ORDER BY create_time DESC
LIMIT 1
</select>
<insert id="insertEtLocationLog" parameterType="RlLocationLog" useGeneratedKeys="true" keyProperty="locationId">
insert into rl_location_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mac != null">mac,</if>
<if test="onenetMsg != null">onenet_msg,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="createTime != null">create_time,</if>
<if test="at != null">at,</if>
<if test="status != null">status,</if>
<if test="lockStatus != null">lock_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mac != null">#{mac},</if>
<if test="onenetMsg != null">#{onenetMsg},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="createTime != null">#{createTime},</if>
<if test="at != null">#{at},</if>
<if test="status != null">#{status},</if>
<if test="lockStatus != null">#{lockStatus},</if>
</trim>
</insert>
<update id="updateEtLocationLog" parameterType="RlLocationLog">
update rl_location_log
<trim prefix="SET" suffixOverrides=",">
<if test="mac != null">mac = #{mac},</if>
<if test="onenetMsg != null">onenet_msg = #{onenetMsg},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="at != null">at = #{at},</if>
<if test="status != null">status = #{status},</if>
<if test="lockStatus != null">lock_status = #{lockStatus},</if>
</trim>
where location_id = #{locationId}
</update>
<delete id="deleteEtLocationLogByLocationId" parameterType="Long">
delete from rl_location_log where location_id = #{locationId}
</delete>
<delete id="deleteEtLocationLogByLocationIds" parameterType="String">
delete from rl_location_log where location_id in
<foreach item="locationId" collection="array" open="(" separator="," close=")">
#{locationId}
</foreach>
</delete>
<delete id="deleteLocationLogByCreateTime">
delete from rl_location_log
where create_time &lt;= now() - INTERVAL 7 DAY
</delete>
</mapper>

View File

@ -61,12 +61,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
rl_model m
LEFT JOIN rl_model_store ms ON ms.mode_id = m.model_id
LEFT JOIN rl_fee_rule fr ON fr.model_id = m.model_id
LEFT JOIN rl_model_rule mr ON mr.model_id = m.model_id
LEFT JOIN rl_fee_rule fr ON fr.rule_id = mr.rule_id
WHERE
ms.store_id = #{storeId}
AND fr.price = ( SELECT MIN( fr2.price ) FROM rl_fee_rule fr2 WHERE fr2.model_id = m.model_id )
ms.store_id = 1
AND fr.price = ( SELECT MIN( fr2.price ) FROM rl_model_rule mr2
LEFT JOIN rl_fee_rule fr2 ON fr2.rule_id = mr2.rule_id
WHERE mr2.model_id = m.model_id )
GROUP BY
m.model_id
m.model_id;
</select>
<select id="getModelListByMerchantId" resultType="com.ruoyi.system.domain.model.RlModelVO">

View File

@ -217,6 +217,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
</select>
<select id="getOrderFee" resultType="java.math.BigDecimal">
select COALESCE(SUM(pay_fee), 0) payFee from rl_order where status = 8
<if test="startDateStr != null and startDateStr != ''">
AND date_format(pay_time,'%Y%m%d%H%i%s') &gt;= date_format(#{startDateStr},'%Y%m%d%H%i%s')
</if>
<if test="endDateStr != null and endDateStr != ''">
AND date_format(pay_time,'%Y%m%d%H%i%s') &lt;= date_format(#{endDateStr},'%Y%m%d%H%i%s')
</if>
<if test="agentId != null">and agent_id = #{agentId}</if>
<if test="merchantId != null">and merchant_id = #{merchantId}</if>
</select>
<select id="getOrderNum" resultType="java.lang.Integer">
select count(1) from rl_order where status = 8
<if test="startDateStr != null and startDateStr != ''">
AND date_format(pay_time,'%Y%m%d%H%i%s') &gt;= date_format(#{startDateStr},'%Y%m%d%H%i%s')
</if>
<if test="endDateStr != null and endDateStr != ''">
AND date_format(pay_time,'%Y%m%d%H%i%s') &lt;= date_format(#{endDateStr},'%Y%m%d%H%i%s')
</if>
<if test="agentId != null">and agent_id = #{agentId}</if>
<if test="merchantId != null">and merchant_id = #{merchantId}</if>
</select>
<insert id="insertRlOrder" parameterType="RlOrder" useGeneratedKeys="true" keyProperty="orderId">
insert into rl_order
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operUserId != null "> and oper_user_id = #{operUserId}</if>
<if test="operPhone != null and operPhone != ''"> and oper_phone = #{operPhone}</if>
</where>
order by oper_id desc
</select>
<select id="selectRlOrderOperByOperId" parameterType="Long" resultMap="RlOrderOperResult">

View File

@ -7,8 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RlUserExt" id="RlUserExtResult" autoMapping="true" />
<sql id="selectRlUserExtVo">
select ext_id, user_id, balance, dividend_proportion, cooperation_time, dividend_status, wx_collection_code,
ali_collection_code, agent_id, handling_charge_type, withdraw_handling_charge from rl_user_ext
select ext_id, user_id, balance, dividend_proportion, cooperation_time, dividend_status,
agent_id from rl_user_ext
</sql>
<select id="selectRlUserExtList" parameterType="RlUserExt" resultMap="RlUserExtResult">
@ -40,11 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dividendProportion != null">dividend_proportion,</if>
<if test="cooperationTime != null">cooperation_time,</if>
<if test="dividendStatus != null">dividend_status,</if>
<if test="wxCollectionCode != null">wx_collection_code,</if>
<if test="aliCollectionCode != null">ali_collection_code,</if>
<if test="agentId != null">agent_id,</if>
<if test="handlingChargeType != null">handling_charge_type,</if>
<if test="withdrawHandlingCharge != null">withdraw_handling_charge,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
@ -52,11 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dividendProportion != null">#{dividendProportion},</if>
<if test="cooperationTime != null">#{cooperationTime},</if>
<if test="dividendStatus != null">#{dividendStatus},</if>
<if test="wxCollectionCode != null">#{wxCollectionCode},</if>
<if test="aliCollectionCode != null">#{aliCollectionCode},</if>
<if test="agentId != null">#{agentId},</if>
<if test="handlingChargeType != null">#{handlingChargeType},</if>
<if test="withdrawHandlingCharge != null">#{withdrawHandlingCharge},</if>
</trim>
</insert>
@ -68,11 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dividendProportion != null">dividend_proportion = #{dividendProportion},</if>
<if test="cooperationTime != null">cooperation_time = #{cooperationTime},</if>
<if test="dividendStatus != null">dividend_status = #{dividendStatus},</if>
<if test="wxCollectionCode != null">wx_collection_code = #{wxCollectionCode},</if>
<if test="aliCollectionCode != null">ali_collection_code = #{aliCollectionCode},</if>
<if test="agentId != null">agent_id = #{agentId},</if>
<if test="handlingChargeType != null">handling_charge_type = #{handlingChargeType},</if>
<if test="withdrawHandlingCharge != null">withdraw_handling_charge = #{withdrawHandlingCharge},</if>
</trim>
where user_id = #{userId}
</update>

View File

@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectUserVo">
select u.user_id, u.user_name, u.real_name, u.id_card, u.nick_name, u.email, u.avatar,u.user_type,
u.phonenumber, u.password, u.sex, u.status,
u.phonenumber, u.password, u.sex, u.status,u.applet_type,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.wxopenid,u.is_authentication,u.applet_type,
ex.balance,ex.dividend_proportion dividendProportion,ex.cooperation_time cooperationTime,ex.dividend_status dividendStatus
from rl_user u
@ -73,6 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by u.login_date desc
</select>
<select id="selectAppUserList" parameterType="RlUser" resultMap="EUserResult">
<include refid="selectUserVo"/>
where u.del_flag = '0' and u.applet_type = '1'
</select>
<select id="selectAllocatedList" parameterType="RlUser" resultMap="EUserResult">
select distinct u.user_id, u.user_name, u.nick_name,u.real_name, u.email, u.phonenumber, u.status, u.create_time
from rl_user u

View File

@ -82,10 +82,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSmStoreList" parameterType="StoreQuery" resultMap="SmStoreResult">
<include refid="selectSmStoreVo"/>
<where>
<include refid="searchCondition"/>
</where>
order by ss.group_sort asc, ss.create_time asc
where 1=1 and ss.deleted = false
<include refid="searchCondition"/>
order by ss.create_time desc
</select>
<select id="selectSmStoreById" parameterType="Long" resultMap="SmStoreResult">

View File

@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<delete id="deleteUserRoleByUserId" parameterType="Long">
delete from sys_user_role where user_id=#{userId}RlUserRole
delete from sys_user_role where user_id=#{userId}
</delete>
<select id="countUserRoleByRoleId" resultType="Integer">