This commit is contained in:
TimSpan 2024-09-06 19:24:03 +08:00
commit be3eea4a2a
70 changed files with 1596 additions and 146 deletions

View File

@ -27,6 +27,7 @@
<minio.version>8.4.3</minio.version> <minio.version>8.4.3</minio.version>
<okhttp.version>4.8.1</okhttp.version> <okhttp.version>4.8.1</okhttp.version>
<sa.token.version>1.38.0</sa.token.version> <sa.token.version>1.38.0</sa.token.version>
<wx.miniapp.version>4.6.0</wx.miniapp.version>
</properties> </properties>
<dependencies> <dependencies>
@ -200,6 +201,12 @@
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>${okhttp.version}</version> <version>${okhttp.version}</version>
</dependency> </dependency>
<!-- 微信小程序开发工具 -->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>${wx.miniapp.version}</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>

View File

@ -4,6 +4,7 @@ import com.changhu.enums.ClientType;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.lang.annotation.*; import java.lang.annotation.*;
import java.util.List;
/** /**
* @author 20252 * @author 20252
@ -14,7 +15,7 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@RestController @RestController
public @interface CheckClientType { public @interface CheckUserType {
/** /**
* 是否需要校验客户端类型 * 是否需要校验客户端类型
@ -24,5 +25,5 @@ public @interface CheckClientType {
/** /**
* 需要的客户端类型 * 需要的客户端类型
*/ */
ClientType clientType() default ClientType.NONE; UserType[] userTypes();
} }

View File

@ -0,0 +1,22 @@
package com.changhu.common.annotation;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20252
* @createTime 2024/9/6 上午11:13
* @desc UserType...
*/
@AllArgsConstructor
@Getter
public enum UserType {
MANAGEMENT_POLICE("公安后台用户"),
MANAGEMENT_SECURITY("保安后台用户"),
MANAGEMENT_SUPER("超级后台用户"),
MINI_PROGRAM_POLICE("小程序公安用户"),
MINI_PROGRAM_PROJECT_MANAGE("小程序项目经理");
private final String remark;
}

View File

@ -0,0 +1,22 @@
package com.changhu.common.db.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20252
* @createTime 2024/9/5 上午11:50
* @desc MiniProgramUserIdentity...
*/
@AllArgsConstructor
@Getter
public enum MiniProgramUserIdentity implements BaseEnum<String>, IEnum<String> {
POLICE("police", "公安"),
PROJECT_MANAGER("project_manager", "项目经理");
private final String value;
private final String label;
}

View File

@ -0,0 +1,24 @@
package com.changhu.common.db.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20252
* @createTime 2024/9/5 上午11:04
* @desc 服务项目类型
*/
@AllArgsConstructor
@Getter
public enum ServiceProjectType implements BaseEnum<String>, IEnum<String> {
SECURITY("security", "安保"),
PROPERTY("property", "物业"),
;
private final String value;
private final String label;
}

View File

@ -6,6 +6,7 @@ import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import com.changhu.common.annotation.UserType;
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.enums.ClientType; import com.changhu.enums.ClientType;
@ -45,18 +46,18 @@ public class UserUtil {
return getTokenInfo(); return getTokenInfo();
} }
public static SaTokenInfo loginAndTokenInfo(Long userId, ClientType clientType, Long unitId) { public static SaTokenInfo loginAndTokenInfo(Long userId, UserType userType, Long unitId) {
StpUtil.login(userId, SaLoginConfig.setExtra("clientType", clientType).setExtra("unitId", unitId)); StpUtil.login(userId, SaLoginConfig.setExtra("userType", userType).setExtra("unitId", unitId));
return getTokenInfo(); return getTokenInfo();
} }
/** /**
* 获取客户端类型 * 获取客户端类型
*/ */
public static ClientType getClientType() { public static UserType getUserType() {
Object clientType = StpUtil.getExtra("clientType"); Object clientType = StpUtil.getExtra("userType");
if (clientType instanceof String ct) { if (clientType instanceof String ct) {
return ClientType.valueOf(ct); return UserType.valueOf(ct);
} }
return null; return null;
} }

View File

@ -2,7 +2,7 @@ package com.changhu.config;
import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.changhu.support.interceptor.ClientTypeInterceptor; import com.changhu.support.interceptor.UserTypeInterceptor;
import com.changhu.support.interceptor.JsonBodyInterceptor; import com.changhu.support.interceptor.JsonBodyInterceptor;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -51,7 +51,7 @@ public class WebConfig implements WebMvcConfigurer {
// 注册jsonBody 拦截器 用于标识是否需要JsonResult返回 // 注册jsonBody 拦截器 用于标识是否需要JsonResult返回
registry.addInterceptor(new JsonBodyInterceptor()); registry.addInterceptor(new JsonBodyInterceptor());
// 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端 // 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端
registry.addInterceptor(new ClientTypeInterceptor()); registry.addInterceptor(new UserTypeInterceptor());
} }
@Override @Override

View File

