Compare commits

..

No commits in common. "3c461b485366d4093c0eb9e9d4bdacb6e37f88ed" and "d6ed7e354cce334f077689c7725898b793a0e2ea" have entirely different histories.

60 changed files with 111 additions and 1114 deletions

View File

@ -27,7 +27,6 @@
<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>
@ -201,12 +200,6 @@
<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,7 +4,6 @@ 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
@ -15,7 +14,7 @@ import java.util.List;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@RestController @RestController
public @interface CheckUserType { public @interface CheckClientType {
/** /**
* 是否需要校验客户端类型 * 是否需要校验客户端类型
@ -25,5 +24,5 @@ public @interface CheckUserType {
/** /**
* 需要的客户端类型 * 需要的客户端类型
*/ */
UserType[] userTypes(); ClientType clientType() default ClientType.NONE;
} }

View File

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,24 +0,0 @@
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,7 +6,6 @@ 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;
@ -46,18 +45,18 @@ public class UserUtil {
return getTokenInfo(); return getTokenInfo();
} }
public static SaTokenInfo loginAndTokenInfo(Long userId, UserType userType, Long unitId) { public static SaTokenInfo loginAndTokenInfo(Long userId, ClientType clientType, Long unitId) {
StpUtil.login(userId, SaLoginConfig.setExtra("userType", userType).setExtra("unitId", unitId)); StpUtil.login(userId, SaLoginConfig.setExtra("clientType", clientType).setExtra("unitId", unitId));
return getTokenInfo(); return getTokenInfo();
} }
/** /**
* 获取客户端类型 * 获取客户端类型
*/ */
public static UserType getUserType() { public static ClientType getClientType() {
Object clientType = StpUtil.getExtra("userType"); Object clientType = StpUtil.getExtra("clientType");
if (clientType instanceof String ct) { if (clientType instanceof String ct) {
return UserType.valueOf(ct); return ClientType.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.UserTypeInterceptor; import com.changhu.support.interceptor.ClientTypeInterceptor;
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 UserTypeInterceptor()); registry.addInterceptor(new ClientTypeInterceptor());
} }
@Override @Override

View File

@ -22,7 +22,6 @@ 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;
@ -52,7 +51,6 @@ 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,6 +15,7 @@ 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,7 +3,6 @@ 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;
@ -11,6 +10,7 @@ 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(),
UserType.MANAGEMENT_POLICE, ClientType.MANAGEMENT_POLICE,
managementPoliceUnitUser.getPoliceUnitId() managementPoliceUnitUser.getPoliceUnitId()
); );
//返回token //返回token

View File

@ -3,7 +3,6 @@ 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;
@ -68,7 +67,7 @@ public class ManagementSecurityUnitLogin extends AbstractLoginHandler {
//登录 //登录
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo( SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
managementSecurityUnitUser.getSnowFlakeId(), managementSecurityUnitUser.getSnowFlakeId(),
UserType.MANAGEMENT_SECURITY, ClientType.MANAGEMENT_SECURITY,
managementSecurityUnitUser.getSecurityUnitId() managementSecurityUnitUser.getSecurityUnitId()
); );
//返回token //返回token

View File

@ -3,7 +3,6 @@ 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;
@ -46,7 +45,7 @@ public class ManagementSuperLogin extends AbstractLoginHandler {
//登录 //登录
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo( SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
user.getSnowFlakeId(), user.getSnowFlakeId(),
UserType.MANAGEMENT_SUPER, ClientType.MANAGEMENT_SUPER,
null); null);
//返回token //返回token
return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue()); return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue());

View File

