debug
This commit is contained in:
parent
ffe409d63f
commit
ff5f29cf0b
|
@ -1,19 +1,19 @@
|
||||||
package com.ruoyi.bst.agreement.domain;
|
package com.ruoyi.bst.agreement.domain;
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class AgreementQuery extends Agreement{
|
public class AgreementQuery extends AgreementVO {
|
||||||
|
|
||||||
@ApiModelProperty("用户id")
|
@ApiModelProperty("用户ID")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
|
@ApiModelProperty("协议ID列表")
|
||||||
private List<Long> ids;
|
private List<Long> ids;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.bst.agreement.mapper.AgreementMapper">
|
<mapper namespace="com.ruoyi.bst.agreement.mapper.AgreementMapper">
|
||||||
|
|
||||||
<resultMap type="AgreementVO" id="AgreementResult" autoMapping="true">
|
<resultMap type="AgreementVO" id="AgreementResult" autoMapping="true"/>
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="storeId" column="store_id" />
|
|
||||||
<result property="areaId" column="area_id" />
|
|
||||||
<result property="title" column="title" />
|
|
||||||
<result property="brief" column="brief" />
|
|
||||||
<result property="content" column="content" />
|
|
||||||
<result property="agreementType" column="agreement_type" />
|
|
||||||
<result property="duration" column="duration" />
|
|
||||||
<result property="userName" column="user_name" />
|
|
||||||
<result property="areaName" column="area_name" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectAgreementVo">
|
<sql id="selectAgreementVo">
|
||||||
select
|
select
|
||||||
|
@ -31,15 +18,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bag.duration,
|
bag.duration,
|
||||||
bag.create_time,
|
bag.create_time,
|
||||||
bag.update_time,
|
bag.update_time,
|
||||||
su.user_name,
|
su.nick_name as user_name,
|
||||||
ba.name as area_name
|
ba.name as area_name
|
||||||
<include refid="searchTables"></include>
|
from <include refid="searchTables"/>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchTables">
|
<sql id="searchTables">
|
||||||
from bst_agreement bag
|
bst_agreement bag
|
||||||
left join sys_user su on bag.store_id = su.user_id
|
left join sys_user su on bag.store_id = su.user_id
|
||||||
left join bst_area ba on bag.area_id = ba.id
|
left join bst_area ba on bag.area_id = ba.id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
|
@ -49,14 +36,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.brief != null and query.brief != ''"> and bag.brief like concat('%', #{query.brief}, '%')</if>
|
<if test="query.brief != null and query.brief != ''"> and bag.brief like concat('%', #{query.brief}, '%')</if>
|
||||||
<if test="query.content != null and query.content != ''"> and bag.content like concat('%', #{query.content}, '%')</if>
|
<if test="query.content != null and query.content != ''"> and bag.content like concat('%', #{query.content}, '%')</if>
|
||||||
<if test="query.agreementType != null and query.agreementType != ''"> and bag.agreement_type = #{query.agreementType}</if>
|
<if test="query.agreementType != null and query.agreementType != ''"> and bag.agreement_type = #{query.agreementType}</if>
|
||||||
|
<if test="query.userName != null and query.userName != ''"> and su.nick_name like concat('%', #{query.userName}, '%')</if>
|
||||||
<if test="query.duration != null "> and bag.duration = #{query.duration}</if>
|
<if test="query.duration != null "> and bag.duration = #{query.duration}</if>
|
||||||
|
<if test="query.ids != null and query.ids.size() > 0">
|
||||||
|
and bag.id in
|
||||||
|
<foreach collection="query.ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||||
null,
|
null,
|
||||||
"bag.store_id",
|
"bag.store_id",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
query.scope
|
query.scope
|
||||||
)}
|
)}
|
||||||
${query.params.dataScope}
|
${query.params.dataScope}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.bst.area.domain;
|
package com.ruoyi.bst.area.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
@ -13,4 +14,10 @@ public class AreaQuery extends AreaVO {
|
||||||
|
|
||||||
@ApiModelProperty("关键词")
|
@ApiModelProperty("关键词")
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
|
@ApiModelProperty("半径(米)")
|
||||||
|
private BigDecimal radius;
|
||||||
|
|
||||||
|
@ApiModelProperty("中心坐标")
|
||||||
|
private List<BigDecimal> center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
||||||
import com.ruoyi.bst.area.domain.Area;
|
import com.ruoyi.bst.area.domain.Area;
|
||||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||||
import com.ruoyi.bst.area.domain.AreaVO;
|
import com.ruoyi.bst.area.domain.AreaVO;
|
||||||
|
import com.ruoyi.common.domain.vo.LongIntegerVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运营区Mapper接口
|
* 运营区Mapper接口
|
||||||
|
@ -95,4 +96,11 @@ public interface AreaMapper
|
||||||
*/
|
*/
|
||||||
List<AreaVO> selectSimpleList(@Param("query") AreaQuery query);
|
List<AreaVO> selectSimpleList(@Param("query") AreaQuery query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备数量最多的运营区ID
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<LongIntegerVO> selectDeviceCountGroupByAreaId(@Param("query") AreaQuery query);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ba.name like concat('%', #{query.keyword}, '%')
|
ba.name like concat('%', #{query.keyword}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
<if test="query.radius != null and query.center != null and query.center.size() >= 2">
|
||||||
|
and (
|
||||||
|
ST_Contains(ba.boundary, point(#{query.center[0]}, #{query.center[1]}))
|
||||||
|
or
|
||||||
|
ST_Distance_Sphere(
|
||||||
|
point(#{query.center[0]}, #{query.center[1]}),
|
||||||
|
point(ba.longitude, ba.latitude)
|
||||||
|
) <= #{query.radius}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
||||||
.userSetAlias("ba.user_id,ba.create_id,su.agent_id")
|
.userSetAlias("ba.user_id,ba.create_id,su.agent_id")
|
||||||
.areaAlias("ba.id", query.areaPermissions)
|
.areaAlias("ba.id", query.areaPermissions)
|
||||||
|
@ -292,4 +302,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- selectMaxOfDeviceCountAreaId -->
|
||||||
|
|
||||||
|
<select id="selectDeviceCountGroupByAreaId" resultMap="com.ruoyi.common.mapper.CommonMapper.LongIntegerVO">
|
||||||
|
select
|
||||||
|
ba.id as `key`,
|
||||||
|
count(bd.id) as `value`
|
||||||
|
from <include refid="searchTables"/>
|
||||||
|
left join bst_device bd on bd.area_id = ba.id and bd.deleted = false
|
||||||
|
<where>
|
||||||
|
<include refid="searchCondition"/>
|
||||||
|
</where>
|
||||||
|
group by `key`
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||||
import com.ruoyi.bst.area.domain.vo.AreaStatVO;
|
import com.ruoyi.bst.area.domain.vo.AreaStatVO;
|
||||||
|
import com.ruoyi.common.domain.vo.LongIntegerVO;
|
||||||
|
|
||||||
public interface AreaDashboard {
|
public interface AreaDashboard {
|
||||||
|
|
||||||
|
@ -13,4 +14,13 @@ public interface AreaDashboard {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AreaStatVO selectStat(AreaQuery query, List<String> keys);
|
AreaStatVO selectStat(AreaQuery query, List<String> keys);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备数量最多的运营区ID
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
LongIntegerVO selectMaxOfDeviceCountAreaId(AreaQuery query);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,14 @@ import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||||
import com.ruoyi.bst.area.domain.vo.AreaStatVO;
|
import com.ruoyi.bst.area.domain.vo.AreaStatVO;
|
||||||
import com.ruoyi.bst.area.mapper.AreaMapper;
|
import com.ruoyi.bst.area.mapper.AreaMapper;
|
||||||
import com.ruoyi.bst.area.service.AreaDashboard;
|
import com.ruoyi.bst.area.service.AreaDashboard;
|
||||||
|
import com.ruoyi.common.domain.vo.LongIntegerVO;
|
||||||
import com.ruoyi.common.utils.MathUtils;
|
import com.ruoyi.common.utils.MathUtils;
|
||||||
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import com.ruoyi.dashboard.constants.StatKeys;
|
import com.ruoyi.dashboard.constants.StatKeys;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -27,4 +30,12 @@ public class AreaDashboardImpl implements AreaDashboard {
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LongIntegerVO selectMaxOfDeviceCountAreaId(AreaQuery query) {
|
||||||
|
PageHelper.startPage(1, 1);
|
||||||
|
PageHelper.orderBy("value desc");
|
||||||
|
List<LongIntegerVO> list = areaMapper.selectDeviceCountGroupByAreaId(query);
|
||||||
|
return CollectionUtils.firstElement(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,10 @@ public class Device extends BaseEntity implements IotDevice
|
||||||
@ApiModelProperty("软件版本")
|
@ApiModelProperty("软件版本")
|
||||||
private String softwareVersion;
|
private String softwareVersion;
|
||||||
|
|
||||||
|
@Excel(name = "最近一次下单用户ID")
|
||||||
|
@ApiModelProperty("最近一次下单用户ID")
|
||||||
|
private Long lastUserId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String mac() {
|
public String mac() {
|
||||||
return this.mac;
|
return this.mac;
|
||||||
|
|
|
@ -78,6 +78,12 @@ public class DeviceVO extends Device {
|
||||||
@ApiModelProperty("硬件版本说明")
|
@ApiModelProperty("硬件版本说明")
|
||||||
private String hardwareVersionInstructions;
|
private String hardwareVersionInstructions;
|
||||||
|
|
||||||
|
// 最近一次下单用户
|
||||||
|
@ApiModelProperty("最近一次下单用户名称")
|
||||||
|
private String lastUserName;
|
||||||
|
@ApiModelProperty("最近一次下单用户手机号")
|
||||||
|
private String lastUserPhone;
|
||||||
|
|
||||||
// 剩余续航(公里)
|
// 剩余续航(公里)
|
||||||
public BigDecimal getRemainEndurance() {
|
public BigDecimal getRemainEndurance() {
|
||||||
BigDecimal remainEndurance = MathUtils.mulDecimal(getRemainingPower(), getModelFullEndurance());
|
BigDecimal remainEndurance = MathUtils.mulDecimal(getRemainingPower(), getModelFullEndurance());
|
||||||
|
|
|
@ -44,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bd.last_online_time,
|
bd.last_online_time,
|
||||||
bd.order_device_id,
|
bd.order_device_id,
|
||||||
bd.software_version,
|
bd.software_version,
|
||||||
|
bd.last_user_id,
|
||||||
mch.nick_name as mch_name,
|
mch.nick_name as mch_name,
|
||||||
mch.point as mch_point,
|
mch.point as mch_point,
|
||||||
bm.name as model_name,
|
bm.name as model_name,
|
||||||
|
@ -69,7 +70,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bod.status as order_device_status,
|
bod.status as order_device_status,
|
||||||
bod.order_id as order_id,
|
bod.order_id as order_id,
|
||||||
bhv.version as hardware_version,
|
bhv.version as hardware_version,
|
||||||
bhv.instructions as hardware_version_instructions
|
bhv.instructions as hardware_version_instructions,
|
||||||
|
bul.nick_name as last_user_name,
|
||||||
|
bul.user_name as last_user_phone
|
||||||
from <include refid="searchTables"/>
|
from <include refid="searchTables"/>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
@ -80,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join bst_area ba on bd.area_id = ba.id
|
left join bst_area ba on bd.area_id = ba.id
|
||||||
left join sys_user basu on basu.user_id = ba.user_id
|
left join sys_user basu on basu.user_id = ba.user_id
|
||||||
left join sys_user basua on basua.user_id = basu.agent_id
|
left join sys_user basua on basua.user_id = basu.agent_id
|
||||||
|
left join sys_user bul on bul.user_id = bd.last_user_id
|
||||||
left join bst_order_device bod on bod.id = bd.order_device_id
|
left join bst_order_device bod on bod.id = bd.order_device_id
|
||||||
left join bst_order bo on bo.id = bod.order_id
|
left join bst_order bo on bo.id = bod.order_id
|
||||||
left join bst_hardware_version bhv on bhv.id = bd.hardware_version_id
|
left join bst_hardware_version bhv on bhv.id = bd.hardware_version_id
|
||||||
|
@ -114,6 +118,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.areaAgentName != null and query.areaAgentName != ''"> and basua.nick_name like concat('%', #{query.areaAgentName}, '%')</if>
|
<if test="query.areaAgentName != null and query.areaAgentName != ''"> and basua.nick_name like concat('%', #{query.areaAgentName}, '%')</if>
|
||||||
<if test="query.orderNo != null and query.orderNo != ''"> and bo.no like concat('%', #{query.orderNo}, '%')</if>
|
<if test="query.orderNo != null and query.orderNo != ''"> and bo.no like concat('%', #{query.orderNo}, '%')</if>
|
||||||
<if test="query.excludeId != null">and bd.id != #{query.excludeId}</if>
|
<if test="query.excludeId != null">and bd.id != #{query.excludeId}</if>
|
||||||
|
<if test="query.lastUserId != null">and bd.last_user_id = #{query.lastUserId}</if>
|
||||||
|
<if test="query.lastUserName != null and query.lastUserName != ''">and bul.nick_name like concat('%', #{query.lastUserName}, '%')</if>
|
||||||
|
<if test="query.lastUserPhone != null and query.lastUserPhone != ''">and bul.user_name like concat('%', #{query.lastUserPhone}, '%')</if>
|
||||||
<if test="query.suitId != null">
|
<if test="query.suitId != null">
|
||||||
and find_in_set(#{query.suitId}, bm.suit_ids)
|
and find_in_set(#{query.suitId}, bm.suit_ids)
|
||||||
</if>
|
</if>
|
||||||
|
@ -200,6 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="lastOnlineTime != null">last_online_time,</if>
|
<if test="lastOnlineTime != null">last_online_time,</if>
|
||||||
<if test="orderDeviceId != null">order_device_id,</if>
|
<if test="orderDeviceId != null">order_device_id,</if>
|
||||||
<if test="softwareVersion != null">software_version,</if>
|
<if test="softwareVersion != null">software_version,</if>
|
||||||
|
<if test="lastUserId != null">last_user_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="modelId != null">#{modelId},</if>
|
<if test="modelId != null">#{modelId},</if>
|
||||||
|
@ -234,6 +242,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="lastOnlineTime != null">#{lastOnlineTime},</if>
|
<if test="lastOnlineTime != null">#{lastOnlineTime},</if>
|
||||||
<if test="orderDeviceId != null">#{orderDeviceId},</if>
|
<if test="orderDeviceId != null">#{orderDeviceId},</if>
|
||||||
<if test="softwareVersion != null">#{softwareVersion},</if>
|
<if test="softwareVersion != null">#{softwareVersion},</if>
|
||||||
|
<if test="lastUserId != null">#{lastUserId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -278,6 +287,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="data.lastOnlineTime != null">bd.last_online_time = #{data.lastOnlineTime},</if>
|
<if test="data.lastOnlineTime != null">bd.last_online_time = #{data.lastOnlineTime},</if>
|
||||||
<if test="data.orderDeviceId != null">bd.order_device_id = #{data.orderDeviceId},</if>
|
<if test="data.orderDeviceId != null">bd.order_device_id = #{data.orderDeviceId},</if>
|
||||||
<if test="data.softwareVersion != null">bd.software_version = #{data.softwareVersion},</if>
|
<if test="data.softwareVersion != null">bd.software_version = #{data.softwareVersion},</if>
|
||||||
|
<if test="data.lastUserId != null">bd.last_user_id = #{data.lastUserId},</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<delete id="deleteDeviceById" parameterType="Long">
|
<delete id="deleteDeviceById" parameterType="Long">
|
||||||
|
|
|
@ -179,5 +179,13 @@ public interface DeviceService
|
||||||
*/
|
*/
|
||||||
public int unbindArea(List<DeviceVO> deviceList);
|
public int unbindArea(List<DeviceVO> deviceList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备最后一次使用的用户ID
|
||||||
|
* @param id 设备ID
|
||||||
|
* @param lastUserId 最后一次使用的用户ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateLastUserId(Long id, Long lastUserId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,6 +314,7 @@ public class DeviceIotServiceImpl implements DeviceIotService {
|
||||||
data.setLastLocationTime(device.getLastLocationTime());
|
data.setLastLocationTime(device.getLastLocationTime());
|
||||||
data.setOnlineStatus(device.getOnlineStatus());
|
data.setOnlineStatus(device.getOnlineStatus());
|
||||||
data.setLastOnlineTime(device.getLastOnlineTime());
|
data.setLastOnlineTime(device.getLastOnlineTime());
|
||||||
|
data.setSoftwareVersion(device.getSoftwareVersion());
|
||||||
return deviceMapper.updateDevice(data);
|
return deviceMapper.updateDevice(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,4 +551,15 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
List<Long> ids = CollectionUtils.map(deviceList, DeviceVO::getId);
|
List<Long> ids = CollectionUtils.map(deviceList, DeviceVO::getId);
|
||||||
return deviceMapper.unbindArea(ids);
|
return deviceMapper.unbindArea(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateLastUserId(Long id, Long lastUserId) {
|
||||||
|
if (id == null || lastUserId == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Device data = new Device();
|
||||||
|
data.setId(id);
|
||||||
|
data.setLastUserId(lastUserId);
|
||||||
|
return deviceMapper.updateDevice(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@ package com.ruoyi.bst.order.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import com.ruoyi.bst.device.domain.enums.DeviceUnLockType;
|
|
||||||
import com.ruoyi.bst.device.domain.vo.DeviceIotVO;
|
|
||||||
import com.ruoyi.bst.device.service.DeviceIotService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.device.domain.enums.DeviceUnLockType;
|
||||||
|
import com.ruoyi.bst.device.domain.vo.DeviceIotVO;
|
||||||
|
import com.ruoyi.bst.device.service.DeviceIotService;
|
||||||
import com.ruoyi.bst.order.domain.Order;
|
import com.ruoyi.bst.order.domain.Order;
|
||||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||||
import com.ruoyi.bst.order.domain.OrderVO;
|
import com.ruoyi.bst.order.domain.OrderVO;
|
||||||
|
|
|
@ -172,14 +172,26 @@ public class OrderDeviceServiceImpl implements OrderDeviceService
|
||||||
ServiceUtil.assertion(orderDevice == null, "订单设备不能为空");
|
ServiceUtil.assertion(orderDevice == null, "订单设备不能为空");
|
||||||
ServiceUtil.assertion(!OrderDeviceStatus.canStart().contains(orderDevice.getStatus()), "订单设备状态不允许开始");
|
ServiceUtil.assertion(!OrderDeviceStatus.canStart().contains(orderDevice.getStatus()), "订单设备状态不允许开始");
|
||||||
|
|
||||||
// 修改订单设备状态
|
Integer result = transactionTemplate.execute(status -> {
|
||||||
OrderDevice data = new OrderDevice();
|
// 修改订单设备状态
|
||||||
data.setStatus(OrderDeviceStatus.USING.getCode());
|
OrderDevice data = new OrderDevice();
|
||||||
data.setStartTime(LocalDateTime.now());
|
data.setStatus(OrderDeviceStatus.USING.getCode());
|
||||||
OrderDeviceQuery query = new OrderDeviceQuery();
|
data.setStartTime(LocalDateTime.now());
|
||||||
query.setId(orderDevice.getId());
|
OrderDeviceQuery query = new OrderDeviceQuery();
|
||||||
query.setStatusList(OrderDeviceStatus.canStart());
|
query.setId(orderDevice.getId());
|
||||||
return orderDeviceMapper.updateByQuery(data, query);
|
query.setStatusList(OrderDeviceStatus.canStart());
|
||||||
|
int rows = orderDeviceMapper.updateByQuery(data, query);
|
||||||
|
|
||||||
|
if (rows > 0 ) {
|
||||||
|
// 更新设备最后一次使用的用户ID
|
||||||
|
int update = deviceService.updateLastUserId(orderDevice.getDeviceId(), orderDevice.getOrderUserId());
|
||||||
|
ServiceUtil.assertion(update != 1, "更新设备最后一次使用的用户ID失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
});
|
||||||
|
|
||||||
|
return result == null ? 0 : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,21 +4,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.bst.realName.mapper.RealNameMapper">
|
<mapper namespace="com.ruoyi.bst.realName.mapper.RealNameMapper">
|
||||||
|
|
||||||
<resultMap type="RealNameVO" id="RealNameResult" autoMapping="true">
|
<resultMap type="RealNameVO" id="RealNameResult" autoMapping="true"/>
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="userName" column="user_name" />
|
|
||||||
<result property="idCard" column="id_card" />
|
|
||||||
<result property="picture" column="picture" />
|
|
||||||
<result property="score" column="score" />
|
|
||||||
<result property="mobile" column="mobile" />
|
|
||||||
<result property="status" column="status" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectRealNameVo">
|
<sql id="selectRealNameVo">
|
||||||
select
|
select
|
||||||
brn.id,
|
brn.id,
|
||||||
|
brn.user_id,
|
||||||
brn.user_name,
|
brn.user_name,
|
||||||
brn.id_card,
|
brn.id_card,
|
||||||
brn.picture,
|
brn.picture,
|
||||||
|
@ -37,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.score != null "> and score = #{query.score}</if>
|
<if test="query.score != null "> and score = #{query.score}</if>
|
||||||
<if test="query.mobile != null and query.mobile != ''"> and mobile = #{query.mobile}</if>
|
<if test="query.mobile != null and query.mobile != ''"> and mobile = #{query.mobile}</if>
|
||||||
<if test="query.status != null and query.status != ''"> and status = #{query.status}</if>
|
<if test="query.status != null and query.status != ''"> and status = #{query.status}</if>
|
||||||
|
<if test="query.userId != null"> and user_id = #{query.userId}</if>
|
||||||
${query.params.dataScope}
|
${query.params.dataScope}
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class RefundVO extends Refund implements Refundable {
|
||||||
private String payBstType;
|
private String payBstType;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String refundOutTradeNo() {
|
public String refundOutTradeNo() {
|
||||||
return getPayNo();
|
return getPayNo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.reason != null and query.reason != ''"> and br.reason like concat('%', #{query.reason}, '%')</if>
|
<if test="query.reason != null and query.reason != ''"> and br.reason like concat('%', #{query.reason}, '%')</if>
|
||||||
<if test="query.userId != null "> and br.user_id = #{query.userId}</if>
|
<if test="query.userId != null "> and br.user_id = #{query.userId}</if>
|
||||||
<if test="query.userName != null and query.userName != ''"> and br.user_name like concat('%', #{query.userName}, '%')</if>
|
<if test="query.userName != null and query.userName != ''"> and br.user_name like concat('%', #{query.userName}, '%')</if>
|
||||||
|
<if test="query.payBstId != null "> and bp.bst_id = #{query.payBstId}</if>
|
||||||
|
<if test="query.payBstType != null and query.payBstType != ''"> and bp.bst_type = #{query.payBstType}</if>
|
||||||
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
|
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
|
||||||
and date(br.create_time) >= #{query.createDateRange[0]}
|
and date(br.create_time) >= #{query.createDateRange[0]}
|
||||||
and date(br.create_time) <= #{query.createDateRange[1]}
|
and date(br.create_time) <= #{query.createDateRange[1]}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.iot.service.impl;
|
package com.ruoyi.iot.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -133,12 +134,17 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
||||||
if (device == null || StringUtils.isBlank(device.getMac()) || device.getLastLocationTime() == null || at == null) {
|
if (device == null || StringUtils.isBlank(device.getMac()) || device.getLastLocationTime() == null || at == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// 0,0定位不处理
|
||||||
|
if (MathUtils.equals(sys.getLon(), BigDecimal.ZERO) && MathUtils.equals(sys.getLat(), BigDecimal.ZERO)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
boolean isOpen = DeviceLockStatus.OPEN.getCode().equals(device.getLockStatus()); // 是否开锁
|
boolean isOpen = DeviceLockStatus.OPEN.getCode().equals(device.getLockStatus()); // 是否开锁
|
||||||
// 需要在设备未启动的时候做,否则可能有安全问题
|
// 需要在设备未启动的时候做,否则可能有安全问题
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
// 若当前数据点的上报时间和设备内上次上报的时间不一样,但是定位一样,则重启设备
|
// 若当前数据点的上报时间和设备内上次上报的时间不一样,但是定位一样,则重启设备
|
||||||
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equals(device.getLongitude(), sys.getLon()) && MathUtils.equals(device.getLatitude(), sys.getLat())) {
|
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equals(device.getLongitude(), sys.getLon()) && MathUtils.equals(device.getLatitude(), sys.getLat())) {
|
||||||
deviceIotService.reboot(device, "设备不同时间的两次定位一样,重启设备", true);
|
String reason = String.format("设备不同时间的两次定位一样,重启设备。定位:%s,%s", sys.getLon(), sys.getLat());
|
||||||
|
deviceIotService.reboot(device, reason, true);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class UserConverterImpl implements UserConverter {
|
||||||
vo.setStatus(data.getStatus());
|
vo.setStatus(data.getStatus());
|
||||||
vo.setWithdrawServiceType(data.getWithdrawServiceType());
|
vo.setWithdrawServiceType(data.getWithdrawServiceType());
|
||||||
vo.setWithdrawServiceValue(data.getWithdrawServiceValue());
|
vo.setWithdrawServiceValue(data.getWithdrawServiceValue());
|
||||||
|
vo.setBonusDelay(data.getBonusDelay());
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ public class UserConverterImpl implements UserConverter {
|
||||||
vo.setStatus(data.getStatus());
|
vo.setStatus(data.getStatus());
|
||||||
vo.setWithdrawServiceType(data.getWithdrawServiceType());
|
vo.setWithdrawServiceType(data.getWithdrawServiceType());
|
||||||
vo.setWithdrawServiceValue(data.getWithdrawServiceValue());
|
vo.setWithdrawServiceValue(data.getWithdrawServiceValue());
|
||||||
|
vo.setBonusDelay(data.getBonusDelay());
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.ruoyi.web.app;
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -7,10 +9,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||||
import com.ruoyi.bst.area.domain.enums.AreaStatus;
|
import com.ruoyi.bst.area.domain.enums.AreaStatus;
|
||||||
|
import com.ruoyi.bst.area.service.AreaDashboard;
|
||||||
import com.ruoyi.bst.area.service.AreaService;
|
import com.ruoyi.bst.area.service.AreaService;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.domain.vo.LongIntegerVO;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
@ -22,14 +26,47 @@ public class AppAreaController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AreaService areaService;
|
private AreaService areaService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AreaDashboard areaDashboard;
|
||||||
|
|
||||||
|
// 设置前提条件
|
||||||
|
private void setQuery(AreaQuery query) {
|
||||||
|
query.setStatus(AreaStatus.ENABLED.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("获取运营区详情")
|
@ApiOperation("获取运营区详情")
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
@Anonymous
|
@Anonymous
|
||||||
public AjaxResult getAreaDetail(Long id) {
|
public AjaxResult getAreaDetail(Long id) {
|
||||||
AreaQuery query = new AreaQuery();
|
AreaQuery query = new AreaQuery();
|
||||||
query.setId(id);
|
query.setId(id);
|
||||||
query.setStatus(AreaStatus.ENABLED.getCode());
|
setQuery(query);
|
||||||
return success(areaService.selectOne(query));
|
return success(areaService.selectOne(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取附近的运营区")
|
||||||
|
@GetMapping("/nearby")
|
||||||
|
@Anonymous
|
||||||
|
public AjaxResult getNearbyArea(AreaQuery query) {
|
||||||
|
if (query.getRadius() == null || query.getRadius().compareTo(BigDecimal.ZERO) <= 0 || query.getRadius().compareTo(BigDecimal.valueOf(10000)) > 0) {
|
||||||
|
return error("半径必须在0-10000之间");
|
||||||
|
}
|
||||||
|
if (query.getCenter() == null) {
|
||||||
|
return error("中心坐标不能为空");
|
||||||
|
}
|
||||||
|
if (query.getCenter().size() != 2) {
|
||||||
|
return error("中心坐标格式错误,必须包含经度和纬度");
|
||||||
|
}
|
||||||
|
setQuery(query);
|
||||||
|
|
||||||
|
// 查询设备数量最多的运营区ID
|
||||||
|
LongIntegerVO max = areaDashboard.selectMaxOfDeviceCountAreaId(query);
|
||||||
|
if (max == null) {
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询运营区详情
|
||||||
|
return success(areaService.selectAreaById(max.getKey()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,7 @@ public class LoginController
|
||||||
StatQuery query = new StatQuery();
|
StatQuery query = new StatQuery();
|
||||||
query.setScope(true);
|
query.setScope(true);
|
||||||
query.setUserId(user.getUserId());
|
query.setUserId(user.getUserId());
|
||||||
|
query.setBonusUserId(user.getUserId());
|
||||||
query.setKeys(Arrays.asList(
|
query.setKeys(Arrays.asList(
|
||||||
StatKeys.WITHDRAW_SUCCESS_AMOUNT,
|
StatKeys.WITHDRAW_SUCCESS_AMOUNT,
|
||||||
StatKeys.BONUS_WAIT_DIVIDE_AMOUNT
|
StatKeys.BONUS_WAIT_DIVIDE_AMOUNT
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
package com.ruoyi.web.system;
|
package com.ruoyi.web.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
@ -9,12 +23,6 @@ import com.ruoyi.system.notice.domain.Notice;
|
||||||
import com.ruoyi.system.notice.domain.NoticeQuery;
|
import com.ruoyi.system.notice.domain.NoticeQuery;
|
||||||
import com.ruoyi.system.notice.domain.NoticeVO;
|
import com.ruoyi.system.notice.domain.NoticeVO;
|
||||||
import com.ruoyi.system.notice.service.NoticeService;
|
import com.ruoyi.system.notice.service.NoticeService;
|
||||||
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 java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 信息操作处理
|
* 公告 信息操作处理
|
||||||
|
@ -58,7 +66,7 @@ public class SysNoticeController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody Notice notice)
|
public AjaxResult add(@Validated @RequestBody Notice notice)
|
||||||
{
|
{
|
||||||
notice.setCreateBy(getUsername());
|
notice.setCreateBy(getNickName());
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return toAjax(noticeService.insertNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +78,7 @@ public class SysNoticeController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody Notice notice)
|
public AjaxResult edit(@Validated @RequestBody Notice notice)
|
||||||
{
|
{
|
||||||
notice.setUpdateBy(getUsername());
|
notice.setUpdateBy(getNickName());
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user