@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
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.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -51,6 +52,7 @@ public class CommonController {
private static final Map<String, List<SelectNodeVo<?>>> enumsResult = new HashMap<>(); private static final Map<String, List<SelectNodeVo<?>>> enumsResult = new HashMap<>();
@Cacheable(value = "common", key = "'AdministrativeDivisionLevel' + #level + 'Tree'")
@Operation(summary = "行政区划树") @Operation(summary = "行政区划树")
@GetMapping("/administrativeDivisionTree") @GetMapping("/administrativeDivisionTree")
public List<TreeNodeVo<String>> AdministrativeDivisionTree(@Schema(description = "等级") @RequestParam(defaultValue = "4") Integer level) { public List<TreeNodeVo<String>> AdministrativeDivisionTree(@Schema(description = "等级") @RequestParam(defaultValue = "4") Integer level) {

View File

@ -15,7 +15,6 @@ import lombok.Getter;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum ClientType { public enum ClientType {
NONE("未定义", null),
MANAGEMENT_SUPER("超级后台", ManagementSuperLogin.instance), MANAGEMENT_SUPER("超级后台", ManagementSuperLogin.instance),
MANAGEMENT_POLICE("公安后台", ManagementPoliceUnitLogin.instance), MANAGEMENT_POLICE("公安后台", ManagementPoliceUnitLogin.instance),
MANAGEMENT_SECURITY("保安后台", ManagementSecurityUnitLogin.instance), MANAGEMENT_SECURITY("保安后台", ManagementSecurityUnitLogin.instance),

View File

@ -3,6 +3,7 @@ package com.changhu.enums.handler;
import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.SaTokenInfo;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
@ -10,7 +11,6 @@ import com.changhu.common.pojo.vo.TokenInfo;
import com.changhu.common.utils.RsaUtil; import com.changhu.common.utils.RsaUtil;
import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.UserUtil;
import com.changhu.common.utils.ValidatorUtil; import com.changhu.common.utils.ValidatorUtil;
import com.changhu.enums.ClientType;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.pojo.entity.PoliceUnit; import com.changhu.module.management.pojo.entity.PoliceUnit;
import com.changhu.pojo.params.ManagementPoliceUnitLoginParams; import com.changhu.pojo.params.ManagementPoliceUnitLoginParams;
@ -69,7 +69,7 @@ public class ManagementPoliceUnitLogin extends AbstractLoginHandler {
//登录 //登录
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo( SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
managementPoliceUnitUser.getSnowFlakeId(), managementPoliceUnitUser.getSnowFlakeId(),
ClientType.MANAGEMENT_POLICE, UserType.MANAGEMENT_POLICE,
managementPoliceUnitUser.getPoliceUnitId() managementPoliceUnitUser.getPoliceUnitId()
); );
//返回token //返回token

View File

@ -3,6 +3,7 @@ package com.changhu.enums.handler;
import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.SaTokenInfo;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
@ -67,7 +68,7 @@ public class ManagementSecurityUnitLogin extends AbstractLoginHandler {
//登录 //登录
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo( SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
managementSecurityUnitUser.getSnowFlakeId(), managementSecurityUnitUser.getSnowFlakeId(),
ClientType.MANAGEMENT_SECURITY, UserType.MANAGEMENT_SECURITY,
managementSecurityUnitUser.getSecurityUnitId() managementSecurityUnitUser.getSecurityUnitId()
); );
//返回token //返回token

View File

@ -3,6 +3,7 @@ package com.changhu.enums.handler;
import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.SaTokenInfo;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType;
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.vo.TokenInfo; import com.changhu.common.pojo.vo.TokenInfo;
@ -45,7 +46,7 @@ public class ManagementSuperLogin extends AbstractLoginHandler {
//登录 //登录
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo( SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
user.getSnowFlakeId(), user.getSnowFlakeId(),
ClientType.MANAGEMENT_SUPER, UserType.MANAGEMENT_SUPER,
null); null);
//返回token //返回token
return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue()); return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue());

View File

@ -3,19 +3,20 @@ 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.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams; import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo; import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.module.management.service.EnterprisesUnitService; import com.changhu.module.management.service.EnterprisesUnitService;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
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.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.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import java.util.List;
import org.springframework.web.bind.annotation.RequestMapping;
/** /**
* @author 20252 * @author 20252
@ -44,11 +45,17 @@ public class EnterprisesUnitController {
@Operation(summary = "根据id删除") @Operation(summary = "根据id删除")
@DeleteMapping("/deleteById") @DeleteMapping("/deleteById")
public void deleteById(@RequestBody Long enterprisesUnitId) { public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) {
boolean b = enterprisesUnitService.removeById(enterprisesUnitId); boolean b = enterprisesUnitService.removeById(enterprisesUnitId);
if (!b) { if (!b) {
throw new MessageException(); throw new MessageException();
} }
} }
@Operation(summary = "根据行政区划编码查询下面的企事业单位")
@PostMapping("/queryListByAdministrativeDivisionCodes")
public List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(@RequestBody @Schema(description = "行政区划编码") List<String> administrativeDivisionCodes) {
return enterprisesUnitService.queryListByAdministrativeDivisionCodes(administrativeDivisionCodes);
}
} }

View File

@ -1,8 +1,9 @@
package com.changhu.module.management.controller; 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.CheckClientType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType;
import com.changhu.enums.ClientType; import com.changhu.enums.ClientType;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
@ -14,10 +15,7 @@ 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.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.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
* @author 20252 * @author 20252
@ -26,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestParam;
*/ */
@Tag(name = "后台-公安用户") @Tag(name = "后台-公安用户")
@JsonBody @JsonBody
@CheckClientType(clientType = ClientType.MANAGEMENT_POLICE) @CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
@RequestMapping("/managementPoliceUnitUser") @RequestMapping("/managementPoliceUnitUser")
public class ManagementPoliceUnitUserController { public class ManagementPoliceUnitUserController {
@ -46,7 +44,7 @@ public class ManagementPoliceUnitUserController {
} }
@Operation(summary = "根据id删除") @Operation(summary = "根据id删除")
@PostMapping("/deleteById") @DeleteMapping("/deleteById")
public void deleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) { public void deleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) {
managementPoliceUnitUserService.deleteById(managementPoliceUnitUserId); managementPoliceUnitUserService.deleteById(managementPoliceUnitUserId);
} }

View File

@ -1,8 +1,9 @@
package com.changhu.module.management.controller; 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.CheckClientType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType;
import com.changhu.enums.ClientType; import com.changhu.enums.ClientType;
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
@ -24,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
@Tag(name = "后台-保安用户") @Tag(name = "后台-保安用户")
@JsonBody @JsonBody
@RequestMapping("/managementSecurityUnitUser") @RequestMapping("/managementSecurityUnitUser")
@CheckClientType(clientType = ClientType.MANAGEMENT_SECURITY) @CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public class ManagementSecurityUnitUserController { public class ManagementSecurityUnitUserController {
@Autowired @Autowired

View File

@ -1,8 +1,13 @@
package com.changhu.module.management.controller; 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.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType;
import com.changhu.enums.ClientType;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
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;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
@ -32,4 +37,11 @@ public class PoliceUnitController {
return policeUnitService.pager(queryParams); return policeUnitService.pager(queryParams);
} }
@Operation(summary = "公安单位下的企事业单位分页")
@PostMapping("/policeEnterprisesUnitPager")
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
public Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(@RequestBody PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
return policeUnitService.policeEnterprisesUnitPager(queryParams);
}
} }

View File

@ -1,7 +1,11 @@
package com.changhu.module.management.controller; 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.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.enums.ClientType;
import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams; 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;
@ -11,10 +15,13 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/8/30 上午10:46 * @createTime 2024/8/30 上午10:46
@ -40,4 +47,11 @@ public class SecurityUnitController {
securityUnitService.saveOrUpdate(params); securityUnitService.saveOrUpdate(params);
} }
@Operation(summary = "查询单位下的项目经理")
@GetMapping("/listProjectManager")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public List<SelectNodeVo<Long>> listProjectManager() {
return securityUnitService.listProjectManager();
}
} }

View File

@ -0,0 +1,54 @@
package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType;
import com.changhu.common.exception.MessageException;
import com.changhu.enums.ClientType;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.management.service.ServiceProjectService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author 20252
* @createTime 2024/9/5 上午11:09
* @desc ServiceProjectController...
*/
@Tag(name = "服务项目")
@JsonBody
@RequestMapping("/serviceProject")
public class ServiceProjectController {
@Autowired
private ServiceProjectService serviceProjectService;
@Operation(summary = "分页查询")
@PostMapping("/pager")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public Page<ServiceProjectPagerVo> pager(@RequestBody PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
return serviceProjectService.pager(queryParams);
}
@Operation(summary = "新增或者保存")
@PostMapping("/saveOrUpdate")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public void saveOrUpdate(@RequestBody ServiceProjectSaveOrUpdateParams params) {
serviceProjectService.saveOrUpdate(params);
}
@Operation(summary = "根据id删除")
@DeleteMapping("/deleteById")
public void deleteById(@RequestParam Long serviceProjectId) {
boolean b = serviceProjectService.removeById(serviceProjectId);
if (!b) {
throw new MessageException();
}
}
}

View File

@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo; import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -25,4 +27,14 @@ public interface EnterprisesUnitMapper extends BaseMapper<EnterprisesUnit> {
*/ */
Page<EnterprisesUnitPagerVo> pager(@Param("page") Page<EnterprisesUnitPagerVo> page, Page<EnterprisesUnitPagerVo> pager(@Param("page") Page<EnterprisesUnitPagerVo> page,
@Param("params") EnterprisesUnitPagerQueryParams params); @Param("params") EnterprisesUnitPagerQueryParams params);
/**
* 公安单位下的企事业单位分页
*
* @param page 分页对象
* @param params 查询参数
* @return 结果
*/
Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(@Param("page") Page<PoliceEnterprisesUnitPagerVo> page,
@Param("params") PoliceEnterprisesUnitPagerQueryParams params);
} }

View File

@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo; import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import com.changhu.support.mybatisplus.annotation.DataScope;
import com.changhu.support.mybatisplus.handler.permission.management.ManagementPoliceUnitUserPagerPermissionHandler;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -25,7 +23,6 @@ public interface ManagementPoliceUnitUserMapper extends BaseMapper<ManagementPol
* @param params 查询参数 * @param params 查询参数
* @return 结果 * @return 结果
*/ */
@DataScope(permissionHandler = ManagementPoliceUnitUserPagerPermissionHandler.class)
Page<ManagementPoliceUnitUserPagerVo> pager(@Param("page") Page<ManagementPoliceUnitUserPagerVo> page, Page<ManagementPoliceUnitUserPagerVo> pager(@Param("page") Page<ManagementPoliceUnitUserPagerVo> page,
@Param("params") ManagementPoliceUnitUserPagerQueryParams params); @Param("params") ManagementPoliceUnitUserPagerQueryParams params);
} }

View File

@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser; import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo; import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import com.changhu.support.mybatisplus.annotation.DataScope;
import com.changhu.support.mybatisplus.handler.permission.management.ManagementSecurityUnitUserPagerPermissionHandler;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -25,7 +23,6 @@ public interface ManagementSecurityUnitUserMapper extends BaseMapper<ManagementS
* @param params 查询参数 * @param params 查询参数
* @return 结果 * @return 结果
*/ */
@DataScope(permissionHandler = ManagementSecurityUnitUserPagerPermissionHandler.class)
Page<ManagementSecurityUnitUserPagerVo> pager(@Param("page") Page<ManagementSecurityUnitUserPagerVo> page, Page<ManagementSecurityUnitUserPagerVo> pager(@Param("page") Page<ManagementSecurityUnitUserPagerVo> page,
@Param("params") ManagementSecurityUnitUserPagerQueryParams params); @Param("params") ManagementSecurityUnitUserPagerQueryParams params);
} }

