Compare commits
No commits in common. "f88b71adf6c5de0956747d961b66a404ac1951a6" and "ad682a2f7858e88eb3238d47b9da4f65f734e9bf" have entirely different histories.
f88b71adf6
...
ad682a2f78
|
@ -60,10 +60,6 @@ public class MessageException extends RuntimeException {
|
||||||
this.message = resultCode.getMessage();
|
this.message = resultCode.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageException() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return StrUtil.format("业务错误:错误代码:{},错误内容:{}", Objects.isNull(this.code) ? 500 : this.code, this.message);
|
return StrUtil.format("业务错误:错误代码:{},错误内容:{}", Objects.isNull(this.code) ? 500 : this.code, this.message);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.changhu.common.pojo.vo;
|
package com.changhu.common.pojo.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,10 +9,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class TokenInfo {
|
public class TokenInfo {
|
||||||
|
|
||||||
@Schema(description = "token的名字")
|
|
||||||
private String name;
|
private String name;
|
||||||
@Schema(description = "token的值")
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
public TokenInfo(String name, String value) {
|
public TokenInfo(String name, String value) {
|
||||||
|
|
|
@ -23,6 +23,9 @@ public class WebConfig implements WebMvcConfigurer {
|
||||||
private final List<String> whiteList = new ArrayList<>();
|
private final List<String> whiteList = new ArrayList<>();
|
||||||
|
|
||||||
public WebConfig() {
|
public WebConfig() {
|
||||||
|
//todo 要删除的
|
||||||
|
whiteList.add("/managementSuperUser/**");
|
||||||
|
|
||||||
whiteList.add("/common/**");
|
whiteList.add("/common/**");
|
||||||
whiteList.add("/test/**");
|
whiteList.add("/test/**");
|
||||||
whiteList.add("/login");
|
whiteList.add("/login");
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.changhu.enums;
|
package com.changhu.enums;
|
||||||
|
|
||||||
import com.changhu.enums.handler.AbstractLoginHandler;
|
import com.changhu.enums.handler.AbstractLoginHandler;
|
||||||
import com.changhu.enums.handler.ManagementPoliceUnitLogin;
|
|
||||||
import com.changhu.enums.handler.ManagementSecurityUnitLogin;
|
|
||||||
import com.changhu.enums.handler.ManagementSuperLogin;
|
import com.changhu.enums.handler.ManagementSuperLogin;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -15,12 +13,13 @@ import lombok.Getter;
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ClientType {
|
public enum ClientType {
|
||||||
MANAGEMENT_SUPER("超级后台", ManagementSuperLogin.instance),
|
MANAGEMENT_SUPER("management_super", "超级后台", ManagementSuperLogin.instance),
|
||||||
MANAGEMENT_POLICE("公安后台", ManagementPoliceUnitLogin.instance),
|
MANAGEMENT_POLICE("management_police", "公安后台", ManagementSuperLogin.instance),
|
||||||
MANAGEMENT_SECURITY("保安后台", ManagementSecurityUnitLogin.instance),
|
MANAGEMENT_SECURITY("management_security", "保安后台", ManagementSuperLogin.instance),
|
||||||
MINI_PROGRAM("微信小程序", ManagementSuperLogin.instance),
|
MINI_PROGRAM("mini_program", "微信小程序", ManagementSuperLogin.instance),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
private final String value;
|
||||||
private final String remark;
|
private final String remark;
|
||||||
private final AbstractLoginHandler loginHandler;
|
private final AbstractLoginHandler loginHandler;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
package com.changhu.enums.handler;
|
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.changhu.common.db.enums.IsEnable;
|
|
||||||
import com.changhu.common.enums.ResultCode;
|
|
||||||
import com.changhu.common.exception.MessageException;
|
|
||||||
import com.changhu.common.pojo.vo.TokenInfo;
|
|
||||||
import com.changhu.common.utils.RsaUtil;
|
|
||||||
import com.changhu.common.utils.UserUtil;
|
|
||||||
import com.changhu.common.utils.ValidatorUtil;
|
|
||||||
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
|
|
||||||
import com.changhu.module.management.pojo.entity.PoliceUnit;
|
|
||||||
import com.changhu.module.management.service.ManagementPoliceUnitUserService;
|
|
||||||
import com.changhu.module.management.service.PoliceUnitService;
|
|
||||||
import com.changhu.pojo.params.ManagementPoliceUnitLoginParams;
|
|
||||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/2 下午4:52
|
|
||||||
* @desc ManagementPoliceUnitLogin...
|
|
||||||
*/
|
|
||||||
public class ManagementPoliceUnitLogin extends AbstractLoginHandler {
|
|
||||||
|
|
||||||
private final ManagementPoliceUnitUserService policeUnitUserService = SpringUtil.getBean(ManagementPoliceUnitUserService.class);
|
|
||||||
private final PoliceUnitService policeUnitService = SpringUtil.getBean(PoliceUnitService.class);
|
|
||||||
|
|
||||||
public static final ManagementPoliceUnitLogin instance = new ManagementPoliceUnitLogin();
|
|
||||||
|
|
||||||
private ManagementPoliceUnitLogin() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TokenInfo login(JSONObject jsonObject) {
|
|
||||||
ManagementPoliceUnitLoginParams managementPoliceUnitLoginParams = jsonObject.to(ManagementPoliceUnitLoginParams.class);
|
|
||||||
ValidatorUtil.manual(managementPoliceUnitLoginParams);
|
|
||||||
|
|
||||||
String accountOrTelephone = managementPoliceUnitLoginParams.getAccountOrTelephone();
|
|
||||||
String password = RsaUtil.decrypt(managementPoliceUnitLoginParams.getPassword());
|
|
||||||
|
|
||||||
//查看 账号/手机号 是否存在
|
|
||||||
ManagementPoliceUnitUser managementPoliceUnitUser = policeUnitUserService.lambdaQuery()
|
|
||||||
.eq(ManagementPoliceUnitUser::getAccount, accountOrTelephone)
|
|
||||||
.or()
|
|
||||||
.eq(ManagementPoliceUnitUser::getTelephone, accountOrTelephone)
|
|
||||||
.oneOpt()
|
|
||||||
.orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND));
|
|
||||||
|
|
||||||
//判断用户是否禁用
|
|
||||||
if (managementPoliceUnitUser.getIsEnable().equals(IsEnable.FALSE)) {
|
|
||||||
throw new MessageException(ResultCode.USER_IS_DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断单位是否禁用
|
|
||||||
IsEnable unitEnable = policeUnitService.lambdaQuery()
|
|
||||||
.eq(BaseEntity::getSnowFlakeId, managementPoliceUnitUser.getPoliceUnitId())
|
|
||||||
.oneOpt()
|
|
||||||
.map(PoliceUnit::getIsEnable)
|
|
||||||
.orElseThrow(() -> new MessageException("单位不存在"));
|
|
||||||
if (unitEnable.equals(IsEnable.FALSE)) {
|
|
||||||
throw new MessageException("单位被禁用");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//判断密码是否正确
|
|
||||||
if (!UserUtil.verifyPassWord(password, managementPoliceUnitUser.getSalt(), managementPoliceUnitUser.getPassword())) {
|
|
||||||
throw new MessageException(ResultCode.PASSWORD_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
//登录
|
|
||||||
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(managementPoliceUnitUser.getSnowFlakeId());
|
|
||||||
//返回token
|
|
||||||
return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
package com.changhu.enums.handler;
|
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.changhu.common.db.enums.IsEnable;
|
|
||||||
import com.changhu.common.enums.ResultCode;
|
|
||||||
import com.changhu.common.exception.MessageException;
|
|
||||||
import com.changhu.common.pojo.vo.TokenInfo;
|
|
||||||
import com.changhu.common.utils.RsaUtil;
|
|
||||||
import com.changhu.common.utils.UserUtil;
|
|
||||||
import com.changhu.common.utils.ValidatorUtil;
|
|
||||||
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
|
|
||||||
import com.changhu.module.management.pojo.entity.PoliceUnit;
|
|
||||||
import com.changhu.module.management.pojo.entity.SecurityUnit;
|
|
||||||
import com.changhu.module.management.service.ManagementSecurityUnitUserService;
|
|
||||||
import com.changhu.module.management.service.SecurityUnitService;
|
|
||||||
import com.changhu.pojo.params.ManagementSecurityUnitLoginParams;
|
|
||||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/2 下午5:48
|
|
||||||
* @desc ManagementSecurityUnitLogin...
|
|
||||||
*/
|
|
||||||
public class ManagementSecurityUnitLogin extends AbstractLoginHandler {
|
|
||||||
|
|
||||||
private final ManagementSecurityUnitUserService securityUnitUserService = SpringUtil.getBean(ManagementSecurityUnitUserService.class);
|
|
||||||
private final SecurityUnitService securityUnitService = SpringUtil.getBean(SecurityUnitService.class);
|
|
||||||
|
|
||||||
public static final ManagementSecurityUnitLogin instance = new ManagementSecurityUnitLogin();
|
|
||||||
|
|
||||||
private ManagementSecurityUnitLogin() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TokenInfo login(JSONObject jsonObject) {
|
|
||||||
ManagementSecurityUnitLoginParams loginParams = jsonObject.to(ManagementSecurityUnitLoginParams.class);
|
|
||||||
ValidatorUtil.manual(loginParams);
|
|
||||||
|
|
||||||
String accountOrTelephone = loginParams.getAccountOrTelephone();
|
|
||||||
String password = RsaUtil.decrypt(loginParams.getPassword());
|
|
||||||
|
|
||||||
//查看 账号/手机号 是否存在
|
|
||||||
ManagementSecurityUnitUser managementSecurityUnitUser = securityUnitUserService.lambdaQuery()
|
|
||||||
.eq(ManagementSecurityUnitUser::getAccount, accountOrTelephone)
|
|
||||||
.or()
|
|
||||||
.eq(ManagementSecurityUnitUser::getTelephone, accountOrTelephone)
|
|
||||||
.oneOpt()
|
|
||||||
.orElseThrow(() -> new MessageException(ResultCode.ERROR));
|
|
||||||
|
|
||||||
//判断用户是否禁用
|
|
||||||
if (managementSecurityUnitUser.getIsEnable().equals(IsEnable.FALSE)) {
|
|
||||||
throw new MessageException(ResultCode.USER_IS_DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断单位是否禁用
|
|
||||||
IsEnable unitEnable = securityUnitService.lambdaQuery()
|
|
||||||
.eq(BaseEntity::getSnowFlakeId, managementSecurityUnitUser.getSecurityUnitId())
|
|
||||||
.oneOpt()
|
|
||||||
.map(SecurityUnit::getIsEnable)
|
|
||||||
.orElseThrow(() -> new MessageException("单位不存在"));
|
|
||||||
if (unitEnable.equals(IsEnable.FALSE)) {
|
|
||||||
throw new MessageException("单位被禁用");
|
|
||||||
}
|
|
||||||
|
|
||||||
//判断密码是否正确
|
|
||||||
if (!UserUtil.verifyPassWord(password, managementSecurityUnitUser.getSalt(), managementSecurityUnitUser.getPassword())) {
|
|
||||||
throw new MessageException(ResultCode.PASSWORD_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
//登录
|
|
||||||
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(managementSecurityUnitUser.getSnowFlakeId());
|
|
||||||
//返回token
|
|
||||||
return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -38,7 +38,7 @@ public class ManagementSuperLogin extends AbstractLoginHandler {
|
||||||
ManagementSuperUser user = managementSuperUserService.lambdaQuery()
|
ManagementSuperUser user = managementSuperUserService.lambdaQuery()
|
||||||
.eq(ManagementSuperUser::getTelephone, telephone)
|
.eq(ManagementSuperUser::getTelephone, telephone)
|
||||||
.oneOpt()
|
.oneOpt()
|
||||||
.orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND));
|
.orElseThrow(() -> new MessageException("用户不存在"));
|
||||||
|
|
||||||
//判断密码是否正确
|
//判断密码是否正确
|
||||||
if (!UserUtil.verifyPassWord(password, user.getSalt(), user.getPassword())) {
|
if (!UserUtil.verifyPassWord(password, user.getSalt(), user.getPassword())) {
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.changhu.module.management.controller;
|
|
||||||
|
|
||||||
import com.changhu.common.annotation.JsonBody;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/3 上午10:17
|
|
||||||
* @desc EnterprisesUnitController...
|
|
||||||
*/
|
|
||||||
@Tag(name = "企事业单位")
|
|
||||||
@JsonBody
|
|
||||||
@RequestMapping("/enterprisesUnit")
|
|
||||||
public class EnterprisesUnitController {
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ package com.changhu.module.management.controller;
|
||||||
import com.changhu.common.annotation.JsonBody;
|
import com.changhu.common.annotation.JsonBody;
|
||||||
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
|
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
|
||||||
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
|
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
|
||||||
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;
|
|
||||||
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
||||||
import com.changhu.module.management.service.IndexService;
|
import com.changhu.module.management.service.IndexService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
@ -38,10 +37,4 @@ public class IndexController {
|
||||||
public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid IndexCheckStatusParams params) {
|
public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid IndexCheckStatusParams params) {
|
||||||
return indexService.getCheckStatus(params);
|
return indexService.getCheckStatus(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "启用或禁用状态")
|
|
||||||
@PostMapping("/disableOrEnable")
|
|
||||||
public void disableOrEnable(@RequestBody @Valid IndexDisableOrEnableParams params) {
|
|
||||||
indexService.disableOrEnable(params);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.changhu.module.management.controller;
|
|
||||||
|
|
||||||
import com.changhu.common.annotation.JsonBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/3 上午10:21
|
|
||||||
* @desc ManagementPoliceUnitUserController...
|
|
||||||
*/
|
|
||||||
@JsonBody
|
|
||||||
@RequestMapping("/managementPoliceUnitUser")
|
|
||||||
public class ManagementPoliceUnitUserController {
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.changhu.module.management.controller;
|
|
||||||
|
|
||||||
import com.changhu.common.annotation.JsonBody;
|
|
||||||
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
|
|
||||||
import com.changhu.module.management.service.ManagementSecurityUnitUserService;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/3 上午10:22
|
|
||||||
* @desc ManagementSecurityUnitUserController...
|
|
||||||
*/
|
|
||||||
@JsonBody
|
|
||||||
@RequestMapping("/managementSecurityUnitUser")
|
|
||||||
public class ManagementSecurityUnitUserController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ManagementSecurityUnitUserService managementSecurityUnitUserService;
|
|
||||||
|
|
||||||
@PostMapping("/saveOrUpdate")
|
|
||||||
public void saveOrUpdate(@RequestBody @Valid ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
|
|
||||||
managementSecurityUnitUserService.saveOrUpdate(saveOrUpdateParams);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,11 +25,4 @@ public abstract class AbstractUnitTypeHandler {
|
||||||
* @return 审核状态
|
* @return 审核状态
|
||||||
*/
|
*/
|
||||||
public abstract UnitCheckStatusVo getCheckStatus(String onlyCode);
|
public abstract UnitCheckStatusVo getCheckStatus(String onlyCode);
|
||||||
|
|
||||||
/**
|
|
||||||
* 启用或者禁用状态
|
|
||||||
*
|
|
||||||
* @param unitId 单位id
|
|
||||||
*/
|
|
||||||
public abstract void disableOrEnable(Long unitId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.changhu.common.db.enums.CheckStatus;
|
import com.changhu.common.db.enums.CheckStatus;
|
||||||
import com.changhu.common.db.enums.IsEnable;
|
|
||||||
import com.changhu.common.db.enums.IsOrNot;
|
import com.changhu.common.db.enums.IsOrNot;
|
||||||
import com.changhu.common.db.enums.Sex;
|
import com.changhu.common.db.enums.Sex;
|
||||||
import com.changhu.common.enums.ResultCode;
|
import com.changhu.common.enums.ResultCode;
|
||||||
|
@ -12,7 +11,6 @@ import com.changhu.common.exception.MessageException;
|
||||||
import com.changhu.common.utils.UserUtil;
|
import com.changhu.common.utils.UserUtil;
|
||||||
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
|
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
|
||||||
import com.changhu.module.management.pojo.entity.PoliceUnit;
|
import com.changhu.module.management.pojo.entity.PoliceUnit;
|
||||||
import com.changhu.module.management.pojo.entity.SecurityUnit;
|
|
||||||
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
||||||
import com.changhu.module.management.service.ManagementPoliceUnitUserService;
|
import com.changhu.module.management.service.ManagementPoliceUnitUserService;
|
||||||
import com.changhu.module.management.service.PoliceUnitService;
|
import com.changhu.module.management.service.PoliceUnitService;
|
||||||
|
@ -105,25 +103,4 @@ public class PoliceUnitTypeHandler extends AbstractUnitTypeHandler {
|
||||||
}
|
}
|
||||||
return unitCheckStatusVo;
|
return unitCheckStatusVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disableOrEnable(Long unitId) {
|
|
||||||
PoliceUnit policeUnit = policeUnitService.lambdaQuery()
|
|
||||||
.eq(BaseEntity::getSnowFlakeId, unitId)
|
|
||||||
.oneOpt()
|
|
||||||
.orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
|
|
||||||
//取反
|
|
||||||
IsEnable isEnable = switch (policeUnit.getIsEnable()) {
|
|
||||||
case TRUE -> IsEnable.FALSE;
|
|
||||||
case FALSE -> IsEnable.TRUE;
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean update = policeUnitService.lambdaUpdate()
|
|
||||||
.set(PoliceUnit::getIsEnable, isEnable)
|
|
||||||
.eq(BaseEntity::getSnowFlakeId, unitId)
|
|
||||||
.update();
|
|
||||||
if (!update) {
|
|
||||||
throw new MessageException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,25 +105,4 @@ public class SecurityUnitTypeHandler extends AbstractUnitTypeHandler {
|
||||||
return unitCheckStatusVo;
|
return unitCheckStatusVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disableOrEnable(Long unitId) {
|
|
||||||
SecurityUnit securityUnit = securityUnitService.lambdaQuery()
|
|
||||||
.eq(BaseEntity::getSnowFlakeId, unitId)
|
|
||||||
.oneOpt()
|
|
||||||
.orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
|
|
||||||
//取反
|
|
||||||
IsEnable isEnable = switch (securityUnit.getIsEnable()) {
|
|
||||||
case TRUE -> IsEnable.FALSE;
|
|
||||||
case FALSE -> IsEnable.TRUE;
|
|
||||||
};
|
|
||||||
|
|
||||||
boolean update = securityUnitService.lambdaUpdate()
|
|
||||||
.set(SecurityUnit::getIsEnable, isEnable)
|
|
||||||
.eq(BaseEntity::getSnowFlakeId, unitId)
|
|
||||||
.update();
|
|
||||||
if (!update) {
|
|
||||||
throw new MessageException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.changhu.module.management.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* enterprises_unit (企事业单位) 固化类
|
|
||||||
* author: luozhun
|
|
||||||
* desc 由groovy脚本自动生成
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface EnterprisesUnitMapper extends BaseMapper<EnterprisesUnit> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
package com.changhu.module.management.pojo.entity;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
|
|
||||||
import com.changhu.module.management.pojo.model.ContactPersonInfo;
|
|
||||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企事业单位 实体类
|
|
||||||
* author: luozhun
|
|
||||||
* desc 由groovy脚本自动生成
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName(autoResultMap = true)
|
|
||||||
public class EnterprisesUnit extends BaseEntity implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属公安机关id
|
|
||||||
*/
|
|
||||||
private Long policeUnitId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 省
|
|
||||||
*/
|
|
||||||
private String province;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 市
|
|
||||||
*/
|
|
||||||
private String city;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 区/县
|
|
||||||
*/
|
|
||||||
private String districts;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 街道
|
|
||||||
*/
|
|
||||||
private String street;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 详细地址
|
|
||||||
*/
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系人
|
|
||||||
*/
|
|
||||||
@TableField(typeHandler = Fastjson2TypeHandler.class)
|
|
||||||
private ContactPersonInfo contactPersonInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.changhu.module.management.pojo.params;
|
|
||||||
|
|
||||||
import com.changhu.module.management.enums.UnitOptType;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/3 上午9:28
|
|
||||||
* @desc IndexDisableOrEnableParams...
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class IndexDisableOrEnableParams {
|
|
||||||
@Schema(description = "单位id")
|
|
||||||
@NotNull(message = "单位id不能为空")
|
|
||||||
private Long unitId;
|
|
||||||
|
|
||||||
@Schema(description = "单位类型")
|
|
||||||
@NotNull(message = "单位类型不能为空")
|
|
||||||
private UnitOptType unitOptType;
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.changhu.module.management.pojo.params;
|
|
||||||
|
|
||||||
import com.changhu.common.db.enums.IsEnable;
|
|
||||||
import com.changhu.common.db.enums.Sex;
|
|
||||||
import com.changhu.common.validator.annotation.IsMobile;
|
|
||||||
import com.changhu.module.management.pojo.model.ContactPersonInfo;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/3 上午10:26
|
|
||||||
* @desc ManagementSecurityUnitUserSaveOrUpdateParams...
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ManagementSecurityUnitUserSaveOrUpdateParams {
|
|
||||||
|
|
||||||
@Schema(description = "id")
|
|
||||||
private Long snowFlakeId;
|
|
||||||
|
|
||||||
@NotBlank(message = "名称不能为空")
|
|
||||||
@Schema(description = "名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "性别")
|
|
||||||
@NotNull(message = "性别不能为空")
|
|
||||||
private Sex sex;
|
|
||||||
|
|
||||||
@IsMobile
|
|
||||||
@NotBlank(message = "手机号不能为空")
|
|
||||||
private String telephone;
|
|
||||||
|
|
||||||
@NotNull(message = "启用状态不能为空")
|
|
||||||
@Schema(description = "启用状态")
|
|
||||||
private IsEnable isEnable;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.changhu.module.management.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* enterprises_unit (企事业单位) 服务类
|
|
||||||
* author: luozhun
|
|
||||||
* desc 由groovy脚本自动生成
|
|
||||||
*/
|
|
||||||
public interface EnterprisesUnitService extends IService<EnterprisesUnit>{
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ package com.changhu.module.management.service;
|
||||||
|
|
||||||
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
|
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
|
||||||
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
|
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
|
||||||
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;
|
|
||||||
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,11 +25,4 @@ public interface IndexService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params);
|
UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params);
|
||||||
|
|
||||||
/**
|
|
||||||
* 启用或者禁用单位
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
*/
|
|
||||||
void disableOrEnable(IndexDisableOrEnableParams params);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.changhu.module.management.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
|
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
|
||||||
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* management_security_unit_user (后台-保安单位用户表) 服务类
|
* management_security_unit_user (后台-保安单位用户表) 服务类
|
||||||
|
@ -11,10 +10,4 @@ import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveO
|
||||||
*/
|
*/
|
||||||
public interface ManagementSecurityUnitUserService extends IService<ManagementSecurityUnitUser> {
|
public interface ManagementSecurityUnitUserService extends IService<ManagementSecurityUnitUser> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增或者修改
|
|
||||||
*
|
|
||||||
* @param saveOrUpdateParams 参数
|
|
||||||
*/
|
|
||||||
void saveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.changhu.module.management.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.changhu.module.management.mapper.EnterprisesUnitMapper;
|
|
||||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
|
||||||
import com.changhu.module.management.service.EnterprisesUnitService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* enterprises_unit (企事业单位) 服务实现类
|
|
||||||
* author: luozhun
|
|
||||||
* desc 由groovy脚本自动生成
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class EnterprisesUnitServiceImpl extends ServiceImpl<EnterprisesUnitMapper, EnterprisesUnit> implements EnterprisesUnitService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ package com.changhu.module.management.service.impl;
|
||||||
|
|
||||||
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
|
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
|
||||||
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
|
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
|
||||||
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;
|
|
||||||
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
||||||
import com.changhu.module.management.service.IndexService;
|
import com.changhu.module.management.service.IndexService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -27,11 +26,4 @@ public class IndexServiceImpl implements IndexService {
|
||||||
.getHandler()
|
.getHandler()
|
||||||
.getCheckStatus(params.getOnlyCode());
|
.getCheckStatus(params.getOnlyCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disableOrEnable(IndexDisableOrEnableParams params) {
|
|
||||||
params.getUnitOptType()
|
|
||||||
.getHandler()
|
|
||||||
.disableOrEnable(params.getUnitId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,10 @@
|
||||||
package com.changhu.module.management.service.impl;
|
package com.changhu.module.management.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.changhu.common.exception.MessageException;
|
|
||||||
import com.changhu.common.utils.UserUtil;
|
|
||||||
import com.changhu.module.management.mapper.ManagementSecurityUnitUserMapper;
|
import com.changhu.module.management.mapper.ManagementSecurityUnitUserMapper;
|
||||||
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
|
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
|
||||||
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
|
|
||||||
import com.changhu.module.management.service.ManagementSecurityUnitUserService;
|
import com.changhu.module.management.service.ManagementSecurityUnitUserService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* management_security_unit_user (后台-保安单位用户表) 服务实现类
|
* management_security_unit_user (后台-保安单位用户表) 服务实现类
|
||||||
|
@ -23,34 +14,4 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<ManagementSecurityUnitUserMapper, ManagementSecurityUnitUser> implements ManagementSecurityUnitUserService {
|
public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<ManagementSecurityUnitUserMapper, ManagementSecurityUnitUser> implements ManagementSecurityUnitUserService {
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@Override
|
|
||||||
public void saveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
|
|
||||||
//查看手机号是否已存在
|
|
||||||
boolean exists = this.lambdaQuery()
|
|
||||||
.eq(ManagementSecurityUnitUser::getTelephone, saveOrUpdateParams.getTelephone())
|
|
||||||
.exists();
|
|
||||||
if (exists) {
|
|
||||||
throw new MessageException("该手机号已存在");
|
|
||||||
}
|
|
||||||
ManagementSecurityUnitUser managementSecurityUnitUser = BeanUtil.copyProperties(saveOrUpdateParams, ManagementSecurityUnitUser.class);
|
|
||||||
//新增 需要补全一些信息
|
|
||||||
if (managementSecurityUnitUser.getSnowFlakeId() == null) {
|
|
||||||
String account = RandomUtil.randomString(6);
|
|
||||||
boolean accExits = this.lambdaQuery()
|
|
||||||
.eq(ManagementSecurityUnitUser::getAccount, account)
|
|
||||||
.exists();
|
|
||||||
if (accExits) {
|
|
||||||
throw new MessageException("生成的账号已存在 请重新提交生成");
|
|
||||||
}
|
|
||||||
//生成账号
|
|
||||||
managementSecurityUnitUser.setAccount(account);
|
|
||||||
//生成密码
|
|
||||||
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
|
|
||||||
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
|
|
||||||
managementSecurityUnitUser.setSalt(saltAndPassWord.get(0));
|
|
||||||
managementSecurityUnitUser.setPassword(saltAndPassWord.get(1));
|
|
||||||
}
|
|
||||||
this.saveOrUpdate(managementSecurityUnitUser);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.changhu.pojo.params;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/2 下午4:53
|
|
||||||
* @desc ManagementPoliceUnitLoginParams...
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ManagementPoliceUnitLoginParams {
|
|
||||||
|
|
||||||
@NotBlank(message = "账号/手机号不能为空")
|
|
||||||
private String accountOrTelephone;
|
|
||||||
|
|
||||||
@NotBlank(message = "密码不能为空")
|
|
||||||
private String password;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.changhu.pojo.params;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 20252
|
|
||||||
* @createTime 2024/9/2 下午4:53
|
|
||||||
* @desc ManagementPoliceUnitLoginParams...
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ManagementSecurityUnitLoginParams {
|
|
||||||
|
|
||||||
@NotBlank(message = "账号/手机号不能为空")
|
|
||||||
private String accountOrTelephone;
|
|
||||||
|
|
||||||
@NotBlank(message = "密码不能为空")
|
|
||||||
private String password;
|
|
||||||
}
|
|
|
@ -1,162 +0,0 @@
|
||||||
/* 扩展ant design pro按钮组件颜色 */
|
|
||||||
$--my-antd-important: !important;
|
|
||||||
|
|
||||||
.btn-danger {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #F5222D;
|
|
||||||
border-color: #F5222D;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #ff4d4f $--my-antd-important;
|
|
||||||
border-color: #ff4d4f $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #cf1322 $--my-antd-important;
|
|
||||||
border-color: #cf1322 $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-volcano {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #FA541C;
|
|
||||||
border-color: #FA541C;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #ff7a45 $--my-antd-important;
|
|
||||||
border-color: #ff7a45 $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #d4380d $--my-antd-important;
|
|
||||||
border-color: #d4380d $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-warn {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #FAAD14;
|
|
||||||
border-color: #FAAD14;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #ffc53d $--my-antd-important;
|
|
||||||
border-color: #ffc53d $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #d48806 $--my-antd-important;
|
|
||||||
border-color: #d48806 $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-success {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #52C41A;
|
|
||||||
border-color: #52C41A;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #73d13d $--my-antd-important;
|
|
||||||
border-color: #73d13d $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #389e0d $--my-antd-important;
|
|
||||||
border-color: #389e0d $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-color-cyan {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #13C2C2;
|
|
||||||
border-color: #13C2C2;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #36cfc9 $--my-antd-important;
|
|
||||||
border-color: #36cfc9 $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #08979c $--my-antd-important;
|
|
||||||
border-color: #08979c $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-daybreak {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #1890FF;
|
|
||||||
border-color: #1890FF;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #096dd9 $--my-antd-important;
|
|
||||||
border-color: #096dd9 $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #40a9ff $--my-antd-important;
|
|
||||||
border-color: #40a9ff $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-color-geekblue {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #2F54EB;
|
|
||||||
border-color: #2F54EB;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #1d39c4 $--my-antd-important;
|
|
||||||
border-color: #1d39c4 $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #597ef7 $--my-antd-important;
|
|
||||||
border-color: #597ef7 $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-purple {
|
|
||||||
color: #ffffff;
|
|
||||||
background-color: #722ED1;
|
|
||||||
border-color: #722ED1;
|
|
||||||
|
|
||||||
&:hover, &:focus {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #9254de $--my-antd-important;
|
|
||||||
border-color: #9254de $--my-antd-important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active, &.active {
|
|
||||||
color: #ffffff $--my-antd-important;
|
|
||||||
background-color: #531dab $--my-antd-important;
|
|
||||||
border-color: #531dab $--my-antd-important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-row-warn td {
|
|
||||||
background-color: #fefca6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-row-danger td {
|
|
||||||
background-color: #f79988;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-row-success td {
|
|
||||||
background-color: #b6fcbe;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-table-summary td {
|
|
||||||
background: #edeff6;
|
|
||||||
}
|
|
|
@ -7,11 +7,11 @@ type DictType =
|
||||||
| 'IsOrNot'
|
| 'IsOrNot'
|
||||||
| 'Sex'
|
| 'Sex'
|
||||||
|
|
||||||
export const initDict = () => {
|
export const initEnums = () => {
|
||||||
api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {
|
api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {
|
||||||
sessionStorage.setItem('dictMap', JSON.stringify(resp.data))
|
sessionStorage.setItem('dictMap', JSON.stringify(resp.data))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dictSelectNodes = <T>(dictType: DictType): SelectNodeVo<T>[] => JSON.parse(sessionStorage.getItem('dictMap') as string)?.[dictType] || []
|
export const enumSelectNodes = <T>(enumType: DictType): SelectNodeVo<T>[] => JSON.parse(sessionStorage.getItem('dictMap') as string)?.[enumType] || []
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@ import {SystemMenu} from "@/types/config";
|
||||||
|
|
||||||
export const CLIENT_TYPE = "MANAGEMENT_SUPER";
|
export const CLIENT_TYPE = "MANAGEMENT_SUPER";
|
||||||
export const ROUTER_WHITE_LIST: string[] = ['/login', '/test'];
|
export const ROUTER_WHITE_LIST: string[] = ['/login', '/test'];
|
||||||
export const UNIT_TYPE = {
|
|
||||||
security: 'SECURITY_UNIT',
|
|
||||||
police: 'POLICE_UNIT'
|
|
||||||
}
|
|
||||||
|
|
||||||
export const SYSTEM_MENUS: SystemMenu[] = [
|
export const SYSTEM_MENUS: SystemMenu[] = [
|
||||||
{
|
{
|
||||||
|
@ -32,12 +28,6 @@ export const SYSTEM_MENUS: SystemMenu[] = [
|
||||||
path: '/securityUnit',
|
path: '/securityUnit',
|
||||||
type: 'menu',
|
type: 'menu',
|
||||||
component: () => import('@/views/unitManage/securityUnit/index.vue')
|
component: () => import('@/views/unitManage/securityUnit/index.vue')
|
||||||
}, {
|
|
||||||
title: '企事业单位',
|
|
||||||
name: 'enterprisesUnit',
|
|
||||||
path: '/enterprisesUnit',
|
|
||||||
type: 'menu',
|
|
||||||
component: () => import('@/views/unitManage/enterprisesUnit/index.vue')
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,15 @@ import '@/reset.css'
|
||||||
|
|
||||||
// 公共样式
|
// 公共样式
|
||||||
import '@/assets/scss/common.scss'
|
import '@/assets/scss/common.scss'
|
||||||
//ant design 扩展样式
|
|
||||||
import '@/assets/scss/myAntD.scss'
|
|
||||||
// iconfont css
|
// iconfont css
|
||||||
import "@/assets/iconfont/iconfont.css";
|
import "@/assets/iconfont/iconfont.css";
|
||||||
// vue Router
|
// vue Router
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
// pinia stores
|
// pinia stores
|
||||||
import pinia from "@/stores";
|
import pinia from "@/stores";
|
||||||
import {initDict} from "@/config/dict.ts";
|
import {initEnums} from "@/config/dict.ts";
|
||||||
|
|
||||||
initDict();
|
initEnums();
|
||||||
|
|
||||||
const vueApp = createApp(App);
|
const vueApp = createApp(App);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
企事业单位管理
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
|
|
||||||
</style>
|
|
|
@ -16,9 +16,8 @@ import {ComponentExposed} from "vue-component-type-helpers";
|
||||||
import {TableProMaxProps} from "@/types/components/table";
|
import {TableProMaxProps} from "@/types/components/table";
|
||||||
import {PoliceUnitPagerQueryParams, PoliceUnitPagerVo} from "@/types/views/unitManage/policeUnit.ts";
|
import {PoliceUnitPagerQueryParams, PoliceUnitPagerVo} from "@/types/views/unitManage/policeUnit.ts";
|
||||||
import api from "@/axios";
|
import api from "@/axios";
|
||||||
import {dictSelectNodes} from "@/config/dict.ts";
|
import {enumSelectNodes} from "@/config/dict.ts";
|
||||||
import {message} from "ant-design-vue";
|
import {message} from "ant-design-vue";
|
||||||
import {UNIT_TYPE} from "@/config";
|
|
||||||
|
|
||||||
type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams>
|
type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams>
|
||||||
|
|
||||||
|
@ -62,7 +61,7 @@ const columns: TableProps['columns'] = [
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
const resp = await api.post('/management/checkPass', {
|
const resp = await api.post('/management/checkPass', {
|
||||||
checkDataId: record.snowFlakeId,
|
checkDataId: record.snowFlakeId,
|
||||||
unitOptType: UNIT_TYPE.police
|
unitOptType: 'POLICE_UNIT'
|
||||||
})
|
})
|
||||||
message.success(resp.message)
|
message.success(resp.message)
|
||||||
await tableRef.value?.requestGetTableData()
|
await tableRef.value?.requestGetTableData()
|
||||||
|
@ -71,17 +70,7 @@ const columns: TableProps['columns'] = [
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
}
|
}
|
||||||
<a-button
|
{record.isEnable.value === 0 ? <a-button danger>禁用</a-button> : <a-button>启用</a-button>}
|
||||||
class={record.isEnable.value === 0 ? 'btn-danger' : 'btn-success'}
|
|
||||||
onClick={async () => {
|
|
||||||
const resp = await api.post('/management/disableOrEnable', {
|
|
||||||
unitId: record.snowFlakeId,
|
|
||||||
unitOptType: UNIT_TYPE.police
|
|
||||||
})
|
|
||||||
message.success(resp.message)
|
|
||||||
await tableRef.value?.requestGetTableData()
|
|
||||||
}}
|
|
||||||
>{record.isEnable.value === 0 ? '禁用' : '启用'}</a-button>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -100,7 +89,7 @@ const searchFormOptions: TableProps["searchFormOptions"] = {
|
||||||
{
|
{
|
||||||
value: null,
|
value: null,
|
||||||
label: '全部'
|
label: '全部'
|
||||||
}, ...dictSelectNodes('IsEnable')
|
}, ...enumSelectNodes('IsEnable')
|
||||||
]
|
]
|
||||||
}, checkStatus: {
|
}, checkStatus: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
|
@ -109,7 +98,7 @@ const searchFormOptions: TableProps["searchFormOptions"] = {
|
||||||
{
|
{
|
||||||
value: null,
|
value: null,
|
||||||
label: '全部'
|
label: '全部'
|
||||||
}, ...dictSelectNodes('CheckStatus')
|
}, ...enumSelectNodes('CheckStatus')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,8 @@ import {SecurityUnitPagerQueryParams, SecurityUnitPagerVo} from "@/types/views/u
|
||||||
import api from "@/axios";
|
import api from "@/axios";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import {ComponentExposed} from "vue-component-type-helpers";
|
import {ComponentExposed} from "vue-component-type-helpers";
|
||||||
import {dictSelectNodes} from "@/config/dict.ts";
|
import {enumSelectNodes} from "@/config/dict.ts";
|
||||||
import {message} from "ant-design-vue";
|
import {message} from "ant-design-vue";
|
||||||
import {UNIT_TYPE} from "@/config";
|
|
||||||
|
|
||||||
|
|
||||||
type TableProps = TableProMaxProps<SecurityUnitPagerVo, SecurityUnitPagerQueryParams>
|
type TableProps = TableProMaxProps<SecurityUnitPagerVo, SecurityUnitPagerQueryParams>
|
||||||
|
|
||||||
|
@ -87,7 +85,7 @@ const columns: TableProps['columns'] = [
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
const resp = await api.post('/management/checkPass', {
|
const resp = await api.post('/management/checkPass', {
|
||||||
checkDataId: record.snowFlakeId,
|
checkDataId: record.snowFlakeId,
|
||||||
unitOptType: UNIT_TYPE.security
|
unitOptType: 'SECURITY_UNIT'
|
||||||
})
|
})
|
||||||
message.success(resp.message)
|
message.success(resp.message)
|
||||||
await tableRef.value?.requestGetTableData()
|
await tableRef.value?.requestGetTableData()
|
||||||
|
@ -96,17 +94,7 @@ const columns: TableProps['columns'] = [
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
}
|
}
|
||||||
<a-button
|
{record.isEnable.value === 0 ? <a-button danger>禁用</a-button> : <a-button>启用</a-button>}
|
||||||
class={record.isEnable.value === 0 ? 'btn-danger' : 'btn-success'}
|
|
||||||
onClick={async () => {
|
|
||||||
const resp = await api.post('/management/disableOrEnable', {
|
|
||||||
unitId: record.snowFlakeId,
|
|
||||||
unitOptType: UNIT_TYPE.security
|
|
||||||
})
|
|
||||||
message.success(resp.message)
|
|
||||||
await tableRef.value?.requestGetTableData()
|
|
||||||
}}
|
|
||||||
>{record.isEnable.value === 0 ? '禁用' : '启用'}</a-button>
|
|
||||||
</a-space>
|
</a-space>
|
||||||
},
|
},
|
||||||
width: 200
|
width: 200
|
||||||
|
@ -127,7 +115,7 @@ const searchFormOptions: TableProps["searchFormOptions"] = {
|
||||||
{
|
{
|
||||||
value: null,
|
value: null,
|
||||||
label: '全部'
|
label: '全部'
|
||||||
}, ...dictSelectNodes('IsEnable')
|
}, ...enumSelectNodes('IsEnable')
|
||||||
]
|
]
|
||||||
}, checkStatus: {
|
}, checkStatus: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
|
@ -136,7 +124,7 @@ const searchFormOptions: TableProps["searchFormOptions"] = {
|
||||||
{
|
{
|
||||||
value: null,
|
value: null,
|
||||||
label: '全部'
|
label: '全部'
|
||||||
}, ...dictSelectNodes('CheckStatus')
|
}, ...enumSelectNodes('CheckStatus')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue