新增客户
This commit is contained in:
@ -6,7 +6,6 @@ import com.fuyuanshen.app.domain.APPDeviceType;
|
|||||||
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
|
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
|
||||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||||
import com.fuyuanshen.app.service.equipment.APPDeviceService;
|
import com.fuyuanshen.app.service.equipment.APPDeviceService;
|
||||||
import com.fuyuanshen.common.core.domain.PageResult;
|
|
||||||
import com.fuyuanshen.common.core.domain.ResponseVO;
|
import com.fuyuanshen.common.core.domain.ResponseVO;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
@ -16,6 +16,12 @@
|
|||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fuyuanshen</groupId>
|
||||||
|
<artifactId>fys-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 通用工具-->
|
<!-- 通用工具-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fuyuanshen</groupId>
|
<groupId>com.fuyuanshen</groupId>
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.fuyuanshen.customer.constant;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数组相关常量
|
||||||
|
*
|
||||||
|
* @author: 默苍璃
|
||||||
|
* @date: 2025-07-0710:10
|
||||||
|
*/
|
||||||
|
public class ArrayConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认长整型数组
|
||||||
|
*/
|
||||||
|
public static final Long[] DEFAULT_LONG_ARRAY = {666L};
|
||||||
|
public static final Long DEFAULT_LONG = 666L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空字符串数组
|
||||||
|
*/
|
||||||
|
public static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取只读的默认长整型列表
|
||||||
|
*/
|
||||||
|
public static List<Long> getDefaultLongList() {
|
||||||
|
return Collections.unmodifiableList(new ArrayList<>(List.of(DEFAULT_LONG_ARRAY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -6,11 +6,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.fuyuanshen.common.core.domain.model.LoginUser;
|
import com.fuyuanshen.common.core.domain.model.LoginUser;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||||
|
import com.fuyuanshen.customer.constant.ArrayConstants;
|
||||||
import com.fuyuanshen.customer.domain.Customer;
|
import com.fuyuanshen.customer.domain.Customer;
|
||||||
import com.fuyuanshen.customer.domain.query.UserQueryCriteria;
|
import com.fuyuanshen.customer.domain.query.UserQueryCriteria;
|
||||||
import com.fuyuanshen.customer.domain.vo.ConsumerVo;
|
import com.fuyuanshen.customer.domain.vo.ConsumerVo;
|
||||||
import com.fuyuanshen.customer.mapper.CustomerMapper;
|
import com.fuyuanshen.customer.mapper.CustomerMapper;
|
||||||
import com.fuyuanshen.customer.service.CustomerService;
|
import com.fuyuanshen.customer.service.CustomerService;
|
||||||
|
import com.fuyuanshen.system.domain.SysUserRole;
|
||||||
|
import com.fuyuanshen.system.domain.bo.SysUserBo;
|
||||||
|
import com.fuyuanshen.system.mapper.SysRoleMapper;
|
||||||
|
import com.fuyuanshen.system.mapper.SysUserRoleMapper;
|
||||||
|
import com.fuyuanshen.system.service.ISysUserService;
|
||||||
|
import com.fuyuanshen.system.service.impl.SysUserServiceImpl;
|
||||||
import io.undertow.util.BadRequestException;
|
import io.undertow.util.BadRequestException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -28,6 +35,9 @@ import java.util.Set;
|
|||||||
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
|
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
|
||||||
|
|
||||||
private final CustomerMapper customerMapper;
|
private final CustomerMapper customerMapper;
|
||||||
|
private final SysUserServiceImpl userService;
|
||||||
|
private final SysRoleMapper roleMapper;
|
||||||
|
private final SysUserRoleMapper userRoleMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,6 +94,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|||||||
customer.setPid(loginUser.getUserId());
|
customer.setPid(loginUser.getUserId());
|
||||||
|
|
||||||
save(customer);
|
save(customer);
|
||||||
|
|
||||||
|
// 新增用户与角色管理
|
||||||
|
SysUserRole sysUserRole = new SysUserRole();
|
||||||
|
sysUserRole.setUserId(customer.getCustomerId());
|
||||||
|
sysUserRole.setRoleId(ArrayConstants.DEFAULT_LONG);
|
||||||
|
userRoleMapper.insert(sysUserRole);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,12 @@
|
|||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- <dependency> -->
|
||||||
|
<!-- <groupId>com.fuyuanshen</groupId> -->
|
||||||
|
<!-- <artifactId>fys-app</artifactId> -->
|
||||||
|
<!-- </dependency> -->
|
||||||
|
|
||||||
<!-- 通用工具-->
|
<!-- 通用工具-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fuyuanshen</groupId>
|
<groupId>com.fuyuanshen</groupId>
|
||||||
|
@ -387,11 +387,18 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
|||||||
List<Device> deviceChain = getDeviceChain(id);
|
List<Device> deviceChain = getDeviceChain(id);
|
||||||
deviceChain.forEach((device) -> {
|
deviceChain.forEach((device) -> {
|
||||||
device.setDeviceStatus(DeviceStatusEnum.INVALID.getCode());
|
device.setDeviceStatus(DeviceStatusEnum.INVALID.getCode());
|
||||||
// device.setCustomerId(null);
|
|
||||||
// device.setCustomerName("");
|
|
||||||
deviceMapper.updateById(device);
|
deviceMapper.updateById(device);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ids.forEach((id) -> {
|
||||||
|
Device device = new Device();
|
||||||
|
device.setId(id);
|
||||||
|
device.setCustomerId(null);
|
||||||
|
device.setCustomerName("");
|
||||||
|
deviceMapper.updateById(device);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- <dependency> -->
|
||||||
|
<!-- <groupId>com.fuyuanshen</groupId> -->
|
||||||
|
<!-- <artifactId>fys-app</artifactId> -->
|
||||||
|
<!-- </dependency> -->
|
||||||
|
|
||||||
<!-- 通用工具-->
|
<!-- 通用工具-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fuyuanshen</groupId>
|
<groupId>com.fuyuanshen</groupId>
|
||||||
|
@ -428,7 +428,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
* @param user 用户对象
|
* @param user 用户对象
|
||||||
* @param clear 清除已存在的关联数据
|
* @param clear 清除已存在的关联数据
|
||||||
*/
|
*/
|
||||||
private void insertUserRole(SysUserBo user, boolean clear) {
|
public void insertUserRole(SysUserBo user, boolean clear) {
|
||||||
this.insertUserRole(user.getUserId(), user.getRoleIds(), clear);
|
this.insertUserRole(user.getUserId(), user.getRoleIds(), clear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user