View File

@ -0,0 +1,28 @@
package com.changhu.module.management.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* service_project (服务项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
/**
* 分页查询
*
* @param page 分页对象
* @param params 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(@Param("page") Page<ServiceProjectPagerVo> page,
@Param("params") ServiceProjectPagerQueryParams params);
}

View File

@ -0,0 +1,99 @@
package com.changhu.module.management.pojo.entity;
import java.io.Serial;
import java.io.Serializable;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectType;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
/**
* 服务项目 实体类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@TableName(autoResultMap = true)
public class ServiceProject extends BaseEntity implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 保安单位id
*/
private Long securityUnitId;
/**
* 企事业单位id
*/
private Long enterprisesUnitId;
/**
* 项目经理小程序用户id
*/
private Long projectManagerMiniProgramUserId;
/**
* 名称
*/
private String name;
/**
* 服务类型
*/
private ServiceProjectType type;
/**
* 是否自招保安(只有当type为property 此字段必填)
*/
private IsOrNot isRecruitSecurity;
/**
* 证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)
*/
private String idNumber;
/**
* 服务区域面积
*/
private Double serviceArea;
/**
* 楼栋数量
*/
private Integer buildingTotal;
/**
* 户数
*/
private Integer houseTotal;
/**
* 工作人员数量
*/
private Integer staffTotal;
/**
* 保安人员数量
*/
private Integer securityUserTotal;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,58 @@
package com.changhu.module.management.pojo.params;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/5 上午11:36
* @desc ServiceProjectSaveOrUpdateParams...
*/
@Data
public class ServiceProjectSaveOrUpdateParams {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "企事业单位id")
@NotNull(message = "企事业单位不能为空")
private Long enterprisesUnitId;
@Schema(description = "项目经理小程序用户id")
private Long projectManagerMiniProgramUserId;
@Schema(description = "名称")
@NotNull(message = "名称不能为空")
private String name;
@Schema(description = "服务类型")
@NotNull(message = "服务类型不能为空")
private ServiceProjectType type;
@Schema(description = "是否自招保安(只有当type为property 此字段必填)")
private IsOrNot isRecruitSecurity;
@Schema(description = "证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)")
private String idNumber;
@Schema(description = "服务区域面积")
private Double serviceArea;
@Schema(description = "楼栋数量")
private Integer buildingTotal;
@Schema(description = "户数")
private Integer houseTotal;
@Schema(description = "工作人员数量")
private Integer staffTotal;
@Schema(description = "保安人员数量")
private Integer securityUserTotal;
@Schema(description = "备注")
private String remark;
}

View File

@ -1,5 +1,6 @@
package com.changhu.module.management.pojo.queryParams; package com.changhu.module.management.pojo.queryParams;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.Sex; import com.changhu.common.db.enums.Sex;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -17,4 +18,6 @@ public class ManagementPoliceUnitUserPagerQueryParams {
private String telephone; private String telephone;
@Schema(description = "性别") @Schema(description = "性别")
private Sex sex; private Sex sex;
@Schema(description = "是否启用")
private IsEnable isEnable;
} }

View File

@ -0,0 +1,19 @@
package com.changhu.module.management.pojo.queryParams;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/5 下午2:49
* @desc PoliceEnterprisesUnitPagerQueryParams...
*/
@Data
public class PoliceEnterprisesUnitPagerQueryParams {
@Schema(description = "名称")
private String name;
@Schema(description = "详细地址")
private String address;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,22 @@
package com.changhu.module.management.pojo.queryParams;
import com.changhu.common.db.enums.ServiceProjectType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/5 上午11:15
* @desc ServiceProjectPagerQueryParams...
*/
@Data
public class ServiceProjectPagerQueryParams {
@Schema(description = "服务项目名称")
private String name;
@Schema(description = "服务项目类型")
private ServiceProjectType type;
@Schema(description = "备注")
private String remark;
@Schema(description = "项目经理小程序用户名称")
private String projectManagerMiniProgramUserName;
}

View File

@ -25,7 +25,7 @@ public class ManagementPoliceUnitUserPagerVo {
@Schema(description = "性别") @Schema(description = "性别")
private Sex sex; private Sex sex;
@Schema(description = "性别") @Schema(description = "账号")
private String account; private String account;
@Schema(description = "手机号") @Schema(description = "手机号")

View File

@ -25,7 +25,7 @@ public class ManagementSecurityUnitUserPagerVo {
@Schema(description = "性别") @Schema(description = "性别")
private Sex sex; private Sex sex;
@Schema(description = "性别") @Schema(description = "账号")
private String account; private String account;
@Schema(description = "手机号") @Schema(description = "手机号")

View File

@ -0,0 +1,46 @@
package com.changhu.module.management.pojo.vo;
import com.changhu.module.management.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author 20252
* @createTime 2024/9/5 下午2:46
* @desc PoliceEnterprisesUnitPagerVo...
*/
@Data
public class PoliceEnterprisesUnitPagerVo {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "名称")
private String name;
@Schema(description = "省编码")
private String province;
@Schema(description = "省名称")
private String provinceName;
@Schema(description = "市编码")
private String city;
@Schema(description = "市名称")
private String cityName;
@Schema(description = "县编码")
private String districts;
@Schema(description = "县名称")
private String districtsName;
@Schema(description = "乡镇编码")
private String street;
@Schema(description = "乡镇名称")
private String streetName;
@Schema(description = "详细地址")
private String address;
@Schema(description = "联系人")
private ContactPersonInfo contactPersonInfo;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,69 @@
package com.changhu.module.management.pojo.vo;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/5 上午11:15
* @desc ServiceProjectPagerVo...
*/
@Data
public class ServiceProjectPagerVo {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "企事业单位id")
private Long enterprisesUnitId;
@Schema(description = "企事业单位名称")
private String enterprisesUnitName;
@Schema(description = "企事业单位行政区划编码")
private List<String> enterprisesUnitAdministrativeDivisionCodes;
@Schema(description = "项目经理小程序用户id")
private Long projectManagerMiniProgramUserId;
@Schema(description = "项目经理小程序用户名称")
private String projectManagerMiniProgramUserName;
@Schema(description = "服务项目名称")
private String name;
@Schema(description = "服务类型")
private ServiceProjectType type;
@Schema(description = "是否自招保安(只有当type为property 此字段必填)")
private IsOrNot isRecruitSecurity;
@Schema(description = "证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)")
private String idNumber;
@Schema(description = "服务区域面积")
private Double serviceArea;
@Schema(description = "楼栋数量")
private Integer buildingTotal;
@Schema(description = "户数")
private Integer houseTotal;
@Schema(description = "工作人员数量")
private Integer staffTotal;
@Schema(description = "保安人员数量")
private Integer securityUserTotal;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建人名称")
private String createUserName;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -2,12 +2,15 @@ package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams; import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo; import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/** /**
* enterprises_unit (企事业单位) 服务类 * enterprises_unit (企事业单位) 服务类
* author: luozhun * author: luozhun
@ -29,4 +32,12 @@ public interface EnterprisesUnitService extends IService<EnterprisesUnit> {
* @param params 参数 * @param params 参数
*/ */
void saveOrUpdate(EnterprisesUnitSaveOrUpdateParams params); void saveOrUpdate(EnterprisesUnitSaveOrUpdateParams params);
/**
* 根据行政区划编码查询下面的企事业单位
*
* @param administrativeDivisionCodes 行政区划编码
* @return 结果
*/
List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(List<String> administrativeDivisionCodes);
} }

View File

@ -3,7 +3,9 @@ package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.management.pojo.entity.PoliceUnit; import com.changhu.module.management.pojo.entity.PoliceUnit;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo; import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
@ -21,4 +23,12 @@ public interface PoliceUnitService extends IService<PoliceUnit> {
* @return 结果 * @return 结果
*/ */
Page<PoliceUnitPagerVo> pager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams); Page<PoliceUnitPagerVo> pager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams);
/**
* 公安单位下的企事业单位分页
*
* @param queryParams 查询参数
* @return 结果
*/
Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams);
} }