@ -3,20 +3,19 @@ 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.*; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
/** /**
* @author 20252 * @author 20252
@ -45,17 +44,11 @@ public class EnterprisesUnitController {
@Operation(summary = "根据id删除") @Operation(summary = "根据id删除")
@DeleteMapping("/deleteById") @DeleteMapping("/deleteById")
public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) { public void deleteById(@RequestBody 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,9 +1,8 @@
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.CheckClientType;
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;
@ -15,7 +14,10 @@ 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.*; import org.springframework.web.bind.annotation.PostMapping;
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
@ -24,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
*/ */
@Tag(name = "后台-公安用户") @Tag(name = "后台-公安用户")
@JsonBody @JsonBody
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE) @CheckClientType(clientType = ClientType.MANAGEMENT_POLICE)
@RequestMapping("/managementPoliceUnitUser") @RequestMapping("/managementPoliceUnitUser")
public class ManagementPoliceUnitUserController { public class ManagementPoliceUnitUserController {
@ -44,7 +46,7 @@ public class ManagementPoliceUnitUserController {
} }
@Operation(summary = "根据id删除") @Operation(summary = "根据id删除")
@DeleteMapping("/deleteById") @PostMapping("/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,9 +1,8 @@
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.CheckClientType;
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;
@ -25,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
@Tag(name = "后台-保安用户") @Tag(name = "后台-保安用户")
@JsonBody @JsonBody
@RequestMapping("/managementSecurityUnitUser") @RequestMapping("/managementSecurityUnitUser")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY) @CheckClientType(clientType = ClientType.MANAGEMENT_SECURITY)
public class ManagementSecurityUnitUserController { public class ManagementSecurityUnitUserController {
@Autowired @Autowired

View File

@ -1,13 +1,8 @@
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;
@ -37,11 +32,4 @@ 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,11 +1,7 @@
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;
@ -15,13 +11,10 @@ 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
@ -47,11 +40,4 @@ 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

@ -1,54 +0,0 @@
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,9 +4,7 @@ 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;
@ -27,14 +25,4 @@ 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,6 +5,8 @@ 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;
@ -23,6 +25,7 @@ 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,6 +5,8 @@ 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;
@ -23,6 +25,7 @@ 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

@ -1,28 +0,0 @@
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

@ -1,99 +0,0 @@
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

@ -1,58 +0,0 @@
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,6 +1,5 @@
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;
@ -18,6 +17,4 @@ 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

@ -1,19 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,46 +0,0 @@
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

@ -1,69 +0,0 @@
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,15 +2,12 @@ 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
@ -32,12 +29,4 @@ 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,9 +3,7 @@ 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;
@ -23,12 +21,4 @@ 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,15 +2,12 @@ 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
@ -33,10 +30,4 @@ public interface SecurityUnitService extends IService<SecurityUnit> {
*/ */
void saveOrUpdate(SecurityUnitSaveOrUpdateParams params); void saveOrUpdate(SecurityUnitSaveOrUpdateParams params);
/**
* 查询单位下的项目经理
*
* @return 项目经理
*/
List<SelectNodeVo<Long>> listProjectManager();
} }

View File

@ -1,32 +0,0 @@
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,12 +1,9 @@
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;
@ -16,7 +13,6 @@ 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;
/** /**
@ -55,26 +51,4 @@ 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,7 +35,6 @@ 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,7 +5,6 @@ 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;
@ -37,7 +36,6 @@ 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) {
@ -56,7 +54,7 @@ public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<Managemen
} }
//生成账号 //生成账号
managementSecurityUnitUser.setAccount(account); managementSecurityUnitUser.setAccount(account);
if (!UserType.MANAGEMENT_SECURITY.equals(UserUtil.getUserType())) { if (!ClientType.MANAGEMENT_SECURITY.equals(UserUtil.getClientType())) {
throw new MessageException("客户端类型不对"); throw new MessageException("客户端类型不对");
} }
//补全单位 //补全单位

View File

@ -2,16 +2,12 @@ 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;
/** /**
@ -22,16 +18,8 @@ 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,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 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.db.enums.IsEnable; import com.changhu.common.utils.JavaClassToTsUtil;
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;
/** /**
@ -33,9 +23,6 @@ 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());
@ -62,24 +49,9 @@ public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, Sec
this.saveOrUpdate(securityUnit); this.saveOrUpdate(securityUnit);
} }
@Override public static void main(String[] args) {
public List<SelectNodeVo<Long>> listProjectManager() { String parse = JavaClassToTsUtil.parse(SecurityUnitPagerQueryParams.class);
String tel = LambdaUtil.getFieldName(MiniProgramUser::getTelephone); System.out.println(parse);
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

@ -1,39 +0,0 @@
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

@ -1,35 +0,0 @@
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

@ -1,15 +0,0 @@
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

@ -1,79 +0,0 @@
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

@ -1,31 +0,0 @@
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

@ -1,20 +0,0 @@
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

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

View File

@ -0,0 +1,29 @@
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

@ -0,0 +1,29 @@
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

@ -1,30 +0,0 @@
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

@ -1,29 +0,0 @@
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,9 +128,6 @@
<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,14 +141,6 @@ 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,37 +22,4 @@
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,7 +9,6 @@
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>
@ -19,9 +18,6 @@
<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,7 +9,6 @@
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

@ -1,31 +0,0 @@
<?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

@ -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: 70, width: 50,
title: '序号', title: '序号',
customRender: ({index}) => index + 1 customRender: ({index}) => index + 1
}) })

View File

@ -6,8 +6,6 @@ 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 => {