Compare commits
3 Commits
879e485056
...
d84a7cde3b
Author | SHA1 | Date | |
---|---|---|---|
d84a7cde3b | |||
33e53de5a1 | |||
3bce279d7b |
@ -92,7 +92,7 @@ public class Customer extends TenantEntity {
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
private String status = "0";
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 1代表删除)
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.fuyuanshen.customer.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuyuanshen.common.core.domain.model.LoginUser;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||
import com.fuyuanshen.customer.constant.ArrayConstants;
|
||||
@ -92,6 +94,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
}
|
||||
customer.setUserLevel((byte) (loginUser.getUserLevel() + 1));
|
||||
customer.setPid(loginUser.getUserId());
|
||||
customer.setStatus("0");
|
||||
|
||||
save(customer);
|
||||
|
||||
@ -106,18 +109,40 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* 不是因为寂寞才想你,只是因为想你才寂寞。
|
||||
*
|
||||
* @param resources /
|
||||
* @param customer /
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateCustomer(Customer resources) throws Exception {
|
||||
if (resources.getEnabled()) {
|
||||
resources.setStatus("0");
|
||||
} else {
|
||||
resources.setStatus("1");
|
||||
public void updateCustomer(Customer customer) throws Exception {
|
||||
|
||||
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
|
||||
if (StringUtils.isNotEmpty(customer.getUserName())) {
|
||||
userQueryCriteria.setCustomerName(customer.getUserName());
|
||||
List<Customer> customers = customerMapper.queryCustomers(userQueryCriteria);
|
||||
if (!customers.isEmpty()) {
|
||||
throw new BadRequestException("用户名已存在!!!");
|
||||
}
|
||||
saveOrUpdate(resources);
|
||||
}
|
||||
|
||||
if (customer.getEnabled()) {
|
||||
customer.setStatus("0");
|
||||
} else {
|
||||
// 强制下线
|
||||
// StpUtil.logout(customer.getCustomerId());
|
||||
// StpUtil.kickout(customer.getCustomerId());
|
||||
customer.setStatus("1");
|
||||
// 检查目标用户是否有有效的登录状态
|
||||
if (StpUtil.isLogin(customer.getCustomerId())) {
|
||||
// 用户已登录,可以执行踢出操作
|
||||
StpUtil.kickout(customer.getCustomerId());
|
||||
} else {
|
||||
// 用户未登录,无法踢出
|
||||
System.out.println("目标用户未登录,无法执行踢出操作");
|
||||
}
|
||||
}
|
||||
saveOrUpdate(customer);
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,7 +105,6 @@ public class Device extends TenantEntity {
|
||||
@Schema(name = "设备状态")
|
||||
private Integer deviceStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 绑定状态
|
||||
* 0 未绑定
|
||||
@ -127,4 +126,17 @@ public class Device extends TenantEntity {
|
||||
private Date bindingTime;
|
||||
|
||||
private String sendMsg;
|
||||
|
||||
/**
|
||||
* 发布主题(格式:A/{device_id})
|
||||
* pub_topic
|
||||
*/
|
||||
private String pubTopic;
|
||||
|
||||
/**
|
||||
* 订阅主题(格式:B/{device_id})
|
||||
* sub_topic
|
||||
*/
|
||||
private String subTopic;
|
||||
|
||||
}
|
||||
|
@ -186,6 +186,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
device.setCreateByName(loginUser.getNickname());
|
||||
device.setTypeName(deviceTypes.getTypeName());
|
||||
device.setDeviceType(deviceTypes.getId());
|
||||
if (device.getDeviceImei() != null) {
|
||||
device.setPubTopic("A/" + device.getDeviceImei());
|
||||
device.setSubTopic("B/" + device.getDeviceImei());
|
||||
}
|
||||
|
||||
deviceMapper.insert(device);
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
<!-- 分页查询设备 -->
|
||||
<select id="findAll" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
select
|
||||
da.id AS id,d.device_name,d.bluetooth_name,
|
||||
da.id AS id,d.device_name,d.bluetooth_name,d.pub_topic,d.sub_topic,
|
||||
d.device_pic, d.device_mac, d.device_sn, d.update_by,d.device_imei,
|
||||
d.update_time, dg.id AS device_type, d.remark, d.binding_status,t.type_name AS typeName,
|
||||
da.assignee_id AS customerId, da.assignee_name AS customerName, da.active AS deviceStatus,
|
||||
|
Reference in New Issue
Block a user