View File

@ -2,12 +2,15 @@ package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.common.pojo.vo.SelectNodeVo;
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.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.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/** /**
* security_unit (保安单位) 服务类 * security_unit (保安单位) 服务类
* author: luozhun * author: luozhun
@ -30,4 +33,10 @@ public interface SecurityUnitService extends IService<SecurityUnit> {
*/ */
void saveOrUpdate(SecurityUnitSaveOrUpdateParams params); void saveOrUpdate(SecurityUnitSaveOrUpdateParams params);
/**
* 查询单位下的项目经理
*
* @return 项目经理
*/
List<SelectNodeVo<Long>> listProjectManager();
} }

View File

@ -0,0 +1,32 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* service_project (服务项目) 服务类
* author: luozhun
* desc 由groovy脚本自动生成
*/
public interface ServiceProjectService extends IService<ServiceProject> {
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams);
/**
* 新增或者修改
*
* @param params 参数
*/
void saveOrUpdate(ServiceProjectSaveOrUpdateParams params);
}

View File

@ -1,9 +1,12 @@
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 cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.func.LambdaUtil;
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.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.mapper.EnterprisesUnitMapper; import com.changhu.module.management.mapper.EnterprisesUnitMapper;
import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams; import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams;
@ -13,6 +16,7 @@ import com.changhu.module.management.service.EnterprisesUnitService;
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;
/** /**
@ -51,4 +55,26 @@ public class EnterprisesUnitServiceImpl extends ServiceImpl<EnterprisesUnitMappe
throw new MessageException(); throw new MessageException();
} }
} }
@Override
public List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(List<String> administrativeDivisionCodes) {
String addr = LambdaUtil.getFieldName(EnterprisesUnit::getAddress);
String rem = LambdaUtil.getFieldName(EnterprisesUnit::getRemark);
return this.lambdaQuery()
.eq(!administrativeDivisionCodes.isEmpty(), EnterprisesUnit::getProvince, administrativeDivisionCodes.get(0))
.eq(administrativeDivisionCodes.size() >= 2, EnterprisesUnit::getCity, administrativeDivisionCodes.get(1))
.eq(administrativeDivisionCodes.size() >= 3, EnterprisesUnit::getDistricts, administrativeDivisionCodes.get(2))
.eq(administrativeDivisionCodes.size() >= 4, EnterprisesUnit::getStreet, administrativeDivisionCodes.get(3))
.list()
.stream()
.map(item -> SelectNodeVo.<Long>builder()
.value(item.getSnowFlakeId())
.label(item.getName())
.extData(Dict.of(
addr, item.getAddress(),
rem, item.getRemark()
))
.build())
.toList();
}
} }

View File

@ -35,6 +35,7 @@ public class ManagementPoliceUnitUserServiceImpl extends ServiceImpl<ManagementP
public void saveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params) { public void saveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params) {
//查看手机号是否存在 //查看手机号是否存在
boolean exists = this.lambdaQuery() boolean exists = this.lambdaQuery()
.ne(params.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, params.getSnowFlakeId())
.eq(ManagementPoliceUnitUser::getTelephone, params.getTelephone()) .eq(ManagementPoliceUnitUser::getTelephone, params.getTelephone())
.exists(); .exists();
if (exists) { if (exists) {

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
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.annotation.UserType;
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.utils.UserUtil; import com.changhu.common.utils.UserUtil;
@ -36,6 +37,7 @@ public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<Managemen
public void saveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) { public void saveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
//查看手机号是否已存在 //查看手机号是否已存在
boolean exists = this.lambdaQuery() boolean exists = this.lambdaQuery()
.ne(saveOrUpdateParams.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, saveOrUpdateParams.getSnowFlakeId())
.eq(ManagementSecurityUnitUser::getTelephone, saveOrUpdateParams.getTelephone()) .eq(ManagementSecurityUnitUser::getTelephone, saveOrUpdateParams.getTelephone())
.exists(); .exists();
if (exists) { if (exists) {
@ -54,7 +56,7 @@ public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<Managemen
} }
//生成账号 //生成账号
managementSecurityUnitUser.setAccount(account); managementSecurityUnitUser.setAccount(account);
if (!ClientType.MANAGEMENT_SECURITY.equals(UserUtil.getClientType())) { if (!UserType.MANAGEMENT_SECURITY.equals(UserUtil.getUserType())) {
throw new MessageException("客户端类型不对"); throw new MessageException("客户端类型不对");
} }
//补全单位 //补全单位

View File

@ -2,12 +2,16 @@ package com.changhu.module.management.service.impl;
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.module.management.mapper.EnterprisesUnitMapper;
import com.changhu.module.management.mapper.PoliceUnitMapper; import com.changhu.module.management.mapper.PoliceUnitMapper;
import com.changhu.module.management.pojo.entity.PoliceUnit; import com.changhu.module.management.pojo.entity.PoliceUnit;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
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;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -18,8 +22,16 @@ import org.springframework.stereotype.Service;
@Service @Service
public class PoliceUnitServiceImpl extends ServiceImpl<PoliceUnitMapper, PoliceUnit> implements PoliceUnitService { public class PoliceUnitServiceImpl extends ServiceImpl<PoliceUnitMapper, PoliceUnit> implements PoliceUnitService {
@Autowired
private EnterprisesUnitMapper enterprisesUnitMapper;
@Override @Override
public Page<PoliceUnitPagerVo> pager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) { public Page<PoliceUnitPagerVo> pager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) {
return baseMapper.pager(queryParams.getPage(), queryParams.getParams()); return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
} }
@Override
public Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
return enterprisesUnitMapper.policeEnterprisesUnitPager(queryParams.getPage(), queryParams.getParams());
}
} }

View File

@ -1,18 +1,28 @@
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 cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.func.LambdaUtil;
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.common.db.enums.IsEnable;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
import com.changhu.module.management.mapper.SecurityUnitMapper; import com.changhu.module.management.mapper.SecurityUnitMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
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.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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional; import java.util.Optional;
/** /**
@ -23,6 +33,9 @@ import java.util.Optional;
@Service @Service
public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, SecurityUnit> implements SecurityUnitService { public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, SecurityUnit> implements SecurityUnitService {
@Autowired
private MiniProgramUserMapper miniProgramUserMapper;
@Override @Override
public Page<SecurityUnitPagerVo> pager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) { public Page<SecurityUnitPagerVo> pager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
return baseMapper.pager(queryParams.getPage(), queryParams.getParams()); return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
@ -49,9 +62,24 @@ public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, Sec
this.saveOrUpdate(securityUnit); this.saveOrUpdate(securityUnit);
} }
public static void main(String[] args) { @Override
String parse = JavaClassToTsUtil.parse(SecurityUnitPagerQueryParams.class); public List<SelectNodeVo<Long>> listProjectManager() {
System.out.println(parse); String tel = LambdaUtil.getFieldName(MiniProgramUser::getTelephone);
String sex = LambdaUtil.getFieldName(MiniProgramUser::getSex);
return miniProgramUserMapper.selectList(Wrappers.<MiniProgramUser>lambdaQuery()
.eq(MiniProgramUser::getIsEnable, IsEnable.TRUE)
.eq(MiniProgramUser::getIdentity, MiniProgramUserIdentity.PROJECT_MANAGER)
.eq(MiniProgramUser::getUnitId, UserUtil.getUnitId()))
.stream()
.map(item -> SelectNodeVo.<Long>builder()
.value(item.getSnowFlakeId())
.label(item.getName())
.extData(Dict.of(
tel, item.getTelephone(),
sex, item.getSex()
))
.build())
.toList();
} }
} }

View File

@ -0,0 +1,39 @@
package com.changhu.module.management.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.ServiceProjectMapper;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.management.service.ServiceProjectService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.stereotype.Service;
/**
* service_project (服务项目) 服务实现类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Service
public class ServiceProjectServiceImpl extends ServiceImpl<ServiceProjectMapper, ServiceProject> implements ServiceProjectService {
@Override
public Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void saveOrUpdate(ServiceProjectSaveOrUpdateParams params) {
ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class);
serviceProject.setSecurityUnitId(UserUtil.getUnitId());
boolean b = this.saveOrUpdate(serviceProject);
if (!b) {
throw new MessageException();
}
}
}

View File

@ -0,0 +1,35 @@
package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType;
import com.changhu.enums.ClientType;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
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/6 上午10:42
* @desc MiniProgramUserController...
*/
@Tag(name = "小程序用户接口")
@JsonBody
@RequestMapping("/miniProgramUser")
public class MiniProgramUserController {
@Autowired
private MiniProgramUserService miniProgramUserService;
@Operation(summary = "注册")
@PostMapping("/register")
public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
miniProgramUserService.register(params);
}
}

