This commit is contained in:
TimSpan 2024-09-02 18:08:02 +08:00
commit 45a490600f
66 changed files with 1116 additions and 179 deletions

View File

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

View File

@ -1,6 +1,8 @@
package com.changhu.common.db.enums; package com.changhu.common.db.enums;
import cn.hutool.core.lang.Dict;
import com.baomidou.mybatisplus.annotation.IEnum; import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.annotation.IsExtData;
import com.changhu.common.db.BaseEnum; import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@ -14,10 +16,21 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
public enum CheckStatus implements BaseEnum<Integer>, IEnum<Integer> { public enum CheckStatus implements BaseEnum<Integer>, IEnum<Integer> {
checked(0, "已审核"), checked(0, "已审核", "success"),
unChecked(1, "未审核"), unChecked(1, "未审核", "error"),
; ;
private final Integer value; private final Integer value;
private final String label; 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; package com.changhu.common.db.enums;
import cn.hutool.core.lang.Dict;
import com.changhu.common.db.BaseEnum; import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

View File

@ -1,5 +1,6 @@
package com.changhu.common.db.enums; package com.changhu.common.db.enums;
import cn.hutool.core.lang.Dict;
import com.baomidou.mybatisplus.annotation.IEnum; import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.annotation.IsExtData; import com.changhu.common.annotation.IsExtData;
import com.changhu.common.db.BaseEnum; import com.changhu.common.db.BaseEnum;
@ -24,4 +25,12 @@ public enum IsEnable implements BaseEnum<Integer>, IEnum<Integer> {
@IsExtData @IsExtData
private final String color; 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; package com.changhu.common.db.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.db.BaseEnum; import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@ -11,7 +12,7 @@ import lombok.Getter;
*/ */
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum IsOrNot implements BaseEnum<Integer> { public enum IsOrNot implements BaseEnum<Integer>, IEnum<Integer> {
IS(0, ""), IS(0, ""),
NOT(1, ""), NOT(1, ""),
; ;

View File

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

View File

@ -13,7 +13,10 @@ import lombok.NoArgsConstructor;
import org.springframework.lang.NonNull; import org.springframework.lang.NonNull;
import java.io.Serializable; 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.function.Function;
import java.util.stream.Collectors; 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.lang.Validator;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.changhu.common.utils.ValidatorUtil;
import com.changhu.common.validator.annotation.IsMobile; import com.changhu.common.validator.annotation.IsMobile;
import jakarta.validation.ConstraintValidator; import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;

View File

@ -8,12 +8,7 @@ import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.*;
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.RetentionPolicy.RUNTIME; 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<>(); private final List<String> whiteList = new ArrayList<>();
public WebConfig() { public WebConfig() {
//todo 要删除的
whiteList.add("/managementSuperUser/**"); whiteList.add("/managementSuperUser/**");
whiteList.add("/common/**"); whiteList.add("/common/**");
whiteList.add("/test/**"); whiteList.add("/test/**");
whiteList.add("/login"); whiteList.add("/login");
whiteList.add("/logout"); whiteList.add("/logout");
whiteList.add("/management/getCheckStatus");
whiteList.add("/favicon.ico"); whiteList.add("/favicon.ico");
//druid console //druid console
whiteList.add("/druid/**"); 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.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

View File

@ -2,7 +2,6 @@ package com.changhu.enums.handler;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.common.pojo.vo.TokenInfo;
import org.apache.poi.ss.formula.functions.T;
/** /**
* @author 20252 * @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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody; 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.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo; import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.management.service.PoliceUnitService; import com.changhu.module.management.service.PoliceUnitService;
@ -33,7 +32,4 @@ public class PoliceUnitController {
return policeUnitService.pager(queryParams); 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) { public void saveOrUpdate(@RequestBody @Valid SecurityUnitSaveOrUpdateParams params) {
securityUnitService.saveOrUpdate(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脚本自动生成 * desc 由groovy脚本自动生成
*/ */
@Mapper @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; 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.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.SecurityUnit; import com.changhu.module.management.pojo.entity.SecurityUnit;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;

View File

@ -1,18 +1,18 @@
package com.changhu.module.management.pojo.entity; package com.changhu.module.management.pojo.entity;
import java.io.Serial; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import com.changhu.common.db.enums.IsEnable; 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.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; 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 Sex sex;
/**
* 账号
*/
private String account;
/** /**
* 手机号 * 手机号
*/ */

View File

@ -1,18 +1,18 @@
package com.changhu.module.management.pojo.entity; package com.changhu.module.management.pojo.entity;
import java.io.Serial; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import com.changhu.common.db.enums.IsEnable; 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.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; 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 Sex sex;
/**
* 账号
*/
private String account;
/** /**
* 手机号 * 手机号
*/ */

View File

@ -1,17 +1,17 @@
package com.changhu.module.management.pojo.entity; 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.Serial;
import java.io.Serializable; 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; 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.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
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.IsEnable;
import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.module.management.pojo.model.ContactPersonInfo;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; 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; 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.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
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.IsEnable;
import com.changhu.module.management.pojo.model.LegalPersonInfo; import com.changhu.module.management.pojo.model.LegalPersonInfo;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder; 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; 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.db.enums.IsEnable;
import com.changhu.common.validator.annotation.IsMobile;
import com.changhu.module.management.pojo.model.LegalPersonInfo; import com.changhu.module.management.pojo.model.LegalPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; 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.common.db.enums.IsEnable;
import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.module.management.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -12,6 +13,7 @@ import java.time.LocalDateTime;
* @createTime 2024/8/30 下午3:55 * @createTime 2024/8/30 下午3:55
* @desc PoliceUnitPagerVo... * @desc PoliceUnitPagerVo...
*/ */
@Data
public class PoliceUnitPagerVo { public class PoliceUnitPagerVo {
@Schema(description = "id") @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 * author: luozhun
* desc 由groovy脚本自动生成 * 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 参数 * @param params 参数
*/ */
void saveOrUpdate(SecurityUnitSaveOrUpdateParams 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; package com.changhu.module.management.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.service.ManagementPoliceUserService; import com.changhu.module.management.service.ManagementPoliceUnitUserService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
* desc 由groovy脚本自动生成 * desc 由groovy脚本自动生成
*/ */
@Service @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; package com.changhu.module.management.service.impl;
import cn.hutool.core.bean.BeanUtil; 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.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.mapper.SecurityUnitMapper;
import com.changhu.module.management.pojo.entity.SecurityUnit; 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.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo; import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import com.changhu.module.management.service.SecurityUnitService; import com.changhu.module.management.service.SecurityUnitService;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional; import java.util.Optional;
/** /**
@ -35,27 +25,7 @@ public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, Sec
@Override @Override
public Page<SecurityUnitPagerVo> pager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) { public Page<SecurityUnitPagerVo> pager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
Page<SecurityUnitPagerVo> page = queryParams.getPage(); return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
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);
} }
@Override @Override

View File

@ -1,16 +1,16 @@
package com.changhu.pojo.entity; 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.Serial;
import java.io.Serializable; 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) 实体类 * 全国行政区划表(2023/12/04) 实体类

View File

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

View File

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

View File

@ -1,8 +1,6 @@
package com.changhu.service.impl; package com.changhu.service.impl;
import com.changhu.common.pojo.vo.TokenInfo; 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.pojo.params.LoginParams;
import com.changhu.service.LoginService; import com.changhu.service.LoginService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

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

View File

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

View File

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

View File

@ -1,28 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!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"> <mapper namespace="com.changhu.module.management.mapper.PoliceUnitMapper">
<select id="pager" resultType="com.changhu.module.management.pojo.vo.PoliceUnitPagerVo"> <resultMap id="PoliceUnitPagerVoResultMap" type="com.changhu.module.management.pojo.vo.PoliceUnitPagerVo">
select * <result
from police_unit column="contact_person_info"
where delete_flag = 0 typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
<if test="params.name!=null and params.name!=''">and name like concat('%',#{params.name},'%')</if> property="contactPersonInfo"/>
<if test="params.code!=null and params.code!=''">and code like concat('%',#{params.code},'%')</if> </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!=null">
<if test="params.administrativeDivisionCodes.size>=1"> <if test="params.administrativeDivisionCodes.size>=1">
and province = #{params.administrativeDivisionCodes[0]} and pu.province = #{params.administrativeDivisionCodes[0]}
</if> </if>
<if test="params.administrativeDivisionCodes.size>=2"> <if test="params.administrativeDivisionCodes.size>=2">
and city = #{params.administrativeDivisionCodes[1]} and pu.city = #{params.administrativeDivisionCodes[1]}
</if> </if>
<if test="params.administrativeDivisionCodes.size>=3"> <if test="params.administrativeDivisionCodes.size>=3">
and districts = #{params.administrativeDivisionCodes[2]} and pu.districts = #{params.administrativeDivisionCodes[2]}
</if> </if>
<if test="params.administrativeDivisionCodes.size>=4"> <if test="params.administrativeDivisionCodes.size>=4">
and street = #{params.administrativeDivisionCodes[3]} and pu.street = #{params.administrativeDivisionCodes[3]}
</if> </if>
order by create_time desc
</if> </if>
<if test="params.isEnable!=null">and is_enable = #{params.isEnable.value}</if> <if test="params.isEnable!=null">and pu.is_enable = #{params.isEnable.value}</if>
<if test="params.checkStatus!=null">and check_status = #{params.checkStatus.value}</if> <if test="params.checkStatus!=null">and pu.check_status = #{params.checkStatus.value}</if>
order by pu.create_time desc
</select> </select>
</mapper> </mapper>

View File

@ -1,34 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!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"> <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 select
* su.*,
from security_unit 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 where
delete_flag = 0 su.delete_flag = 0
<if test="params.name!=null and params.name!=''"> <if test="params.name!=null and params.name!=''">
and name like concat('%',#{params.name},'%') and su.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]}
</if> </if>
<if test="params.administrativeDivisionCodes.size>=2"> <if test="params.socialCode!=null and params.socialCode!=''">
and city = #{params.administrativeDivisionCodes[1]} and su.socialCode like concat('%',#{params.socialCode},'%')
</if> </if>
<if test="params.administrativeDivisionCodes.size>=3"> <if test="params.administrativeDivisionCodes!=null">
and districts = #{params.administrativeDivisionCodes[2]} <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>
<if test="params.administrativeDivisionCodes.size>=4"> <if test="params.isEnable!=null">and su.is_enable = #{params.isEnable.value}</if>
and street = #{params.administrativeDivisionCodes[3]} <if test="params.checkStatus!=null">and su.check_status = #{params.checkStatus.value}</if>
</if> order by su.create_time desc
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>
</select> </select>
</mapper> </mapper>

View File

@ -5,7 +5,11 @@ VITE_DROP_CONSOLE=false
# axios # axios
VITE_APP_BASE_API=/api VITE_APP_BASE_API=/api
VITE_APP_PROXY_URL=http://localhost:8765 VITE_APP_PROXY_URL=http://172.10.10.151:8765
# rsa 公钥 # rsa 公钥
VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R0NWIOBciHCr7P7coDT8tNKfelgR7txcJOqHCO/MIWe7T04aHQTcpQxqx9hMca7dbqz8TZpz9jvLzE/6ZonVKxHsoFnNlHMp1/CPAJ9f6D9wYicum2KltJkmQ0g//D9W2zPCYoGOmSRFcZx/KEBa4EM53jQIDAQAB VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R0NWIOBciHCr7P7coDT8tNKfelgR7txcJOqHCO/MIWe7T04aHQTcpQxqx9hMca7dbqz8TZpz9jvLzE/6ZonVKxHsoFnNlHMp1/CPAJ9f6D9wYicum2KltJkmQ0g//D9W2zPCYoGOmSRFcZx/KEBa4EM53jQIDAQAB
# minio
VITE_APP_MINIO_URL=http://118.253.177.137:9000
VITE_APP_MINIO_BUCKET=police-security-dev

View File

@ -23,3 +23,7 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
package-lock.json
yarn.lock
components.d.ts

View File

@ -17,9 +17,12 @@
"pinia-plugin-persistedstate": "^3.2.0", "pinia-plugin-persistedstate": "^3.2.0",
"sass": "^1.77.8", "sass": "^1.77.8",
"vue": "^3.4.37", "vue": "^3.4.37",
"vue-router": "4" "vue-router": "4",
"vue-uuid": "^3.0.0",
"lodash-es": "^4.17.21"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash-es": "^4.17.8",
"@types/node": "^22.5.1", "@types/node": "^22.5.1",
"@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue": "^5.1.2",
"@vitejs/plugin-vue-jsx": "^4.0.1", "@vitejs/plugin-vue-jsx": "^4.0.1",

View File

@ -39,7 +39,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue' import {ref} from 'vue'
import {FormInstance, message, notification} from "ant-design-vue"; import {FormInstance, notification} from "ant-design-vue";
import {Rule} from "ant-design-vue/es/form"; import {Rule} from "ant-design-vue/es/form";
import {LoginParams} from "@/types/views/login.ts"; import {LoginParams} from "@/types/views/login.ts";
import api from "@/axios"; import api from "@/axios";

View File

@ -0,0 +1,95 @@
<template>
<div class="simpleUploadDiv">
<a-progress v-if="uploading" type="circle" :percent="percent"/>
<a-image
height="80%"
v-else
:src="minioBaseUrl+modelValue"
alt="avatar"/>
<a-button class="btn-success" @click="selectFile">{{ btnLabel }}</a-button>
<input id="myFileInput" type="file" style="display: none"/>
</div>
</template>
<script setup lang="ts">
import {message} from "ant-design-vue";
import {onMounted, onUnmounted, ref} from "vue";
import {generateSimpleObjectName, getResignedObjectUrl} from "@/utils/minioUtil";
import axios, {CancelTokenSource} from "axios";
import {convertFileSizeToStr} from "@/utils/index.ts";
const minioBaseUrl = __APP_ENV.VITE_APP_MINIO_URL
const modelValue = defineModel<string>('value')
const props = withDefaults(defineProps<{
parentDir?: string,
allowedExtensions?: string[],
maxSize?: number,
width?: string | number,
height?: string | number,
btnLabel?: string
}>(), {
parentDir: '',
allowedExtensions: () => ['jpg', 'jpeg', 'png', 'gif'],
maxSize: 1024 * 1024 * 4,
width: '150px',
height: '150px',
btnLabel: '选择图片'
})
const uploading = ref(false)
const percent = ref(0)
let cancelToken: CancelTokenSource | null = null
const selectFile = () => {
document.getElementById('myFileInput')?.click()
}
async function inputFileListener(this: HTMLInputElement) {
const selectedFile: File = this.files?.[0] as File;
const fileExtension = selectedFile.name?.split('.').pop().toLowerCase() as string;
if (!props.allowedExtensions.includes(fileExtension)) {
return message.error(`错误:不支持的文件格式,目前支持:【${props.allowedExtensions}`)
}
const isMax = selectedFile.size > props.maxSize;
if (isMax) {
return message.error(`文件大小超出限制,最大支持:【${convertFileSizeToStr(props.maxSize)}`);
}
cancelToken?.cancel();
percent.value = 0;
uploading.value = true;
const objectName = generateSimpleObjectName(selectedFile.name, props.parentDir)
const uploadUrl = await getResignedObjectUrl(__APP_ENV.VITE_APP_MINIO_BUCKET, objectName);
cancelToken = axios.CancelToken.source()
await axios.put(uploadUrl, selectedFile, {
cancelToken: cancelToken.token,
onUploadProgress: (progressEvent) => {
percent.value = (progressEvent.loaded / (progressEvent.total as number) * 100 | 0)
}
})
modelValue.value = '/' + __APP_ENV.VITE_APP_MINIO_BUCKET + objectName;
uploading.value = false;
}
onMounted(() => {
document.getElementById('myFileInput')?.addEventListener('change', inputFileListener);
})
onUnmounted(() => {
document.getElementById('myFileInput')?.removeEventListener('change', inputFileListener);
})
</script>
<style scoped lang="scss">
.simpleUploadDiv {
width: v-bind(width);
height: v-bind(height);
display: flex;
flex-direction: column;
}
</style>

View File

@ -1,2 +1,2 @@
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','/enterprise'];

View File

@ -8,3 +8,56 @@ interface JsonResult<T> {
message: string; message: string;
data?: T; data?: T;
} }
/**
*
*/
class SelectNodeVo<T, E = Record<string, any>> {
value: T;
label: string;
options?: SelectNodeVo<T>[]
orderIndex?: number;
disabled?: boolean;
extData?: E
}
/**
*
*/
class TreeNodeVo<T, E = Record<string, any>> {
value: T;
parentValue: T;
label: string;
orderIndex?: number;
children?: TreeNodeVo<T>[]
extData?: E;
}
/**
*
*/
declare interface Grid {
//栅格占据的列数
span?: number;
//栅格左侧的间隔格数
offset?: number;
//栅格向右移动格数
push?: number;
//栅格向左移动格数
pull?: number;
//<768px 响应式栅格数或者栅格属性对象
xs?: number;
//≥768px 响应式栅格数或者栅格属性对象
sm?: number;
//≥992px 响应式栅格数或者栅格属性对象
md?: number;
//≥1200px 响应式栅格数或者栅格属性对象
lg?: number;
//≥1920px 响应式栅格数或者栅格属性对象
xl?: number;
}
interface BaseEnum<T> {
value: T;
label: string
}

View File

@ -29,7 +29,7 @@ router.beforeEach(async (to, from, next) => {
if (ROUTER_WHITE_LIST.includes(to.path)) { if (ROUTER_WHITE_LIST.includes(to.path)) {
return next(); return next();
} }
//不在白名单内需要查看是否携带token 没有token需要返回登录页进行登录 // 不在白名单内需要查看是否携带token 没有token需要返回登录页进行登录
if (!userStore.getTokenInfo?.value) { if (!userStore.getTokenInfo?.value) {
await message.warn('未找到token请重新登陆!') await message.warn('未找到token请重新登陆!')
return next('/login'); return next('/login');

View File

@ -1,6 +1,14 @@
import {RouteRecordRaw} from "vue-router"; import {RouteRecordRaw} from "vue-router";
export const staticRouter: RouteRecordRaw[] = [ export const staticRouter: RouteRecordRaw[] = [
{
path: '/enterprise',
name: 'enterprise',
meta: {
title: '企业入驻',
},
component: () => import("@/views/enterprise.vue"),
},
{ {
path: '/login', path: '/login',
name: 'login', name: 'login',
@ -11,6 +19,13 @@ export const staticRouter: RouteRecordRaw[] = [
}, { }, {
path: "/", path: "/",
redirect: '/index', redirect: '/index',
}, {
path: '/test',
name: 'test',
meta: {
title: '测试',
},
component: () => import("@/views/test.vue"),
}, { }, {
path: '/layout', path: '/layout',
name: 'layout', name: 'layout',
@ -29,5 +44,5 @@ export const staticRouter: RouteRecordRaw[] = [
component: () => import('@/views/index.vue') component: () => import('@/views/index.vue')
} }
] ]
} },
] ]

View File

@ -0,0 +1,17 @@
import {ceil, divide} from "lodash-es";
/**
*
* @param fileSizeInBytes
*/
export const convertFileSizeToStr = (fileSizeInBytes: number): string => {
if (fileSizeInBytes < 1024) {
return fileSizeInBytes + "B";
} else if (fileSizeInBytes < 1024 * 1024) {
return (ceil(divide(fileSizeInBytes, 1024), 2)) + "KB";
} else if (fileSizeInBytes < 1024 * 1024 * 1024) {
return (ceil(divide(fileSizeInBytes, (1024 * 1024)), 2)) + "MB";
} else {
return (ceil(divide(fileSizeInBytes, (1024 * 1024 * 1024)), 2)) + "GB";
}
}

View File

@ -0,0 +1,26 @@
import api from "@/axios";
import dayjs from "dayjs";
import {uuid} from "vue-uuid";
/**
*
* @param fileName
* @param parentDir
*/
export const generateSimpleObjectName = (fileName: string, parentDir?: String): string => {
let objectName = parentDir + dayjs().format('/YYYY/MM/DD/') + uuid.v4().replace(/-/g, '');
if (fileName && fileName.length > 0) {
objectName += fileName.substring(fileName.lastIndexOf('.'))
}
return objectName;
}
/**
* URL
*/
export const getResignedObjectUrl = async (bucketName: string, objectName: string): Promise<string> => {
return (await api.get<string>('/common/getResignedObjectUrl', {
bucketName,
objectName
})).data as string;
}

View File

@ -0,0 +1,182 @@
<template>
<div class="enterprise">
<div class="enterpriseIndex">
<div class="enterpriseItem">
<a-tabs v-model:activeKey="activeKey" :tabBarGutter="300" centered >
<a-tab-pane key="1" tab="企业入驻">
<a-form
ref="formDateRef"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
layout="horizontal"
:model="formDate"
@finish="onFinish"
>
<a-form-item label="名称" name="name">
<a-input v-model:value="formDate.name" />
</a-form-item>
<a-form-item label="统一社会编码" name="socialCode">
<a-input v-model:value="formDate.socialCode"/>
</a-form-item>
<a-form-item label="公司性质" name="nature">
<a-input v-model:value="formDate.nature"/>
</a-form-item>
<a-form-item label="行政区划" >
<a-cascader v-model:value="formDate.administrativeDivisionCodes" :show-search="{ filter }" :options="administrativeDivisionTree" @change="searchAdministrativeDivisionTree" />
</a-form-item>
<a-form-item label="营业执照" name="businessLicense">
<SingleImageFileUpload v-model:value="formDate.businessLicense"></SingleImageFileUpload>
</a-form-item>
<a-form-item label="法人名字">
<a-input v-model:value="formDate.legalPersonInfo" />
</a-form-item>
<a-form-item label="法人手机号码">
<a-input v-model:value="formDate.telephone" />
</a-form-item>
<a-form-item label="详细地址" >
<a-input v-model:value="formDate.address" />
</a-form-item>
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
<a-button type="primary" html-type="submit" style="width: 100px">确认</a-button>
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane key="2" tab="查询企业状态" >
</a-tab-pane>
</a-tabs>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import {ref, onMounted} from 'vue';
import type { Rule } from 'ant-design-vue/es/form';
import type { ShowSearchType } from 'ant-design-vue/es/cascader';
import api from "@/axios";
import { message } from 'ant-design-vue';
import SingleImageFileUpload from "@/components/upload/SingleImageFileUpload.vue";
const activeKey = ref('1');
const labelCol = { style: { width: '120px' } };
const wrapperCol = { span: 14 };
const administrativeDivisionTree = ref<TreeNodeVo<string>[]>([])
const formDateRef = ref();
interface formDatePort {
name:string,
socialCode:string,
businessLicense:string,
legalPersonInfo:string,
telephone:string,
administrativeDivisionCodes:Record<string, any>,
address:string,
nature:string
}
const formDate = ref<formDatePort>({
name:'',
socialCode:'',
businessLicense:'',
legalPersonInfo:'',
telephone:'',
administrativeDivisionCodes:[''],
address:'',
nature:''
})
const rules: Record<string, Rule[]> = {
name: [
{ required: true, message: '请输入姓名', trigger: 'change' },
],
socialCode:[
{ required: true, message: '请输入社会编码', trigger: 'change' },
],
nature:[
{ required: true, message: '请填写公司性质', trigger: 'change' },
],
businessLicense:[
{ required: true, message: '请上传营业执照', trigger: 'change' },
],
administrativeDivisionCodes:[
{ required: true, message: '请选择行政区划', trigger: 'change' },
]
};
// 1
const DivisionTree = async ()=>{
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree')
administrativeDivisionTree.value = resp.data as TreeNodeVo<string>[]
}
// 2
const filter: ShowSearchType['filter'] = (inputValue, path) => {
return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
};
//
const searchAdministrativeDivisionTree = (e:Array<string>)=>{
formDate.value.administrativeDivisionCodes = e
}
//
const onFinish = async ()=>{
//
await formDateRef.value.validate()
const legalPersonInfo = {
name:formDate.value.legalPersonInfo,
telephone:formDate.value.telephone
}
const securityUnitRegisterParams = {
name:formDate.value.name,
socialCode:formDate.value.socialCode,
businessLicense:formDate.value.businessLicense,
legalPersonInfo:legalPersonInfo,
nature:formDate.value.nature,
administrativeDivisionCodes:formDate.value.administrativeDivisionCodes,
address:formDate.value.address
}
const resp = await api.post('/common/securityUnitRegister',securityUnitRegisterParams)
console.log(resp)
await message.loading('正在注册中...')
message.success('企业入驻成功')
await formDateRef.value.resetFields() //
formDate.value = {
name:'',
socialCode:'',
businessLicense:'',
legalPersonInfo:'',
telephone:'',
administrativeDivisionCodes:[''],
address:'',
nature:''
}
}
onMounted( async ()=>{
await DivisionTree()
})
</script>
<style scoped lang="scss">
.enterprise{
display: flex;
justify-content: center; /* 水平居中 */
align-items: center;
text-align: center;
height: 100vh;
width: 100%;
.enterpriseIndex{
border: 1px solid #cccccc;
height: 90vh;
width: 800px;
}
}
</style>

View File

@ -0,0 +1,13 @@
<template>
<div>
<SingleImageFileUpload v-model:value="url"></SingleImageFileUpload>
</div>
</template>
<script setup lang="ts">
import SingleImageFileUpload from "@/components/upload/SingleImageFileUpload.vue";
import {ref} from "vue";
const url = ref<string>('')
</script>
<style scoped lang="scss">
</style>

View File

@ -11,6 +11,10 @@ interface ImportMetaEnv {
readonly VITE_APP_BASE_API: string; readonly VITE_APP_BASE_API: string;
readonly VITE_APP_PROXY_URL: string; readonly VITE_APP_PROXY_URL: string;
// minio
readonly VITE_APP_MINIO_URL: string
readonly VITE_APP_MINIO_BUCKET: string
// RSA公钥 // RSA公钥
readonly VITE_APP_RSA_PUBLIC_KEY: string; readonly VITE_APP_RSA_PUBLIC_KEY: string;
} }

View File

@ -18,7 +18,7 @@
"jsx": "preserve", "jsx": "preserve",
"jsxImportSource": "vue", "jsxImportSource": "vue",
/* Linting */ /* Linting */
"strict": true, "strict": false,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,

View File

@ -13,7 +13,7 @@
"moduleDetection": "force", "moduleDetection": "force",
"noEmit": true, "noEmit": true,
/* Linting */ /* Linting */
"strict": true, "strict": false,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true

View File

@ -9,7 +9,7 @@
</TableProMax> </TableProMax>
</template> </template>
<script setup lang="ts"> <script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue"; import TableProMax from "@/components/table/TableProMax.vue";
import {ref} from "vue"; import {ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers"; 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 {PoliceUnitPagerQueryParams, PoliceUnitPagerVo} from "@/types/views/unitManage/policeUnit.ts";
import api from "@/axios"; import api from "@/axios";
import {enumSelectNodes} from "@/config/dict.ts"; import {enumSelectNodes} from "@/config/dict.ts";
import {message} from "ant-design-vue";
type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams> type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams>
@ -30,21 +31,48 @@ const columns: TableProps['columns'] = [
dataIndex: 'code', dataIndex: 'code',
title: '代码' title: '代码'
}, { }, {
dataIndex: 'legalPersonInfo', dataIndex: 'contactPersonInfo',
title: '联系人' title: '联系人',
customRender({record}) {
return record.contactPersonInfo?.name + "/" + record.contactPersonInfo?.telephone
},
}, { }, {
dataIndex: 'provinceName', dataIndex: 'provinceName',
title: '行政区划', 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('/')
}, { }, {
dataIndex: 'isEnable', dataIndex: 'isEnable',
title: '是否启用' title: '是否启用',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
}, { }, {
dataIndex: 'checkStatus', dataIndex: 'checkStatus',
title: '审核状态' title: '审核状态',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
}, { }, {
dataIndex: 'createTime', dataIndex: 'createTime',
title: '创建时间' 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"] = { const searchFormOptions: TableProps["searchFormOptions"] = {

View File

@ -4,12 +4,13 @@
:request-api="reqApi" :request-api="reqApi"
:columns="columns" :columns="columns"
:searchFormOptions="searchFormOptions" :searchFormOptions="searchFormOptions"
:scroll="{x}"
> >
</TableProMax> </TableProMax>
</template> </template>
<script setup lang="ts"> <script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue"; import TableProMax from "@/components/table/TableProMax.vue";
import {TableProMaxProps} from "@/types/components/table"; import {TableProMaxProps} from "@/types/components/table";
import {SecurityUnitPagerQueryParams, SecurityUnitPagerVo} from "@/types/views/unitManage/securityUnit.ts"; import {SecurityUnitPagerQueryParams, SecurityUnitPagerVo} from "@/types/views/unitManage/securityUnit.ts";
@ -17,6 +18,7 @@ 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 {enumSelectNodes} from "@/config/dict.ts"; import {enumSelectNodes} from "@/config/dict.ts";
import {message} from "ant-design-vue";
type TableProps = TableProMaxProps<SecurityUnitPagerVo, SecurityUnitPagerQueryParams> type TableProps = TableProMaxProps<SecurityUnitPagerVo, SecurityUnitPagerQueryParams>
@ -25,34 +27,80 @@ const reqApi: TableProps['requestApi'] = (params) => api.post('/securityUnit/pag
const columns: TableProps['columns'] = [ const columns: TableProps['columns'] = [
{ {
dataIndex: 'name', dataIndex: 'name',
title: '名称' title: '名称',
width: 200,
ellipsis: true
}, { }, {
dataIndex: 'socialCode', dataIndex: 'socialCode',
title: '社会编码' title: '社会编码',
width: 200,
ellipsis: true
}, { }, {
dataIndex: 'businessLicense', 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', dataIndex: 'legalPersonInfo',
title: '法人信息' title: '法人信息',
width: 200,
customRender({record}) {
return record.legalPersonInfo?.name + "/" + record.legalPersonInfo?.telephone
},
}, { }, {
dataIndex: 'provinceName', dataIndex: 'provinceName',
title: '行政区划', 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', dataIndex: 'nature',
title: '性质' title: '性质',
width: 200
}, { }, {
dataIndex: 'isEnable', dataIndex: 'isEnable',
title: '是否启用' title: '是否启用',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
width: 150
}, { }, {
dataIndex: 'checkStatus', dataIndex: 'checkStatus',
title: '审核状态' title: '审核状态',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
width: 150
}, { }, {
dataIndex: 'createTime', 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"] = { const searchFormOptions: TableProps["searchFormOptions"] = {
name: { name: {
type: 'input', type: 'input',

View File

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