增加userId登录
This commit is contained in:
parent
ca4fa4e66c
commit
0bb9a8b829
@ -0,0 +1,56 @@
|
|||||||
|
package com.zhgd.xmgl.modules.basicdata.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.zhgd.xmgl.enums.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业类型,1总部,2区域,3城市,4项目部
|
||||||
|
*/
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
||||||
|
public enum CompanyTypeEnum implements BaseEnum {
|
||||||
|
/**
|
||||||
|
* 1总部
|
||||||
|
*/
|
||||||
|
HEADQUARTERS(1, "总部"),
|
||||||
|
/**
|
||||||
|
* 2区域
|
||||||
|
*/
|
||||||
|
REGIONS(2, "区域"),
|
||||||
|
/**
|
||||||
|
* 3城市
|
||||||
|
*/
|
||||||
|
CITIES(3, "城市"),
|
||||||
|
/**
|
||||||
|
* 4项目部
|
||||||
|
*/
|
||||||
|
PROJECT_DEPARTMENTS(4, "项目部"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private Integer value;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
CompanyTypeEnum(Integer value, String desc) {
|
||||||
|
this.value = value;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(Integer value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package com.zhgd.xmgl.modules.basicdata.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.zhgd.xmgl.enums.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号类型,1系统管理员:jxjadmin,2企业管理员账号:17512009894,3企业区账号,4企业市账号,5项目账号(thhy,只能看一个项目),6项目子账号(aq,比一个项目更小),7企业子账号:qyyszh(只能看到很多项目的账号):,8参建单位,9政务
|
||||||
|
*/
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
||||||
|
public enum SystemUserAccountTypeEnum implements BaseEnum {
|
||||||
|
/**
|
||||||
|
* 系统管理员
|
||||||
|
*/
|
||||||
|
SYSTEM_ADMINISTRATOR(1, "系统管理员"),
|
||||||
|
/**
|
||||||
|
* 企业管理员账号
|
||||||
|
*/
|
||||||
|
ENTERPRISE_ADMINISTRATOR_ACCOUNT(2, "企业管理员账号"),
|
||||||
|
/**
|
||||||
|
* 企业区账号
|
||||||
|
*/
|
||||||
|
ENTERPRISE_DISTRICT_ACCOUNT(3, "企业区账号"),
|
||||||
|
/**
|
||||||
|
* 企业市账号
|
||||||
|
*/
|
||||||
|
ENTERPRISE_CITY_ACCOUNT(4, "企业市账号"),
|
||||||
|
/**
|
||||||
|
* 项目账号
|
||||||
|
*/
|
||||||
|
PROJECT_ACCOUNT(5, "项目账号"),
|
||||||
|
/**
|
||||||
|
* 项目子账号
|
||||||
|
*/
|
||||||
|
PROJECT_SUB_ACCOUNT(6, "项目子账号"),
|
||||||
|
/**
|
||||||
|
* 企业子账号
|
||||||
|
*/
|
||||||
|
ENTERPRISE_SUB_ACCOUNT(7, "企业子账号"),
|
||||||
|
/**
|
||||||
|
* 参建单位
|
||||||
|
*/
|
||||||
|
CONSTRUCTION_UNIT(8, "参建单位"),
|
||||||
|
/**
|
||||||
|
* 政务
|
||||||
|
*/
|
||||||
|
GOVERNMENT_AFFAIR(9, "政务"),
|
||||||
|
/**
|
||||||
|
* 新用户
|
||||||
|
*/
|
||||||
|
NEW_USER(10, "新用户"),
|
||||||
|
/**
|
||||||
|
* 供应商
|
||||||
|
*/
|
||||||
|
SUPPLIER(11, "供应商"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private Integer value;
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
SystemUserAccountTypeEnum(Integer value, String desc) {
|
||||||
|
this.value = value;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(Integer value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,12 +16,33 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface BaseRoleMapper extends BaseMapper<BaseRole> {
|
public interface BaseRoleMapper extends BaseMapper<BaseRole> {
|
||||||
|
/**
|
||||||
|
* 根据用户id查询角色
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<BaseRole> selectRoleByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
BaseRole selectRoleByUserId(@Param("userId") Long userId);
|
/**
|
||||||
|
* 根据项目sn删除角色权限关联数据
|
||||||
|
*
|
||||||
|
* @param projectSn
|
||||||
|
*/
|
||||||
void deleteRoleAuthority(@Param("projectSn") String projectSn);
|
void deleteRoleAuthority(@Param("projectSn") String projectSn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目sn删除账号角色关联表
|
||||||
|
*
|
||||||
|
* @param projectSn
|
||||||
|
*/
|
||||||
void deleteRoleUser(@Param("projectSn") String projectSn);
|
void deleteRoleUser(@Param("projectSn") String projectSn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目的角色列表
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<BaseRole> getProjectBaseRoleList(Map<String, Object> map);
|
List<BaseRole> getProjectBaseRoleList(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,9 +23,9 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
|
|||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.redis.lock.RedisRepository;
|
import com.zhgd.redis.lock.RedisRepository;
|
||||||
import com.zhgd.xmgl.entity.sj.JwtPayloadUserInfo;
|
import com.zhgd.xmgl.entity.sj.JwtPayloadUserInfo;
|
||||||
import com.zhgd.xmgl.enums.ParamEnum;
|
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.*;
|
import com.zhgd.xmgl.modules.basicdata.entity.*;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.dto.LoginInfoByTokenDto;
|
import com.zhgd.xmgl.modules.basicdata.entity.dto.LoginInfoByTokenDto;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.enums.SystemUserAccountTypeEnum;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.*;
|
import com.zhgd.xmgl.modules.basicdata.mapper.*;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
|
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
||||||
@ -43,6 +43,7 @@ import com.zhgd.xmgl.modules.project.entity.ProjectExternalSystemService;
|
|||||||
import com.zhgd.xmgl.modules.project.mapper.ProjectExternalSystemServiceMapper;
|
import com.zhgd.xmgl.modules.project.mapper.ProjectExternalSystemServiceMapper;
|
||||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||||
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
||||||
|
import com.zhgd.xmgl.modules.quality.enums.QualityInspectionRecordStatusEnum;
|
||||||
import com.zhgd.xmgl.modules.quality.mapper.QualityRegionMapper;
|
import com.zhgd.xmgl.modules.quality.mapper.QualityRegionMapper;
|
||||||
import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService;
|
import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService;
|
||||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDev;
|
||||||
@ -55,6 +56,7 @@ import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
|||||||
import com.zhgd.xmgl.modules.xz.entity.XzRegistry;
|
import com.zhgd.xmgl.modules.xz.entity.XzRegistry;
|
||||||
import com.zhgd.xmgl.modules.xz.mapper.XzRegistryMapper;
|
import com.zhgd.xmgl.modules.xz.mapper.XzRegistryMapper;
|
||||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord;
|
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord;
|
||||||
|
import com.zhgd.xmgl.modules.xz.security.enums.XzSecurityQualityInspectionRecordStatusEnum;
|
||||||
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
|
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
|
||||||
import com.zhgd.xmgl.modules.xz.service.impl.XzRegistryServiceImpl;
|
import com.zhgd.xmgl.modules.xz.service.impl.XzRegistryServiceImpl;
|
||||||
import com.zhgd.xmgl.security.JwtTokenProvider;
|
import com.zhgd.xmgl.security.JwtTokenProvider;
|
||||||
@ -86,6 +88,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import static com.zhgd.xmgl.constant.Cts.DEFAULT;
|
import static com.zhgd.xmgl.constant.Cts.DEFAULT;
|
||||||
import static com.zhgd.xmgl.constant.Cts.QUERY_TYPE;
|
import static com.zhgd.xmgl.constant.Cts.QUERY_TYPE;
|
||||||
|
import static com.zhgd.xmgl.modules.basicdata.enums.CompanyTypeEnum.HEADQUARTERS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 账号
|
* @Description: 账号
|
||||||
@ -105,6 +108,9 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
* 修改密码的有效期
|
* 修改密码的有效期
|
||||||
*/
|
*/
|
||||||
public static final String UPDATE_PW_UUID = "UPDATE_PW_UUID:";
|
public static final String UPDATE_PW_UUID = "UPDATE_PW_UUID:";
|
||||||
|
public static final String CLIENT_ID = "clientId";
|
||||||
|
public static final String BEARER = "Bearer ";
|
||||||
|
public static final String LIST = "list";
|
||||||
/**
|
/**
|
||||||
* redis密码登录失败次数前缀
|
* redis密码登录失败次数前缀
|
||||||
*/
|
*/
|
||||||
@ -210,7 +216,8 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
//登录失败次数不得多于5次,登录失败后锁定时间不少于10分钟
|
//登录失败次数不得多于5次,登录失败后锁定时间不少于10分钟
|
||||||
String key = PW_FAILED_COUNT_PREFIX + EnvironmentUtil.getActiveEnvironment() + ":" + account;
|
String key = PW_FAILED_COUNT_PREFIX + EnvironmentUtil.getActiveEnvironment() + ":" + account;
|
||||||
Integer num = (Integer) redisRepository.get(key);
|
Integer num = (Integer) redisRepository.get(key);
|
||||||
if (num != null && num >= 5) {
|
int i = 5;
|
||||||
|
if (num != null && num >= i) {
|
||||||
throw new OpenAlertException("您已登录失败次数达到5次,锁定账号时间10分钟,请稍后重试");
|
throw new OpenAlertException("您已登录失败次数达到5次,锁定账号时间10分钟,请稍后重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,23 +269,26 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
|
|
||||||
private Map<String, Object> doLogin(Map<String, Object> map, SystemUser systemUser) {
|
private Map<String, Object> doLogin(Map<String, Object> map, SystemUser systemUser) {
|
||||||
// 保存 手机传输的clientId 推送消息时使用
|
// 保存 手机传输的clientId 推送消息时使用
|
||||||
if (map.containsKey("clientId") && null != map.get("clientId") && StringUtils.isNotEmpty(map.get("clientId").toString())) {
|
if (map.containsKey(CLIENT_ID) && null != map.get(CLIENT_ID) && StringUtils.isNotEmpty(map.get(CLIENT_ID).toString())) {
|
||||||
systemUser.setClientId(map.get("clientId").toString());
|
systemUser.setClientId(map.get(CLIENT_ID).toString());
|
||||||
log.info("收到clientId---------" + map.get("clientId").toString());
|
log.info("收到clientId---------" + map.get(CLIENT_ID).toString());
|
||||||
updateById(systemUser);
|
updateById(systemUser);
|
||||||
} else {
|
} else {
|
||||||
log.info("未收到clientId-------------------");
|
log.info("未收到clientId-------------------");
|
||||||
}
|
}
|
||||||
if (map.containsKey("loginType")) {
|
String loginTypeStr = "loginType";
|
||||||
if (systemUser.getAccountType() != 1) {
|
if (map.containsKey(loginTypeStr)) {
|
||||||
Integer loginType = MapUtils.getInteger(map, "loginType");
|
if (!Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||||
if (loginType == 1) {
|
Integer loginType = MapUtils.getInteger(map, loginTypeStr);
|
||||||
if (systemUser.getAccountType() != 2 && systemUser.getAccountType() != 3 && systemUser.getAccountType() != 4 && systemUser.getAccountType() != 7) {
|
int loginTypeOne = 1;
|
||||||
|
int loginTypeTwo = 2;
|
||||||
|
if (loginType == loginTypeOne) {
|
||||||
|
if (!Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue()) && !Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue()) && !Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_CITY_ACCOUNT.getValue()) && !Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_SUB_ACCOUNT.getValue())) {
|
||||||
log.info("账号类型不正确,loginType:{}", loginType);
|
log.info("账号类型不正确,loginType:{}", loginType);
|
||||||
throw new OpenAlertException(MessageUtil.get("loginErr"));
|
throw new OpenAlertException(MessageUtil.get("loginErr"));
|
||||||
}
|
}
|
||||||
} else if (loginType == 2) {
|
} else if (loginType == loginTypeTwo) {
|
||||||
if (systemUser.getAccountType() != 5 && systemUser.getAccountType() != 6) {
|
if (!Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue()) && !Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
log.info("账号类型不正确,loginType:{}", loginType);
|
log.info("账号类型不正确,loginType:{}", loginType);
|
||||||
throw new OpenAlertException(MessageUtil.get("loginErr"));
|
throw new OpenAlertException(MessageUtil.get("loginErr"));
|
||||||
}
|
}
|
||||||
@ -288,7 +298,8 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
|
|
||||||
Map<String, Object> result = new HashMap<>(16);
|
Map<String, Object> result = new HashMap<>(16);
|
||||||
|
|
||||||
if ((Objects.equals(systemUser.getAccountType(), 10) || Objects.equals(systemUser.getAccountType(), 11)) &&
|
String account = systemUser.getAccount();
|
||||||
|
if ((Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.NEW_USER.getValue()) || Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.SUPPLIER.getValue())) &&
|
||||||
StringUtils.isBlank(MapUtils.getString(map, "headquartersSn"))) {
|
StringUtils.isBlank(MapUtils.getString(map, "headquartersSn"))) {
|
||||||
try {
|
try {
|
||||||
HashMap<String, Object> emailMap = xzRegistryService.getRegistryEmailByAccount(systemUser.getAccount());
|
HashMap<String, Object> emailMap = xzRegistryService.getRegistryEmailByAccount(systemUser.getAccount());
|
||||||
@ -296,7 +307,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String token = jwtTokenProvider.createToken(MapUtils.getString(map, "account"), 60 * 60 * 24 * 30 * 12, 0);
|
String token = jwtTokenProvider.createToken(account, 60 * 60 * 24 * 30 * 12, 0);
|
||||||
result.put("userEnterpriseId", "");
|
result.put("userEnterpriseId", "");
|
||||||
result.put("seeEquipment", 0);
|
result.put("seeEquipment", 0);
|
||||||
result.put("token", token);
|
result.put("token", token);
|
||||||
@ -326,10 +337,38 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
result.put("addProjectType", null);
|
result.put("addProjectType", null);
|
||||||
result.put("enterProjectBackType", null);
|
result.put("enterProjectBackType", null);
|
||||||
result.put("companyBigScreen", null);
|
result.put("companyBigScreen", null);
|
||||||
|
String projectSn = MapUtils.getString(map, "projectSn");
|
||||||
|
if (StrUtil.isNotBlank(projectSn)) {
|
||||||
|
CompanyConfig companyConfig = companyConfigMapper.getCompanyConfigByProject(projectSn);
|
||||||
|
if (companyConfig.getExpireTime() == null) {
|
||||||
|
throw new OpenAlertException(MessageUtil.get("loginEnabledErr"));
|
||||||
|
} else {
|
||||||
|
DateTime expireTime = DateUtil.parse(companyConfig.getExpireTime(), "yyyy-MM-dd");
|
||||||
|
DateTime currentDate = new DateTime();
|
||||||
|
|
||||||
|
if (expireTime.getTime() < currentDate.getTime()) {
|
||||||
|
throw new OpenAlertException(MessageUtil.get("loginExpiredErr"));
|
||||||
|
} else {
|
||||||
|
companyConfig.setDiffDay((int) DateUtil.between(currentDate, DateUtil.offset(expireTime, DateField.DAY_OF_MONTH, 1), DateUnit.DAY));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (companyConfig == null || companyConfig.getIsEnable() == 0) {
|
||||||
|
throw new OpenAlertException(MessageUtil.get("loginEnabledErr"));
|
||||||
|
}
|
||||||
|
if (companyConfig.getDiffDay() == 0) {
|
||||||
|
throw new OpenAlertException(MessageUtil.get("loginExpiredErr"));
|
||||||
|
}
|
||||||
|
if (companyConfig.getEffectiveTime() == null) {
|
||||||
|
companyConfig.setEffectiveTime(60 * 60 * 24 * 30 * 12);
|
||||||
|
}
|
||||||
|
Map<String, Object> menuAuthority = getUserAuthority(null, SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue(), projectSn, null, companyConfig.getStyleType());
|
||||||
|
result.put("menuAuthority", menuAuthority);
|
||||||
|
} else {
|
||||||
Map<String, Object> menuAuthority = new HashMap<>(16);
|
Map<String, Object> menuAuthority = new HashMap<>(16);
|
||||||
menuAuthority.put("moduleList", new ArrayList<>());
|
menuAuthority.put("moduleList", new ArrayList<>());
|
||||||
menuAuthority.put("menuList", new ArrayList<>());
|
menuAuthority.put("menuList", new ArrayList<>());
|
||||||
result.put("menuAuthority", menuAuthority);
|
result.put("menuAuthority", menuAuthority);
|
||||||
|
}
|
||||||
result.put("scope", scope);
|
result.put("scope", scope);
|
||||||
result.put("expire", false);
|
result.put("expire", false);
|
||||||
result.put("personMail", systemUser.getPersonMail());
|
result.put("personMail", systemUser.getPersonMail());
|
||||||
@ -347,7 +386,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
CompanyConfig companyConfig = null;
|
CompanyConfig companyConfig = null;
|
||||||
if (systemUser.getAccountType() == 1) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||||
companyConfig = new CompanyConfig();
|
companyConfig = new CompanyConfig();
|
||||||
companyConfig.setIsEnable(1);
|
companyConfig.setIsEnable(1);
|
||||||
companyConfig.setEffectiveTime(60 * 60 * 24);
|
companyConfig.setEffectiveTime(60 * 60 * 24);
|
||||||
@ -363,9 +402,9 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
companyConfig.setAddProjectType(0);
|
companyConfig.setAddProjectType(0);
|
||||||
companyConfig.setStyleType(1);
|
companyConfig.setStyleType(1);
|
||||||
companyConfig.setHeadquartersSn("-1");
|
companyConfig.setHeadquartersSn("-1");
|
||||||
} else if (systemUser.getAccountType() == 5 || systemUser.getAccountType() == ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue()) {
|
} else if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue()) || Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
companyConfig = companyConfigMapper.getCompanyConfigByProject(systemUser.getSn());
|
companyConfig = companyConfigMapper.getCompanyConfigByProject(systemUser.getSn());
|
||||||
} else if (systemUser.getAccountType() == 10 || systemUser.getAccountType() == 11) {
|
} else if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.NEW_USER.getValue()) || systemUser.getAccountType().equals(SystemUserAccountTypeEnum.SUPPLIER.getValue())) {
|
||||||
companyConfig = companyConfigMapper.getCompanyConfigByHeadquartersSn(MapUtils.getString(map, "headquartersSn"));
|
companyConfig = companyConfigMapper.getCompanyConfigByHeadquartersSn(MapUtils.getString(map, "headquartersSn"));
|
||||||
} else {
|
} else {
|
||||||
companyConfig = companyConfigMapper.getCompanyConfigBySn(systemUser.getSn());
|
companyConfig = companyConfigMapper.getCompanyConfigBySn(systemUser.getSn());
|
||||||
@ -383,7 +422,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
companyConfig.setDiffDay((int) DateUtil.between(currentDate, DateUtil.offset(expireTime, DateField.DAY_OF_MONTH, 1), DateUnit.DAY));
|
companyConfig.setDiffDay((int) DateUtil.between(currentDate, DateUtil.offset(expireTime, DateField.DAY_OF_MONTH, 1), DateUnit.DAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (systemUser.getAccountType() == ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue()) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
List<SystemUser> users = getProjectChildernSystemUserList(new MapBuilder<String, Object>().put("projectSn", systemUser.getSn())
|
List<SystemUser> users = getProjectChildernSystemUserList(new MapBuilder<String, Object>().put("projectSn", systemUser.getSn())
|
||||||
.put("userId", systemUser.getUserId()).build());
|
.put("userId", systemUser.getUserId()).build());
|
||||||
if (CollUtil.isNotEmpty(users)) {
|
if (CollUtil.isNotEmpty(users)) {
|
||||||
@ -400,20 +439,21 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
companyConfig.setEffectiveTime(60 * 60 * 24 * 30 * 12);
|
companyConfig.setEffectiveTime(60 * 60 * 24 * 30 * 12);
|
||||||
}
|
}
|
||||||
SystemLogoConfig slc = this.getSystemLogoConfig(companyConfig.getHeadquartersSn());
|
SystemLogoConfig slc = this.getSystemLogoConfig(companyConfig.getHeadquartersSn());
|
||||||
String token = jwtTokenProvider.createToken(MapUtils.getString(map, "account"), companyConfig.getEffectiveTime(), slc != null ? slc.getLoginTimeOut() : null);
|
String token = jwtTokenProvider.createToken(account, companyConfig.getEffectiveTime(), slc != null ? slc.getLoginTimeOut() : null);
|
||||||
UserEnterprise userEnterprise = userEnterpriseService.selectUserEnterpriseByUserId(systemUser.getUserId());
|
UserEnterprise userEnterprise = userEnterpriseService.selectUserEnterpriseByUserId(systemUser.getUserId());
|
||||||
if (userEnterprise != null) {
|
if (userEnterprise != null) {
|
||||||
result.put("userEnterpriseId", userEnterprise.getEnterpriseId());
|
result.put("userEnterpriseId", userEnterprise.getEnterpriseId());
|
||||||
} else {
|
} else {
|
||||||
result.put("userEnterpriseId", "");
|
result.put("userEnterpriseId", "");
|
||||||
}
|
}
|
||||||
if (systemUser.getAccountType() == ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue()) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
//项目子账号要判断是否能查看设备中台
|
//项目子账号要判断是否能查看设备中台
|
||||||
BaseRole baseRole = baseRoleMapper.selectRoleByUserId(systemUser.getUserId());
|
List<BaseRole> baseRoles = baseRoleMapper.selectRoleByUserId(systemUser.getUserId());
|
||||||
if (baseRole == null) {
|
if (CollUtil.isEmpty(baseRoles)) {
|
||||||
result.put("seeEquipment", 1);
|
result.put("seeEquipment", 1);
|
||||||
} else {
|
} else {
|
||||||
result.put("seeEquipment", Integer.valueOf(baseRole.getSeeEquipment()));
|
boolean see = baseRoles.stream().anyMatch(baseRole -> Objects.equals(baseRole.getSeeEquipment(), "0"));
|
||||||
|
result.put("seeEquipment", see ? 0 : 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.put("seeEquipment", 0);
|
result.put("seeEquipment", 0);
|
||||||
@ -473,10 +513,11 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(Map<String, Object> map) {
|
public void register(Map<String, Object> map) {
|
||||||
if (StringUtils.isNotEmpty(MapUtils.getString(map, "verificationCode"))) {
|
String verificationCode = "verificationCode";
|
||||||
|
if (StringUtils.isNotEmpty(MapUtils.getString(map, verificationCode))) {
|
||||||
Map<String, Object> parm = new HashMap<>(16);
|
Map<String, Object> parm = new HashMap<>(16);
|
||||||
parm.put("phone", MapUtils.getString(map, "companyTel"));
|
parm.put("phone", MapUtils.getString(map, "companyTel"));
|
||||||
parm.put("code", MapUtils.getString(map, "verificationCode"));
|
parm.put("code", MapUtils.getString(map, verificationCode));
|
||||||
int countnum = verificationCodeMapper.getVerificationCodeCount(parm);
|
int countnum = verificationCodeMapper.getVerificationCodeCount(parm);
|
||||||
if (countnum == 0) {
|
if (countnum == 0) {
|
||||||
throw new OpenAlertException(MessageUtil.get("verificationErr"));
|
throw new OpenAlertException(MessageUtil.get("verificationErr"));
|
||||||
@ -497,7 +538,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase();
|
String uuid = UUID.randomUUID().toString().replace("-", "").toUpperCase();
|
||||||
Company company = new Company();
|
Company company = new Company();
|
||||||
company.setCompanyName(MapUtils.getString(map, "companyName"));
|
company.setCompanyName(MapUtils.getString(map, "companyName"));
|
||||||
company.setCompanyType(1);
|
company.setCompanyType(HEADQUARTERS.getValue());
|
||||||
company.setCompanySn(uuid);
|
company.setCompanySn(uuid);
|
||||||
company.setHeadquartersSn(uuid);
|
company.setHeadquartersSn(uuid);
|
||||||
company.setParentId(0L);
|
company.setParentId(0L);
|
||||||
@ -514,7 +555,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
systemUser.setPassword(passwordEncoder.encode(password));
|
systemUser.setPassword(passwordEncoder.encode(password));
|
||||||
//systemUser.setPassword(password);
|
//systemUser.setPassword(password);
|
||||||
systemUser.setUserTel(MapUtils.getString(map, "companyTel"));
|
systemUser.setUserTel(MapUtils.getString(map, "companyTel"));
|
||||||
systemUser.setAccountType(2);
|
systemUser.setAccountType(SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue());
|
||||||
systemUser.setSn(uuid);
|
systemUser.setSn(uuid);
|
||||||
systemUserMapper.insert(systemUser);
|
systemUserMapper.insert(systemUser);
|
||||||
CompanyConfig companyConfig = new CompanyConfig();
|
CompanyConfig companyConfig = new CompanyConfig();
|
||||||
@ -633,39 +674,8 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getUserByAccount(Map<String, Object> map) {
|
public Map<String, Object> getUserByAccount(Map<String, Object> map) {
|
||||||
try {
|
return null;
|
||||||
String account = MapUtils.getString(map, "u");
|
|
||||||
Long time = MapUtils.getLong(map, "t");
|
|
||||||
String password = MapUtils.getString(map, "p");
|
|
||||||
String code = "szszhxmgl";
|
|
||||||
String password1 = SecureUtil.md5(account + time + code);
|
|
||||||
time = time * 1000L;
|
|
||||||
DateTime date = DateUtil.date(time);
|
|
||||||
long diff = DateUtil.between(date, new Date(), DateUnit.SECOND);
|
|
||||||
/* if (diff > 60) {
|
|
||||||
throw new OpenAlertException("该参数已失效!");
|
|
||||||
}*/
|
|
||||||
if (!password.equals(password1)) {
|
|
||||||
throw new OpenAlertException("参数校验失败!");
|
|
||||||
}
|
}
|
||||||
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper();
|
|
||||||
queryWrapper.lambda()
|
|
||||||
.eq(SystemUser::getAccount, account);
|
|
||||||
SystemUser systemUser = systemUserMapper.selectOne(queryWrapper);
|
|
||||||
if (systemUser == null) {
|
|
||||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
|
||||||
}
|
|
||||||
return getUserInfo(systemUser);
|
|
||||||
} catch (AuthenticationException e) {
|
|
||||||
log.error("error:", e);
|
|
||||||
throw new CustomException("Invalid username/password supplied", HttpStatus.UNPROCESSABLE_ENTITY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
// long time = 1723166407 * 1000L;
|
|
||||||
// System.out.println(DateUtil.date(time));
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getProjectUserByNumber(Map<String, Object> map) {
|
public Map<String, Object> getProjectUserByNumber(Map<String, Object> map) {
|
||||||
@ -679,7 +689,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
String projectSn = projectList.get(0).getProjectSn();
|
String projectSn = projectList.get(0).getProjectSn();
|
||||||
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper();
|
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper();
|
||||||
queryWrapper.lambda().eq(SystemUser::getSn, projectSn)
|
queryWrapper.lambda().eq(SystemUser::getSn, projectSn)
|
||||||
.eq(SystemUser::getAccountType, 5);
|
.eq(SystemUser::getAccountType, SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue());
|
||||||
List<SystemUser> list = systemUserMapper.selectList(queryWrapper);
|
List<SystemUser> list = systemUserMapper.selectList(queryWrapper);
|
||||||
if (list == null || list.size() == 0) {
|
if (list == null || list.size() == 0) {
|
||||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||||
@ -694,7 +704,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
private Map<String, Object> getUserInfo(SystemUser systemUser) {
|
private Map<String, Object> getUserInfo(SystemUser systemUser) {
|
||||||
Map<String, Object> result = new HashMap<>(16);
|
Map<String, Object> result = new HashMap<>(16);
|
||||||
CompanyConfig companyConfig = null;
|
CompanyConfig companyConfig = null;
|
||||||
if (systemUser.getAccountType() == 1) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.SYSTEM_ADMINISTRATOR.getValue())) {
|
||||||
companyConfig = new CompanyConfig();
|
companyConfig = new CompanyConfig();
|
||||||
companyConfig.setIsEnable(1);
|
companyConfig.setIsEnable(1);
|
||||||
companyConfig.setEffectiveTime(60 * 60 * 24);
|
companyConfig.setEffectiveTime(60 * 60 * 24);
|
||||||
@ -707,7 +717,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
companyConfig.setStyleType(1);
|
companyConfig.setStyleType(1);
|
||||||
companyConfig.setEnterProjectBackType(0);
|
companyConfig.setEnterProjectBackType(0);
|
||||||
companyConfig.setAddProjectType(0);
|
companyConfig.setAddProjectType(0);
|
||||||
} else if (systemUser.getAccountType() == 5 || systemUser.getAccountType() == ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue()) {
|
} else if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue()) || Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
companyConfig = companyConfigMapper.getCompanyConfigByProject(systemUser.getSn());
|
companyConfig = companyConfigMapper.getCompanyConfigByProject(systemUser.getSn());
|
||||||
} else {
|
} else {
|
||||||
companyConfig = companyConfigMapper.getCompanyConfigBySn(systemUser.getSn());
|
companyConfig = companyConfigMapper.getCompanyConfigBySn(systemUser.getSn());
|
||||||
@ -744,14 +754,14 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
} else {
|
} else {
|
||||||
result.put("userEnterpriseId", "");
|
result.put("userEnterpriseId", "");
|
||||||
}
|
}
|
||||||
if (systemUser.getAccountType() == ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue()) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
//项目子账号要判断是否能查看设备中台
|
//项目子账号要判断是否能查看设备中台
|
||||||
BaseRole baseRole = baseRoleMapper.selectRoleByUserId(systemUser.getUserId());
|
List<BaseRole> baseRoles = baseRoleMapper.selectRoleByUserId(systemUser.getUserId());
|
||||||
if (baseRole == null) {
|
if (CollUtil.isEmpty(baseRoles)) {
|
||||||
result.put("seeEquipment", 1);
|
result.put("seeEquipment", 1);
|
||||||
} else {
|
} else {
|
||||||
result.put("seeEquipment", baseRole.getSeeEquipment());
|
boolean see = baseRoles.stream().anyMatch(baseRole -> Objects.equals(baseRole.getSeeEquipment(), "0"));
|
||||||
}
|
result.put("seeEquipment", see ? 0 : 1); }
|
||||||
} else {
|
} else {
|
||||||
result.put("seeEquipment", 0);
|
result.put("seeEquipment", 0);
|
||||||
}
|
}
|
||||||
@ -863,14 +873,14 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
}
|
}
|
||||||
systemUserMapper.updateById(systemUser);
|
systemUserMapper.updateById(systemUser);
|
||||||
|
|
||||||
if (systemUser.getAccountType() == ParamEnum.SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue()) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
WorkerInfo workerInfo = workerInfoMapper.selectById(systemUser.getWorkerId());
|
WorkerInfo workerInfo = workerInfoMapper.selectById(systemUser.getWorkerId());
|
||||||
workerInfo.setSex(systemUser.getSex());
|
workerInfo.setSex(systemUser.getSex());
|
||||||
workerInfo.setPersonMail(systemUser.getPersonMail());
|
workerInfo.setPersonMail(systemUser.getPersonMail());
|
||||||
workerInfo.setWorkerName(systemUser.getRealName());
|
workerInfo.setWorkerName(systemUser.getRealName());
|
||||||
workerInfo.setPhoneNumber(systemUser.getUserTel());
|
workerInfo.setPhoneNumber(systemUser.getUserTel());
|
||||||
workerInfoService.editWorkerInfo(workerInfo);
|
workerInfoService.editWorkerInfo(workerInfo);
|
||||||
} else if (systemUser.getAccountType() == 10 || systemUser.getAccountType() == 11) {
|
} else if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.NEW_USER.getValue()) || Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.SUPPLIER.getValue())) {
|
||||||
xzRegistryMapper.update(null, new LambdaUpdateWrapper<XzRegistry>()
|
xzRegistryMapper.update(null, new LambdaUpdateWrapper<XzRegistry>()
|
||||||
.set(XzRegistry::getEmail, systemUser.getPersonMail())
|
.set(XzRegistry::getEmail, systemUser.getPersonMail())
|
||||||
.eq(XzRegistry::getAccount, systemUser.getAccount())
|
.eq(XzRegistry::getAccount, systemUser.getAccount())
|
||||||
@ -911,6 +921,12 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
return baseMapper.queryById(map);
|
return baseMapper.queryById(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public String getFrameUserName(Long userId) {
|
||||||
|
// SystemUser systemUser = systemUserMapper.selectById(userId);
|
||||||
|
// return "【" + (systemUser != null ? systemUser.getRealName() : "用户名") + "】";
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addProjectUser(SystemUser systemUser) {
|
public void addProjectUser(SystemUser systemUser) {
|
||||||
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper<>();
|
||||||
@ -924,7 +940,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
throw new OpenAlertException(MessageUtil.get("passwordEmptyErr"));
|
throw new OpenAlertException(MessageUtil.get("passwordEmptyErr"));
|
||||||
}
|
}
|
||||||
PwUtil.checkPwPattern(password);
|
PwUtil.checkPwPattern(password);
|
||||||
systemUser.setAccountType(6);
|
systemUser.setAccountType(SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue());
|
||||||
systemUser.setShowPassword(password);
|
systemUser.setShowPassword(password);
|
||||||
systemUser.setPassword(passwordEncoder.encode(password));
|
systemUser.setPassword(passwordEncoder.encode(password));
|
||||||
if (systemUser.getWorkerId() != null) {
|
if (systemUser.getWorkerId() != null) {
|
||||||
@ -1022,28 +1038,26 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
List<EntityMap> actionList = new ArrayList<>();
|
List<EntityMap> actionList = new ArrayList<>();
|
||||||
param.put("isEnable", "1");
|
param.put("isEnable", "1");
|
||||||
param.put("styleType", styleType);
|
param.put("styleType", styleType);
|
||||||
if (accountType == 2) {
|
if (Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())) {
|
||||||
param.put("headquartersSn", headquartersSn);
|
param.put("headquartersSn", headquartersSn);
|
||||||
param.put("moduleType", moduleType);
|
|
||||||
moduleList = baseModuleMapper.getCompanyModuleList(param);
|
moduleList = baseModuleMapper.getCompanyModuleList(param);
|
||||||
menuList = baseMenuService.selectHeadquartersMenuList(param);
|
menuList = baseMenuService.selectHeadquartersMenuList(param);
|
||||||
actionList = baseActionMapper.getHeadquartersActionList(param);
|
actionList = baseActionMapper.getHeadquartersActionList(param);
|
||||||
data.put("roleName", "公司管理员");
|
data.put("roleName", "公司管理员");
|
||||||
} else if (accountType == 3 || accountType == 4 || accountType == 7) {
|
} else if (Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue()) || Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_CITY_ACCOUNT.getValue()) || Objects.equals(accountType, SystemUserAccountTypeEnum.ENTERPRISE_SUB_ACCOUNT.getValue())) {
|
||||||
param.put("userId", userId);
|
param.put("userId", userId);
|
||||||
param.put("moduleType", moduleType);
|
|
||||||
moduleList = baseModuleMapper.getUserModuleList(param);
|
moduleList = baseModuleMapper.getUserModuleList(param);
|
||||||
menuList = baseMenuService.selectComapnyUserMenuList(param);
|
menuList = baseMenuService.selectComapnyUserMenuList(param);
|
||||||
actionList = baseActionMapper.getComapnyUserActionList(param);
|
actionList = baseActionMapper.getComapnyUserActionList(param);
|
||||||
data.put("roleName", "公司管理员");
|
data.put("roleName", "公司管理员");
|
||||||
} else if (accountType == 5) {
|
} else if (Objects.equals(accountType, SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue())) {
|
||||||
param.put("projectSn", sn);
|
param.put("projectSn", sn);
|
||||||
param.put("moduleType", moduleType);
|
param.put("moduleType", moduleType);
|
||||||
moduleList = baseModuleMapper.getProjectModuleList(param);
|
moduleList = baseModuleMapper.getProjectModuleList(param);
|
||||||
menuList = baseMenuService.getProjectBaseMenuList(param);
|
menuList = baseMenuService.getProjectBaseMenuList(param);
|
||||||
actionList = baseActionMapper.getProjectBaseActionList(param);
|
actionList = baseActionMapper.getProjectBaseActionList(param);
|
||||||
data.put("roleName", "项目管理员");
|
data.put("roleName", "项目管理员");
|
||||||
} else if (accountType == 6) {
|
} else if (Objects.equals(accountType, SystemUserAccountTypeEnum.PROJECT_SUB_ACCOUNT.getValue())) {
|
||||||
param.put("projectSn", sn);
|
param.put("projectSn", sn);
|
||||||
param.put("userId", userId);
|
param.put("userId", userId);
|
||||||
param.put("moduleType", moduleType);
|
param.put("moduleType", moduleType);
|
||||||
@ -1052,7 +1066,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
actionList = baseActionMapper.getProjectUserActionList(param);
|
actionList = baseActionMapper.getProjectUserActionList(param);
|
||||||
String roleName = baseRoleUserMapper.getUserRoleName(param);
|
String roleName = baseRoleUserMapper.getUserRoleName(param);
|
||||||
data.put("roleName", roleName);
|
data.put("roleName", roleName);
|
||||||
} else if (accountType == 11) {
|
} else if (Objects.equals(accountType, SystemUserAccountTypeEnum.SUPPLIER.getValue())) {
|
||||||
//供应商
|
//供应商
|
||||||
moduleList = baseModuleMapper.getSupplierModuleList(param);
|
moduleList = baseModuleMapper.getSupplierModuleList(param);
|
||||||
menuList = baseMenuService.getSupplierMenuList(param);
|
menuList = baseMenuService.getSupplierMenuList(param);
|
||||||
@ -1107,16 +1121,16 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
private List<EntityMap> groupList(List<EntityMap> list, List<EntityMap> childList) {
|
private List<EntityMap> groupList(List<EntityMap> list, List<EntityMap> childList) {
|
||||||
for (EntityMap menu : list) {
|
for (EntityMap menu : list) {
|
||||||
List<EntityMap> tempList = new ArrayList<>();
|
List<EntityMap> tempList = new ArrayList<>();
|
||||||
List<EntityMap> List2 = new ArrayList<>();
|
List<EntityMap> list2 = new ArrayList<>();
|
||||||
for (EntityMap childMenu : childList) {
|
for (EntityMap childMenu : childList) {
|
||||||
if (MapUtils.getString(menu, "menuId").equals(MapUtils.getString(childMenu, "parentId"))) {
|
if (MapUtils.getString(menu, "menuId").equals(MapUtils.getString(childMenu, "parentId"))) {
|
||||||
tempList.add(childMenu);
|
tempList.add(childMenu);
|
||||||
} else {
|
} else {
|
||||||
List2.add(childMenu);
|
list2.add(childMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (List2.size() > 0) {
|
if (list2.size() > 0) {
|
||||||
tempList = groupList(tempList, List2);
|
tempList = groupList(tempList, list2);
|
||||||
}
|
}
|
||||||
if (tempList.size() > 0) {
|
if (tempList.size() > 0) {
|
||||||
menu.put("menu_list", tempList);
|
menu.put("menu_list", tempList);
|
||||||
@ -1146,7 +1160,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
@Override
|
@Override
|
||||||
public void sendSafetyHatAccountData(Map<String, Object> map) {
|
public void sendSafetyHatAccountData(Map<String, Object> map) {
|
||||||
SystemUser systemUser = systemUserMapper.selectById(MapUtils.getString(map, "userId"));
|
SystemUser systemUser = systemUserMapper.selectById(MapUtils.getString(map, "userId"));
|
||||||
if (systemUser == null || systemUser.getAccountType() != 5) {
|
if (systemUser == null || !Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue())) {
|
||||||
throw new OpenAlertException(MessageUtil.get("projectAccountErr"));
|
throw new OpenAlertException(MessageUtil.get("projectAccountErr"));
|
||||||
}
|
}
|
||||||
QueryWrapper<ProjectExternalSystemService> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ProjectExternalSystemService> queryWrapper = new QueryWrapper<>();
|
||||||
@ -1197,12 +1211,6 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* sj统一登录获取类似以前登录的数据
|
|
||||||
*
|
|
||||||
* @param jwtPayloadUserInfo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Result sjLogin(JwtPayloadUserInfo jwtPayloadUserInfo) {
|
public Result sjLogin(JwtPayloadUserInfo jwtPayloadUserInfo) {
|
||||||
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper();
|
QueryWrapper<SystemUser> queryWrapper = new QueryWrapper();
|
||||||
@ -1216,9 +1224,10 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
return Result.success(rsMap);
|
return Result.success(rsMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Result loginByToken(LoginInfoByTokenDto dto) {
|
public Result loginByToken(LoginInfoByTokenDto dto) {
|
||||||
String token = dto.getToken();
|
String token = dto.getToken();
|
||||||
if (token.startsWith("Bearer ")) {
|
if (token.startsWith(BEARER)) {
|
||||||
token = token.substring(7);
|
token = token.substring(7);
|
||||||
}
|
}
|
||||||
jwtTokenProvider.validateToken(token);
|
jwtTokenProvider.validateToken(token);
|
||||||
@ -1321,27 +1330,28 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
// 判断是否存在安全检查中
|
// 判断是否存在安全检查中
|
||||||
List<XzSecurityQualityInspectionRecord> xzSecurityQualityInspectionRecords = xzSecurityQualityInspectionRecordService.list(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
|
List<XzSecurityQualityInspectionRecord> xzSecurityQualityInspectionRecords = xzSecurityQualityInspectionRecordService.list(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
|
||||||
.ne(XzSecurityQualityInspectionRecord::getStatus, 5)
|
.ne(XzSecurityQualityInspectionRecord::getStatus, 5)
|
||||||
.ne(XzSecurityQualityInspectionRecord::getStatus, 6)
|
.ne(XzSecurityQualityInspectionRecord::getStatus, XzSecurityQualityInspectionRecordStatusEnum.UNDO.getValue())
|
||||||
.and(item -> item.eq(XzSecurityQualityInspectionRecord::getChangeId, id)
|
.and(item -> item.eq(XzSecurityQualityInspectionRecord::getChangeId, id)
|
||||||
.or().eq(XzSecurityQualityInspectionRecord::getReviewId, id)
|
.or().eq(XzSecurityQualityInspectionRecord::getReviewId, id)
|
||||||
.or().eq(XzSecurityQualityInspectionRecord::getVerifyManId, id)
|
.or().eq(XzSecurityQualityInspectionRecord::getVerifyManId, id)
|
||||||
.or().eq(XzSecurityQualityInspectionRecord::getInspectManId, id)));
|
.or().eq(XzSecurityQualityInspectionRecord::getInspectManId, id)));
|
||||||
|
int ten = 10;
|
||||||
if (xzSecurityQualityInspectionRecords.size() > 0) {
|
if (xzSecurityQualityInspectionRecords.size() > 0) {
|
||||||
if (stringBuilder.length() > 10) {
|
if (stringBuilder.length() > ten) {
|
||||||
stringBuilder.append("、");
|
stringBuilder.append("、");
|
||||||
}
|
}
|
||||||
stringBuilder.append("安全检查台账");
|
stringBuilder.append("安全检查台账");
|
||||||
}
|
}
|
||||||
// 判断是否存在质量检查中
|
// 判断是否存在质量检查中
|
||||||
List<QualityInspectionRecord> qualityInspectionRecords = qualityInspectionRecordService.list(Wrappers.<QualityInspectionRecord>lambdaQuery()
|
List<QualityInspectionRecord> qualityInspectionRecords = qualityInspectionRecordService.list(Wrappers.<QualityInspectionRecord>lambdaQuery()
|
||||||
.ne(QualityInspectionRecord::getStatus, 5)
|
.ne(QualityInspectionRecord::getStatus, QualityInspectionRecordStatusEnum.PASS.getCode())
|
||||||
.ne(QualityInspectionRecord::getStatus, 6)
|
.ne(QualityInspectionRecord::getStatus, QualityInspectionRecordStatusEnum.UNDO.getCode())
|
||||||
.and(item -> item.eq(QualityInspectionRecord::getChangeId, id)
|
.and(item -> item.eq(QualityInspectionRecord::getChangeId, id)
|
||||||
.or().eq(QualityInspectionRecord::getReviewId, id)
|
.or().eq(QualityInspectionRecord::getReviewId, id)
|
||||||
.or().eq(QualityInspectionRecord::getVerifyManId, id)
|
.or().eq(QualityInspectionRecord::getVerifyManId, id)
|
||||||
.or().eq(QualityInspectionRecord::getInspectManId, id)));
|
.or().eq(QualityInspectionRecord::getInspectManId, id)));
|
||||||
if (qualityInspectionRecords.size() > 0) {
|
if (qualityInspectionRecords.size() > 0) {
|
||||||
if (stringBuilder.length() > 10) {
|
if (stringBuilder.length() > ten) {
|
||||||
stringBuilder.append("、");
|
stringBuilder.append("、");
|
||||||
}
|
}
|
||||||
stringBuilder.append("质量检查台账");
|
stringBuilder.append("质量检查台账");
|
||||||
@ -1359,7 +1369,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
.eq(CheckingPointInfo::getXzCheckingRouteTaskId, xzCheckingRouteTask.getId())
|
.eq(CheckingPointInfo::getXzCheckingRouteTaskId, xzCheckingRouteTask.getId())
|
||||||
.eq(CheckingPointInfo::getCheckingPointUserId, id));
|
.eq(CheckingPointInfo::getCheckingPointUserId, id));
|
||||||
if (checkingPointInfos == null || checkingPointInfos.size() == 0) {
|
if (checkingPointInfos == null || checkingPointInfos.size() == 0) {
|
||||||
if (stringBuilder.length() > 10) {
|
if (stringBuilder.length() > ten) {
|
||||||
stringBuilder.append("、");
|
stringBuilder.append("、");
|
||||||
}
|
}
|
||||||
stringBuilder.append("巡检任务");
|
stringBuilder.append("巡检任务");
|
||||||
@ -1367,7 +1377,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stringBuilder.length() > 10) {
|
if (stringBuilder.length() > ten) {
|
||||||
throw new CustomException(stringBuilder + ",请完成流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
|
throw new CustomException(stringBuilder + ",请完成流程后再删除账号", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1397,7 +1407,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
if (systemUser == null) {
|
if (systemUser == null) {
|
||||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||||
}
|
}
|
||||||
if (systemUser.getAccountType() == 10) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.NEW_USER.getValue())) {
|
||||||
//新用户
|
//新用户
|
||||||
deleteTenantOrSupplier(id, projectSn);
|
deleteTenantOrSupplier(id, projectSn);
|
||||||
} else {
|
} else {
|
||||||
@ -1421,6 +1431,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deleteTenantOrSupplier(String userId, String projectSn) {
|
public void deleteTenantOrSupplier(String userId, String projectSn) {
|
||||||
//查tree
|
//查tree
|
||||||
if (StrUtil.isBlank(projectSn)) {
|
if (StrUtil.isBlank(projectSn)) {
|
||||||
@ -1443,14 +1454,14 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
//往上删除
|
//往上删除
|
||||||
List<String> deleteSnList = new ArrayList<>();
|
List<String> deleteSnList = new ArrayList<>();
|
||||||
deleteSnList.add(projectSn);
|
deleteSnList.add(projectSn);
|
||||||
List<Object> objects = ListUtils.treeToListWithChildren(snTreeJa, "companyId", "parentId", "list", "0");
|
List<Object> objects = ListUtils.treeToListWithChildren(snTreeJa, "companyId", "parentId", LIST, "0");
|
||||||
List<JSONObject> snList = objects.stream().map(o -> ((JSONObject) o)).collect(Collectors.toList());
|
List<JSONObject> snList = objects.stream().map(o -> ((JSONObject) o)).collect(Collectors.toList());
|
||||||
JSONObject projectSnJo = snList.stream().filter(o -> Objects.equals(o.getString("projectSn"), projectSn)).findFirst().get();
|
JSONObject projectSnJo = snList.stream().filter(o -> Objects.equals(o.getString("projectSn"), projectSn)).findFirst().get();
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
String companySn = projectSnJo.getString("companySn");
|
String companySn = projectSnJo.getString("companySn");
|
||||||
JSONObject companyJo;
|
JSONObject companyJo;
|
||||||
companyJo = snList.stream().filter(o -> Objects.equals(o.getString("companySn"), companySn)).findFirst().get();
|
companyJo = snList.stream().filter(o -> Objects.equals(o.getString("companySn"), companySn)).findFirst().get();
|
||||||
if (companyJo.getJSONArray("list").size() <= 1) {
|
if (companyJo.getJSONArray(LIST).size() <= 1) {
|
||||||
do {
|
do {
|
||||||
deleteSnList.add(companyJo.getString("sn"));
|
deleteSnList.add(companyJo.getString("sn"));
|
||||||
String parentId = companyJo.getString("parentId");
|
String parentId = companyJo.getString("parentId");
|
||||||
@ -1459,7 +1470,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
companyJo = companyOp.get();
|
companyJo = companyOp.get();
|
||||||
jsonArray = companyJo.getJSONArray("list");
|
jsonArray = companyJo.getJSONArray(LIST);
|
||||||
} while (jsonArray.size() <= 1);
|
} while (jsonArray.size() <= 1);
|
||||||
}
|
}
|
||||||
//再查一次无结果,就删除账号
|
//再查一次无结果,就删除账号
|
||||||
@ -1472,7 +1483,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
);
|
);
|
||||||
SystemUser systemUser = baseMapper.selectById(userId);
|
SystemUser systemUser = baseMapper.selectById(userId);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
if (systemUser.getAccountType() == 10) {
|
if (Objects.equals(systemUser.getAccountType(), SystemUserAccountTypeEnum.NEW_USER.getValue())) {
|
||||||
deleteUser(String.valueOf(userId));
|
deleteUser(String.valueOf(userId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1499,7 +1510,8 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
//登录失败次数不得多于5次,登录失败后锁定时间不少于10分钟
|
//登录失败次数不得多于5次,登录失败后锁定时间不少于10分钟
|
||||||
String key = PW_FAILED_COUNT_PREFIX + EnvironmentUtil.getActiveEnvironment() + ":" + account;
|
String key = PW_FAILED_COUNT_PREFIX + EnvironmentUtil.getActiveEnvironment() + ":" + account;
|
||||||
Integer num = (Integer) redisRepository.get(key);
|
Integer num = (Integer) redisRepository.get(key);
|
||||||
if (num != null && num >= 5) {
|
int loginNum = 5;
|
||||||
|
if (num != null && num >= loginNum) {
|
||||||
throw new OpenAlertException("您已登录失败次数达到5次,锁定账号时间10分钟,请稍后重试");
|
throw new OpenAlertException("您已登录失败次数达到5次,锁定账号时间10分钟,请稍后重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1522,16 +1534,6 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//密码过期就返回userId,提示修改密码
|
|
||||||
if (PwUtil.checkPwExpire(systemUser.getPwUpdateTime())) {
|
|
||||||
HashMap<String, Object> m = new HashMap<>(16);
|
|
||||||
m.put("expire", true);
|
|
||||||
m.put("userId", systemUser.getUserId());
|
|
||||||
m.put("msg", "需要修改密码");
|
|
||||||
m.put("token", jwtTokenProvider.createToken(systemUser.getAccount(), 3600));
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
|
|
||||||
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account, systemUser.getShowPassword()));
|
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account, systemUser.getShowPassword()));
|
||||||
|
|
||||||
return doLogin(map, systemUser);
|
return doLogin(map, systemUser);
|
||||||
@ -1694,7 +1696,10 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
String name = MapUtils.getString(map, "name");
|
String name = MapUtils.getString(map, "name");
|
||||||
String carNumber = MapUtils.getString(map, "carNumber");
|
String carNumber = MapUtils.getString(map, "carNumber");
|
||||||
Map<String, Object> result = new HashMap<>(16);
|
Map<String, Object> result = new HashMap<>(16);
|
||||||
if (Objects.equals(type, 1)) {
|
//1人员2设备
|
||||||
|
int man = 1;
|
||||||
|
int devType = 2;
|
||||||
|
if (Objects.equals(type, man)) {
|
||||||
List<SafetyHatDev> devs = safetyHatDevMapper.selectDevListByIdCard(idCard);
|
List<SafetyHatDev> devs = safetyHatDevMapper.selectDevListByIdCard(idCard);
|
||||||
if (CollUtil.isEmpty(devs)) {
|
if (CollUtil.isEmpty(devs)) {
|
||||||
throw new OpenAlertException("该人员的安全帽设备不存在");
|
throw new OpenAlertException("该人员的安全帽设备不存在");
|
||||||
@ -1705,7 +1710,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.put("devInfoList", devs);
|
result.put("devInfoList", devs);
|
||||||
} else if (Objects.equals(type, 2)) {
|
} else if (Objects.equals(type, devType)) {
|
||||||
MechanicalEquipmentPositionDev dev = mechanicalEquipmentPositionDevMapper.selectOne(new LambdaQueryWrapper<MechanicalEquipmentPositionDev>()
|
MechanicalEquipmentPositionDev dev = mechanicalEquipmentPositionDevMapper.selectOne(new LambdaQueryWrapper<MechanicalEquipmentPositionDev>()
|
||||||
.eq(MechanicalEquipmentPositionDev::getDevSn, carNumber));
|
.eq(MechanicalEquipmentPositionDev::getDevSn, carNumber));
|
||||||
if (dev == null) {
|
if (dev == null) {
|
||||||
|
|||||||
@ -1,51 +1,39 @@
|
|||||||
package com.zhgd.xmgl.modules.quality.enums;
|
package com.zhgd.xmgl.modules.quality.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 邱平毅
|
* 状态,2待整改,3待复查,4待核验,5合格,6已撤回
|
||||||
* @EnumName QualityInspectionRecordStatusEnum
|
|
||||||
* @date 2023/2/3
|
|
||||||
* @Version 1.0
|
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
public enum QualityInspectionRecordStatusEnum {
|
public enum QualityInspectionRecordStatusEnum {
|
||||||
/**
|
|
||||||
* 无需整改
|
|
||||||
*/
|
|
||||||
NO_NEED_FOR_CORRECTION(1, "无需整改"),
|
|
||||||
/**
|
/**
|
||||||
* 待整改
|
* 待整改
|
||||||
*/
|
*/
|
||||||
TO_BE_CORRECTED(2, "待整改"),
|
NOT_RECTIFIED(2, "待整改"),
|
||||||
/**
|
/**
|
||||||
* 待复查
|
* 待复查
|
||||||
*/
|
*/
|
||||||
TO_BE_REVIEWED(3, "待复查"),
|
NOT_REVIEWED(3, "待复查"),
|
||||||
/**
|
/**
|
||||||
* 待核验
|
* 待核验
|
||||||
*/
|
*/
|
||||||
TO_BE_VERIFIED(4, "待核验"),
|
NOT_VERIFIED(4, "待核验"),
|
||||||
/**
|
/**
|
||||||
* 合格
|
* 合格
|
||||||
*/
|
*/
|
||||||
QUALIFIED(5, "合格"),
|
PASS(5, "合格"),
|
||||||
/**
|
/**
|
||||||
* 不合格
|
* 已撤回
|
||||||
*/
|
*/
|
||||||
DISQUALIFICATION(6, "不合格");
|
UNDO(6, "已撤回"),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
int id;
|
private final Integer code;
|
||||||
String name;
|
private final String desc;
|
||||||
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QualityInspectionRecordStatusEnum(int id, String name) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package com.zhgd.xmgl.task;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
||||||
import com.zhgd.xmgl.modules.quality.enums.QualityInspectionRecordStatusEnum;
|
|
||||||
import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService;
|
import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService;
|
||||||
|
import com.zhgd.xmgl.modules.quality.enums.QualityInspectionRecordStatusEnum;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@ -34,11 +34,11 @@ public class QualityInspectionRecordTask {
|
|||||||
@Scheduled(cron = "0 0 * * * ?")
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
public void autoClose() {
|
public void autoClose() {
|
||||||
List<QualityInspectionRecord> recordList = qualityInspectionRecordService.list(Wrappers.lambdaQuery(QualityInspectionRecord.class)
|
List<QualityInspectionRecord> recordList = qualityInspectionRecordService.list(Wrappers.lambdaQuery(QualityInspectionRecord.class)
|
||||||
.eq(QualityInspectionRecord::getStatus, QualityInspectionRecordStatusEnum.TO_BE_VERIFIED.getId()));
|
.eq(QualityInspectionRecord::getStatus, QualityInspectionRecordStatusEnum.NOT_VERIFIED.getCode()));
|
||||||
if (CollUtil.isNotEmpty(recordList)) {
|
if (CollUtil.isNotEmpty(recordList)) {
|
||||||
Set<Long> ids = recordList.stream().map(QualityInspectionRecord::getId).collect(Collectors.toSet());
|
Set<Long> ids = recordList.stream().map(QualityInspectionRecord::getId).collect(Collectors.toSet());
|
||||||
qualityInspectionRecordService.update(Wrappers.lambdaUpdate(QualityInspectionRecord.class).in(QualityInspectionRecord::getId, ids)
|
qualityInspectionRecordService.update(Wrappers.lambdaUpdate(QualityInspectionRecord.class).in(QualityInspectionRecord::getId, ids)
|
||||||
.set(QualityInspectionRecord::getStatus, QualityInspectionRecordStatusEnum.QUALIFIED.getId()));
|
.set(QualityInspectionRecord::getStatus, QualityInspectionRecordStatusEnum.PASS.getCode()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user