View File

@ -0,0 +1,15 @@
package com.changhu.module.miniProgram.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import org.apache.ibatis.annotations.Mapper;
/**
* mini_program_user (小程序用户) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface MiniProgramUserMapper extends BaseMapper<MiniProgramUser> {
}

View File

@ -0,0 +1,79 @@
package com.changhu.module.miniProgram.pojo.entity;
import java.io.Serial;
import java.io.Serializable;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.Sex;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
/**
* 小程序用户 实体类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@TableName(autoResultMap = true)
public class MiniProgramUser extends BaseEntity implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 名称
*/
private String name;
/**
* 手机号
*/
private String telephone;
/**
* 性别
*/
private Sex sex;
/**
* 身份证
*/
private String idCard;
/**
* 小程序唯一标识
*/
private String openId;
/**
* 会话密钥
*/
private String sessionKey;
/**
* 身份
*/
private MiniProgramUserIdentity identity;
/**
* 所属单位id
*/
private Long unitId;
/**
* 是否启用
*/
private IsEnable isEnable;
}

View File

@ -0,0 +1,31 @@
package com.changhu.module.miniProgram.pojo.params;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.Sex;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/6 上午10:47
* @desc MiniProgramUserRegisterParams...
*/
@Data
public class MiniProgramUserRegisterParams {
@NotBlank(message = "code不能为空")
private String code;
@NotBlank(message = "名称不能为空")
private String name;
@NotNull(message = "性别不能为空")
private Sex sex;
private String telephone;
@NotNull(message = "身份不能为空")
private MiniProgramUserIdentity identity;
@NotNull(message = "单位不能为空")
private Long unitId;
}

View File

@ -0,0 +1,20 @@
package com.changhu.module.miniProgram.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
/**
* mini_program_user (小程序用户) 服务类
* author: luozhun
* desc 由groovy脚本自动生成
*/
public interface MiniProgramUserService extends IService<MiniProgramUser> {
/**
* 注册
*
* @param params 参数
*/
void register(MiniProgramUserRegisterParams params);
}

View File

@ -0,0 +1,52 @@
package com.changhu.module.miniProgram.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.SnowFlakeIdUtil;
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* mini_program_user (小程序用户) 服务实现类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Service
public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMapper, MiniProgramUser> implements MiniProgramUserService {
@Autowired
private WxMaService wxMaService;
@Override
public void register(MiniProgramUserRegisterParams params) {
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
try {
WxMaJscode2SessionResult sessionInfo = wxMaService.getUserService().getSessionInfo(params.getCode());
miniProgramUser.setOpenId(sessionInfo.getOpenid());
miniProgramUser.setSessionKey(sessionInfo.getSessionKey());
} catch (WxErrorException e) {
throw new MessageException(e.getMessage());
}
boolean exists = baseMapper.exists(Wrappers.<MiniProgramUser>lambdaQuery().eq(MiniProgramUser::getOpenId, miniProgramUser.getOpenId()));
if (exists) {
throw new MessageException("该用户已存在,请勿重复注册!");
}
miniProgramUser.setSnowFlakeId(SnowFlakeIdUtil.snowflakeId());
boolean save = this.save(miniProgramUser);
if (!save) {
throw new MessageException();
}
//todo 是否需要返回token直接登录?
}
}

View File

