Commit 305ac4e7 authored by hkl's avatar hkl

feat:1.新需求提交

parent 4c309cd1
...@@ -6,133 +6,155 @@ package org.jeecg.common.constant; ...@@ -6,133 +6,155 @@ package org.jeecg.common.constant;
*/ */
public interface CommonConstant { public interface CommonConstant {
/** /**
* 正常状态 * 正常状态
*/ */
Integer STATUS_NORMAL = 0; Integer STATUS_NORMAL = 0;
/** /**
* 禁用状态 * 禁用状态
*/ */
Integer STATUS_DISABLE = -1; Integer STATUS_DISABLE = -1;
/** /**
* 删除标志 * 删除标志
*/ */
Integer DEL_FLAG_1 = 1; Integer DEL_FLAG_1 = 1;
/** /**
* 未删除 * 未删除
*/ */
Integer DEL_FLAG_0 = 0; Integer DEL_FLAG_0 = 0;
/** /**
* 系统日志类型: 登录 * 系统日志类型: 登录
*/ */
int LOG_TYPE_1 = 1; int LOG_TYPE_1 = 1;
/** /**
* 系统日志类型: 操作 * 系统日志类型: 操作
*/ */
int LOG_TYPE_2 = 2; int LOG_TYPE_2 = 2;
/** /**
* 操作日志类型: 查询 * 操作日志类型: 查询
*/ */
int OPERATE_TYPE_1 = 1; int OPERATE_TYPE_1 = 1;
/** /**
* 操作日志类型: 添加 * 操作日志类型: 添加
*/ */
int OPERATE_TYPE_2 = 2; int OPERATE_TYPE_2 = 2;
/** /**
* 操作日志类型: 更新 * 操作日志类型: 更新
*/ */
int OPERATE_TYPE_3 = 3; int OPERATE_TYPE_3 = 3;
/** /**
* 操作日志类型: 删除 * 操作日志类型: 删除
*/ */
int OPERATE_TYPE_4 = 4; int OPERATE_TYPE_4 = 4;
/** /**
* 操作日志类型: 倒入 * 操作日志类型: 倒入
*/ */
int OPERATE_TYPE_5 = 5; int OPERATE_TYPE_5 = 5;
/** /**
* 操作日志类型: 导出 * 操作日志类型: 导出
*/ */
int OPERATE_TYPE_6 = 6; int OPERATE_TYPE_6 = 6;
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */ /**
* {@code 500 Server Error} (HTTP/1.0 - RFC 1945)
*/
Integer SC_INTERNAL_SERVER_ERROR_500 = 500; Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */ /**
* {@code 200 OK} (HTTP/1.0 - RFC 1945)
*/
Integer SC_OK_200 = 200; Integer SC_OK_200 = 200;
/**访问权限认证未通过 510*/ /**
Integer SC_JEECG_NO_AUTHZ=510; * 访问权限认证未通过 510
*/
/** 登录用户Shiro权限缓存KEY前缀 */ Integer SC_JEECG_NO_AUTHZ = 510;
public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.jeecg.config.shiro.ShiroRealm.authorizationCache:";
/** 登录用户Token令牌缓存KEY前缀 */ /**
String PREFIX_USER_TOKEN = "prefix_user_token:"; * 登录用户Shiro权限缓存KEY前缀
*/
public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.jeecg.config.shiro.ShiroRealm.authorizationCache:";
/**
* 登录用户Token令牌缓存KEY前缀
*/
String PREFIX_USER_TOKEN = "prefix_user_token:";
// /** Token缓存时间:3600秒即一小时 */ // /** Token缓存时间:3600秒即一小时 */
// int TOKEN_EXPIRE_TIME = 3600; // int TOKEN_EXPIRE_TIME = 3600;
/** 登录二维码 */ /**
String LOGIN_QRCODE_PRE = "QRCODELOGIN:"; * 登录二维码
String LOGIN_QRCODE = "LQ:"; */
/** 登录二维码token */ String LOGIN_QRCODE_PRE = "QRCODELOGIN:";
String LOGIN_QRCODE_TOKEN = "LQT:"; String LOGIN_QRCODE = "LQ:";
/**
* 登录二维码token
/** */
* 0:一级菜单 String LOGIN_QRCODE_TOKEN = "LQT:";
*/
Integer MENU_TYPE_0 = 0;
/** /**
* 1:子菜单 * 0:一级菜单
*/ */
Integer MENU_TYPE_1 = 1; Integer MENU_TYPE_0 = 0;
/** /**
* 2:按钮权限 * 1:子菜单
*/ */
Integer MENU_TYPE_2 = 2; Integer MENU_TYPE_1 = 1;
/**
/**通告对象类型(USER:指定用户,ALL:全体用户)*/ * 2:按钮权限
String MSG_TYPE_UESR = "USER"; */
String MSG_TYPE_ALL = "ALL"; Integer MENU_TYPE_2 = 2;
/**发布状态(0未发布,1已发布,2已撤销)*/ /**
String NO_SEND = "0"; * 通告对象类型(USER:指定用户,ALL:全体用户)
String HAS_SEND = "1"; */
String HAS_CANCLE = "2"; String MSG_TYPE_UESR = "USER";
String MSG_TYPE_ALL = "ALL";
/**阅读状态(0未读,1已读)*/
String HAS_READ_FLAG = "1"; /**
String NO_READ_FLAG = "0"; * 发布状态(0未发布,1已发布,2已撤销)
*/
/**优先级(L低,M中,H高)*/ String NO_SEND = "0";
String PRIORITY_L = "L"; String HAS_SEND = "1";
String PRIORITY_M = "M"; String HAS_CANCLE = "2";
String PRIORITY_H = "H";
/**
* 阅读状态(0未读,1已读)
*/
String HAS_READ_FLAG = "1";
String NO_READ_FLAG = "0";
/**
* 优先级(L低,M中,H高)
*/
String PRIORITY_L = "L";
String PRIORITY_M = "M";
String PRIORITY_H = "H";
/** /**
* 短信模板方式 0 .登录模板、1.注册模板、2.忘记密码模板 * 短信模板方式 0 .登录模板、1.注册模板、2.忘记密码模板
*/ */
String SMS_TPL_TYPE_0 = "0"; String SMS_TPL_TYPE_0 = "0";
String SMS_TPL_TYPE_1 = "1"; String SMS_TPL_TYPE_1 = "1";
String SMS_TPL_TYPE_2 = "2"; String SMS_TPL_TYPE_2 = "2";
/** /**
* 状态(0无效1有效) * 状态(0无效1有效)
*/ */
String STATUS_0 = "0"; String STATUS_0 = "0";
String STATUS_1 = "1"; String STATUS_1 = "1";
/** /**
* 同步工作流引擎1同步0不同步 * 同步工作流引擎1同步0不同步
*/ */
...@@ -144,7 +166,7 @@ public interface CommonConstant { ...@@ -144,7 +166,7 @@ public interface CommonConstant {
*/ */
String MSG_CATEGORY_1 = "1"; String MSG_CATEGORY_1 = "1";
String MSG_CATEGORY_2 = "2"; String MSG_CATEGORY_2 = "2";
/** /**
* 是否配置菜单的数据权限 1是0否 * 是否配置菜单的数据权限 1是0否
*/ */
...@@ -157,8 +179,15 @@ public interface CommonConstant { ...@@ -157,8 +179,15 @@ public interface CommonConstant {
Integer USER_UNFREEZE = 1; Integer USER_UNFREEZE = 1;
Integer USER_FREEZE = 2; Integer USER_FREEZE = 2;
Integer USER_QUIT = 3; Integer USER_QUIT = 3;
/**字典翻译文本后缀*/ /**
* 默认密码
*/
String DEFAULT_PASSWORD = "Gw@123456+";
/**
* 字典翻译文本后缀
*/
String DICT_TEXT_SUFFIX = "_dictText"; String DICT_TEXT_SUFFIX = "_dictText";
/** /**
...@@ -234,26 +263,46 @@ public interface CommonConstant { ...@@ -234,26 +263,46 @@ public interface CommonConstant {
Integer USER_IDENTITY_1 = 1; Integer USER_IDENTITY_1 = 1;
Integer USER_IDENTITY_2 = 2; Integer USER_IDENTITY_2 = 2;
/** sys_user 表 username 唯一键索引 */ /**
* sys_user 表 username 唯一键索引
*/
String SQL_INDEX_UNIQ_SYS_USER_USERNAME = "uniq_sys_user_username"; String SQL_INDEX_UNIQ_SYS_USER_USERNAME = "uniq_sys_user_username";
/** sys_user 表 work_no 唯一键索引 */ /**
* sys_user 表 work_no 唯一键索引
*/
String SQL_INDEX_UNIQ_SYS_USER_WORK_NO = "uniq_sys_user_work_no"; String SQL_INDEX_UNIQ_SYS_USER_WORK_NO = "uniq_sys_user_work_no";
/** sys_user 表 phone 唯一键索引 */ /**
* sys_user 表 phone 唯一键索引
*/
String SQL_INDEX_UNIQ_SYS_USER_PHONE = "uniq_sys_user_phone"; String SQL_INDEX_UNIQ_SYS_USER_PHONE = "uniq_sys_user_phone";
/** 达梦数据库升提示。违反表[SYS_USER]唯一性约束 */ /**
* 达梦数据库升提示。违反表[SYS_USER]唯一性约束
*/
String SQL_INDEX_UNIQ_SYS_USER = "唯一性约束"; String SQL_INDEX_UNIQ_SYS_USER = "唯一性约束";
/** sys_user 表 email 唯一键索引 */ /**
* sys_user 表 email 唯一键索引
*/
String SQL_INDEX_UNIQ_SYS_USER_EMAIL = "uniq_sys_user_email"; String SQL_INDEX_UNIQ_SYS_USER_EMAIL = "uniq_sys_user_email";
/** sys_quartz_job 表 job_class_name 唯一键索引 */ /**
* sys_quartz_job 表 job_class_name 唯一键索引
*/
String SQL_INDEX_UNIQ_JOB_CLASS_NAME = "uniq_job_class_name"; String SQL_INDEX_UNIQ_JOB_CLASS_NAME = "uniq_job_class_name";
/** sys_position 表 code 唯一键索引 */ /**
* sys_position 表 code 唯一键索引
*/
String SQL_INDEX_UNIQ_CODE = "uniq_code"; String SQL_INDEX_UNIQ_CODE = "uniq_code";
/** sys_role 表 code 唯一键索引 */ /**
* sys_role 表 code 唯一键索引
*/
String SQL_INDEX_UNIQ_SYS_ROLE_CODE = "uniq_sys_role_role_code"; String SQL_INDEX_UNIQ_SYS_ROLE_CODE = "uniq_sys_role_role_code";
/** sys_depart 表 code 唯一键索引 */ /**
* sys_depart 表 code 唯一键索引
*/
String SQL_INDEX_UNIQ_DEPART_ORG_CODE = "uniq_depart_org_code"; String SQL_INDEX_UNIQ_DEPART_ORG_CODE = "uniq_depart_org_code";
/** sys_category 表 code 唯一键索引 */ /**
* sys_category 表 code 唯一键索引
*/
String SQL_INDEX_UNIQ_CATEGORY_CODE = "idx_sc_code"; String SQL_INDEX_UNIQ_CATEGORY_CODE = "idx_sc_code";
/** /**
* 在线聊天 是否为默认分组 * 在线聊天 是否为默认分组
...@@ -293,7 +342,7 @@ public interface CommonConstant { ...@@ -293,7 +342,7 @@ public interface CommonConstant {
* 公文文档上传自定义路径 * 公文文档上传自定义路径
*/ */
String UPLOAD_CUSTOM_PATH_OFFICIAL = "officialdoc"; String UPLOAD_CUSTOM_PATH_OFFICIAL = "officialdoc";
/** /**
* 公文文档下载自定义路径 * 公文文档下载自定义路径
*/ */
String DOWNLOAD_CUSTOM_PATH_OFFICIAL = "officaldown"; String DOWNLOAD_CUSTOM_PATH_OFFICIAL = "officaldown";
...@@ -301,8 +350,8 @@ public interface CommonConstant { ...@@ -301,8 +350,8 @@ public interface CommonConstant {
/** /**
* WPS存储值类别(1 code文号 2 text(WPS模板还是公文发文模板)) * WPS存储值类别(1 code文号 2 text(WPS模板还是公文发文模板))
*/ */
String WPS_TYPE_1="1"; String WPS_TYPE_1 = "1";
String WPS_TYPE_2="2"; String WPS_TYPE_2 = "2";
/**===============================================================================================*/ /**===============================================================================================*/
...@@ -313,9 +362,13 @@ public interface CommonConstant { ...@@ -313,9 +362,13 @@ public interface CommonConstant {
String X_ACCESS_TOKEN = "X-Access-Token"; String X_ACCESS_TOKEN = "X-Access-Token";
String X_SIGN = "X-Sign"; String X_SIGN = "X-Sign";
String X_TIMESTAMP = "X-TIMESTAMP"; String X_TIMESTAMP = "X-TIMESTAMP";
/** 租户请求头 更名为:X-Tenant-Id */ /**
* 租户请求头 更名为:X-Tenant-Id
*/
String TENANT_ID = "X-Tenant-Id"; String TENANT_ID = "X-Tenant-Id";
/**===============================================================================================*/ /**
* ===============================================================================================
*/
String TOKEN_IS_INVALID_MSG = "Token失效,请重新登录!"; String TOKEN_IS_INVALID_MSG = "Token失效,请重新登录!";
String X_FORWARDED_SCHEME = "X-Forwarded-Scheme"; String X_FORWARDED_SCHEME = "X-Forwarded-Scheme";
...@@ -340,39 +393,63 @@ public interface CommonConstant { ...@@ -340,39 +393,63 @@ public interface CommonConstant {
*/ */
String THIRD_SYNC_TO_LOCAL = "SYNC_TO_LOCAL"; String THIRD_SYNC_TO_LOCAL = "SYNC_TO_LOCAL";
/** 系统通告消息状态:0=未发布 */ /**
* 系统通告消息状态:0=未发布
*/
String ANNOUNCEMENT_SEND_STATUS_0 = "0"; String ANNOUNCEMENT_SEND_STATUS_0 = "0";
/** 系统通告消息状态:1=已发布 */ /**
* 系统通告消息状态:1=已发布
*/
String ANNOUNCEMENT_SEND_STATUS_1 = "1"; String ANNOUNCEMENT_SEND_STATUS_1 = "1";
/** 系统通告消息状态:2=已撤销 */ /**
* 系统通告消息状态:2=已撤销
*/
String ANNOUNCEMENT_SEND_STATUS_2 = "2"; String ANNOUNCEMENT_SEND_STATUS_2 = "2";
/**ONLINE 报表权限用 从request中获取地址栏后的参数*/ /**
String ONL_REP_URL_PARAM_STR="onlRepUrlParamStr"; * ONLINE 报表权限用 从request中获取地址栏后的参数
*/
String ONL_REP_URL_PARAM_STR = "onlRepUrlParamStr";
/**POST请求*/ /**
* POST请求
*/
String HTTP_POST = "POST"; String HTTP_POST = "POST";
/**PUT请求*/ /**
* PUT请求
*/
String HTTP_PUT = "PUT"; String HTTP_PUT = "PUT";
/**PATCH请求*/ /**
* PATCH请求
*/
String HTTP_PATCH = "PATCH"; String HTTP_PATCH = "PATCH";
/**未知的*/ /**
* 未知的
*/
String UNKNOWN = "unknown"; String UNKNOWN = "unknown";
/**字符串http*/ /**
* 字符串http
*/
String STR_HTTP = "http"; String STR_HTTP = "http";
/**String 类型的空值*/ /**
* String 类型的空值
*/
String STRING_NULL = "null"; String STRING_NULL = "null";
/**前端vue3版本Header参数名*/ /**
String VERSION="X-Version"; * 前端vue3版本Header参数名
*/
String VERSION = "X-Version";
/**存储在线程变量里的动态表名*/ /**
String DYNAMIC_TABLE_NAME="DYNAMIC_TABLE_NAME"; * 存储在线程变量里的动态表名
*/
String DYNAMIC_TABLE_NAME = "DYNAMIC_TABLE_NAME";
/** /**
* http:// http协议 * http:// http协议
*/ */
...@@ -382,10 +459,14 @@ public interface CommonConstant { ...@@ -382,10 +459,14 @@ public interface CommonConstant {
* https:// https协议 * https:// https协议
*/ */
String HTTPS_PROTOCOL = "https://"; String HTTPS_PROTOCOL = "https://";
/** 部门表唯一key,id */ /**
* 部门表唯一key,id
*/
String DEPART_KEY_ID = "id"; String DEPART_KEY_ID = "id";
/** 部门表唯一key,orgCode */ /**
* 部门表唯一key,orgCode
*/
String DEPART_KEY_ORG_CODE = "orgCode"; String DEPART_KEY_ORG_CODE = "orgCode";
/** /**
...@@ -418,7 +499,9 @@ public interface CommonConstant { ...@@ -418,7 +499,9 @@ public interface CommonConstant {
*/ */
String DATA_LOG_TYPE_JSON = "json"; String DATA_LOG_TYPE_JSON = "json";
/** 消息模板:markdown */ /**
* 消息模板:markdown
*/
String MSG_TEMPLATE_TYPE_MD = "5"; String MSG_TEMPLATE_TYPE_MD = "5";
/** /**
...@@ -456,38 +539,38 @@ public interface CommonConstant { ...@@ -456,38 +539,38 @@ public interface CommonConstant {
*/ */
Integer BPM_USER_EVENT_ADD = 1; Integer BPM_USER_EVENT_ADD = 1;
/** /**
* 离职事件 * 离职事件
*/ */
Integer BPM_USER_EVENT_LEVEL = 2; Integer BPM_USER_EVENT_LEVEL = 2;
/** /**
* 用户租户状态(正常/已通过审核的) * 用户租户状态(正常/已通过审核的)
*/ */
String USER_TENANT_NORMAL = "1"; String USER_TENANT_NORMAL = "1";
/** /**
* 用户租户状态(离职) * 用户租户状态(离职)
*/ */
String USER_TENANT_QUIT = "2"; String USER_TENANT_QUIT = "2";
/** /**
* 用户租户状态(审核中) * 用户租户状态(审核中)
*/ */
String USER_TENANT_UNDER_REVIEW = "3"; String USER_TENANT_UNDER_REVIEW = "3";
/** /**
* 用户租户状态(拒绝) * 用户租户状态(拒绝)
*/ */
String USER_TENANT_REFUSE = "4"; String USER_TENANT_REFUSE = "4";
/** /**
* 不是叶子节点 * 不是叶子节点
*/ */
Integer NOT_LEAF = 0; Integer NOT_LEAF = 0;
/** /**
* 是叶子节点 * 是叶子节点
*/ */
Integer IS_LEAF = 1; Integer IS_LEAF = 1;
} }
...@@ -9,6 +9,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor; ...@@ -9,6 +9,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
...@@ -40,6 +41,7 @@ import java.util.stream.Collectors; ...@@ -40,6 +41,7 @@ import java.util.stream.Collectors;
@EnableSwagger2 //开启 Swagger2 @EnableSwagger2 //开启 Swagger2
@EnableKnife4j //开启 knife4j,可以不写 @EnableKnife4j //开启 knife4j,可以不写
@Import(BeanValidatorPluginsConfiguration.class) @Import(BeanValidatorPluginsConfiguration.class)
@Profile("!prod")
public class Swagger2Config implements WebMvcConfigurer { public class Swagger2Config implements WebMvcConfigurer {
/** /**
......
...@@ -583,7 +583,7 @@ public class AnalysisAlgorithm { ...@@ -583,7 +583,7 @@ public class AnalysisAlgorithm {
} }
// 2.循环遍历单元设备中心里程落在检查项目【开始-结束】这个区间视为这个区间的单元设备 // 2.循环遍历单元设备测点里程落在单元【开始-结束】这个区间视为这个区间的单元设备检查数据
List<MovementAdditiveInfoUnitDeviceMap> additiveInfoUnitMaps = new ArrayList<>(); List<MovementAdditiveInfoUnitDeviceMap> additiveInfoUnitMaps = new ArrayList<>();
int analysisType = analysisBatch.getAnalysisType(); int analysisType = analysisBatch.getAnalysisType();
for (Map<String, Object> unitDevice : unitDeviceList) { for (Map<String, Object> unitDevice : unitDeviceList) {
...@@ -1379,9 +1379,10 @@ public class AnalysisAlgorithm { ...@@ -1379,9 +1379,10 @@ public class AnalysisAlgorithm {
/** /**
* 创建轨检车测点得分 * 创建轨检车测点得分
*/ */
private AnalysisBatchUnitDevicePointScore createRailVehicleCheckTransfinitePointScore(AnalysisBatch private AnalysisBatchUnitDevicePointScore createRailVehicleCheckTransfinitePointScore(AnalysisBatch analysisBatch,
analysisBatch, List<MovementOverReport> currentUnitDeviceOverReportList, String overrunType, BigDecimal List<MovementOverReport> currentUnitDeviceOverReportList,
weightValue) { String overrunType,
BigDecimal weightValue) {
if (ObjectUtil.isEmpty(currentUnitDeviceOverReportList)) { if (ObjectUtil.isEmpty(currentUnitDeviceOverReportList)) {
return null; return null;
} }
......
...@@ -4,7 +4,9 @@ import org.jeecg.common.constant.CommonConstant; ...@@ -4,7 +4,9 @@ import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.PasswordUtil;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.base.service.BaseCommonService; import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.modules.iam.dto.IamResponseDTO; import org.jeecg.modules.iam.dto.IamResponseDTO;
import org.jeecg.modules.iam.req.IamReq; import org.jeecg.modules.iam.req.IamReq;
...@@ -25,6 +27,8 @@ import org.springframework.stereotype.Service; ...@@ -25,6 +27,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import static org.jeecg.common.constant.CommonConstant.DEFAULT_PASSWORD;
@Service @Service
public class IamServiceImpl implements IamService { public class IamServiceImpl implements IamService {
...@@ -76,9 +80,14 @@ public class IamServiceImpl implements IamService { ...@@ -76,9 +80,14 @@ public class IamServiceImpl implements IamService {
currentUser = new SysUser(); currentUser = new SysUser();
currentUser.setUsername(loginInfo.getUserCode()); currentUser.setUsername(loginInfo.getUserCode());
currentUser.setRealname(loginInfo.getUserName()); currentUser.setRealname(loginInfo.getUserName());
currentUser.setPassword("123456");
currentUser.setWorkNo(loginInfo.getUserCode()); currentUser.setWorkNo(loginInfo.getUserCode());
currentUser.setDelFlag(0); String salt = oConvertUtils.randomGen(8);
currentUser.setSalt(salt); //加盐
String passwordEncode = PasswordUtil.encrypt(loginInfo.getUserCode(), DEFAULT_PASSWORD, salt);
currentUser.setPassword(passwordEncode);// 默认密码
currentUser.setUserIdentity(1);// 正式员工身份
currentUser.setWorkNo(loginInfo.getUserCode());
currentUser.setDelFlag(CommonConstant.DEL_FLAG_0);
currentUser.setLoginTenantId(0); currentUser.setLoginTenantId(0);
currentUser.setStatus(CommonConstant.USER_UNFREEZE); currentUser.setStatus(CommonConstant.USER_UNFREEZE);
sysUserService.save(currentUser); sysUserService.save(currentUser);
...@@ -94,6 +103,7 @@ public class IamServiceImpl implements IamService { ...@@ -94,6 +103,7 @@ public class IamServiceImpl implements IamService {
SysUserRole sysUserRole = new SysUserRole(); SysUserRole sysUserRole = new SysUserRole();
sysUserRole.setRoleId(role.getId()); sysUserRole.setRoleId(role.getId());
sysUserRole.setUserId(currentUser.getId()); sysUserRole.setUserId(currentUser.getId());
sysUserRole.setTenantId(0);
sysUserRoleService.save(sysUserRole); sysUserRoleService.save(sysUserRole);
} }
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
...@@ -15,6 +16,7 @@ import org.jeecg.modules.maintenanceWork.entity.WorkBatch; ...@@ -15,6 +16,7 @@ import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail; import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchService; import org.jeecg.modules.maintenanceWork.service.IWorkBatchService;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchDetailModifyVO; import org.jeecg.modules.maintenanceWork.vo.WorkBatchDetailModifyVO;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchUserVO;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO; import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchDetailService; import org.jeecg.modules.maintenanceWork.service.IWorkBatchDetailService;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchDetailModifyService; import org.jeecg.modules.maintenanceWork.service.IWorkBatchDetailModifyService;
...@@ -57,6 +59,18 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe ...@@ -57,6 +59,18 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
return Result.OK(pageData); return Result.OK(pageData);
} }
@AutoLog(value = "维修作业管理-作业计划批次管理-获取派工用户")
@ApiOperation(value = "维修作业管理-作业计划批次管理-获取派工用户", notes = "维修作业管理-作业计划批次管理-获取派工用户")
@GetMapping(value = "/listUser")
@ApiParam(name = "query", value = "查询名称/账号", required = true)
public Result<List<WorkBatchUserVO>> listUser(String query) {
List<WorkBatchUserVO> userList = this.service.listUser(query);
return Result.OK(userList);
}
@AutoLog(value = "维修作业管理-作业计划批次管理-维修作业管理页面新增") @AutoLog(value = "维修作业管理-作业计划批次管理-维修作业管理页面新增")
@ApiOperation(value = "维修作业管理-作业计划批次管理-维修作业管理页面新增", notes = "维修作业管理-作业计划批次管理-维修作业管理页面新增") @ApiOperation(value = "维修作业管理-作业计划批次管理-维修作业管理页面新增", notes = "维修作业管理-作业计划批次管理-维修作业管理页面新增")
@PostMapping(value = "/saveRecord") @PostMapping(value = "/saveRecord")
...@@ -76,6 +90,7 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe ...@@ -76,6 +90,7 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
return Result.OK("操作成功"); return Result.OK("操作成功");
} }
@AutoLog(value = "维修作业管理-作业计划批次管理-超限页面新增") @AutoLog(value = "维修作业管理-作业计划批次管理-超限页面新增")
@ApiOperation(value = "维修作业管理-作业计划批次管理-超限页面新增", notes = "维修作业管理-作业计划批次管理-超限页面新增") @ApiOperation(value = "维修作业管理-作业计划批次管理-超限页面新增", notes = "维修作业管理-作业计划批次管理-超限页面新增")
@PostMapping(value = "/transfiniteSaveRecord") @PostMapping(value = "/transfiniteSaveRecord")
......
...@@ -6,6 +6,7 @@ import org.jeecg.modules.maintenanceWork.dto.UnitDeviceDTO; ...@@ -6,6 +6,7 @@ import org.jeecg.modules.maintenanceWork.dto.UnitDeviceDTO;
import org.jeecg.modules.maintenanceWork.dto.WorkBatchDTO; import org.jeecg.modules.maintenanceWork.dto.WorkBatchDTO;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch; import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchUserVO;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO; import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
import org.jeecg.modules.unitDevice.dto.CaseReportCheckDataDTO; import org.jeecg.modules.unitDevice.dto.CaseReportCheckDataDTO;
import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO; import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO;
...@@ -32,4 +33,6 @@ public interface WorkBatchMapper extends BaseMapper<WorkBatch> { ...@@ -32,4 +33,6 @@ public interface WorkBatchMapper extends BaseMapper<WorkBatch> {
Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto); Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto);
List<ToDoDetailVO> getTodoList(String currentUserId); List<ToDoDetailVO> getTodoList(String currentUserId);
List<WorkBatchUserVO> listUser(String query);
} }
...@@ -167,4 +167,19 @@ ...@@ -167,4 +167,19 @@
AND t1.create_by = #{currentUserId} AND t1.create_by = #{currentUserId}
</if> </if>
</select> </select>
<select id="listUser" resultType="org.jeecg.modules.maintenanceWork.vo.WorkBatchUserVO">
SELECT
t1.id user_id,
t1.username,
t1.realname,
t1.user_identity,
t3.role_name
FROM
sys_user t1
INNER JOIN sys_user_role t2 ON t2.user_id = t1.id
INNER JOIN sys_role t3 ON t3.id = t2.role_id
WHERE
t1.del_flag = 0
AND (t1.username LIKE concat('%',#{query},'%') OR t1.realname LIKE concat('%',#{query},'%'))
</select>
</mapper> </mapper>
...@@ -5,6 +5,7 @@ import org.jeecg.modules.homePage.vo.ToDoDetailVO; ...@@ -5,6 +5,7 @@ import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.jeecg.modules.maintenanceWork.dto.*; import org.jeecg.modules.maintenanceWork.dto.*;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch; import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchUserVO;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO; import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
import org.jeecg.modules.unitDevice.dto.CaseReportCheckDataDTO; import org.jeecg.modules.unitDevice.dto.CaseReportCheckDataDTO;
import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO; import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO;
...@@ -41,4 +42,6 @@ public interface IWorkBatchService extends IService<WorkBatch> { ...@@ -41,4 +42,6 @@ public interface IWorkBatchService extends IService<WorkBatch> {
Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto); Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto);
List<ToDoDetailVO> getTodoList(String currentUserId); List<ToDoDetailVO> getTodoList(String currentUserId);
List<WorkBatchUserVO> listUser(String query);
} }
...@@ -27,6 +27,7 @@ import org.jeecg.modules.maintenanceWork.mapper.WorkBatchDetailModifyMapper; ...@@ -27,6 +27,7 @@ import org.jeecg.modules.maintenanceWork.mapper.WorkBatchDetailModifyMapper;
import org.jeecg.modules.maintenanceWork.mapper.WorkBatchMapper; import org.jeecg.modules.maintenanceWork.mapper.WorkBatchMapper;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchService; import org.jeecg.modules.maintenanceWork.service.IWorkBatchService;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchDetailVO; import org.jeecg.modules.maintenanceWork.vo.WorkBatchDetailVO;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchUserVO;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO; import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO; import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO;
import org.jeecg.modules.unitDevice.vo.CaseReportWorkBatchVO; import org.jeecg.modules.unitDevice.vo.CaseReportWorkBatchVO;
...@@ -294,5 +295,10 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -294,5 +295,10 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
return this.baseMapper.getTodoList(currentUserId); return this.baseMapper.getTodoList(currentUserId);
} }
@Override
public List<WorkBatchUserVO> listUser(String query) {
return this.baseMapper.listUser(query);
}
} }
package org.jeecg.modules.maintenanceWork.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* <p>
* 维修作业管理-作业计划批次管理表
* </p>
*
* @author hkl
* @since 2023-08-09
*/
@Data
@ApiModel(value = "WorkBatchUserVO对象", description = "维修作业管理-派工用户")
public class WorkBatchUserVO {
private static final long serialVersionUID = 1L;
private String id;
}
...@@ -261,7 +261,7 @@ public class CommonController { ...@@ -261,7 +261,7 @@ public class CommonController {
response.addHeader("Cache-Control", "no-cache"); response.addHeader("Cache-Control", "no-cache");
inputStream = classPathResource.getInputStream(); inputStream = classPathResource.getInputStream();
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
byte[] buf = new byte[4096]; byte[] buf = new byte[1024];
int len; int len;
while ((len = inputStream.read(buf)) > 0) { while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len); outputStream.write(buf, 0, len);
......
...@@ -121,6 +121,14 @@ public class LoginController { ...@@ -121,6 +121,14 @@ public class LoginController {
return result; return result;
} }
//1.5 正式员工只能走AO
Integer userIdentity = sysUser.getUserIdentity();
if (1 == userIdentity) {
result.error500("正式员工请从OA登录");
return result;
}
//2. 校验用户名或密码是否正确 //2. 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt()); String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
String syspassword = sysUser.getPassword(); String syspassword = sysUser.getPassword();
...@@ -132,6 +140,7 @@ public class LoginController { ...@@ -132,6 +140,7 @@ public class LoginController {
return result; return result;
} }
//用户登录信息 //用户登录信息
userInfo(sysUser, result); userInfo(sysUser, result);
//update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码 //update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码
......
package org.jeecg.modules.system.controller; package org.jeecg.modules.system.controller;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.sax.handler.RowHandler;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -10,25 +13,30 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -10,25 +13,30 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.aspect.annotation.PermissionData; import org.jeecg.common.aspect.annotation.PermissionData;
import org.jeecg.common.config.TenantContext; import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.config.mybatisPlus.MybatisPlusSaasConfig; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.*; import org.jeecg.common.util.*;
import org.jeecg.config.mybatisPlus.MybatisPlusSaasConfig;
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.modules.system.entity.*; import org.jeecg.modules.system.entity.*;
import org.jeecg.modules.system.model.DepartIdModel; import org.jeecg.modules.system.model.DepartIdModel;
import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.model.SysUserSysDepartModel;
...@@ -49,12 +57,16 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -49,12 +57,16 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.jeecg.common.constant.CommonConstant.DEFAULT_PASSWORD;
/** /**
* <p> * <p>
* 用户表 前端控制器 * 用户表 前端控制器
...@@ -187,33 +199,33 @@ public class SysUserController { ...@@ -187,33 +199,33 @@ public class SysUserController {
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
LambdaQueryWrapper<SysUser> lambdaQuery = Wrappers.lambdaQuery(); LambdaQueryWrapper<SysUser> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.eq(SysUser::getUsername, user.getUsername()); lambdaQuery.eq(SysUser::getUsername, user.getUsername());
lambdaQuery.eq(SysUser::getDelFlag,0); lambdaQuery.eq(SysUser::getDelFlag, 0);
List<SysUser> list = sysUserService.list(lambdaQuery); List<SysUser> list = sysUserService.list(lambdaQuery);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
return Result.error("登录账号已存在"); return Result.error("登录账号已存在");
} }
LambdaQueryWrapper<SysUser> workNoQuery = Wrappers.lambdaQuery(); // LambdaQueryWrapper<SysUser> workNoQuery = Wrappers.lambdaQuery();
workNoQuery.eq(SysUser::getWorkNo, user.getWorkNo()); // workNoQuery.eq(SysUser::getWorkNo, user.getWorkNo());
workNoQuery.eq(SysUser::getDelFlag,0); // workNoQuery.eq(SysUser::getDelFlag, 0);
List<SysUser> workNoList = sysUserService.list(workNoQuery); // List<SysUser> workNoList = sysUserService.list(workNoQuery);
if (workNoList != null && workNoList.size() > 0) { // if (workNoList != null && workNoList.size() > 0) {
return Result.error("工号已存在"); // return Result.error("工号已存在");
} // }
LambdaQueryWrapper<SysUser> phoneQuery = Wrappers.lambdaQuery(); // LambdaQueryWrapper<SysUser> phoneQuery = Wrappers.lambdaQuery();
phoneQuery.eq(SysUser::getPhone, user.getPhone()); // phoneQuery.eq(SysUser::getPhone, user.getPhone());
phoneQuery.eq(SysUser::getDelFlag,0); // phoneQuery.eq(SysUser::getDelFlag, 0);
List<SysUser> phoneList = sysUserService.list(phoneQuery); // List<SysUser> phoneList = sysUserService.list(phoneQuery);
if (phoneList != null && phoneList.size() > 0) { // if (phoneList != null && phoneList.size() > 0) {
return Result.error("手机号码已存在"); // return Result.error("手机号码已存在");
} // }
LambdaQueryWrapper<SysUser> emailQuery = Wrappers.lambdaQuery(); // LambdaQueryWrapper<SysUser> emailQuery = Wrappers.lambdaQuery();
emailQuery.eq(SysUser::getEmail, user.getEmail()); // emailQuery.eq(SysUser::getEmail, user.getEmail());
emailQuery.eq(SysUser::getDelFlag,0); // emailQuery.eq(SysUser::getDelFlag, 0);
List<SysUser> emailList = sysUserService.list(emailQuery); // List<SysUser> emailList = sysUserService.list(emailQuery);
if (emailList != null && emailList.size() > 0) { // if (emailList != null && emailList.size() > 0) {
return Result.error("邮箱已存在"); // return Result.error("邮箱已存在");
} // }
user.setCreateTime(new Date());//设置创建时间 user.setCreateTime(new Date());//设置创建时间
String salt = oConvertUtils.randomGen(8); String salt = oConvertUtils.randomGen(8);
user.setSalt(salt); user.setSalt(salt);
...@@ -226,6 +238,7 @@ public class SysUserController { ...@@ -226,6 +238,7 @@ public class SysUserController {
// 保存用户走一个service 保证事务 // 保存用户走一个service 保证事务
//获取租户ids //获取租户ids
String relTenantIds = jsonObject.getString("relTenantIds"); String relTenantIds = jsonObject.getString("relTenantIds");
relTenantIds = "0";
sysUserService.saveUser(user, selectedRoles, selectedDeparts, relTenantIds); sysUserService.saveUser(user, selectedRoles, selectedDeparts, relTenantIds);
baseCommonService.addLog("添加用户,username: " + user.getUsername(), CommonConstant.LOG_TYPE_2, 2); baseCommonService.addLog("添加用户,username: " + user.getUsername(), CommonConstant.LOG_TYPE_2, 2);
result.success("添加成功!"); result.success("添加成功!");
...@@ -250,37 +263,37 @@ public class SysUserController { ...@@ -250,37 +263,37 @@ public class SysUserController {
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
LambdaQueryWrapper<SysUser> lambdaQuery = Wrappers.lambdaQuery(); LambdaQueryWrapper<SysUser> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.eq(SysUser::getUsername, user.getUsername()); lambdaQuery.eq(SysUser::getUsername, user.getUsername());
lambdaQuery.eq(SysUser::getDelFlag,0); lambdaQuery.eq(SysUser::getDelFlag, 0);
lambdaQuery.ne(SysUser::getId,user.getId()); lambdaQuery.ne(SysUser::getId, user.getId());
List<SysUser> list = sysUserService.list(lambdaQuery); List<SysUser> list = sysUserService.list(lambdaQuery);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
return Result.error("登录账号已存在"); return Result.error("登录账号已存在");
} }
LambdaQueryWrapper<SysUser> workNoQuery = Wrappers.lambdaQuery(); // LambdaQueryWrapper<SysUser> workNoQuery = Wrappers.lambdaQuery();
workNoQuery.eq(SysUser::getWorkNo, user.getWorkNo()); // workNoQuery.eq(SysUser::getWorkNo, user.getWorkNo());
workNoQuery.eq(SysUser::getDelFlag,0); // workNoQuery.eq(SysUser::getDelFlag, 0);
workNoQuery.ne(SysUser::getId,user.getId()); // workNoQuery.ne(SysUser::getId, user.getId());
List<SysUser> workNoList = sysUserService.list(workNoQuery); // List<SysUser> workNoList = sysUserService.list(workNoQuery);
if (workNoList != null && workNoList.size() > 0) { // if (workNoList != null && workNoList.size() > 0) {
return Result.error("工号已存在"); // return Result.error("工号已存在");
} // }
LambdaQueryWrapper<SysUser> phoneQuery = Wrappers.lambdaQuery(); // LambdaQueryWrapper<SysUser> phoneQuery = Wrappers.lambdaQuery();
phoneQuery.eq(SysUser::getPhone, user.getPhone()); // phoneQuery.eq(SysUser::getPhone, user.getPhone());
phoneQuery.eq(SysUser::getDelFlag,0); // phoneQuery.eq(SysUser::getDelFlag, 0);
phoneQuery.ne(SysUser::getId,user.getId()); // phoneQuery.ne(SysUser::getId, user.getId());
List<SysUser> phoneList = sysUserService.list(phoneQuery); // List<SysUser> phoneList = sysUserService.list(phoneQuery);
if (phoneList != null && phoneList.size() > 0) { // if (phoneList != null && phoneList.size() > 0) {
return Result.error("手机号码已存在"); // return Result.error("手机号码已存在");
} // }
LambdaQueryWrapper<SysUser> emailQuery = Wrappers.lambdaQuery(); // LambdaQueryWrapper<SysUser> emailQuery = Wrappers.lambdaQuery();
emailQuery.eq(SysUser::getEmail, user.getEmail()); // emailQuery.eq(SysUser::getEmail, user.getEmail());
emailQuery.eq(SysUser::getDelFlag,0); // emailQuery.eq(SysUser::getDelFlag, 0);
emailQuery.ne(SysUser::getId,user.getId()); // emailQuery.ne(SysUser::getId, user.getId());
List<SysUser> emailList = sysUserService.list(emailQuery); // List<SysUser> emailList = sysUserService.list(emailQuery);
if (emailList != null && emailList.size() > 0) { // if (emailList != null && emailList.size() > 0) {
return Result.error("邮箱已存在"); // return Result.error("邮箱已存在");
} // }
user.setUpdateTime(new Date()); user.setUpdateTime(new Date());
//String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt()); //String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
user.setPassword(sysUser.getPassword()); user.setPassword(sysUser.getPassword());
...@@ -295,6 +308,7 @@ public class SysUserController { ...@@ -295,6 +308,7 @@ public class SysUserController {
// 修改用户走一个service 保证事务 // 修改用户走一个service 保证事务
//获取租户ids //获取租户ids
String relTenantIds = jsonObject.getString("relTenantIds"); String relTenantIds = jsonObject.getString("relTenantIds");
relTenantIds = "0";
sysUserService.editUser(user, roles, departs, relTenantIds); sysUserService.editUser(user, roles, departs, relTenantIds);
result.success("修改成功!"); result.success("修改成功!");
} }
...@@ -579,6 +593,188 @@ public class SysUserController { ...@@ -579,6 +593,188 @@ public class SysUserController {
return mv; return mv;
} }
@Resource
private ISysRoleService sysRoleService;
@PostMapping(value = "/importUser")
@AutoLog(value = "导入用户")
@ApiOperation(value = "用户管理-导入用户", notes = "用户管理-导入用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "文件"),
})
public Result<String> importUser(MultipartFile file) {
List<SysRole> roleList = sysRoleService.list();
try (InputStream inputStream = file.getInputStream()) {
// 1.excel导入List<List<Object>> 中
CurrentRowHandler currentRowHandler = new CurrentRowHandler(roleList);
ExcelUtil.readBySax(inputStream, 0, currentRowHandler);
// 2.判断是否处理成功
if (!currentRowHandler.disposeMark) {
throw new JeecgBootException(currentRowHandler.msg.toString());
}
// 3.直接保存
sysUserService.saveBatch(currentRowHandler.sysUserList);
sysUserRoleService.saveBatch(currentRowHandler.sysUserRoleList);
} catch (IOException e) {
throw new JeecgBootException(e);
}
return Result.ok("操作成功");
}
/**
* 当前行处理器
*/
private static class CurrentRowHandler implements RowHandler {
/**
* 处理结果
* ture:处理成功
* false: 处理失败
*/
public boolean disposeMark;
public StringBuffer msg;
/**
* 角色code映射
*/
private Map<String, String> roleMap;
/**
* 用户列表
*/
public List<SysUser> sysUserList;
/**
* 用户角色id
*/
public List<SysUserRole> sysUserRoleList;
public CurrentRowHandler(List<SysRole> roles) {
this.disposeMark = true;
this.msg = new StringBuffer();
// 将角色映射表
this.roleMap = new HashMap<>();
for (SysRole role : roles) {
roleMap.put(role.getRoleName(), role.getId());
}
}
@Override
public void handle(int sheetIndex, long rowIndex, List<Object> rowList) {
// 跳过第一行
if (rowIndex == 0) {
return;
}
// 名称=真实姓名
String realName = Convert.toStr(rowList.get(0));
if (ObjectUtil.isEmpty(realName)) {
this.disposeMark = false;
msg.append("第【" + rowIndex + 1 + "】行名称不能为空");
}
// 工号 = 用户账号
String username = Convert.toStr(rowList.get(1));
if (ObjectUtil.isEmpty(username)) {
this.disposeMark = false;
msg.append("第【" + rowIndex + 1 + "】行工号不能为空");
}
// 身份 中文
String userIdentityStr = Convert.toStr(rowList.get(2));
Integer userIdentity = 1;
if (ObjectUtil.isEmpty(userIdentityStr)) {
this.disposeMark = false;
msg.append("第【" + rowIndex + 1 + "】行身份不能为空");
} else if ("正式".equals(userIdentityStr)) {
userIdentity = 1;
} else if ("委外".equals(userIdentityStr)) {
userIdentity = 2;
} else {
msg.append("第【" + rowIndex + 1 + "】行身份识别失败");
}
// 角色名称
String roleName = Convert.toStr(rowList.get(3));
String roleId = "";
if (ObjectUtil.isEmpty(roleName)) {
this.disposeMark = false;
msg.append("第【" + rowIndex + 1 + "】行角色不能为空");
} else if (roleMap.containsKey(roleName)) {
roleId = roleMap.get(roleName);
} else {
msg.append("第【" + rowIndex + 1 + "】行角色识别失败");
}
// 添加换行符号
msg.append("\n\r");
// 构建用户
SysUser currentUser = new SysUser();
currentUser.setId(IdWorker.getIdStr());
currentUser.setUsername(username);
currentUser.setRealname(roleName);
currentUser.setUserIdentity(userIdentity);// 正式员工身份
currentUser.setWorkNo(username);
currentUser.setDelFlag(0);
currentUser.setLoginTenantId(0);
currentUser.setStatus(CommonConstant.USER_UNFREEZE);
String salt = oConvertUtils.randomGen(8);
currentUser.setSalt(salt); //加盐
String passwordEncode = PasswordUtil.encrypt(username, DEFAULT_PASSWORD, salt);
currentUser.setPassword(passwordEncode);// 默认密码
sysUserList.add(currentUser);
// 构建用户和角色关联
SysUserRole currentUserRole = new SysUserRole();
currentUserRole.setId(IdWorker.getIdStr());
currentUserRole.setUserId(currentUser.getId());
currentUserRole.setRoleId(roleId);
sysUserRoleList.add(currentUserRole);
}
// @Override
// public void handle(int sheetIndex, int rowIndex, List<Object> rowList) {
// // 跳过第一行
// if (rowIndex == 0) {
// return;
// }
//
// // 创建第一个JSON对象
// ObjectMapper mapper = new ObjectMapper();
// ObjectNode jsonObject = mapper.createObjectNode();
//
// // 水头
// Double h = Convert.toDouble(rowList.get(0));
// jsonObject.put("H", h);
// // 流量
// Double q = Convert.toDouble(rowList.get(1));
// jsonObject.put("Q", q);
// // 出力
// Double n = Convert.toDouble(rowList.get(2));
// jsonObject.put("N", n);
//
//
// this.dataSource.add(jsonObject);
// }
}
/** /**
* 通过excel导入数据 * 通过excel导入数据
* *
......
...@@ -167,9 +167,9 @@ public class SysUser implements Serializable { ...@@ -167,9 +167,9 @@ public class SysUser implements Serializable {
private Integer activitiSync; private Integer activitiSync;
/** /**
* 身份(0 普通成员 1 上级) * 身份 1-正式 2-委外
*/ */
@Excel(name="(1普通成员 2上级)",width = 15) @Excel(name="1-正式 2-委外",width = 15)
private Integer userIdentity; private Integer userIdentity;
/** /**
......
server: server:
port: 8081 port: 17002
tomcat: tomcat:
max-swallow-size: -1 max-swallow-size: -1
error: error:
...@@ -99,7 +99,7 @@ spring: ...@@ -99,7 +99,7 @@ spring:
datasource: datasource:
druid: druid:
stat-view-servlet: stat-view-servlet:
enabled: true enabled: false
loginUsername: admin loginUsername: admin
loginPassword: 123456 loginPassword: 123456
allow: allow:
...@@ -131,13 +131,13 @@ spring: ...@@ -131,13 +131,13 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource: datasource:
master: master:
url: jdbc:mysql://47.94.207.62:3306/hzgw_test?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull url: jdbc:mysql://47.94.207.62:3306/hzgw_prod?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull
username: root username: root
password: superAdmin&321 password: superAdmin&321
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置 #redis 配置
redis: redis:
database: 0 database: 9
host: 47.94.207.62 host: 47.94.207.62
lettuce: lettuce:
pool: pool:
...@@ -161,7 +161,7 @@ mybatis-plus: ...@@ -161,7 +161,7 @@ mybatis-plus:
table-underline: true table-underline: true
configuration: configuration:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段 # 返回类型为Map,显示null对应的字段
call-setters-on-nulls: true call-setters-on-nulls: true
# 驼峰 # 驼峰
...@@ -187,7 +187,6 @@ jeecg: ...@@ -187,7 +187,6 @@ jeecg:
upload: F:\\upFiles upload: F:\\upFiles
#webapp文件路径 #webapp文件路径
webapp: F:\\upFiles webapp: F:\\upFiles
#文件访问域名
shiro: shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/** excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置 #阿里云oss存储和大鱼短信秘钥配置
...@@ -296,3 +295,11 @@ third-app: ...@@ -296,3 +295,11 @@ third-app:
# appSecret # appSecret
client-secret: ?? client-secret: ??
agent-id: ?? agent-id: ??
# 统一身份证
iam:
postUserInfoUrl: http://47.110.134.43:15105/common-uuv/login/user/temp-code
# 获取用户信息成功状态码
getUserInfoSucceed: ok
defaultRoleCode: gcs
...@@ -99,9 +99,9 @@ spring: ...@@ -99,9 +99,9 @@ spring:
datasource: datasource:
druid: druid:
stat-view-servlet: stat-view-servlet:
enabled: true enabled: false
loginUsername: admin loginUsername: lkjxlkjslkfjl1dsaf
loginPassword: 123456 loginPassword: alqw1w55+1234jkdf1234
allow: allow:
web-stat-filter: web-stat-filter:
enabled: true enabled: true
...@@ -182,9 +182,9 @@ jeecg: ...@@ -182,9 +182,9 @@ jeecg:
app: http://localhost:8051 app: http://localhost:8051
path: path:
#文件上传根目录 设置 #文件上传根目录 设置
upload: /opt/ztgk/prod/file upload: /opt/etc/file
#webapp文件路径 #webapp文件路径
webapp: /opt/ztgk/prod/file webapp: /opt/etc/file
shiro: shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/** excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置 #阿里云oss存储和大鱼短信秘钥配置
...@@ -241,6 +241,7 @@ jeecg: ...@@ -241,6 +241,7 @@ jeecg:
logging: logging:
level: level:
org.jeecg.modules.system.mapper: info org.jeecg.modules.system.mapper: info
register-shutdown-hook:
#cas单点登录 #cas单点登录
cas: cas:
prefixUrl: http://cas.example.org:8443/cas prefixUrl: http://cas.example.org:8443/cas
......
...@@ -2,4 +2,4 @@ spring: ...@@ -2,4 +2,4 @@ spring:
application: application:
name: hzgw name: hzgw
profiles: profiles:
active: @package.environment@ active: dev
...@@ -206,6 +206,11 @@ ...@@ -206,6 +206,11 @@
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>4.4.1</version> <version>4.4.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</dependency>
<!--minio--> <!--minio-->
<dependency> <dependency>
<groupId>io.minio</groupId> <groupId>io.minio</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment