Compare commits

..

3 Commits

Author SHA1 Message Date
luozhun 8f2feca49b Merge remote-tracking branch 'origin/main' 2024-09-02 11:48:22 +08:00
luozhun e52490011a 单位审核及状态查询 2024-09-02 11:48:12 +08:00
luozhun 909d278772 代码提交 2024-08-30 18:05:45 +08:00
50 changed files with 692 additions and 171 deletions

View File

@ -2,11 +2,8 @@ package com.changhu.common.db;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.exception.MessageException;
import java.io.Serializable;
/**
* author: luozhun
* desc: BaseEnum

View File

@ -1,6 +1,8 @@
package com.changhu.common.db.enums;
import cn.hutool.core.lang.Dict;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.annotation.IsExtData;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -14,10 +16,21 @@ import lombok.Getter;
@AllArgsConstructor
public enum CheckStatus implements BaseEnum<Integer>, IEnum<Integer> {
checked(0, "已审核"),
unChecked(1, "未审核"),
checked(0, "已审核", "success"),
unChecked(1, "未审核", "error"),
;
private final Integer value;
private final String label;
@IsExtData
private final String color;
@Override
public Object serializer() {
return Dict.of(
"value", this.getValue(),
"label", this.getLabel(),
"extData", Dict.of("color", this.color)
);
}
}

View File

@ -1,6 +1,5 @@
package com.changhu.common.db.enums;
import cn.hutool.core.lang.Dict;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

View File

@ -1,5 +1,6 @@
package com.changhu.common.db.enums;
import cn.hutool.core.lang.Dict;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.annotation.IsExtData;
import com.changhu.common.db.BaseEnum;
@ -24,4 +25,12 @@ public enum IsEnable implements BaseEnum<Integer>, IEnum<Integer> {
@IsExtData
private final String color;
@Override
public Object serializer() {
return Dict.of(
"value", this.getValue(),
"label", this.getLabel(),
"extData", Dict.of("color", this.color)
);
}
}

View File

@ -1,5 +1,6 @@
package com.changhu.common.db.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -11,7 +12,7 @@ import lombok.Getter;
*/
@Getter
@AllArgsConstructor
public enum IsOrNot implements BaseEnum<Integer> {
public enum IsOrNot implements BaseEnum<Integer>, IEnum<Integer> {
IS(0, ""),
NOT(1, ""),
;

View File

@ -1,5 +1,6 @@
package com.changhu.common.db.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -12,7 +13,7 @@ import lombok.Getter;
*/
@Getter
@AllArgsConstructor
public enum Sex implements BaseEnum<Integer> {
public enum Sex implements BaseEnum<Integer>, IEnum<Integer> {
MAN(0, ""),
WOMAN(1, ""),
UNKNOWN(2, "隐藏");

View File

@ -13,7 +13,10 @@ import lombok.NoArgsConstructor;
import org.springframework.lang.NonNull;
import java.io.Serializable;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;

View File

@ -2,7 +2,6 @@ package com.changhu.common.validator;
import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.StrUtil;
import com.changhu.common.utils.ValidatorUtil;
import com.changhu.common.validator.annotation.IsMobile;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

View File

@ -8,12 +8,7 @@ import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**

View File

@ -23,11 +23,14 @@ public class WebConfig implements WebMvcConfigurer {
private final List<String> whiteList = new ArrayList<>();
public WebConfig() {
//todo 要删除的
whiteList.add("/managementSuperUser/**");
whiteList.add("/common/**");
whiteList.add("/test/**");
whiteList.add("/login");
whiteList.add("/logout");
whiteList.add("/management/getCheckStatus");
whiteList.add("/favicon.ico");
//druid console
whiteList.add("/druid/**");

View File

@ -20,7 +20,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@ -2,7 +2,6 @@ package com.changhu.enums.handler;
import com.alibaba.fastjson2.JSONObject;
import com.changhu.common.pojo.vo.TokenInfo;
import org.apache.poi.ss.formula.functions.T;
/**
* @author 20252

View File

@ -0,0 +1,40 @@
package com.changhu.module.management.controller;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.service.IndexService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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/2 上午9:48
* @desc IndexController...
*/
@Tag(name = "后台-通用接口")
@JsonBody
@RequestMapping("/management")
public class IndexController {
@Autowired
private IndexService indexService;
@Operation(summary = "审核通过")
@PostMapping("/checkPass")
public void checkPass(@RequestBody @Valid IndexCheckPassParams params) {
indexService.checkPass(params);
}
@Operation(summary = "获取审核状态")
@PostMapping("/getCheckStatus")
public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid IndexCheckStatusParams params) {
return indexService.getCheckStatus(params);
}
}

View File

@ -2,7 +2,6 @@ package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.utils.JavaClassToTsUtil;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.management.service.PoliceUnitService;
@ -33,7 +32,4 @@ public class PoliceUnitController {
return policeUnitService.pager(queryParams);
}
public static void main(String[] args) {
System.out.println(JavaClassToTsUtil.parse(PoliceUnitPagerVo.class));
}
}

View File

@ -39,4 +39,5 @@ public class SecurityUnitController {
public void saveOrUpdate(@RequestBody @Valid SecurityUnitSaveOrUpdateParams params) {
securityUnitService.saveOrUpdate(params);
}
}

View File

@ -0,0 +1,22 @@
package com.changhu.module.management.enums;
import com.changhu.module.management.enums.handler.AbstractUnitTypeHandler;
import com.changhu.module.management.enums.handler.PoliceUnitTypeHandler;
import com.changhu.module.management.enums.handler.SecurityUnitTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20252
* @createTime 2024/9/2 上午9:51
* @desc IndexCheckPass...
*/
@AllArgsConstructor
@Getter
public enum UnitOptType {
SECURITY_UNIT(new SecurityUnitTypeHandler()),
POLICE_UNIT(new PoliceUnitTypeHandler());
private final AbstractUnitTypeHandler handler;
}

View File

@ -0,0 +1,28 @@
package com.changhu.module.management.enums.handler;
import cn.hutool.extra.spring.SpringUtil;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import org.springframework.transaction.PlatformTransactionManager;
/**
* @author 20252
* @createTime 2024/9/2 上午9:53
* @desc AbstractCheckPassHandler...
*/
public abstract class AbstractUnitTypeHandler {
final PlatformTransactionManager transactionManager = SpringUtil.getBean(PlatformTransactionManager.class);
/**
* 通过
*/
public abstract void pass(Long checkDataId);
/**
* 获取审核状态
*
* @param onlyCode 唯一代码
* @return 审核状态
*/
public abstract UnitCheckStatusVo getCheckStatus(String onlyCode);
}

View File

@ -0,0 +1,106 @@
package com.changhu.module.management.enums.handler;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.Sex;
import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.pojo.entity.PoliceUnit;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.service.ManagementPoliceUnitUserService;
import com.changhu.module.management.service.PoliceUnitService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/2 上午11:03
* @desc PoliceUnitTypeHandler...
*/
@Slf4j
public class PoliceUnitTypeHandler extends AbstractUnitTypeHandler {
private final PoliceUnitService policeUnitService = SpringUtil.getBean(PoliceUnitService.class);
private final ManagementPoliceUnitUserService policeUnitUserService = SpringUtil.getBean(ManagementPoliceUnitUserService.class);
@Override
public void pass(Long checkDataId) {
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
TransactionStatus status = transactionManager.getTransaction(def);
try {
PoliceUnit policeUnit = policeUnitService.getOptById(checkDataId).orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
//更新状态
boolean update = policeUnitService.lambdaUpdate()
.set(PoliceUnit::getCheckStatus, CheckStatus.checked)
.eq(BaseEntity::getSnowFlakeId, checkDataId)
.update();
if (!update) {
throw new MessageException(ResultCode.ERROR);
}
//生成管理员账号密码
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
ManagementPoliceUnitUser managementPoliceUnitUser = new ManagementPoliceUnitUser();
managementPoliceUnitUser.setPoliceUnitId(policeUnit.getSnowFlakeId());
managementPoliceUnitUser.setName("超级管理员");
managementPoliceUnitUser.setSex(Sex.UNKNOWN);
managementPoliceUnitUser.setAccount(RandomUtil.randomString(6));
managementPoliceUnitUser.setTelephone("");
managementPoliceUnitUser.setSalt(saltAndPassWord.get(0));
managementPoliceUnitUser.setPassword(saltAndPassWord.get(1));
managementPoliceUnitUser.setIsAdmin(IsOrNot.IS);
boolean save = policeUnitUserService.save(managementPoliceUnitUser);
if (!save) {
throw new MessageException(ResultCode.ERROR);
}
//提交事务
transactionManager.commit(status);
} catch (Exception e) {
//回滚事务
transactionManager.rollback(status);
log.error("公安单位审核通过错误:{}", e.getMessage());
throw new MessageException(e.getMessage());
}
}
@Override
public UnitCheckStatusVo getCheckStatus(String onlyCode) {
PoliceUnit policeUnit = policeUnitService.lambdaQuery()
.eq(PoliceUnit::getCode, onlyCode)
.oneOpt()
.orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
UnitCheckStatusVo unitCheckStatusVo = new UnitCheckStatusVo();
unitCheckStatusVo.setCheckStatus(policeUnit.getCheckStatus());
if (policeUnit.getCheckStatus().equals(CheckStatus.checked)) {
ManagementPoliceUnitUser managementPoliceUnitUser = policeUnitUserService.lambdaQuery()
.eq(ManagementPoliceUnitUser::getPoliceUnitId, policeUnit.getSnowFlakeId())
.eq(ManagementPoliceUnitUser::getIsAdmin, IsOrNot.IS)
.oneOpt()
.orElseThrow(() -> new MessageException("超管账号未初始化 请联系管理员"));
unitCheckStatusVo.setAccount(managementPoliceUnitUser.getAccount());
unitCheckStatusVo.setRemark("恭喜!单位审核通过了,请使用管理员账号前往登录页进行登录.");
} else {
unitCheckStatusVo.setPassword(null);
unitCheckStatusVo.setRemark("单位注册申请正在审核中...");
}
return unitCheckStatusVo;
}
}

View File

@ -0,0 +1,108 @@
package com.changhu.module.management.enums.handler;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
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.Sex;
import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
import com.changhu.module.management.pojo.entity.SecurityUnit;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.service.ManagementSecurityUnitUserService;
import com.changhu.module.management.service.SecurityUnitService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/2 上午9:55
* @desc SecurityCheckPassHandler...
*/
@Slf4j
public class SecurityUnitTypeHandler extends AbstractUnitTypeHandler {
private final SecurityUnitService securityUnitService = SpringUtil.getBean(SecurityUnitService.class);
private final ManagementSecurityUnitUserService securityUnitUserService = SpringUtil.getBean(ManagementSecurityUnitUserService.class);
@Override
public void pass(Long checkDataId) {
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
TransactionStatus status = transactionManager.getTransaction(def);
try {
SecurityUnit securityUnit = securityUnitService.getOptById(checkDataId).orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
//更新状态
boolean update = securityUnitService.lambdaUpdate()
.set(SecurityUnit::getCheckStatus, CheckStatus.checked)
.eq(BaseEntity::getSnowFlakeId, checkDataId)
.update();
if (!update) {
throw new MessageException(ResultCode.ERROR);
}
//生成简单的超级管理员账号密码
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
ManagementSecurityUnitUser managementSecurityUnitUser = new ManagementSecurityUnitUser();
managementSecurityUnitUser.setSecurityUnitId(securityUnit.getSnowFlakeId());
managementSecurityUnitUser.setName("超级管理员");
managementSecurityUnitUser.setSex(Sex.UNKNOWN);
managementSecurityUnitUser.setAccount(RandomUtil.randomString(6));
managementSecurityUnitUser.setTelephone("");
managementSecurityUnitUser.setSalt(saltAndPassWord.get(0));
managementSecurityUnitUser.setPassword(saltAndPassWord.get(1));
managementSecurityUnitUser.setIsEnable(IsEnable.TRUE);
managementSecurityUnitUser.setIsAdmin(IsOrNot.IS);
managementSecurityUnitUser.setRemark("单位审核通过 默认分配超管账号");
boolean save = securityUnitUserService.save(managementSecurityUnitUser);
if (!save) {
throw new MessageException(ResultCode.ERROR);
}
//提交事务
transactionManager.commit(status);
} catch (Exception e) {
//回滚事务
transactionManager.rollback(status);
log.error("保安单位审核通过错误:{}", e.getMessage());
throw new MessageException(e.getMessage());
}
}
@Override
public UnitCheckStatusVo getCheckStatus(String onlyCode) {
SecurityUnit securityUnit = securityUnitService.lambdaQuery()
.eq(SecurityUnit::getSocialCode, onlyCode)
.oneOpt()
.orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
UnitCheckStatusVo unitCheckStatusVo = new UnitCheckStatusVo();
unitCheckStatusVo.setCheckStatus(securityUnit.getCheckStatus());
if (securityUnit.getCheckStatus().equals(CheckStatus.checked)) {
ManagementSecurityUnitUser managementSecurityUnitUser = securityUnitUserService.lambdaQuery()
.eq(ManagementSecurityUnitUser::getSecurityUnitId, securityUnit.getSnowFlakeId())
.eq(ManagementSecurityUnitUser::getIsAdmin, IsOrNot.IS)
.oneOpt()
.orElseThrow(() -> new MessageException("超管账号未初始化 请联系管理员"));
unitCheckStatusVo.setAccount(managementSecurityUnitUser.getAccount());
unitCheckStatusVo.setRemark("恭喜!单位审核通过了,请使用管理员账号前往登录页进行登录.");
} else {
unitCheckStatusVo.setPassword(null);
unitCheckStatusVo.setRemark("单位注册申请正在审核中...");
}
return unitCheckStatusVo;
}
}

View File

@ -10,6 +10,6 @@ import org.apache.ibatis.annotations.Mapper;
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementPoliceUserMapper extends BaseMapper<ManagementPoliceUnitUser> {
public interface ManagementPoliceUnitUserMapper extends BaseMapper<ManagementPoliceUnitUser> {
}

View File

@ -1,9 +1,6 @@
package com.changhu.module.management.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.SecurityUnit;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;

View File

@ -1,18 +1,18 @@
package com.changhu.module.management.pojo.entity;
import java.io.Serial;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.Sex;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serial;
import java.io.Serializable;
/**
@ -46,6 +46,11 @@ public class ManagementPoliceUnitUser extends BaseEntity implements Serializable
*/
private Sex sex;
/**
* 账号
*/
private String account;
/**
* 手机号
*/

View File

@ -1,18 +1,18 @@
package com.changhu.module.management.pojo.entity;
import java.io.Serial;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.Sex;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serial;
import java.io.Serializable;
/**
@ -46,6 +46,11 @@ public class ManagementSecurityUnitUser extends BaseEntity implements Serializab
*/
private Sex sex;
/**
* 账号
*/
private String account;
/**
* 手机号
*/

View File

@ -1,17 +1,17 @@
package com.changhu.module.management.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serial;
import java.io.Serializable;
import com.changhu.common.db.enums.IsEnable;
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;
/**
* 后台-超级后台 实体类

View File

@ -1,20 +1,20 @@
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.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.module.management.pojo.model.ContactPersonInfo;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serial;
import java.io.Serializable;
/**

View File

@ -1,20 +1,20 @@
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.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.module.management.pojo.model.LegalPersonInfo;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serial;
import java.io.Serializable;
/**

View File

@ -0,0 +1,22 @@
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/2 上午9:59
* @desc IndexCheckPassParams...
*/
@Data
public class IndexCheckPassParams {
@Schema(description = "审核数据的id")
@NotNull(message = "审核数据的id不能为空")
private Long checkDataId;
@Schema(description = "单位类型")
@NotNull(message = "单位类型不能为空")
private UnitOptType unitOptType;
}

View File

@ -0,0 +1,23 @@
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/2 上午10:51
* @desc IndexCheckStatusParams...
*/
@Data
public class IndexCheckStatusParams {
@Schema(description = "审核数据的唯一标识")
@NotNull(message = "唯一标识不能为空")
private String onlyCode;
@Schema(description = "单位类型")
@NotNull(message = "单位类型不能为空")
private UnitOptType unitOptType;
}

View File

@ -1,10 +1,6 @@
package com.changhu.module.management.pojo.params;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.validator.annotation.IsMobile;
import com.changhu.module.management.pojo.model.LegalPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

View File

@ -4,6 +4,7 @@ import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.module.management.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@ -12,6 +13,7 @@ import java.time.LocalDateTime;
* @createTime 2024/8/30 下午3:55
* @desc PoliceUnitPagerVo...
*/
@Data
public class PoliceUnitPagerVo {
@Schema(description = "id")

View File

@ -0,0 +1,22 @@
package com.changhu.module.management.pojo.vo;
import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.utils.UserUtil;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/2 上午10:42
* @desc SecurityUnitCheckStatusVo...
*/
@Data
public class UnitCheckStatusVo {
private CheckStatus checkStatus;
private String remark;
private String account;
private String password = UserUtil.DEFAULT_PASSWORD;
}

View File

@ -0,0 +1,28 @@
package com.changhu.module.management.service;
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
/**
* @author 20252
* @createTime 2024/9/2 上午9:49
* @desc IndexService...
*/
public interface IndexService {
/**
* 审核通过
*
* @param params 审核参数
*/
void checkPass(IndexCheckPassParams params);
/**
* 获取审核状态
*
* @param params 参数
* @return 结果
*/
UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params);
}

View File

@ -8,6 +8,6 @@ import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
* author: luozhun
* desc 由groovy脚本自动生成
*/
public interface ManagementPoliceUserService extends IService<ManagementPoliceUnitUser> {
public interface ManagementPoliceUnitUserService extends IService<ManagementPoliceUnitUser> {
}

View File

@ -29,4 +29,5 @@ public interface SecurityUnitService extends IService<SecurityUnit> {
* @param params 参数
*/
void saveOrUpdate(SecurityUnitSaveOrUpdateParams params);
}

View File

@ -0,0 +1,29 @@
package com.changhu.module.management.service.impl;
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.service.IndexService;
import org.springframework.stereotype.Service;
/**
* @author 20252
* @createTime 2024/9/2 上午9:49
* @desc IndexServiceImpl...
*/
@Service
public class IndexServiceImpl implements IndexService {
@Override
public void checkPass(IndexCheckPassParams params) {
params.getUnitOptType()
.getHandler()
.pass(params.getCheckDataId());
}
@Override
public UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params) {
return params.getUnitOptType()
.getHandler()
.getCheckStatus(params.getOnlyCode());
}
}

View File

@ -1,9 +1,9 @@
package com.changhu.module.management.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.module.management.mapper.ManagementPoliceUserMapper;
import com.changhu.module.management.mapper.ManagementPoliceUnitUserMapper;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.service.ManagementPoliceUserService;
import com.changhu.module.management.service.ManagementPoliceUnitUserService;
import org.springframework.stereotype.Service;
/**
@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
* desc 由groovy脚本自动生成
*/
@Service
public class ManagementPoliceUserServiceImpl extends ServiceImpl<ManagementPoliceUserMapper, ManagementPoliceUnitUser> implements ManagementPoliceUserService {
public class ManagementPoliceUnitUserServiceImpl extends ServiceImpl<ManagementPoliceUnitUserMapper, ManagementPoliceUnitUser> implements ManagementPoliceUnitUserService {
}

View File

@ -1,28 +1,18 @@
package com.changhu.module.management.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.changhu.common.utils.JavaClassToTsUtil;
import com.changhu.module.management.pojo.model.LegalPersonInfo;
import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams;
import com.google.common.collect.Lists;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.CheckStatus;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.utils.JavaClassToTsUtil;
import com.changhu.module.management.mapper.SecurityUnitMapper;
import com.changhu.module.management.pojo.entity.SecurityUnit;
import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import com.changhu.module.management.service.SecurityUnitService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
@ -35,27 +25,7 @@ public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, Sec
@Override
public Page<SecurityUnitPagerVo> pager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
Page<SecurityUnitPagerVo> page = queryParams.getPage();
SecurityUnitPagerQueryParams params = queryParams.getParams();
LambdaQueryWrapper<SecurityUnit> wrapper = Wrappers.<SecurityUnit>lambdaQuery()
.like(StrUtil.isNotEmpty(params.getName()), SecurityUnit::getName, params.getName())
.like(StrUtil.isNotEmpty(params.getSocialCode()), SecurityUnit::getSocialCode, params.getSocialCode());
if (params.getCheckStatus() != null) {
wrapper.eq(SecurityUnit::getCheckStatus, params.getCheckStatus().getValue());
}
if (params.getIsEnable() != null) {
wrapper.eq(SecurityUnit::getIsEnable, params.getIsEnable().getValue());
}
List<String> administrativeDivisionCodes = params.getAdministrativeDivisionCodes();
if (administrativeDivisionCodes != null) {
wrapper.eq(!administrativeDivisionCodes.isEmpty(), SecurityUnit::getProvince, administrativeDivisionCodes.get(0));
wrapper.eq(administrativeDivisionCodes.size() >= 2, SecurityUnit::getCity, administrativeDivisionCodes.get(1));
wrapper.eq(administrativeDivisionCodes.size() >= 3, SecurityUnit::getDistricts, administrativeDivisionCodes.get(2));
wrapper.eq(administrativeDivisionCodes.size() >= 4, SecurityUnit::getStreet, administrativeDivisionCodes.get(3));
}
return baseMapper.pager(page, params);
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Override

View File

@ -1,16 +1,16 @@
package com.changhu.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serial;
import java.io.Serializable;
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;
/**
* 全国行政区划表(2023/12/04) 实体类

View File

@ -2,10 +2,8 @@ package com.changhu.pojo.params;
import com.changhu.module.management.pojo.model.LegalPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;

View File

@ -2,7 +2,6 @@ package com.changhu.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.model.JsonResult;

View File

@ -1,8 +1,6 @@
package com.changhu.service.impl;
import com.changhu.common.pojo.vo.TokenInfo;
import com.changhu.enums.ClientType;
import com.changhu.enums.handler.AbstractLoginHandler;
import com.changhu.pojo.params.LoginParams;
import com.changhu.service.LoginService;
import org.springframework.stereotype.Service;

View File

@ -6,7 +6,6 @@ import com.changhu.common.annotation.Desensitized;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -1,7 +1,6 @@
package com.changhu.support.mybatisplus.pojo.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.changhu.common.db.enums.DeleteFlag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

View File

@ -1,7 +1,6 @@
package com.changhu.support.ws.manager;
import com.alibaba.fastjson2.JSON;
import com.changhu.support.ws.enums.WsMsgType;
import com.changhu.support.ws.pojo.dto.WsMsgDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.socket.TextMessage;
@ -9,7 +8,6 @@ import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -9,8 +9,6 @@ import com.changhu.support.ws.manager.UserConnectWebsocketManager;
import com.changhu.support.ws.pojo.dto.WsMsgDTO;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;

View File

@ -1,28 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.changhu.module.management.mapper.PoliceUnitMapper">
<select id="pager" resultType="com.changhu.module.management.pojo.vo.PoliceUnitPagerVo">
select *
from police_unit
where delete_flag = 0
<if test="params.name!=null and params.name!=''">and name like concat('%',#{params.name},'%')</if>
<if test="params.code!=null and params.code!=''">and code like concat('%',#{params.code},'%')</if>
<resultMap id="PoliceUnitPagerVoResultMap" type="com.changhu.module.management.pojo.vo.PoliceUnitPagerVo">
<result
column="contact_person_info"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="contactPersonInfo"/>
</resultMap>
<select id="pager" resultMap="PoliceUnitPagerVoResultMap">
select
pu.*,
ad1.name as provinceName,
ad2.name as cityName,
ad3.name as districtsName,
ad4.name as streetName
from police_unit pu
left join administrative_division ad1 on pu.province = ad1.code and ad1.delete_flag = 0
left join administrative_division ad2 on pu.city = ad2.code and ad2.delete_flag = 0
left join administrative_division ad3 on pu.districts = ad3.code and ad3.delete_flag = 0
left join administrative_division ad4 on pu.street = ad4.code and ad4.delete_flag = 0
where pu.delete_flag = 0
<if test="params.name!=null and params.name!=''">and pu.name like concat('%',#{params.name},'%')</if>
<if test="params.code!=null and params.code!=''">and pu.code like concat('%',#{params.code},'%')</if>
<if test="params.administrativeDivisionCodes!=null">
<if test="params.administrativeDivisionCodes.size>=1">
and province = #{params.administrativeDivisionCodes[0]}
and pu.province = #{params.administrativeDivisionCodes[0]}
</if>
<if test="params.administrativeDivisionCodes.size>=2">
and city = #{params.administrativeDivisionCodes[1]}
and pu.city = #{params.administrativeDivisionCodes[1]}
</if>
<if test="params.administrativeDivisionCodes.size>=3">
and districts = #{params.administrativeDivisionCodes[2]}
and pu.districts = #{params.administrativeDivisionCodes[2]}
</if>
<if test="params.administrativeDivisionCodes.size>=4">
and street = #{params.administrativeDivisionCodes[3]}
and pu.street = #{params.administrativeDivisionCodes[3]}
</if>
order by create_time desc
</if>
<if test="params.isEnable!=null">and is_enable = #{params.isEnable.value}</if>
<if test="params.checkStatus!=null">and check_status = #{params.checkStatus.value}</if>
<if test="params.isEnable!=null">and pu.is_enable = #{params.isEnable.value}</if>
<if test="params.checkStatus!=null">and pu.check_status = #{params.checkStatus.value}</if>
order by pu.create_time desc
</select>
</mapper>

View File

@ -1,34 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.changhu.module.management.mapper.SecurityUnitMapper">
<select id="pager" resultType="com.changhu.module.management.pojo.vo.SecurityUnitPagerVo">
<resultMap id="SecurityUnitPagerVoResultMap" type="com.changhu.module.management.pojo.vo.SecurityUnitPagerVo">
<result
column="legal_person_info"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="legalPersonInfo"/>
</resultMap>
<select id="pager" resultMap="SecurityUnitPagerVoResultMap">
select
*
from security_unit
su.*,
ad1.name as provinceName,
ad2.name as cityName,
ad3.name as districtsName,
ad4.name as streetName
from
security_unit su
left join administrative_division ad1 on su.province = ad1.code and ad1.delete_flag = 0
left join administrative_division ad2 on su.city = ad2.code and ad2.delete_flag = 0
left join administrative_division ad3 on su.districts = ad3.code and ad3.delete_flag = 0
left join administrative_division ad4 on su.street = ad4.code and ad4.delete_flag = 0
where
delete_flag = 0
<if test="params.name!=null and params.name!=''">
and name like concat('%',#{params.name},'%')
</if>
<if test="params.socialCode!=null and params.socialCode!=''">
and socialCode like concat('%',#{params.socialCode},'%')
</if>
<if test="params.administrativeDivisionCodes!=null">
<if test="params.administrativeDivisionCodes.size>=1">
and province = #{params.administrativeDivisionCodes[0]}
su.delete_flag = 0
<if test="params.name!=null and params.name!=''">
and su.name like concat('%',#{params.name},'%')
</if>
<if test="params.administrativeDivisionCodes.size>=2">
and city = #{params.administrativeDivisionCodes[1]}
<if test="params.socialCode!=null and params.socialCode!=''">
and su.socialCode like concat('%',#{params.socialCode},'%')
</if>
<if test="params.administrativeDivisionCodes.size>=3">
and districts = #{params.administrativeDivisionCodes[2]}
<if test="params.administrativeDivisionCodes!=null">
<if test="params.administrativeDivisionCodes.size>=1">
and su.province = #{params.administrativeDivisionCodes[0]}
</if>
<if test="params.administrativeDivisionCodes.size>=2">
and su.city = #{params.administrativeDivisionCodes[1]}
</if>
<if test="params.administrativeDivisionCodes.size>=3">
and su.districts = #{params.administrativeDivisionCodes[2]}
</if>
<if test="params.administrativeDivisionCodes.size>=4">
and su.street = #{params.administrativeDivisionCodes[3]}
</if>
order by su.create_time desc
</if>
<if test="params.administrativeDivisionCodes.size>=4">
and street = #{params.administrativeDivisionCodes[3]}
</if>
order by create_time desc
</if>
<if test="params.isEnable!=null">and is_enable = #{params.isEnable.value}</if>
<if test="params.checkStatus!=null">and check_status = #{params.checkStatus.value}</if>
<if test="params.isEnable!=null">and su.is_enable = #{params.isEnable.value}</if>
<if test="params.checkStatus!=null">and su.check_status = #{params.checkStatus.value}</if>
order by su.create_time desc
</select>
</mapper>

View File

@ -9,7 +9,7 @@
</TableProMax>
</template>
<script setup lang="ts">
<script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue";
import {ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers";
@ -17,6 +17,7 @@ import {TableProMaxProps} from "@/types/components/table";
import {PoliceUnitPagerQueryParams, PoliceUnitPagerVo} from "@/types/views/unitManage/policeUnit.ts";
import api from "@/axios";
import {enumSelectNodes} from "@/config/dict.ts";
import {message} from "ant-design-vue";
type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams>
@ -30,21 +31,48 @@ const columns: TableProps['columns'] = [
dataIndex: 'code',
title: '代码'
}, {
dataIndex: 'legalPersonInfo',
title: '联系人'
dataIndex: 'contactPersonInfo',
title: '联系人',
customRender({record}) {
return record.contactPersonInfo?.name + "/" + record.contactPersonInfo?.telephone
},
}, {
dataIndex: 'provinceName',
title: '行政区划',
customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join('/')
}, {
dataIndex: 'isEnable',
title: '是否启用'
title: '是否启用',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
}, {
dataIndex: 'checkStatus',
title: '审核状态'
title: '审核状态',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
}, {
dataIndex: 'createTime',
title: '创建时间'
}, {
dataIndex: 'opt',
title: '操作',
customRender({record}) {
return <a-space>
{record.checkStatus.value === 1 && <a-popconfirm
title="确认审核通过嘛?"
onConfirm={async () => {
const resp = await api.post('/management/checkPass', {
checkDataId: record.snowFlakeId,
unitOptType: 'POLICE_UNIT'
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}>
<a-button type="primary">审核通过
</a-button>
</a-popconfirm>
}
{record.isEnable.value === 0 ? <a-button danger>禁用</a-button> : <a-button></a-button>}
</a-space>
},
}
]
const searchFormOptions: TableProps["searchFormOptions"] = {

View File

@ -4,12 +4,13 @@
:request-api="reqApi"
:columns="columns"
:searchFormOptions="searchFormOptions"
:scroll="{x}"
>
</TableProMax>
</template>
<script setup lang="ts">
<script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue";
import {TableProMaxProps} from "@/types/components/table";
import {SecurityUnitPagerQueryParams, SecurityUnitPagerVo} from "@/types/views/unitManage/securityUnit.ts";
@ -17,6 +18,7 @@ import api from "@/axios";
import {ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers";
import {enumSelectNodes} from "@/config/dict.ts";
import {message} from "ant-design-vue";
type TableProps = TableProMaxProps<SecurityUnitPagerVo, SecurityUnitPagerQueryParams>
@ -25,34 +27,80 @@ const reqApi: TableProps['requestApi'] = (params) => api.post('/securityUnit/pag
const columns: TableProps['columns'] = [
{
dataIndex: 'name',
title: '名称'
title: '名称',
width: 200,
ellipsis: true
}, {
dataIndex: 'socialCode',
title: '社会编码'
title: '社会编码',
width: 200,
ellipsis: true
}, {
dataIndex: 'businessLicense',
title: '印业执照'
title: '营业执照',
width: 150,
customRender({text}) {
return <a-image width={100} height={100} src={__APP_ENV.VITE_APP_MINIO_URL + text}></a-image>
},
}, {
dataIndex: 'legalPersonInfo',
title: '法人信息'
title: '法人信息',
width: 200,
customRender({record}) {
return record.legalPersonInfo?.name + "/" + record.legalPersonInfo?.telephone
},
}, {
dataIndex: 'provinceName',
title: '行政区划',
customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join('/')
customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join('/'),
width: 200,
ellipsis: true
}, {
dataIndex: 'nature',
title: '性质'
title: '性质',
width: 200
}, {
dataIndex: 'isEnable',
title: '是否启用'
title: '是否启用',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
width: 150
}, {
dataIndex: 'checkStatus',
title: '审核状态'
title: '审核状态',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
width: 150
}, {
dataIndex: 'createTime',
title: '创建时间'
title: '创建时间',
width: 150,
ellipsis: true,
}, {
dataIndex: 'opt',
title: '操作',
fixed: "right",
customRender({record}) {
return <a-space>
{record.checkStatus.value === 1 && <a-popconfirm
title="确认审核通过嘛?"
onConfirm={async () => {
const resp = await api.post('/management/checkPass', {
checkDataId: record.snowFlakeId,
unitOptType: 'SECURITY_UNIT'
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}>
<a-button type="primary">审核通过
</a-button>
</a-popconfirm>
}
{record.isEnable.value === 0 ? <a-button danger>禁用</a-button> : <a-button></a-button>}
</a-space>
},
width: 200
}
]
const x: number = columns.reduce((a, b) => a + (b.width as number), 0)
const searchFormOptions: TableProps["searchFormOptions"] = {
name: {
type: 'input',

View File

@ -18,3 +18,9 @@ interface ImportMetaEnv {
// RSA公钥
readonly VITE_APP_RSA_PUBLIC_KEY: string;
}
declare module '*.vue' {
import {DefineComponent} from "vue"
const component: DefineComponent<{}, {}, any>
export default component
}