commit: 添加罗库版本

This commit is contained in:
republicline 2025-02-12 14:17:16 +08:00
parent 9578e2ee1f
commit 868011b38e
6 changed files with 56 additions and 91 deletions

View File

@ -73,9 +73,9 @@ public class UserExcelVO implements Serializable {
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空")
@ExcelProperty("部门名称")
private String deptName;
//@NotBlank(message = "部门名称不能为空")
//@ExcelProperty("部门名称")
//private String deptName;
/**
* 角色列表
@ -84,12 +84,12 @@ public class UserExcelVO implements Serializable {
@ExcelProperty("角色")
private String roleNameList;
/**
* 角色列表
*/
@NotBlank(message = "岗位不能为空")
@ExcelProperty("岗位名称")
private String postNameList;
///**
// * 角色列表
// */
//@NotBlank(message = "岗位不能为空")
//@ExcelProperty("岗位名称")
//private String postNameList;
/**
* 锁定标记

View File

@ -357,11 +357,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
.map(SysRole::getRoleName)
.collect(Collectors.joining(StrUtil.COMMA));
excelVO.setRoleNameList(roleNameList);
String postNameList = userVO.getPostList()
.stream()
.map(SysPost::getPostName)
.collect(Collectors.joining(StrUtil.COMMA));
excelVO.setPostNameList(postNameList);
//String postNameList = userVO.getPostList()
// .stream()
// .map(SysPost::getPostName)
// .collect(Collectors.joining(StrUtil.COMMA));
//excelVO.setPostNameList(postNameList);
return excelVO;
}).collect(Collectors.toList());
return userExcelVOList;
@ -378,9 +378,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
public R importUser(List<UserExcelVO> excelVOList, BindingResult bindingResult) {
// 通用校验获取失败的数据
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
List<SysDept> deptList = sysDeptService.list();
//List<SysDept> deptList = sysDeptService.list();
List<SysRole> roleList = sysRoleService.list();
List<SysPost> postList = sysPostService.list();
//List<SysPost> postList = sysPostService.list();
// 执行数据插入操作 组装 UserDto
for (UserExcelVO excel : excelVOList) {
@ -397,12 +397,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
// 判断输入的部门名称列表是否合法
Optional<SysDept> deptOptional = deptList.stream()
.filter(dept -> excel.getDeptName().equals(dept.getName()))
.findFirst();
if (!deptOptional.isPresent()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_DEPT_DEPTNAME_INEXISTENCE, excel.getDeptName()));
}
//Optional<SysDept> deptOptional = deptList.stream()
// .filter(dept -> excel.getDeptName().equals(dept.getName()))
// .findFirst();
//if (!deptOptional.isPresent()) {
// errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_DEPT_DEPTNAME_INEXISTENCE, excel.getDeptName()));
//}
// 判断输入的角色名称列表是否合法
List<String> roleNameList = StrUtil.split(excel.getRoleNameList(), StrUtil.COMMA);
@ -426,7 +426,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 数据合法情况
if (CollUtil.isEmpty(errorMsg)) {
insertExcelUser(excel, deptOptional, roleCollList, null);
insertExcelUser(excel, roleCollList);
} else {
// 数据不合法情况
errorMessageList.add(new ErrorMessage(excel.getLineNum(), errorMsg));
@ -443,8 +443,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
/**
* 插入excel User
*/
private void insertExcelUser(UserExcelVO excel, Optional<SysDept> deptOptional, List<SysRole> roleCollList,
List<SysPost> postCollList) {
private void insertExcelUser(UserExcelVO excel, List<SysRole> roleCollList) {
UserDTO userDTO = new UserDTO();
userDTO.setUsername(excel.getUsername());
userDTO.setPhone(excel.getPhone());
@ -454,7 +453,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 批量导入初始密码为手机号
userDTO.setPassword(userDTO.getPhone());
// 根据部门名称查询部门ID
userDTO.setDeptId(deptOptional.get().getDeptId());
//userDTO.setDeptId(deptOptional.get().getDeptId());
// 插入岗位名称
// List<Long> postIdList = postCollList.stream().map(SysPost::getPostId).collect(Collectors.toList());
// userDTO.setPost(postIdList);

View File

@ -29,11 +29,11 @@ public class ChatHandler implements WebSocketHandler {
@Resource
private OAuth2AuthorizationService authorizationService;
@Resource
private ChatService chatService;
@Autowired
private RedisTemplate redisTemplate;
//@Resource
//private ChatService chatService;
//
//@Autowired
//private RedisTemplate redisTemplate;
// mysql地址
@Value("${vital-sign.mysql.host}")
@ -200,7 +200,6 @@ public class ChatHandler implements WebSocketHandler {
sessionDbMap.remove(session.getId());
}
// 初始化聊天表格
private void initTChatTable(String dbName, WebSocketSession session) {
try {

View File

@ -175,6 +175,8 @@ public class VitalSignTimerWS {
CustomDataSource finalDataSource = dataSource;
/**
* 判断罗库溴铵还是顺阿曲库胺
* 0默认值无意义1有创2无创
@ -182,19 +184,31 @@ public class VitalSignTimerWS {
*/
// 这里只判断罗库还是顺阿
Connection connection = finalDataSource.getConnection();
String selectSql = "SELECT sum(罗库) from selecttable;";
Statement statement = connection.createStatement();
statement.execute(selectSql);
ResultSet resultSet = statement.getResultSet();
double selectValue = 0;
while (resultSet.next()) {
System.out.println("selectValue = " + selectValue);
selectValue = resultSet.getDouble("sum(罗库)");
System.out.println("change:selectValue = " + selectValue);
// 先判断selecttable是否存在, 不存在则跳过
// mysql判断表是否存在
String selectTableSql = "SELECT * FROM information_schema.tables WHERE table_schema = '" + database + "' AND table_name = 'selecttable'";
Statement selectTableStatement = connection.createStatement();
ResultSet selectTableResultSet = selectTableStatement.executeQuery(selectTableSql);
boolean selectTableExists = false;
while (selectTableResultSet.next()) {
selectTableExists = true;
}
double finalSelectValue = selectValue;
System.out.println("finalSelectValue = " + finalSelectValue);
// 如果存在, 根据逻辑判断
double finalSelectValue = 2; // 默认顺阿曲库胺
if (selectTableExists) {
String selectSql = "SELECT sum(罗库) from selecttable;";
Statement statement = connection.createStatement();
statement.execute(selectSql);
ResultSet resultSet = statement.getResultSet();
while (resultSet.next()) {
finalSelectValue = resultSet.getDouble("sum(罗库)");
}
}
double finalSelectValue1 = finalSelectValue;
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
@ -203,7 +217,7 @@ public class VitalSignTimerWS {
// List<Map> vitalSignsList = vitalSignsService.getVitalSignsList(connection);
Map vitalSignsList = vitalSignsService.getVitalSignsList(connection, username, database);
jsonObject.put("vitalSignsList", vitalSignsList);
List<Map> aiMedicineList = aiMedicineService.getAIMedicine(connection,finalSelectValue);
List<Map> aiMedicineList = aiMedicineService.getAIMedicine(connection, finalSelectValue1);
jsonObject.put("aiMedicineList", aiMedicineList);
// List<Map> docMedicineList = doctorMedicineService.getDocMedicine(connection);
// jsonObject.put("docMedicineList", docMedicineList);

View File

@ -1,47 +0,0 @@
//package com.rax.vital.v2.config;
//
//import com.rax.vital.v2.interceptor.WSChannelInterceptor;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.messaging.simp.config.ChannelRegistration;
//import org.springframework.messaging.simp.config.MessageBrokerRegistry;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
//import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
//import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
//import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
//
//@Configuration
//@EnableWebSocketMessageBroker
//public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer {
//
// @Autowired
// private WSChannelInterceptor wsChannelInterceptor;
//
// @Override
// public void registerStompEndpoints(StompEndpointRegistry registry) {
// registry.addEndpoint("/rax/chat", "/rax/SurgeryData")
// .setAllowedOrigins("*");
// }
//
// @Override
// public void configureMessageBroker(MessageBrokerRegistry registry) {
// // 第一个值表示客户端发送心跳消息的间隔时间第二个值表示服务端发送心跳消息的间隔时间
// long [] heartbeat = {60000, 60000};
// ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
// threadPoolTaskScheduler.initialize();
// registry.enableSimpleBroker("/topic").setTaskScheduler(threadPoolTaskScheduler).setHeartbeatValue(heartbeat);
// registry.setApplicationDestinationPrefixes("/front");
// registry.setUserDestinationPrefix("/topic/user");
// }
//
// /**
// * stomp未登录验证
// *
// * @param registration
// */
// @Override
// public void configureClientInboundChannel(ChannelRegistration registration) {
// registration.interceptors(wsChannelInterceptor);
// }
//
//}