更新优化
This commit is contained in:
parent
c2f7c35db9
commit
5e0bfd58eb
|
@ -1,15 +1,17 @@
|
|||
package com.ruoyi.common.auth.wx;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.auth.wx.config.WxConfig;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
|
@ -73,7 +75,7 @@ public class WxAuthService {
|
|||
Integer errcode = body.getInteger("errcode");
|
||||
if (errcode == null || !errcode.equals(0)) {
|
||||
log.error("获取手机号失败 {}", body);
|
||||
throw new ServiceException("获取手机号失败");
|
||||
throw new ServiceException("获取手机号失败" );
|
||||
}
|
||||
|
||||
String phoneInfo = body.getString("phone_info");
|
||||
|
|
|
@ -15,7 +15,8 @@ public enum RedisLockKey {
|
|||
ORDER_CREATE("order_create", "订单创建"),
|
||||
PAY_CREATE("create_pay", "创建支付"),
|
||||
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", "用户账号唯一");
|
||||
|
||||
private final String key;
|
||||
private final String name;
|
||||
|
|
|
@ -90,7 +90,7 @@ public class DataScopeUtil {
|
|||
}
|
||||
// 全部数据范围
|
||||
if (DataScopeConstants.DATA_SCOPE_ALL.equals(dataScope)) {
|
||||
sqlString = new StringBuilder();
|
||||
sqlString = new StringBuilder(" OR 1=1 ");
|
||||
conditions.add(dataScope);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ public class SysLoginService
|
|||
}
|
||||
// 如果用户仍然不存在,则注册新用户
|
||||
if (user == null) {
|
||||
user = this.registerUser(phone, openId, appId);
|
||||
user = userService.registerUser(phone, openId, appId);
|
||||
}
|
||||
|
||||
ServiceUtil.assertion(user == null, "用户不存在", 401);
|
||||
|
@ -324,36 +324,6 @@ public class SysLoginService
|
|||
}
|
||||
}
|
||||
|
||||
// 注册用户
|
||||
private UserVO registerUser(String phone, String openId, Long appId) {
|
||||
if (StringUtils.isBlank(openId) || appId == null || StringUtils.isBlank(phone)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 生成昵称
|
||||
String nickName = "微信" + openId.substring(openId.length() - 4);
|
||||
if (StringUtils.hasText(phone)) {
|
||||
nickName = "用户" + phone.substring(phone.length() - 4);
|
||||
}
|
||||
|
||||
UserVO user = new UserVO();
|
||||
user.setNickName(nickName);
|
||||
user.setPhonenumber(phone);
|
||||
user.setUserName(phone);
|
||||
|
||||
return transactionTemplate.execute(status -> {
|
||||
int rows = userService.insertUser(user);
|
||||
|
||||
if (rows > 0 ) {
|
||||
int bind = userAppService.bind(user.getUserId(), appId, openId);
|
||||
ServiceUtil.assertion(bind != 1, "绑定APP失败");
|
||||
return userService.selectUserById(user.getUserId());
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
public String loginById(Long userId) {
|
||||
UserVO user = userService.selectUserById(userId);
|
||||
ServiceUtil.assertion(user == null, "ID为%s的用户不存在,请联系管理员", userId);
|
||||
|
|
|
@ -141,8 +141,8 @@ public class Area extends BaseEntity implements LogBizParam
|
|||
@ApiModelProperty("必须停车点还车")
|
||||
private Boolean parkingReturn;
|
||||
|
||||
@Excel(name = "运营区外还车")
|
||||
@ApiModelProperty("运营区外还车")
|
||||
@Excel(name = "允许运营区外还车")
|
||||
@ApiModelProperty("允许运营区外还车")
|
||||
private Boolean areaOutReturn;
|
||||
|
||||
@Excel(name = "还车是否审核")
|
||||
|
|
|
@ -22,7 +22,7 @@ public class AreaJoinConverterImpl implements AreaJoinConverter {
|
|||
return null;
|
||||
}
|
||||
|
||||
UserVO user = userService.selectUserByUserName(data.getUserPhone());
|
||||
UserVO user = this.getUser(data.getUserPhone());
|
||||
ServiceUtil.assertion(user == null, "账号为%s的用户不存在", data.getUserPhone());
|
||||
|
||||
AreaJoin po = new AreaJoin();
|
||||
|
@ -42,7 +42,7 @@ public class AreaJoinConverterImpl implements AreaJoinConverter {
|
|||
return null;
|
||||
}
|
||||
|
||||
UserVO user = userService.selectUserByUserName(data.getUserPhone());
|
||||
UserVO user = this.getUser(data.getUserPhone());
|
||||
ServiceUtil.assertion(user == null, "账号为%s的用户不存在", data.getUserPhone());
|
||||
|
||||
AreaJoin po = new AreaJoin();
|
||||
|
@ -56,4 +56,12 @@ public class AreaJoinConverterImpl implements AreaJoinConverter {
|
|||
po.setPermissions(data.getPermissions());
|
||||
return po;
|
||||
}
|
||||
|
||||
private UserVO getUser(String phone) {
|
||||
UserVO user = userService.selectUserByUserName(phone);
|
||||
if (user == null) {
|
||||
user = userService.registerUser(phone, null, null);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
|
@ -41,4 +41,7 @@ public class DeviceQuery extends DeviceVO {
|
|||
|
||||
@ApiModelProperty("订单为空或状态列表")
|
||||
private List<String> nonOrOrderStatusList;
|
||||
|
||||
@ApiModelProperty("MAC列表")
|
||||
private List<String> macList;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,12 @@ public class DeviceVO extends Device {
|
|||
private BigDecimal areaRingRadius;
|
||||
@ApiModelProperty("运营区用户必须响铃寻车范围")
|
||||
private Boolean areaRequiredRingRadius;
|
||||
@ApiModelProperty("停车点外调度费")
|
||||
private BigDecimal areaDispatchFee;
|
||||
@ApiModelProperty("运营区外调度费")
|
||||
private BigDecimal areaVehicleManagementFee;
|
||||
@ApiModelProperty("是否必须停车点还车")
|
||||
private Boolean areaParkingReturn;
|
||||
|
||||
// 订单
|
||||
@ApiModelProperty("当前订单ID")
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.ruoyi.bst.device.domain.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeviceStatQuery extends DeviceQuery {
|
||||
|
||||
private List<String> keys;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.ruoyi.bst.device.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeviceMacSnVO {
|
||||
|
||||
// MAC
|
||||
private String mac;
|
||||
// SN
|
||||
private String sn;
|
||||
}
|
|
@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
import com.ruoyi.bst.device.domain.Device;
|
||||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.device.domain.vo.DeviceMacSnVO;
|
||||
import com.ruoyi.common.domain.vo.StringIntegerVO;
|
||||
|
||||
/**
|
||||
|
@ -151,4 +152,12 @@ public interface DeviceMapper
|
|||
* @return
|
||||
*/
|
||||
Long selectOrderIdByMac(@Param("mac") String mac);
|
||||
|
||||
/**
|
||||
* 根据mac查询SN
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<DeviceMacSnVO> selectMacSnList(@Param("query") DeviceQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ba.area_time_end as area_time_end,
|
||||
ba.ring_radius as area_ring_radius,
|
||||
ba.required_ring_radius as area_required_ring_radius,
|
||||
ba.dispatch_fee as area_dispatch_fee,
|
||||
ba.vehicle_management_fee as area_vehicle_managerment_fee,
|
||||
ba.parking_return as area_parking_return,
|
||||
basu.point as area_user_point,
|
||||
basu.nick_name as area_user_name,
|
||||
basu.agent_id as area_agent_id,
|
||||
|
@ -123,6 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<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.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.suitId != null">
|
||||
and find_in_set(#{query.suitId}, bm.suit_ids)
|
||||
</if>
|
||||
|
@ -154,6 +158,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="query.macList != null and query.macList.size() > 0">
|
||||
and bd.mac in
|
||||
<foreach collection="query.macList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
||||
.userSetAlias("bd.mch_id,ba.user_id,basu.agent_id")
|
||||
.areaAlias("bd.area_id", query.areaPermissions)
|
||||
|
@ -443,4 +453,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- selectMacSnList -->
|
||||
|
||||
<select id="selectMacSnList" resultType="DeviceMacSnVO">
|
||||
select
|
||||
bd.mac,
|
||||
bd.sn
|
||||
from bst_device bd
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import com.ruoyi.bst.device.domain.Device;
|
||||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.device.domain.vo.DeviceMacSnVO;
|
||||
|
||||
/**
|
||||
* 设备Service接口
|
||||
|
@ -194,5 +195,12 @@ public interface DeviceService
|
|||
*/
|
||||
public Long selectOrderIdByMac(String mac);
|
||||
|
||||
/**
|
||||
* 根据mac查询SN
|
||||
* @param macList
|
||||
* @return
|
||||
*/
|
||||
public List<DeviceMacSnVO> listSnByMac(List<String> macList);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.ruoyi.bst.device.domain.Device;
|
|||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
import com.ruoyi.bst.device.domain.DeviceVO;
|
||||
import com.ruoyi.bst.device.domain.enums.DeviceStatus;
|
||||
import com.ruoyi.bst.device.domain.vo.DeviceMacSnVO;
|
||||
import com.ruoyi.bst.device.mapper.DeviceMapper;
|
||||
import com.ruoyi.bst.device.service.DeviceIotService;
|
||||
import com.ruoyi.bst.device.service.DeviceService;
|
||||
|
@ -107,12 +108,12 @@ public class DeviceServiceImpl implements DeviceService
|
|||
private int executeWithLock(Device device, Function<Device, Integer> operation) {
|
||||
if (StringUtils.hasText(device.getSn())) {
|
||||
boolean lockSn = redisLock.lock(RedisLockKey.DEVICE_SN_UNIQUE, device.getSn());
|
||||
ServiceUtil.assertion(!lockSn, "SN为%s的设备当前录入的人过多,请稍后再试", device.getSn());
|
||||
ServiceUtil.assertion(!lockSn, "SN为%s的设备当前操作的人过多,请稍后再试", device.getSn());
|
||||
}
|
||||
try {
|
||||
if (StringUtils.hasText(device.getMac())) {
|
||||
boolean lockMac = redisLock.lock(RedisLockKey.DEVICE_MAC_UNIQUE, device.getMac());
|
||||
ServiceUtil.assertion(!lockMac, "MAC为%s的设备当前录入的人过多,请稍后再试", device.getMac());
|
||||
ServiceUtil.assertion(!lockMac, "MAC为%s的设备当前操作的人过多,请稍后再试", device.getMac());
|
||||
}
|
||||
try {
|
||||
Integer result = operation.apply(device);
|
||||
|
@ -570,4 +571,15 @@ public class DeviceServiceImpl implements DeviceService
|
|||
}
|
||||
return deviceMapper.selectOrderIdByMac(mac);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceMacSnVO> listSnByMac(List<String> macList) {
|
||||
if (CollectionUtils.isEmptyElement(macList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
DeviceQuery query = new DeviceQuery();
|
||||
query.setMacList(macList);
|
||||
return deviceMapper.selectMacSnList(query);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,7 @@ public class LocationLogQuery extends LocationLogVO {
|
|||
@ApiModelProperty("时间范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private List<LocalDateTime> timeRange;
|
||||
|
||||
@ApiModelProperty("订单ID列表")
|
||||
private List<Long> orderIds;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.orderIds != null and query.orderIds.size() > 0">
|
||||
and bll.order_id in
|
||||
<foreach item="item" collection="query.orderIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||
null,
|
||||
"su.user_id,su.agent_id,bo.area_user_id,bo.area_agent_id,bod.device_mch_id",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.bst.order.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.device.domain.vo.DeviceIotVO;
|
||||
|
@ -182,4 +183,17 @@ public interface OrderService
|
|||
* @return 结果
|
||||
*/
|
||||
public int verify(OrderVerifyDTO dto);
|
||||
|
||||
/**
|
||||
* 查询ID列表
|
||||
* @param query
|
||||
*/
|
||||
public List<Long> selectIdList(OrderQuery query);
|
||||
|
||||
/**
|
||||
* 更新订单距离
|
||||
* @param id 订单ID
|
||||
* @param distance 距离
|
||||
*/
|
||||
public int updateDisatance(Long id, BigDecimal distance);
|
||||
}
|
||||
|
|
|
@ -732,4 +732,20 @@ public class OrderServiceImpl implements OrderService
|
|||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectIdList(OrderQuery query) {
|
||||
return orderMapper.selectIdByQuery(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateDisatance(Long id, BigDecimal distance) {
|
||||
if (id == null || distance == null) {
|
||||
return 0;
|
||||
}
|
||||
Order data = new Order();
|
||||
data.setId(id);
|
||||
data.setDistance(distance);
|
||||
return orderMapper.updateOrder(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.appName != null and query.appName != ''"> and bp.app_name like concat('%', #{query.appName}, '%')</if>
|
||||
<if test="query.channelName != null and query.channelName != ''"> and bp.channel_name like concat('%', #{query.channelName}, '%')</if>
|
||||
<if test="query.areaId != null "> and bp.area_id = #{query.areaId}</if>
|
||||
<if test="query.payDate != null">and date(bp.pay_time) = #{query.payDate}</if>
|
||||
<if test="query.statusList != null and query.statusList.size() > 0">
|
||||
and bp.status in
|
||||
<foreach collection="query.statusList" item="item" open="(" separator="," close=")">
|
||||
|
|
|
@ -5,8 +5,10 @@ import java.math.BigDecimal;
|
|||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Sensitive;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.interfaces.LogBizParam;
|
||||
import com.ruoyi.common.enums.DesensitizedType;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -31,11 +33,13 @@ public class RealName extends BaseEntity implements LogBizParam
|
|||
@Excel(name = "用户姓名")
|
||||
@ApiModelProperty("用户姓名")
|
||||
@NotBlank(message = "用户姓名不允许为空")
|
||||
@Sensitive(desensitizedType = DesensitizedType.USERNAME)
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "身份证")
|
||||
@ApiModelProperty("身份证")
|
||||
@NotBlank(message = "身份证不允许为空")
|
||||
@Sensitive(desensitizedType = DesensitizedType.ID_CARD)
|
||||
private String idCard;
|
||||
|
||||
@Excel(name = "人脸图像")
|
||||
|
@ -49,6 +53,7 @@ public class RealName extends BaseEntity implements LogBizParam
|
|||
@Excel(name = "手机号")
|
||||
@ApiModelProperty("手机号")
|
||||
@NotBlank(message = "手机号不允许为空")
|
||||
@Sensitive(desensitizedType = DesensitizedType.PHONE)
|
||||
private String mobile;
|
||||
|
||||
@Excel(name = "实名认证状态:0-未实名 1-已实名")
|
||||
|
|
|
@ -70,7 +70,7 @@ public interface RealNameMapper
|
|||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRealNameByIds(Long[] ids);
|
||||
public int deleteRealNameByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
Boolean checkIdCard(String idCard);
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<delete id="deleteRealNameByIds" parameterType="String">
|
||||
delete from bst_real_name where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
|
|
@ -38,13 +38,6 @@ public interface RealNameService
|
|||
*/
|
||||
public int insertRealName(RealName realName);
|
||||
|
||||
/**
|
||||
* 修改实名认证信息
|
||||
*
|
||||
* @param realName 实名认证信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRealName(RealName realName);
|
||||
|
||||
/**
|
||||
* 批量删除实名认证信息
|
||||
|
@ -52,7 +45,7 @@ public interface RealNameService
|
|||
* @param ids 需要删除的实名认证信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRealNameByIds(Long[] ids);
|
||||
public int deleteRealNameByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 删除实名认证信息信息
|
||||
|
|
|
@ -95,38 +95,6 @@ public class RealNameServiceImpl implements RealNameService
|
|||
return realNameMapper.insertRealName(realName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实名认证信息
|
||||
*
|
||||
* @param realName 实名认证信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateRealName(RealName realName)
|
||||
{
|
||||
realName.setUpdateTime(DateUtils.getNowDate());
|
||||
UserVO user = userService.selectUserById(realName.getUserId());
|
||||
ServiceUtil.assertion(user == null,"用户信息不存在");
|
||||
ServiceUtil.assertion(StringUtils.isBlank(realName.getUserName()), "用户姓名不允许为空");
|
||||
ServiceUtil.assertion(StringUtils.isBlank(realName.getIdCard()), "用户身份证不允许为空");
|
||||
|
||||
// 构建用户信息表
|
||||
user.setUserName(realName.getUserName());
|
||||
user.setUpdateTime(DateUtils.getNowDate());
|
||||
user.setRealIdCard(realName.getIdCard());
|
||||
|
||||
// 更新用户信息表
|
||||
int updateUser = userService.updateUser(user);
|
||||
ServiceUtil.assertion(updateUser != 1, "更新用户信息失败");
|
||||
|
||||
// 更新实名认证表
|
||||
int updateRealName = realNameMapper.insertRealName(realName);
|
||||
ServiceUtil.assertion(updateRealName != 1, "新增实名认证失败");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除实名认证信息
|
||||
*
|
||||
|
@ -134,7 +102,7 @@ public class RealNameServiceImpl implements RealNameService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRealNameByIds(Long[] ids)
|
||||
public int deleteRealNameByIds(List<Long> ids)
|
||||
{
|
||||
return realNameMapper.deleteRealNameByIds(ids);
|
||||
}
|
||||
|
@ -145,18 +113,9 @@ public class RealNameServiceImpl implements RealNameService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRealNameById(Long userid)
|
||||
public int deleteRealNameById(Long id)
|
||||
{
|
||||
|
||||
UserVO user = new UserVO();
|
||||
user.setUserId(userid);
|
||||
user.setIsReal(false);
|
||||
RealNameVO vo = realNameMapper.selectRealNameByUserId(userid);
|
||||
if (vo != null){
|
||||
userService.updateUser(user);
|
||||
return realNameMapper.deleteRealNameByUserId(userid);
|
||||
}
|
||||
return 0;
|
||||
return realNameMapper.deleteRealNameById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,11 +225,11 @@ public class RealNameServiceImpl implements RealNameService
|
|||
// 数据库操作
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 修改用户实名信息
|
||||
int update = userService.updateUser(data);
|
||||
int update = userService.updateUserRealName(data);
|
||||
ServiceUtil.assertion(update != 1, "更新用户信息失败");
|
||||
|
||||
// 插入实名认证表
|
||||
int insert = realNameMapper.insertRealName(realName);
|
||||
int insert = this.insertRealName(realName);
|
||||
ServiceUtil.assertion(insert != 1, "新增实名认证失败");
|
||||
|
||||
// 删除缓存
|
||||
|
|
|
@ -10,9 +10,11 @@ import javax.validation.constraints.NotBlank;
|
|||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Sensitive;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.interfaces.LogBizParam;
|
||||
import com.ruoyi.common.core.validate.ValidGroup;
|
||||
import com.ruoyi.common.enums.DesensitizedType;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -60,10 +62,12 @@ public class Withdraw extends BaseEntity implements LogBizParam
|
|||
|
||||
@Excel(name = "账户手机号")
|
||||
@ApiModelProperty("账户手机号")
|
||||
@Sensitive(desensitizedType = DesensitizedType.PHONE)
|
||||
private String accountMobile;
|
||||
|
||||
@Excel(name = "账户身份证号")
|
||||
@ApiModelProperty("账户身份证号")
|
||||
@Sensitive(desensitizedType = DesensitizedType.ID_CARD)
|
||||
private String accountIdCard;
|
||||
|
||||
@Excel(name = "银行名称")
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.dashboard.utils;
|
|||
|
||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||
import com.ruoyi.bst.areaJoin.domain.AreaJoinQuery;
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||
import com.ruoyi.bst.bonus.domain.BonusQuery;
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusArrivalType;
|
||||
import com.ruoyi.bst.bonusRefund.domain.BonusRefundQuery;
|
||||
|
@ -24,6 +25,7 @@ public class DashboardUtil {
|
|||
query.setBonusUserId(params.getUserId());
|
||||
query.setAreaId(params.getAreaId());
|
||||
query.setScope(params.getScope());
|
||||
query.addAreaPermission(AreaJoinPermission.ORDER_VIEW.getCode());
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -35,6 +37,7 @@ public class DashboardUtil {
|
|||
query.setBonusUserId(params.getUserId());
|
||||
query.setAreaId(params.getAreaId());
|
||||
query.setScope(params.getScope());
|
||||
query.addAreaPermission(AreaJoinPermission.ORDER_VIEW.getCode());
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -82,6 +85,7 @@ public class DashboardUtil {
|
|||
deviceQuery.setScope(query.getScope());
|
||||
deviceQuery.setMchId(query.getUserId());
|
||||
deviceQuery.setAreaId(query.getAreaId());
|
||||
deviceQuery.addAreaPermission(AreaJoinPermission.DEVICE_VIEW.getCode());
|
||||
return deviceQuery;
|
||||
}
|
||||
|
||||
|
@ -90,6 +94,7 @@ public class DashboardUtil {
|
|||
areaQuery.setScope(query.getScope());
|
||||
areaQuery.setUserId(query.getUserId());
|
||||
areaQuery.setId(query.getAreaId());
|
||||
areaQuery.addAreaPermission(AreaJoinPermission.AREA_VIEW.getCode());
|
||||
return areaQuery;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,7 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
|||
// 需要在设备未启动的时候做,否则可能有安全问题
|
||||
if (!isOpen) {
|
||||
// 若当前数据点的上报时间和设备内上次上报的时间不一样,但是定位一样,则重启设备
|
||||
log.info("当前定位:{},{},上次定位:{},{}", sys.getLon(), sys.getLat(), device.getLongitude(), device.getLatitude());
|
||||
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equals(device.getLongitude(), sys.getLon()) && MathUtils.equals(device.getLatitude(), sys.getLat())) {
|
||||
String reason = String.format("设备不同时间的两次定位一样,重启设备。定位:%s,%s", sys.getLon(), sys.getLat());
|
||||
deviceIotService.reboot(device, reason, true);
|
||||
|
|
|
@ -22,6 +22,9 @@ public class UserQuery extends UserVO {
|
|||
@ApiModelProperty("用户ID列表")
|
||||
private List<Long> userIds;
|
||||
|
||||
@ApiModelProperty("精准用户账号")
|
||||
private String eqUserName;
|
||||
|
||||
@ApiModelProperty("用户名称列表")
|
||||
private List<String> userNames;
|
||||
|
||||
|
|
|
@ -96,6 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="eqUserName != null and eqUserName != ''">
|
||||
AND u.user_name = #{eqUserName}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
|
@ -246,6 +249,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
|
|
|
@ -264,4 +264,18 @@ public interface UserService
|
|||
* @return 结果
|
||||
*/
|
||||
public int updateAreaId(Long userId, Long areaId);
|
||||
|
||||
/**
|
||||
* 注册用户
|
||||
* @param phone 手机号
|
||||
* @param openId 微信openId
|
||||
* @param appId 应用ID
|
||||
* @return 结果
|
||||
*/
|
||||
public UserVO registerUser(String phone, String openId, Long appId);
|
||||
|
||||
/**
|
||||
* 更新用户实名信息
|
||||
*/
|
||||
int updateUserRealName(User data);
|
||||
}
|
||||
|
|
|
@ -33,4 +33,11 @@ public interface UserValidator {
|
|||
*/
|
||||
boolean canView(List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 校验用户账号是否唯一
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
boolean checkUserNameUnique(UserVO user);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,12 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.ruoyi.bst.device.domain.Device;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -22,6 +24,7 @@ import com.ruoyi.bst.app.service.impl.AppServiceImpl;
|
|||
import com.ruoyi.bst.balanceLog.domain.BalanceLog;
|
||||
import com.ruoyi.bst.balanceLog.domain.enums.BalanceLogBstType;
|
||||
import com.ruoyi.bst.balanceLog.service.BalanceLogService;
|
||||
import com.ruoyi.bst.userApp.service.UserAppService;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.constants.ConfigKeys;
|
||||
|
@ -29,6 +32,9 @@ import com.ruoyi.common.core.domain.entity.Role;
|
|||
import com.ruoyi.common.core.domain.entity.User;
|
||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.core.redis.RedisLock;
|
||||
import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
||||
import com.ruoyi.common.enums.UserType;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
|
@ -45,6 +51,7 @@ import com.ruoyi.system.user.domain.vo.UserNameVO;
|
|||
import com.ruoyi.system.user.mapper.UserMapper;
|
||||
import com.ruoyi.system.user.service.UserService;
|
||||
import com.ruoyi.system.user.service.UserValidator;
|
||||
import com.ruoyi.system.user.utils.UserUtil;
|
||||
import com.ruoyi.system.userPost.domain.UserPost;
|
||||
import com.ruoyi.system.userPost.mapper.UserPostMapper;
|
||||
import com.ruoyi.system.userRole.domain.UserRole;
|
||||
|
@ -106,6 +113,11 @@ public class UserServiceImpl implements UserService
|
|||
@Autowired
|
||||
private BalanceLogService balanceLogService;
|
||||
|
||||
@Autowired
|
||||
private UserAppService userAppService;
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
UserServiceImpl(AppConverterImpl appConverterImpl, AppServiceImpl appServiceImpl) {
|
||||
this.appConverterImpl = appConverterImpl;
|
||||
|
@ -285,13 +297,6 @@ public class UserServiceImpl implements UserService
|
|||
@Override
|
||||
public int insertUser(UserVO user)
|
||||
{
|
||||
// 校验
|
||||
ServiceUtil.assertion(StringUtils.isNotEmpty(user.getPhonenumber()) && !this.checkPhoneUnique(user),
|
||||
"新增用户'" + user.getUserName() + "'失败,手机号码已存在"
|
||||
);
|
||||
ServiceUtil.assertion(StringUtils.isNotEmpty(user.getEmail()) && !this.checkEmailUnique(user),
|
||||
"新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"
|
||||
);
|
||||
|
||||
// 填充数据
|
||||
if (user.getPassword() != null) {
|
||||
|
@ -300,19 +305,24 @@ public class UserServiceImpl implements UserService
|
|||
// 设置默认信息
|
||||
this.setDefaultInfo(user);
|
||||
|
||||
return executeWithLock(user, u -> {
|
||||
// 校验
|
||||
ServiceUtil.assertion(StringUtils.isNotEmpty(user.getUserName()) && !userValidator.checkUserNameUnique(user),
|
||||
"新增用户'" + user.getUserName() + "'失败,用户账号已存在"
|
||||
);
|
||||
|
||||
// 操作数据库
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 新增用户信息
|
||||
int rows = userMapper.insertUser(user);
|
||||
// 新增用户岗位关联
|
||||
insertUserPost(user);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
|
||||
if (rows > 0) {
|
||||
// 后校验
|
||||
this.afterCheck(user.getUserId());
|
||||
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
|
@ -320,6 +330,7 @@ public class UserServiceImpl implements UserService
|
|||
});
|
||||
|
||||
return result == null ? 0 : result;
|
||||
});
|
||||
}
|
||||
|
||||
private void setDefaultInfo(UserVO user) {
|
||||
|
@ -366,32 +377,26 @@ public class UserServiceImpl implements UserService
|
|||
*/
|
||||
@Override
|
||||
public int updateUser(UserVO user) {
|
||||
// 校验
|
||||
return executeWithLock(user, u -> {
|
||||
Long userId = user.getUserId();
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
if (user.getRoleIds() != null) {
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
}
|
||||
ServiceUtil.assertion(StringUtils.isNotEmpty(user.getPhonenumber()) && !this.checkPhoneUnique(user),
|
||||
"修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
ServiceUtil.assertion(StringUtils.isNotEmpty(user.getEmail()) && !this.checkEmailUnique(user),
|
||||
"修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
// 删除用户与岗位关联
|
||||
userPostMapper.deleteUserPostByUserId(userId);
|
||||
// 新增用户与岗位管理
|
||||
insertUserPost(user);
|
||||
ServiceUtil.assertion(StringUtils.hasText(user.getUserName()) && !userValidator.checkUserNameUnique(user),
|
||||
"修改账户'" + user.getUserName() + "'失败,用户账号已存在"
|
||||
);
|
||||
|
||||
int rows = userMapper.updateUser(user);
|
||||
|
||||
if (rows > 0) {
|
||||
// 后校验
|
||||
this.afterCheck(user.getUserId());
|
||||
|
||||
if (user.getRoleIds() != null) {
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
// 新增用户与角色关联
|
||||
insertUserRole(user);
|
||||
}
|
||||
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
|
@ -399,6 +404,23 @@ public class UserServiceImpl implements UserService
|
|||
});
|
||||
|
||||
return result == null ? 0 : result;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private int executeWithLock(User user, Function<User, Integer> operation) {
|
||||
if (StringUtils.hasText(user.getUserName())) {
|
||||
boolean lockSn = redisLock.lock(RedisLockKey.USER_NAME_UNIQUE, user.getUserName());
|
||||
ServiceUtil.assertion(!lockSn, "账号为为%s的用户当前操作的人过多,请稍后再试", user.getUserName());
|
||||
}
|
||||
try {
|
||||
Integer result = operation.apply(user);
|
||||
return result == null ? 0 : result;
|
||||
} finally {
|
||||
if (StringUtils.hasText(user.getUserName())) {
|
||||
redisLock.unlock(RedisLockKey.USER_NAME_UNIQUE, user.getUserName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void afterCheck(Long userId) {
|
||||
|
@ -789,4 +811,61 @@ public class UserServiceImpl implements UserService
|
|||
user.setAreaId(areaId);
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 注册用户
|
||||
@Override
|
||||
public UserVO registerUser(String phone, String openId, Long appId) {
|
||||
if (StringUtils.isBlank(phone)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 生成昵称
|
||||
String nickName = null;
|
||||
if (StringUtils.hasText(openId)) {
|
||||
nickName = "微信" + openId.substring(openId.length() - 4);
|
||||
}
|
||||
if (StringUtils.hasText(phone)) {
|
||||
nickName = "用户" + phone.substring(phone.length() - 4);
|
||||
}
|
||||
|
||||
UserVO user = new UserVO();
|
||||
user.setNickName(nickName);
|
||||
user.setPhonenumber(phone);
|
||||
user.setUserName(phone);
|
||||
user.setUserType(UserType.USER.getCode());
|
||||
user.setPassword(UserUtil.randomPassword());
|
||||
user.setPoint(BigDecimal.valueOf(96));
|
||||
|
||||
return transactionTemplate.execute(status -> {
|
||||
int rows = this.insertUser(user);
|
||||
|
||||
if (rows > 0 ) {
|
||||
// 绑定APP
|
||||
if (appId != null && StringUtils.hasText(openId)) {
|
||||
int bind = userAppService.bind(user.getUserId(), appId, openId);
|
||||
ServiceUtil.assertion(bind != 1, "绑定APP失败");
|
||||
}
|
||||
// 返回用户信息
|
||||
return this.selectUserById(user.getUserId());
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUserRealName(User user) {
|
||||
if (user == null || user.getUserId() == null) {
|
||||
return 0;
|
||||
}
|
||||
UserVO data = new UserVO();
|
||||
data.setUserId(user.getUserId());
|
||||
data.setRealName(user.getUserName());
|
||||
data.setRealIdCard(user.getRealIdCard());
|
||||
data.setRealPhone(user.getRealPhone());
|
||||
data.setIsReal(user.getIsReal());
|
||||
return userMapper.updateUser(data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.ruoyi.bst.areaJoin.service.AreaJoinDashboard;
|
|||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.system.user.domain.UserQuery;
|
||||
import com.ruoyi.system.user.mapper.UserMapper;
|
||||
|
@ -39,6 +40,8 @@ public class UserValidatorImpl implements UserValidator {
|
|||
public void validate(UserVO vo) {
|
||||
ServiceUtil.assertion(vo == null, "用户不存在");
|
||||
|
||||
ServiceUtil.assertion(!this.checkUserNameUnique(vo), "用户账号%s已存在", vo.getUserName());
|
||||
|
||||
// 不允许分成大于代理商
|
||||
if (vo.getAgentId() != null) {
|
||||
ServiceUtil.assertion(MathUtils.biggerThan(vo.getPoint(), vo.getAgentPoint()),
|
||||
|
@ -80,5 +83,23 @@ public class UserValidatorImpl implements UserValidator {
|
|||
List<Long> ids = userMapper.selectIdList(query);
|
||||
return new HashSet<>(ids).containsAll(userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkUserNameUnique(UserVO user) {
|
||||
if (user == null) {
|
||||
return true;
|
||||
}
|
||||
return checkUserNameUnique(user.getUserName(), user.getUserId());
|
||||
}
|
||||
|
||||
private boolean checkUserNameUnique(String userName, Long userId) {
|
||||
if (StringUtils.isBlank(userName)) {
|
||||
return true;
|
||||
}
|
||||
UserQuery query = new UserQuery();
|
||||
query.setEqUserName(userName);
|
||||
query.setExcludeUserId(userId);
|
||||
return userMapper.selectCount(query) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.task.order;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -8,6 +9,9 @@ import org.springframework.boot.ApplicationArguments;
|
|||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ruoyi.bst.locationLog.domain.vo.LocationLogPositionVO;
|
||||
import com.ruoyi.bst.locationLog.service.LocationLogService;
|
||||
import com.ruoyi.bst.locationLog.utils.LocationLogUtil;
|
||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||
import com.ruoyi.bst.order.domain.OrderVO;
|
||||
import com.ruoyi.bst.order.domain.dto.OrderEndDTO;
|
||||
|
@ -15,6 +19,7 @@ import com.ruoyi.bst.order.domain.enums.OrderReturnType;
|
|||
import com.ruoyi.bst.order.domain.enums.OrderStatus;
|
||||
import com.ruoyi.bst.order.mapper.OrderMapper;
|
||||
import com.ruoyi.bst.order.service.OrderService;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -29,6 +34,9 @@ public class OrderTask implements ApplicationRunner {
|
|||
@Autowired
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Autowired
|
||||
private LocationLogService locationLogService;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
|
@ -75,4 +83,35 @@ public class OrderTask implements ApplicationRunner {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算进行中的订单距离
|
||||
*/
|
||||
public void calcInUseDistance() {
|
||||
// 查询进行中的订单ID列表
|
||||
OrderQuery query = new OrderQuery();
|
||||
query.setStatusList(OrderStatus.inUse());
|
||||
List<Long> orderIds = orderService.selectIdList(query);
|
||||
|
||||
if (CollectionUtils.isEmptyElement(orderIds)) {
|
||||
log.info("暂无进行中的订单");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (Long id : orderIds) {
|
||||
try {
|
||||
// 查询定位日志
|
||||
List<LocationLogPositionVO> logs = locationLogService.selectPositionListByOrderId(id);
|
||||
|
||||
// 更新距离
|
||||
BigDecimal distance = LocationLogUtil.calcDistance(logs);
|
||||
int update = orderService.updateDisatance(id, distance);
|
||||
ServiceUtil.assertion(update != 1, "更新失败");
|
||||
} catch (Exception e) {
|
||||
log.error("更新ID为{}的订单距离失败:{}", id, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -317,4 +317,13 @@ public class DeviceController extends BaseController
|
|||
return success(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询MAC对应的SN
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:device:list')")
|
||||
@PostMapping("/listSnByMac")
|
||||
public AjaxResult listSnByMac(@RequestBody List<String> macList){
|
||||
return success(deviceService.listSnByMac(macList));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,12 +84,8 @@ public class RealNameController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('bst:realName:remove')")
|
||||
@Log(title = "删除实名认证信息", businessType = BusinessType.DELETE, bizIdName = "arg0", bizType = LogBizType.REAL_NAME)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
public AjaxResult remove(@PathVariable List<Long> id)
|
||||
{
|
||||
UserVO user = userService.selectUserById(id);
|
||||
if (user == null) {
|
||||
return error("当前用户不存在");
|
||||
}
|
||||
return toAjax(realNameService.deleteRealNameById(id));
|
||||
return toAjax(realNameService.deleteRealNameByIds(id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -50,6 +52,9 @@ public class LoginController
|
|||
@Autowired
|
||||
private DashboardService dashboardService;
|
||||
|
||||
@Value("${ruoyi.loginById}")
|
||||
private Boolean loginById;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
|
@ -82,12 +87,12 @@ public class LoginController
|
|||
@PostMapping("/loginById")
|
||||
@Anonymous
|
||||
public AjaxResult loginById(Long userId) {
|
||||
return AjaxResult.error("接口已弃用");
|
||||
// AjaxResult ajax = AjaxResult.success();
|
||||
// // 生成令牌
|
||||
// String token = loginService.loginById(userId);
|
||||
// ajax.put(Constants.TOKEN, token);
|
||||
// return ajax;
|
||||
ServiceUtil.assertion(!loginById, "接口不可用");
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.loginById(userId);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.ruoyi.web.dashboard;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||
import com.ruoyi.bst.device.domain.dto.DeviceStatQuery;
|
||||
import com.ruoyi.bst.device.service.DeviceDashboard;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard/device")
|
||||
public class DashboardDeviceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DeviceDashboard deviceDashboard;
|
||||
|
||||
@ApiOperation("获取设备统计数据")
|
||||
@PreAuthorize("@ss.hasAnyPermi('dashboard:device:stat')")
|
||||
@GetMapping("/stat")
|
||||
public AjaxResult getStat(DeviceStatQuery query) {
|
||||
query.setScope(true);
|
||||
query.addAreaPermission(AreaJoinPermission.DEVICE_VIEW.getCode());
|
||||
return success(deviceDashboard.selectStat(query, query.getKeys()));
|
||||
}
|
||||
}
|
|
@ -169,6 +169,10 @@ public class SysUserController extends BaseController
|
|||
user.setUpdateBy(getUsername());
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
if (user.getRoleIds() != null) {
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
}
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ ruoyi:
|
|||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 允许使用ID登录
|
||||
loginById: true
|
||||
|
||||
# 支付配置
|
||||
pay:
|
||||
|
@ -45,3 +47,4 @@ pay:
|
|||
# 活体检测
|
||||
liveness:
|
||||
returnUrl: http://192.168.2.99:4100/liveness
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user