Compare commits
5 Commits
aeaa906bc9
...
7d91426414
Author | SHA1 | Date | |
---|---|---|---|
7d91426414 | |||
ad06811747 | |||
34188f20dd | |||
0fa0e4ab1b | |||
e321dcd652 |
@ -50,6 +50,12 @@ public class UserQueryCriteria extends BaseEntity {
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@Schema(name = "帐号状态(0正常 1停用)")
|
||||
private String status;
|
||||
|
||||
@Schema(name = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
|
@ -58,6 +58,12 @@ public class ConsumerVo extends TenantEntity {
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@Schema(name = "帐号状态(0正常 1停用)")
|
||||
private String status;
|
||||
|
||||
@Schema(name = "是否为admin账号", hidden = true)
|
||||
private Boolean isAdmin = false;
|
||||
|
||||
|
@ -112,6 +112,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateCustomer(Customer resources) throws Exception {
|
||||
if (resources.getEnabled()) {
|
||||
resources.setStatus("0");
|
||||
} else {
|
||||
resources.setStatus("1");
|
||||
}
|
||||
saveOrUpdate(resources);
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@
|
||||
<if test="criteria.id != null">
|
||||
and u1.user_id = #{criteria.id}
|
||||
</if>
|
||||
<if test="criteria.enabled != null">
|
||||
and u1.enabled = #{criteria.enabled}
|
||||
<if test="criteria.status != null">
|
||||
and u.status = #{criteria.status}
|
||||
</if>
|
||||
<if test="criteria.deptIds != null and criteria.deptIds.size() != 0">
|
||||
and u1.dept_id in
|
||||
@ -94,7 +94,7 @@
|
||||
<!-- 分页查询客户 -->
|
||||
<select id="findCustomers" resultType="com.fuyuanshen.customer.domain.Customer">
|
||||
select
|
||||
u.user_id as customerId, u.nick_name , u.user_name, u.enabled, u.create_time
|
||||
u.user_id as customerId, u.nick_name , u.user_name, u.enabled, u.create_time,u.status
|
||||
from sys_user u
|
||||
<where>
|
||||
<if test="criteria.ids != null and !criteria.ids.isEmpty()">
|
||||
@ -109,8 +109,8 @@
|
||||
<if test="criteria.blurry != null and criteria.blurry.trim() != ''">
|
||||
and u.nick_name like concat('%', TRIM(#{criteria.blurry}), '%')
|
||||
</if>
|
||||
<if test="criteria.enabled != null">
|
||||
and u.enabled = #{criteria.enabled}
|
||||
<if test="criteria.status != null">
|
||||
and u.status = #{criteria.status}
|
||||
</if>
|
||||
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
|
||||
and u.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
|
||||
@ -139,8 +139,8 @@
|
||||
<if test="criteria.blurry != null and criteria.blurry.trim() != ''">
|
||||
and u.nick_name like concat('%', TRIM(#{criteria.blurry}), '%')
|
||||
</if>
|
||||
<if test="criteria.enabled != null">
|
||||
and u.enabled = #{criteria.enabled}
|
||||
<if test="criteria.status != null">
|
||||
and u.status = #{criteria.status}
|
||||
</if>
|
||||
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
|
||||
and u.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
|
||||
|
@ -34,7 +34,7 @@ public class DeviceAssignments extends TenantEntity {
|
||||
private Long fromCustomerId;
|
||||
|
||||
/**
|
||||
* 接收方
|
||||
* 接收方(当前设备所处位置)
|
||||
*/
|
||||
private Long toCustomerId;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||
import com.fuyuanshen.system.service.ISysOssService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -319,9 +320,9 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
List<DeviceTypeGrants> deviceTypeGrants = new ArrayList<>();
|
||||
for (DeviceAssignments assignment : assignments) {
|
||||
|
||||
if (assignment.getToCustomerId() != null) {
|
||||
if (assignment.getToCustomerId() != null && assignment.getToCustomerId() != 0L) {
|
||||
log.info("设备已经分配客户!!!");
|
||||
continue;
|
||||
throw new RuntimeException("设备已经分配客户!!!");
|
||||
}
|
||||
|
||||
Device device = deviceMapper.selectById(assignment.getDeviceId());
|
||||
@ -412,54 +413,6 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 撤回设备
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
// @Override
|
||||
// public void withdrawDevice(List<Long> ids) {
|
||||
// ids.forEach((id) -> {
|
||||
// List<Device> deviceChain = getDeviceChain(id);
|
||||
// deviceChain.forEach((device) -> {
|
||||
// device.setDeviceStatus(DeviceStatusEnum.INVALID.getCode());
|
||||
// deviceMapper.updateById(device);
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// ids.forEach((id) -> {
|
||||
// Device device = new Device();
|
||||
// device.setId(id);
|
||||
// device.setCustomerId(null);
|
||||
// device.setCustomerName("");
|
||||
// deviceMapper.updateById(device);
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public List<Device> getDeviceChain(Long originalDeviceId) {
|
||||
// List<Device> chain = new ArrayList<>();
|
||||
// Set<Long> visited = new HashSet<>(); // 防止循环引用
|
||||
// findNext(chain, visited, originalDeviceId);
|
||||
// return chain;
|
||||
// }
|
||||
//
|
||||
// private void findNext(List<Device> chain, Set<Long> visited, Long currentOriginalDeviceId) {
|
||||
// if (visited.contains(currentOriginalDeviceId)) {
|
||||
// log.info("检测到循环引用,终止递归");
|
||||
// return;
|
||||
// }
|
||||
// visited.add(currentOriginalDeviceId);
|
||||
//
|
||||
// List<Device> devices = deviceMapper.findByOriginalDeviceId(currentOriginalDeviceId);
|
||||
// for (Device device : devices) {
|
||||
// chain.add(device);
|
||||
// findNext(chain, visited, device.getId());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 撤回设备
|
||||
*
|
||||
@ -474,7 +427,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
Device device = deviceMapper.selectById(assignment.getDeviceId());
|
||||
// 接收者
|
||||
assignment.setAssigneeName("");
|
||||
assignment.setToCustomerId(null);
|
||||
assignment.setToCustomerId(0L);
|
||||
deviceAssignmentsMapper.updateById(assignment);
|
||||
|
||||
// 获取所有已分配的设备
|
||||
|
Reference in New Issue
Block a user