@ -1,6 +1,8 @@
package com.changhu.support.interceptor; package com.changhu.support.interceptor;
import com.changhu.common.annotation.CheckClientType; import cn.hutool.core.util.ArrayUtil;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.UserType;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.UserUtil;
import com.changhu.enums.ClientType; import com.changhu.enums.ClientType;
@ -13,9 +15,9 @@ import org.springframework.web.servlet.HandlerInterceptor;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/4 下午4:00 * @createTime 2024/9/4 下午4:00
* @desc ClientTypeInterceptor... * @desc UserTypeInterceptor...
*/ */
public class ClientTypeInterceptor implements HandlerInterceptor { public class UserTypeInterceptor implements HandlerInterceptor {
@Override @Override
public boolean preHandle(@NotNull HttpServletRequest request, public boolean preHandle(@NotNull HttpServletRequest request,
@ -23,28 +25,28 @@ public class ClientTypeInterceptor implements HandlerInterceptor {
@NotNull Object handler) { @NotNull Object handler) {
if (handler instanceof HandlerMethod handlerMethod) { if (handler instanceof HandlerMethod handlerMethod) {
boolean b = false; boolean b = false;
ClientType ct = null; UserType[] uts = null;
CheckClientType clazzJsonBody = handlerMethod.getBeanType().getAnnotation(CheckClientType.class); CheckUserType clazzJsonBody = handlerMethod.getBeanType().getAnnotation(CheckUserType.class);
CheckClientType methodJsonBody = handlerMethod.getMethodAnnotation(CheckClientType.class); CheckUserType methodJsonBody = handlerMethod.getMethodAnnotation(CheckUserType.class);
if (clazzJsonBody != null) { if (clazzJsonBody != null) {
if (methodJsonBody == null) { if (methodJsonBody == null) {
b = true; b = true;
ct = clazzJsonBody.clientType(); uts = clazzJsonBody.userTypes();
} else if (methodJsonBody.value()) { } else if (methodJsonBody.value()) {
b = true; b = true;
ct = methodJsonBody.clientType(); uts = methodJsonBody.userTypes();
} }
} else { } else {
if (methodJsonBody != null && methodJsonBody.value()) { if (methodJsonBody != null && methodJsonBody.value()) {
b = true; b = true;
ct = methodJsonBody.clientType(); uts = methodJsonBody.userTypes();
} }
} }
if (b) { if (b && ArrayUtil.isNotEmpty(uts)) {
if (!ct.equals(UserUtil.getClientType())) { if (!ArrayUtil.contains(uts, UserUtil.getUserType())) {
throw new MessageException("客户端类型不对"); throw new MessageException("客户端类型不对");
} }
} }

View File

@ -1,29 +0,0 @@
package com.changhu.support.mybatisplus.handler.permission.management;
import com.changhu.common.utils.UserUtil;
import com.changhu.support.mybatisplus.handler.permission.AbstractDataPermissionHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table;
/**
* @author 20252
* @createTime 2024/9/4 下午3:29
* @desc ManagementPoliceUnitUserPagerPermissionHandler...
*/
public class ManagementPoliceUnitUserPagerPermissionHandler implements AbstractDataPermissionHandler {
@Override
public Expression apply(Table table, Expression where, String mappedStatementId) {
if ("mpuu".equals(table.getAlias().getName())) {
return sqlFragment();
}
return null;
}
@Override
public Expression sqlFragment() {
return new EqualsTo(new Column("mpuu.police_unit_id"), new LongValue(UserUtil.getUnitId()));
}
}

View File

@ -1,29 +0,0 @@
package com.changhu.support.mybatisplus.handler.permission.management;
import com.changhu.common.utils.UserUtil;
import com.changhu.support.mybatisplus.handler.permission.AbstractDataPermissionHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table;
/**
* @author 20252
* @createTime 2024/9/3 上午11:11
* @desc 后台安保人员分页权限
*/
public class ManagementSecurityUnitUserPagerPermissionHandler implements AbstractDataPermissionHandler {
@Override
public Expression apply(Table table, Expression where, String mappedStatementId) {
if ("msuu".equals(table.getAlias().getName())) {
return sqlFragment();
}
return null;
}
@Override
public Expression sqlFragment() {
return new EqualsTo(new Column("msuu.security_unit_id"), new LongValue(UserUtil.getUnitId()));
}
}

View File

@ -0,0 +1,30 @@
package com.changhu.support.wx;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* author: luozhun
* desc: some...
* createTime: 2024/4/15 9:41
*/
@Configuration
@EnableConfigurationProperties(WxMaProperties.class)
public class WxMaConfiguration {
@Bean
public WxMaService wxMaService(WxMaProperties properties) {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid(properties.getAppid());
config.setSecret(properties.getSecret());
config.setMsgDataFormat(properties.getMsgDataFormat());
WxMaService service = new WxMaServiceImpl();
service.setWxMaConfig(config);
return service;
}
}

View File

@ -0,0 +1,29 @@
package com.changhu.support.wx;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* author: luozhun
* desc: some...
* createTime: 2024/4/15 9:40
*/
@Data
@ConfigurationProperties(prefix = "wx.miniapp")
public class WxMaProperties {
/**
* 设置微信小程序的appid
*/
private String appid;
/**
* 设置微信小程序的Secret
*/
private String secret;
/**
* 消息格式XML或者JSON
*/
private String msgDataFormat;
}

View File

@ -128,6 +128,9 @@
<logger name="com.changhu.module.management.mapper"> <logger name="com.changhu.module.management.mapper">
<appender-ref ref="MpConsole"/> <appender-ref ref="MpConsole"/>
</logger> </logger>
<logger name="com.changhu.module.miniProgram.mapper">
<appender-ref ref="MpConsole"/>
</logger>
<!--spring日志--> <!--spring日志-->
<logger name="org.springframework" level="DEBUG"/> <logger name="org.springframework" level="DEBUG"/>
<!--建立一个默认的root的logger --> <!--建立一个默认的root的logger -->

View File

@ -141,6 +141,14 @@ sa-token:
# jwt秘钥 # jwt秘钥
jwt-secret-key: a29216f8-cd60-4e96-89c5-ab6012159052 jwt-secret-key: a29216f8-cd60-4e96-89c5-ab6012159052
wx:
miniapp:
#微信小程序的appid
appid: wx8902ddbfddb820d1
#微信小程序的Secret
secret: 8674decea33df3362245937444944596
msgDataFormat: JSON
project: project:
env: dev env: dev
fastjson2: fastjson2:

View File

@ -22,4 +22,37 @@
and eu.police_unit_id = #{params.policeUnitId} and eu.police_unit_id = #{params.policeUnitId}
order by eu.create_time desc order by eu.create_time desc
</select> </select>
<resultMap id="PoliceEnterprisesUnitPagerVoResultMap"
type="com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo">
<result
column="contact_person_info"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="contactPersonInfo"/>
</resultMap>
<select id="policeEnterprisesUnitPager"
resultMap="PoliceEnterprisesUnitPagerVoResultMap">
select eu.*,
ad1.name as provinceName,
ad2.name as cityName,
ad3.name as districtsName,
ad4.name as streetName
from enterprises_unit eu
left join administrative_division ad1 on eu.province = ad1.code and ad1.delete_flag = 0
left join administrative_division ad2 on eu.city = ad2.code and ad2.delete_flag = 0
left join administrative_division ad3 on eu.districts = ad3.code and ad3.delete_flag = 0
left join administrative_division ad4 on eu.street = ad4.code and ad4.delete_flag = 0
where eu.delete_flag = 0
and eu.police_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
<if test="params.name != null and params.name != ''">
and eu.name like concat('%', #{params.name}, '%')
</if>
<if test="params.address != null and params.address != ''">
and eu.address like concat('%', #{params.address}, '%')
</if>
<if test="params.remark != null and params.remark != ''">
and eu.remark like concat('%', #{params.remark}, '%')
</if>
order by eu.create_time desc
</select>
</mapper> </mapper>

View File

@ -9,6 +9,7 @@
left join management_police_unit_user mpuu2 on mpuu.create_by = mpuu2.snow_flake_id left join management_police_unit_user mpuu2 on mpuu.create_by = mpuu2.snow_flake_id
where where
mpuu.delete_flag = 0 mpuu.delete_flag = 0
and mpuu.police_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
<if test="params.name!=null and params.name!=''"> <if test="params.name!=null and params.name!=''">
and mpuu.name like concat('%',#{params.name},'%') and mpuu.name like concat('%',#{params.name},'%')
</if> </if>
@ -18,6 +19,9 @@
<if test="params.sex!=null"> <if test="params.sex!=null">
and mpuu.sex = #{params.sex.value} and mpuu.sex = #{params.sex.value}
</if> </if>
<if test="params.isEnable!=null">
and mpuu.sex = #{params.isEnable.value}
</if>
order by mpuu.create_time desc order by mpuu.create_time desc
</select> </select>
</mapper> </mapper>

View File

@ -9,6 +9,7 @@
left join management_security_unit_user msuu2 on msuu.create_by = msuu2.snow_flake_id left join management_security_unit_user msuu2 on msuu.create_by = msuu2.snow_flake_id
where where
msuu.delete_flag = 0 msuu.delete_flag = 0
and msuu.security_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
<if test="params.name!=null and params.name!=''"> <if test="params.name!=null and params.name!=''">
and msuu.name like concat('%',#{params.name},'%') and msuu.name like concat('%',#{params.name},'%')
</if> </if>

View File

@ -0,0 +1,31 @@
<?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.ServiceProjectMapper">
<select id="pager" resultType="com.changhu.module.management.pojo.vo.ServiceProjectPagerVo">
select
sp.*,
JSON_ARRAY(eu.province,eu.city,eu.districts,eu.street) as 'enterprisesUnitAdministrativeDivisionCodes',
eu.name as 'enterprisesUnitName',
mpu.name as 'projectManagerMiniProgramUserName',
msuu.name as 'createUserName'
from service_project sp
left join enterprises_unit eu on sp.enterprises_unit_id = eu.snow_flake_id
left join mini_program_user mpu on sp.project_manager_mini_program_user_id = mpu.snow_flake_id
left join management_security_unit_user msuu on sp.create_by = msuu.snow_flake_id
where sp.delete_flag = 0
and sp.security_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
<if test="params.name!=null and params.name!=''">
and sp.name like concat('%',#{params.name},'%')
</if>
<if test="params.type!=null">
and sp.type = #{params.type.value}
</if>
<if test="params.remark!=null and params.remark!=''">
and sp.remark like concat('%',#{params.remark},'%')
</if>
<if test="params.projectManagerMiniProgramUserName!=null and params.projectManagerMiniProgramUserName!=''">
and mpu.name like concat('%',#{params.projectManagerMiniProgramUserName},'%')
</if>
order by sp.create_time desc
</select>
</mapper>

View File

@ -161,7 +161,7 @@ const props = withDefaults(defineProps<FormProMaxProps<T>>(), {
labelCol: () => { labelCol: () => {
return { return {
style: { style: {
width: '100px' width: '120px'
} }
} }
}, },

View File

@ -9,7 +9,7 @@
import {IconFontProps} from "@/types/components/iconfont/IconFont"; import {IconFontProps} from "@/types/components/iconfont/IconFont";
withDefaults(defineProps<IconFontProps>(), { withDefaults(defineProps<IconFontProps>(), {
size: 25, size: 20,
type: "svg" type: "svg"
}); });

View File

@ -154,7 +154,7 @@ const tableColumns = computed(() => {
if (!(cols?.[0].dataIndex === 'index')) { if (!(cols?.[0].dataIndex === 'index')) {
cols?.unshift({ cols?.unshift({
dataIndex: 'index', dataIndex: 'index',
width: 60, width: 80,
title: '序号', title: '序号',
customRender: ({index}) => index + 1 customRender: ({index}) => index + 1
}) })

View File

@ -6,6 +6,8 @@ type DictType =
| 'IsEnable' | 'IsEnable'
| 'IsOrNot' | 'IsOrNot'
| 'Sex' | 'Sex'
| 'ServiceProjectType'
| 'MiniProgramUserIdentity'
export const initEnums = () => { export const initEnums = () => {
api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => { api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {

View File

@ -1,7 +1,7 @@
import {SystemMenu} from "@/types/config"; import {SystemMenu} from "@/types/config";
export const ROUTER_WHITE_LIST: string[] = ['/login', '/test','/enterprise']; export const ROUTER_WHITE_LIST: string[] = ['/login', '/test', '/enterprise'];
export const CLIENT_TYPE:string = "MANAGEMENT_SECURITY"; export const CLIENT_TYPE: string = "MANAGEMENT_SECURITY";
export const UNIT_TYPE = { export const UNIT_TYPE = {
security: 'SECURITY_UNIT', security: 'SECURITY_UNIT',
@ -12,27 +12,39 @@ export const SYSTEM_MENUS: SystemMenu[] = [
title: '首页', title: '首页',
name: 'index', name: 'index',
path: '/index', path: '/index',
icon: 'icon-shouye',
type: "menu", type: "menu",
component: () => import('@/views/index.vue') component: () => import('@/views/index.vue')
}, { }, {
title: '用户管理', title: '用户管理',
name: 'userManagement', name: 'userManagement',
path: '/userManagement', path: '/userManagement',
icon: 'icon-yonghuguanli_huaban',
type: 'dir', type: 'dir',
children: [ children: [
{ {
title: '后台管理', title: '后台管理',
name: 'bgManagement', name: 'bgManagement',
path: '/bgManagement', path: '/bgManagement',
icon:'icon-guanlianbaoan',
type: 'menu', type: 'menu',
component: () => import('@/views/userManagement/bgManagement/index.vue') component: () => import('@/views/userManagement/bgManagement/index.vue')
}, { }, {
title: '小程序管理', title: '小程序管理',
name: 'uniManagement', name: 'uniManagement',
path: '/uniManagement', path: '/uniManagement',
icon:'icon-guanlianbaoan',
type: 'menu', type: 'menu',
component: () => import('@/views/userManagement/uniManagement/index.vue') component: () => import('@/views/userManagement/uniManagement/index.vue')
} }
] ]
},
{
title: '服务项目管理',
name: 'serviceManagement',
path: '/serviceManagement',
icon:'icon-xiangmuguanli-',
type: 'menu',
component: () => import('@/views/serviceManagement/index.vue')
} }
] ]

View File

@ -62,7 +62,10 @@ interface BaseEnum<T> {
label: string label: string
} }
interface TypeEnum<T> {
value: string;
label: string
}
interface dataStatus { interface dataStatus {
account: string; account: string;
password: string; password: string;

View File

@ -0,0 +1,25 @@
import {BaseTableRowRecord} from "@/types/components/table";
export interface serviceProjectSaveOrUpdateParams extends BaseTableRowRecord {
snowFlakeId: string
enterprisesUnitId: string,
enterprisesUnitName: string,
projectManagerMiniProgramUserId: string,
projectManagerMiniProgramUserName: string,
name: string,
type: TypeEnum<string>,
isRecruitSecurity: BaseEnum<number>,
idNumber: string,
serviceArea: number,
buildingTotal: number,
houseTotal: number,
staffTotal: number,
securityUserTotal: number,
remark: string,
createUserName: string,
createTime: string,
enterprisesUnitAdministrativeDivisionCodes:Record<string, any>
}

View File

@ -138,6 +138,7 @@ const rules: Record<string, Rule[]> = {
const DivisionTree = async ()=>{ const DivisionTree = async ()=>{
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree') const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree')
administrativeDivisionTree.value = resp.data as TreeNodeVo<string>[] administrativeDivisionTree.value = resp.data as TreeNodeVo<string>[]
} }
// 2 // 2

View File

@ -1,9 +1,417 @@
<template> <template>
<div>服务项目管理</div> <div>
</template> <TableProMax
<script setup lang="ts"> ref="tableRef"
:request-api="reqApi"
:columns="columns"
:searchFormOptions="searchFormOptions"
:scroll="{x}"
>
<template #tableHeader>
<a-space>
<a-button type="primary" @click="addServiceProjects">新增服务项目</a-button>
</a-space>
</template>
</TableProMax>
<a-modal
v-model:open="visible"
:title="serviceTitle"
@ok="submit"
@cancel="closeModal"
>
<FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions"/>
</a-modal>
</div>
</template>
<script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue";
import {TableProMaxProps} from "@/types/components/table";
import api from "@/axios";
import {onMounted, ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers";
import {dictSelectNodes} from "@/config/dict.ts";
import {serviceProjectSaveOrUpdateParams} from "@/types/views/serviceManagement.ts";
import {FormExpose} from "ant-design-vue/es/form/Form";
import {FormProMaxItemOptions} from "@/types/components/form";
import FormProMax from "@/components/form/FormProMax.vue";
import {message} from "ant-design-vue";
type TableProps = TableProMaxProps<serviceProjectSaveOrUpdateParams> //
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
// table
const reqApi: TableProps['requestApi'] = (params) => api.post('/serviceProject/pager', params) //
const searchFormOptions: TableProps["searchFormOptions"] = {
name: {
type: 'input',
label: '服务项目名称'
},
projectManagerMiniProgramUserName:{
type: 'input',
label: '服务经理用户名称'
},
remark: {
type: 'input',
label: '备注'
},
type: {
type: 'select',
label: '服务项目类型',
options: [
{
value: null,
label: '全部'
},...dictSelectNodes('ServiceProjectType')
]
}
}
const visible = ref(false)
const serviceTitle = ref('新增服务项目')
const formRef = ref<FormExpose>(null)
const formParams = ref<{
snowFlakeId?: string,
enterprisesUnitId:string,
administrativeDivisionCodes?:null,
projectManagerMiniProgramUserId?:string,
name: string,
type:string,
isRecruitSecurity:number,
idNumber?: string,
serviceArea?:number,
buildingTotal?:number,
houseTotal?:number,
staffTotal?:number,
securityUserTotal?:number
remark?: string,
}>({
name:'',
isRecruitSecurity:0,
enterprisesUnitId:null,
type:'property'
})
const columns: TableProps['columns'] = [
{
dataIndex: 'enterprisesUnitName',
title: '企事业单位名称',
width: 150,
ellipsis: true
},
{
dataIndex: 'projectManagerMiniProgramUserName',
title: '项目经理小程序用户名称',
width: 200,
ellipsis: true
}, {
dataIndex: 'name',
title: '服务项目名称',
width: 150,
ellipsis: true
},
{
dataIndex:'type',
title: '服务类型',
customRender: ({text}) => <a-tag>{text?.label}</a-tag>,
width:100
},
{
dataIndex:'isRecruitSecurity',
title: '是否自招保安',
customRender: ({text}) => <a-tag>{text?.label}</a-tag>,
width:100
},
{
dataIndex:'idNumber',
title: '证件号',
width:200
},
{
dataIndex:'serviceArea',
title:'服务区域面积',
width:100
},
{
dataIndex:'buildingTotal',
title:'楼栋数量',
width:100
},
{
dataIndex:'houseTotal',
title:'户数',
width:100
},
{
dataIndex:'staffTotal',
title:'工作人员数量',
width:100
},
{
dataIndex:'securityUserTotal',
title:'保安人员数量',
width:100
},
{
dataIndex:'createUserName',
title:'创建人名称',
width:100
},
{
dataIndex: 'createTime',
title: '创建时间',
width: 100,
ellipsis: true,
},
{
dataIndex: 'remark',
title: '备注',
width: 200,
ellipsis: true
},{
dataIndex: 'opt',
title: '操作',
fixed: "right",
width:200,
customRender({record}){
return <a-space>
<a-popconfirm
title="确认删除账号吗?"
onConfirm={async () => {
const resp = await api.delete('/serviceProject/deleteById', {
serviceProjectId: record.snowFlakeId,
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}>
<a-button type="primary" danger>删除</a-button>
</a-popconfirm>
<a-button type="primary" onClick={ async ()=>{
console.log(record)
visible.value = true
serviceTitle.value = '编辑服务项目'
if(record.isRecruitSecurity === null ){
idNumberDisabled.value = false
}
if(record.type.value === 'security'){
isRecruitSecurityHidden.value = true
formParams.value.isRecruitSecurity = null
}else{
formParams.value.isRecruitSecurity = record.isRecruitSecurity.value
if(record.isRecruitSecurity.value === 1){
idNumberDisabled.value = true
}
}
formParams.value.snowFlakeId = record.snowFlakeId
formParams.value.name = record.name
formParams.value.type = record.type.value
formParams.value.remark = record.remark
formParams.value.idNumber = record.idNumber
formParams.value.serviceArea = record.serviceArea
formParams.value.buildingTotal = record.buildingTotal
formParams.value.houseTotal = record.houseTotal
formParams.value.staffTotal = record.staffTotal
formParams.value. securityUserTotal = record.securityUserTotal
formParams.value.enterprisesUnitId = record.enterprisesUnitName
enterprisesUnitId.value = record.enterprisesUnitId
formParams.value.administrativeDivisionCodes = record.enterprisesUnitAdministrativeDivisionCodes
}}>编辑</a-button>
</a-space>
}
},
]
const x: number = columns.reduce((a, b) => a + (b.width as number), 0)
const administrativeDivisionTree = ref<TreeNodeVo<string>[]>([]) //
const getAdministrativeDivisionTree = async ()=>{
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree')
administrativeDivisionTree.value = resp.data as TreeNodeVo<string>[]
}
//
const enterprisesUnitIdList = ref<SelectNodeVo<string>[]>([])
const enterprisesUnitId = ref('')
const isRecruitSecurityHidden = ref<boolean>(false)
const idNumberDisabled = ref<boolean>(false)
const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdateParams>>({
name: {
type: 'input',
label: '名称',
required: true,
},
administrativeDivisionCodes:{
type:'cascader',
label:'行政区划',
required: true,
options: administrativeDivisionTree,
componentsProps:{
showSearch:true,
onChange: async (values)=>{
const resp = await api.post<SelectNodeVo<string>[]>('/enterprisesUnit/queryListByAdministrativeDivisionCodes',values)
enterprisesUnitIdList.value = resp.data
}
}
},
enterprisesUnitId:{
type:'select',
label:'企事业单位',
options:enterprisesUnitIdList,
componentsProps:{
allowClear:true
}
},
type: {
type: 'radioGroup',
label: '服务类型',
options: dictSelectNodes('ServiceProjectType'),
required: true,
componentsProps:{
onChange:(e)=>{
if(e.target.value === 'security'){
isRecruitSecurityHidden.value = true
formParams.value.isRecruitSecurity = null
idNumberDisabled.value = false
}else{
formParams.value.isRecruitSecurity = 0
isRecruitSecurityHidden.value = false
}
}
}
},
isRecruitSecurity: {
type: 'radioGroup',
label: '是否自招保安',
options:dictSelectNodes('IsOrNot'),
hidden:isRecruitSecurityHidden as any,
componentsProps:{
onChange:(e)=>{
idNumberDisabled.value = e.target.value !== 0;
formParams.value.idNumber = ''
}
}
},
idNumber: {
type: 'input',
label: '证件号',
componentsProps:{
disabled:idNumberDisabled as any
}
},
serviceArea:{
type:'inputNumber',
label:'服务区域面积',
},
buildingTotal:{
type:'inputNumber',
label:'楼栋数量',
componentsProps:{
formatter:(value:any)=>{
return Math.round(value)?Math.round(value):'' as any
},
min:0
}
},
houseTotal:{
type:'inputNumber',
label:'户数',
componentsProps:{
formatter:(value:any)=>{
return Math.round(value)?Math.round(value):'' as any
},
min:0
}
},
staffTotal:{
type:'inputNumber',
label:'工作人员数量',
componentsProps:{
formatter:(value:any)=>{
return Math.round(value)?Math.round(value):'' as any
},
min:0
}
},
securityUserTotal:{
type:'inputNumber',
label:'保安人员数量',
componentsProps:{
formatter:(value:any)=>{
return Math.round(value)?Math.round(value):'' as any
},
min:0
}
},
remark: {
type: 'inputTextArea',
label: '备注',
}
})
const submit = async()=>{
await formRef.value.validate()
const snowFlakeId = ref('')
const UnitId = ref('')
if (serviceTitle.value === '新增服务项目') {
snowFlakeId.value = ''
UnitId.value = formParams.value.enterprisesUnitId
} else {
snowFlakeId.value = formParams.value.snowFlakeId
UnitId.value = enterprisesUnitId.value
}
const serviceProjectSaveOrUpdateParams = {
snowFlakeId: snowFlakeId.value,
enterprisesUnitId:UnitId.value,
name: formParams.value.name,
type:formParams.value.type,
isRecruitSecurity:formParams.value.isRecruitSecurity,
idNumber: formParams.value.idNumber,
serviceArea:formParams.value.serviceArea,
buildingTotal:formParams.value.buildingTotal,
houseTotal:formParams.value.houseTotal,
staffTotal:formParams.value.staffTotal,
securityUserTotal:formParams.value.securityUserTotal,
remark: formParams.value.remark,
}
const resp = await api.post('/serviceProject/saveOrUpdate',serviceProjectSaveOrUpdateParams)
message.success(resp.message)
await tableRef.value?.requestGetTableData()
await closeModal()
}
const closeModal = async()=>{
visible.value = false
formParams.value = {
enterprisesUnitId:'',
administrativeDivisionCodes:'',
name:'',
type:'property',
isRecruitSecurity:0,
idNumber:'',
serviceArea:null,
buildingTotal:null,
houseTotal:null,
staffTotal:null,
securityUserTotal:null,
remark:''
}
// await formRef.value.resetFields()
enterprisesUnitId.value = ''
serviceTitle.value = '新增服务项目'
isRecruitSecurityHidden.value = false
idNumberDisabled.value = false
}
const addServiceProjects = () => {
visible.value = true
}
onMounted(async ()=>{
await getAdministrativeDivisionTree()
})
</script> </script>

View File

@ -91,8 +91,8 @@ const columns: TableProps['columns'] = [
return ( return (
record.isAdmin.value === 1? record.isAdmin.value === 1?
<a-space> <a-space>
<a-button type="primary" danger>
<a-popconfirm <a-popconfirm
style="width:100%"
title="确认删除账号吗?" title="确认删除账号吗?"
onConfirm={async () => { onConfirm={async () => {
const resp = await api.delete('/managementSecurityUnitUser/deleteById', { const resp = await api.delete('/managementSecurityUnitUser/deleteById', {
@ -101,9 +101,8 @@ const columns: TableProps['columns'] = [
message.success(resp.message) message.success(resp.message)
await tableRef.value?.requestGetTableData() await tableRef.value?.requestGetTableData()
}}> }}>
删除 <a-button type="primary" danger>删除</a-button>
</a-popconfirm> </a-popconfirm>
</a-button>
<a-button type="primary" onClick={async () => { <a-button type="primary" onClick={async () => {
visible.value = true visible.value = true
title.value = "编辑用户" title.value = "编辑用户"
@ -118,7 +117,7 @@ const columns: TableProps['columns'] = [
</a-button> </a-button>
</a-space> </a-space>
: :
<i></i> <div>超级管理员不能编辑</div>
) )
} }
}, },
@ -218,27 +217,24 @@ const submit = async () => {
} }
const resp = await api.post('/managementSecurityUnitUser/saveOrUpdate', managementSecurityUnitUserSaveOrUpdateParams) const resp = await api.post('/managementSecurityUnitUser/saveOrUpdate', managementSecurityUnitUserSaveOrUpdateParams)
message.success(resp.message) message.success(resp.message)
close()
}
const close = () => {
tableRef.value?.requestGetTableData() tableRef.value?.requestGetTableData()
visible.value = false
closeModal() closeModal()
} }
const closeModal = () => { const closeModal = () => {
formParams.value = { formParams.value = {
name: '', name:'',
sex: 0, sex:0,
telephone: '', telephone:'',
isEnable: 0, isEnable:0,
remark: '' remark:''
} }
visible.value = false visible.value = false
title.value = '新增用户'
} }
//Form //Form
const addUserManagement = () => { const addUserManagement = () => {
visible.value = true visible.value = true
title.value = ''
} }
</script> </script>

View File

@ -154,7 +154,7 @@ const tableColumns = computed(() => {
if (!(cols?.[0].dataIndex === 'index')) { if (!(cols?.[0].dataIndex === 'index')) {
cols?.unshift({ cols?.unshift({
dataIndex: 'index', dataIndex: 'index',
width: 50, width: 70,
title: '序号', title: '序号',
customRender: ({index}) => index + 1 customRender: ({index}) => index + 1
}) })

View File

@ -6,6 +6,8 @@ type DictType =
| 'IsEnable' | 'IsEnable'
| 'IsOrNot' | 'IsOrNot'
| 'Sex' | 'Sex'
| 'ServiceProjectType'
| 'MiniProgramUserIdentity'
export const initDict = () => { export const initDict = () => {
api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => { api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {