运营区修改运营商后,需要判断合伙人的分成是否正确
This commit is contained in:
parent
c637407334
commit
8ba1bd71da
|
@ -1,14 +1,15 @@
|
||||||
package com.ruoyi.common.core.redis;
|
package com.ruoyi.common.core.redis;
|
||||||
|
|
||||||
import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
import java.util.concurrent.TimeUnit;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
|
||||||
import com.ruoyi.common.utils.SnowFlakeUtil;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.SnowFlakeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wjh
|
* @author wjh
|
||||||
|
@ -41,6 +42,10 @@ public class RedisLock {
|
||||||
return lock(redisLockKey.getKey() + ":" + key);
|
return lock(redisLockKey.getKey() + ":" + key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean lock(RedisLockKey redisLockKey, Object key, long seconds) {
|
||||||
|
return lock(redisLockKey.getKey() + ":" + key, String.valueOf(SnowFlakeUtil.newId()), seconds, TimeUnit.SECONDS, retry);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取锁
|
* 获取锁
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,7 +16,8 @@ public enum RedisLockKey {
|
||||||
PAY_CREATE("create_pay", "创建支付"),
|
PAY_CREATE("create_pay", "创建支付"),
|
||||||
DEVICE_SN_UNIQUE("device_sn_unique", "设备SN唯一"),
|
DEVICE_SN_UNIQUE("device_sn_unique", "设备SN唯一"),
|
||||||
DEVICE_MAC_UNIQUE("device_mac_unique", "设备MAC唯一"),
|
DEVICE_MAC_UNIQUE("device_mac_unique", "设备MAC唯一"),
|
||||||
USER_NAME_UNIQUE("user_name_unique", "用户账号唯一");
|
USER_NAME_UNIQUE("user_name_unique", "用户账号唯一"),
|
||||||
|
DEVICE_IOT_REFRESH("device_iot_refresh", "设备物联网信息刷新");
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
|
@ -4,9 +4,6 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.ruoyi.bst.account.domain.enums.AccountType;
|
|
||||||
import com.ruoyi.common.valid.bank.BankCardInfo;
|
|
||||||
import com.ruoyi.common.valid.bank.BankValidUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -46,7 +43,6 @@ public class AccountValidatorImpl implements AccountValidator {
|
||||||
ServiceUtil.assertion(account.getUserIsReal() == null || !account.getUserIsReal(), "ID为%s的用户未实名", account.getUserId());
|
ServiceUtil.assertion(account.getUserIsReal() == null || !account.getUserIsReal(), "ID为%s的用户未实名", account.getUserId());
|
||||||
ServiceUtil.assertion(!Objects.equals(account.getUserRealName(), account.getName()), "收款人姓名与实名姓名不符");
|
ServiceUtil.assertion(!Objects.equals(account.getUserRealName(), account.getName()), "收款人姓名与实名姓名不符");
|
||||||
ServiceUtil.assertion(!Objects.equals(account.getUserRealIdCard(), account.getIdCard()), "收款人身份证号码与实名身份证号码不符");
|
ServiceUtil.assertion(!Objects.equals(account.getUserRealIdCard(), account.getIdCard()), "收款人身份证号码与实名身份证号码不符");
|
||||||
ServiceUtil.assertion(!Objects.equals(account.getUserRealPhone(), account.getMobile()), "收款人手机号与实名手机号不符");
|
|
||||||
|
|
||||||
// 查重
|
// 查重
|
||||||
ServiceUtil.assertion(this.isRepeat(account), "ID为%s的收款账户重复", account.getId());
|
ServiceUtil.assertion(this.isRepeat(account), "ID为%s的收款账户重复", account.getId());
|
||||||
|
|
|
@ -48,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.endTime != null "> and bcs.end_time = #{query.endTime}</if>
|
<if test="query.endTime != null "> and bcs.end_time = #{query.endTime}</if>
|
||||||
<if test="query.isEnabled != null "> and bcs.is_enabled = #{query.isEnabled}</if>
|
<if test="query.isEnabled != null "> and bcs.is_enabled = #{query.isEnabled}</if>
|
||||||
<if test="query.deleted != null "> and bcs.deleted = #{query.deleted}</if>
|
<if test="query.deleted != null "> and bcs.deleted = #{query.deleted}</if>
|
||||||
|
<if test="query.deleted == null "> and bcs.deleted = false</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
||||||
.userSetAlias("bcs.store_id,su.agent_id")
|
.userSetAlias("bcs.store_id,su.agent_id")
|
||||||
.areaAlias("bcs.area_id", query.areaPermissions)
|
.areaAlias("bcs.area_id", query.areaPermissions)
|
||||||
|
|
|
@ -44,4 +44,7 @@ public class DeviceQuery extends DeviceVO {
|
||||||
|
|
||||||
@ApiModelProperty("MAC列表")
|
@ApiModelProperty("MAC列表")
|
||||||
private List<String> macList;
|
private List<String> macList;
|
||||||
|
|
||||||
|
@ApiModelProperty("关键词")
|
||||||
|
private String keyword;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.lastUserPhone != null and query.lastUserPhone != ''">and bul.user_name like concat('%', #{query.lastUserPhone}, '%')</if>
|
<if test="query.lastUserPhone != null and query.lastUserPhone != ''">and bul.user_name like concat('%', #{query.lastUserPhone}, '%')</if>
|
||||||
<if test="query.mchName != null and query.mchName != ''">and mch.nick_name like concat('%', #{query.mchName}, '%')</if>
|
<if test="query.mchName != null and query.mchName != ''">and mch.nick_name like concat('%', #{query.mchName}, '%')</if>
|
||||||
<if test="query.modelName != null and query.modelName != ''">and bm.name like concat('%', #{query.modelName}, '%')</if>
|
<if test="query.modelName != null and query.modelName != ''">and bm.name like concat('%', #{query.modelName}, '%')</if>
|
||||||
|
<if test="query.keyword != null and query.keyword != ''">
|
||||||
|
and (
|
||||||
|
bd.sn like concat('%', #{query.keyword}, '%')
|
||||||
|
or bd.mac like concat('%', #{query.keyword}, '%')
|
||||||
|
or bd.vehicle_num like concat('%', #{query.keyword}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="query.suitId != null">
|
<if test="query.suitId != null">
|
||||||
and bm.id in (
|
and bm.id in (
|
||||||
select bms.model_id from bst_model_suit bms where bms.suit_id = #{query.suitId}
|
select bms.model_id from bst_model_suit bms where bms.suit_id = #{query.suitId}
|
||||||
|
|
|
@ -25,6 +25,8 @@ import com.ruoyi.bst.device.service.DeviceService;
|
||||||
import com.ruoyi.bst.device.utils.DeviceUtil;
|
import com.ruoyi.bst.device.utils.DeviceUtil;
|
||||||
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceStatus;
|
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceStatus;
|
||||||
import com.ruoyi.common.constants.ServiceCode;
|
import com.ruoyi.common.constants.ServiceCode;
|
||||||
|
import com.ruoyi.common.core.redis.RedisLock;
|
||||||
|
import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
||||||
import com.ruoyi.common.utils.MathUtils;
|
import com.ruoyi.common.utils.MathUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
@ -58,6 +60,9 @@ public class DeviceIotServiceImpl implements DeviceIotService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisLock redisLock;
|
||||||
|
|
||||||
private final static Integer SUB_FAST = 5; // 上报频率(快)
|
private final static Integer SUB_FAST = 5; // 上报频率(快)
|
||||||
private final static Integer SUB_SLOW = 300; // 上报频率(慢)
|
private final static Integer SUB_SLOW = 300; // 上报频率(慢)
|
||||||
|
|
||||||
|
@ -274,6 +279,12 @@ public class DeviceIotServiceImpl implements DeviceIotService {
|
||||||
scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
for (DeviceVO device : deviceList) {
|
for (DeviceVO device : deviceList) {
|
||||||
try {
|
try {
|
||||||
|
// 加锁,控制更新频率
|
||||||
|
boolean lock = redisLock.lock(RedisLockKey.DEVICE_IOT_REFRESH, device.getMac(), 10);
|
||||||
|
if (!lock) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取在线状态
|
// 获取在线状态
|
||||||
if (StringUtils.hasText(onlineType)) {
|
if (StringUtils.hasText(onlineType)) {
|
||||||
String onlineStatus = iotService.getOnlineStatus(device, onlineType);
|
String onlineStatus = iotService.getOnlineStatus(device, onlineType);
|
||||||
|
|
|
@ -42,9 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.userName != null and query.userName != ''"> and bf.user_name like concat('%', #{query.userName}, '%')</if>
|
<if test="query.userName != null and query.userName != ''"> and bf.user_name like concat('%', #{query.userName}, '%')</if>
|
||||||
<if test="query.vehicleCode != null "> and bf.vehicle_code = #{query.vehicleCode}</if>
|
<if test="query.vehicleCode != null "> and bf.vehicle_code = #{query.vehicleCode}</if>
|
||||||
<if test="query.picture != null and query.picture != ''"> and bf.picture = #{query.picture}</if>
|
<if test="query.picture != null and query.picture != ''"> and bf.picture = #{query.picture}</if>
|
||||||
<if test="query.orderId != null and query.orderId != ''"> and bf.order_id = #{query.orderId}</if>
|
<if test="query.orderId != null"> and bf.order_id = #{query.orderId}</if>
|
||||||
<if test="query.storeId != null and query.storeId != ''"> and bf.store_id = #{query.storeId}</if>
|
<if test="query.storeId != null"> and bf.store_id = #{query.storeId}</if>
|
||||||
<if test="query.userId != null and query.userId != ''"> and bf.user_id = #{query.userId}</if>
|
<if test="query.userId != null"> and bf.user_id = #{query.userId}</if>
|
||||||
|
<if test="query.areaId != null"> and bf.area_id = #{query.areaId}</if>
|
||||||
<if test="query.faultSiteList != null and query.faultSiteList != ''">
|
<if test="query.faultSiteList != null and query.faultSiteList != ''">
|
||||||
AND
|
AND
|
||||||
<foreach collection="query.faultSiteList" item="item" open="(" separator=" AND " close=")">
|
<foreach collection="query.faultSiteList" item="item" open="(" separator=" AND " close=")">
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
||||||
// 需要在设备未启动的时候做,否则可能有安全问题
|
// 需要在设备未启动的时候做,否则可能有安全问题
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
// 若当前数据点的上报时间和设备内上次上报的时间不一样,但是定位一样,则重启设备
|
// 若当前数据点的上报时间和设备内上次上报的时间不一样,但是定位一样,则重启设备
|
||||||
log.info("当前定位:{},{},上次定位:{},{}", sys.getLon(), sys.getLat(), device.getLongitude(), device.getLatitude());
|
log.info("当前定位:{},{},上次定位:{},{}", sys.getLon().setScale(8), sys.getLat().setScale(8), device.getLongitude().setScale(8), device.getLatitude().setScale(8));
|
||||||
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equalsFixed(device.getLongitude(), sys.getLon(), 8) && MathUtils.equalsFixed(device.getLatitude(), sys.getLat(), 8)) {
|
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equalsFixed(device.getLongitude(), sys.getLon(), 8) && MathUtils.equalsFixed(device.getLatitude(), sys.getLat(), 8)) {
|
||||||
String reason = String.format("设备不同时间的两次定位一样,重启设备。新定位:%s,%s,旧定位:%s,%s", sys.getLon(), sys.getLat(), device.getLongitude(), device.getLatitude());
|
String reason = String.format("设备不同时间的两次定位一样,重启设备。新定位:%s,%s,旧定位:%s,%s", sys.getLon(), sys.getLat(), device.getLongitude(), device.getLatitude());
|
||||||
deviceIotService.reboot(device, reason, true);
|
deviceIotService.reboot(device, reason, true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user