feat(系统): 新增白名单注解并重构拦截器逻辑- 新增 @IsWhiteList 注解用于标记白名单接口

- 重构 WebConfig 类,实现自动扫描控制器并加载白名单
- 更新 CommonController、EnterprisesUnitController 等控制器,添加白名单注解
- 新增 ManagementController 和 WeChatController 控制器- 更新数据库 Mapper 类,统一命名规范
This commit is contained in:
luozhun 2024-11-25 09:32:39 +08:00
parent 00c6b0409f
commit fd192ccecc
237 changed files with 2503 additions and 1993 deletions

View File

@ -1,7 +1,6 @@
package com.changhu.common.annotation;
import com.changhu.common.db.enums.UserType;
import org.springframework.web.bind.annotation.RestController;
import java.lang.annotation.*;
@ -13,7 +12,6 @@ import java.lang.annotation.*;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@RestController
public @interface CheckUserType {
/**

View File

@ -4,7 +4,7 @@ import java.lang.annotation.*;
/**
* author: luozhun
* desc: 是拓展属性
* desc: 标注是拓展属性
* createTime: 2023/11/1 17:25
*/
@Documented

View File

@ -0,0 +1,14 @@
package com.changhu.common.annotation;
import java.lang.annotation.*;
/**
* @author 20252
* @createTime 2024/11/21 下午3:34
* @desc IsWhiteList...
*/
@Documented
@Retention(value = RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface IsWhiteList {
}

View File

@ -1,7 +1,5 @@
package com.changhu.common.annotation;
import org.springframework.web.bind.annotation.RestController;
import java.lang.annotation.*;
/**
@ -12,7 +10,6 @@ import java.lang.annotation.*;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@RestController
public @interface JsonBody {
boolean value() default true;
}

View File

@ -2,38 +2,121 @@ package com.changhu.config;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil;
import com.changhu.support.filter.BodyWrapperFilter;
import com.changhu.support.interceptor.JsonBodyInterceptor;
import com.changhu.support.interceptor.SignInterceptor;
import com.changhu.support.interceptor.UserTypeInterceptor;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ClassUtil;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.filter.BodyWrapperFilter;
import com.changhu.interceptor.JsonBodyInterceptor;
import com.changhu.interceptor.OpenApiAuthInterceptor;
import com.changhu.interceptor.UserTypeInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.ArrayList;
import java.util.List;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Collectors;
/**
* author: luozhun
* desc: WebConfig
* createTime: 2023/8/18 10:56
*/
@Slf4j
@Configuration
public class WebConfig implements WebMvcConfigurer {
private final List<String> whiteList = new ArrayList<>();
/**
* 扫描所有Controller
*/
private static Set<Class<?>> scanRestController() {
//需要过滤出JsonBody
Set<Class<?>> classes = ClassUtil.scanPackage("com.changhu", clazz -> !JsonBody.class.equals(clazz));
return classes.stream().filter(aClass -> {
//判断类上是否有Controller注解
if (aClass.isAnnotationPresent(Controller.class) || aClass.isAnnotationPresent(RestController.class)) {
return true;
}
Annotation[] annotations = aClass.getAnnotations();
for (Annotation annotation : annotations) {
if (annotation.annotationType().isAnnotationPresent(Controller.class) || annotation.annotationType().isAnnotationPresent(RestController.class)) {
return true;
}
}
return false;
}).collect(Collectors.toSet());
}
public WebConfig() {
whiteList.add("/common/**");
whiteList.add("/open/**");
whiteList.add("/test/**");
whiteList.add("/login");
whiteList.add("/logout");
Set<String> w = new HashSet<>();
for (Class<?> clazz : scanRestController()) {
//类上的注解
RequestMapping classRequestMapping = AnnotatedElementUtils.findMergedAnnotation(clazz, RequestMapping.class);
IsWhiteList clazzIsWhiteList = clazz.getAnnotation(IsWhiteList.class);
if (classRequestMapping != null && clazzIsWhiteList != null) {
//直接放行当前控制器的所有方法
w.addAll(Arrays.stream(classRequestMapping.value()).map(path -> {
if (!path.startsWith("/")) {
path = "/" + path;
}
if (!path.endsWith("/")) {
path = path + "/";
}
return path + "**";
}).toList());
continue;
}
//看方法上是否有白名单注解
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
IsWhiteList methodIsWhiteList = method.getAnnotation(IsWhiteList.class);
RequestMapping methodRequestMapping = AnnotatedElementUtils.findMergedAnnotation(method, RequestMapping.class);
if (methodRequestMapping != null && methodIsWhiteList != null) {
List<List<String>> list1 = Arrays.stream(methodRequestMapping.value()).map(path -> {
if (!path.startsWith("/")) {
path = "/" + path;
}
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
List<String> list = new ArrayList<>();
if (classRequestMapping != null && CollUtil.isNotEmpty(Arrays.asList(classRequestMapping.value()))) {
for (String p : classRequestMapping.value()) {
if (!p.startsWith("/")) {
p = "/" + p;
}
if (p.endsWith("/")) {
p = p.substring(0, p.length() - 1);
}
list.add(p + path);
}
} else {
list.add(path);
}
return list;
}).toList();
w.addAll(list1.stream().flatMap(List::stream).toList());
}
}
}
log.info("加载路由白名单:{}", w);
whiteList.addAll(w);
//网站图标
whiteList.add("/favicon.ico");
//druid console
whiteList.add("/druid/**");
@ -43,12 +126,6 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/swagger-resources");
whiteList.add("/**webjars/**");
whiteList.add("/v3/**");
//获取企业注册审核状态
whiteList.add("/management/getCheckStatus");
//微信小程序注册
whiteList.add("/miniProgramUser/register");
//二维码表单录入保安人员
whiteList.add("/miniProgramUser/qrCodeFormInputSecurityUser");
}
@Override
@ -57,12 +134,12 @@ public class WebConfig implements WebMvcConfigurer {
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
.addPathPatterns("/**")
.excludePathPatterns(whiteList);
// 注册jsonBody 拦截器 用于标识是否需要JsonResult返回
// 注册jsonBody拦截器 用于标识是否需要JsonResult返回
registry.addInterceptor(new JsonBodyInterceptor());
// 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端
// 注册用户类型拦截器 用于校验当前用户是否匹配操作客户端
registry.addInterceptor(new UserTypeInterceptor());
// 注册开放接口 拦截器 用于校验第三方是否携带指定apiKey
registry.addInterceptor(new SignInterceptor())
// 注册开放接口认证拦截器 用于校验第三方是否授权
registry.addInterceptor(new OpenApiAuthInterceptor())
.addPathPatterns("/open/**");
}

View File

@ -1,5 +1,6 @@
package com.changhu.controller;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.cache.GlobalCacheManager;
import com.changhu.common.pojo.model.JsonResult;
@ -31,6 +32,8 @@ import java.util.Map;
@Tag(name = "公共接口")
@RequestMapping("/common")
@JsonBody
@IsWhiteList
@RestController
public class CommonController {
@Autowired

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.controller;
package com.changhu.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType;
@ -6,10 +6,10 @@ import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType;
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.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.module.management.service.EnterprisesUnitService;
import com.changhu.pojo.params.EnterprisesUnitSaveOrUpdateParams;
import com.changhu.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.service.EnterprisesUnitService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
@ -27,7 +27,8 @@ import java.util.List;
*/
@Tag(name = "企事业单位")
@JsonBody
@RequestMapping("/enterprisesUnit")
@RequestMapping("/eu")
@RestController
public class EnterprisesUnitController {
@Autowired
@ -41,14 +42,14 @@ public class EnterprisesUnitController {
}
@Operation(summary = "新增或保存")
@PostMapping("/saveOrUpdate")
@PostMapping("/add_upd")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public void saveOrUpdate(@RequestBody @Valid EnterprisesUnitSaveOrUpdateParams params) {
enterprisesUnitService.saveOrUpdate(params);
}
@Operation(summary = "根据id删除")
@DeleteMapping("/deleteById")
@DeleteMapping("/del_id")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) {
boolean b = enterprisesUnitService.removeById(enterprisesUnitId);
@ -58,7 +59,7 @@ public class EnterprisesUnitController {
}
@Operation(summary = "根据行政区划编码查询下面的企事业单位")
@PostMapping("/queryListByAdministrativeDivisionCodes")
@PostMapping("/list_ad_codes")
public List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(@RequestBody @Schema(description = "行政区划编码") List<String> administrativeDivisionCodes) {
return enterprisesUnitService.queryListByAdministrativeDivisionCodes(administrativeDivisionCodes);
}

View File

@ -1,5 +1,6 @@
package com.changhu.controller;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.pojo.vo.TokenInfo;
import com.changhu.pojo.params.LoginParams;
@ -10,6 +11,7 @@ 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.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author 20252
@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestBody;
*/
@Tag(name = "登录相关")
@JsonBody
@RestController
public class LoginController {
@Autowired
@ -25,12 +28,14 @@ public class LoginController {
@Operation(summary = "登录")
@PostMapping("/login")
@IsWhiteList
public TokenInfo login(@RequestBody LoginParams loginParams) {
return loginService.login(loginParams);
}
@Operation(summary = "登出")
@GetMapping("/logout")
@IsWhiteList
public void logout() {
loginService.logout();
}

View File

@ -1,16 +1,16 @@
package com.changhu.module.management.controller;
package com.changhu.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType;
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;
import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.module.management.service.ManagementService;
import com.changhu.pojo.params.CheckStatusParams;
import com.changhu.pojo.params.UnitDisableOrEnableParams;
import com.changhu.pojo.vo.UnitCheckStatusVo;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.service.ManagementService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -19,40 +19,28 @@ 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;
import org.springframework.web.bind.annotation.RestController;
/**
* @author 20252
* @createTime 2024/9/2 上午9:48
* @desc IndexController...
* @createTime 2024/11/22 上午9:03
* @desc ManagementController...
*/
@Tag(name = "后台-通用接口")
@JsonBody
@RequestMapping("/management")
@RestController
public class ManagementController {
@Autowired
private ManagementService managementService;
@Operation(summary = "审核通过")
@PostMapping("/checkPass")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
public void checkPass(@RequestBody @Valid IndexCheckPassParams params) {
managementService.checkPass(params);
}
@Operation(summary = "获取审核状态")
@PostMapping("/getCheckStatus")
public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid IndexCheckStatusParams params) {
@IsWhiteList
public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid CheckStatusParams params) {
return managementService.getCheckStatus(params);
}
@Operation(summary = "启用或禁用状态")
@PostMapping("/disableOrEnable")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
public void disableOrEnable(@RequestBody @Valid IndexDisableOrEnableParams params) {
managementService.disableOrEnable(params);
}
@Operation(summary = "查询单位下的小程序用户")
@PostMapping("/miniProgramUserPager")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
@ -63,14 +51,14 @@ public class ManagementController {
@Operation(summary = "审核通过小程序用户")
@PostMapping("/passMiniProgramUser")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
public void passMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) {
public void passMiniProgramUser(@RequestBody @Valid UnitDisableOrEnableParams params) {
managementService.passMiniProgramUser(params);
}
@Operation(summary = "禁用或启用小程序用户")
@PostMapping("/disableOrEnableMiniProgramUser")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
public void disableOrEnableMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) {
public void disableOrEnableMiniProgramUser(@RequestBody @Valid UnitDisableOrEnableParams params) {
managementService.disableOrEnableMiniProgramUser(params);
}
}

View File

@ -1,5 +1,6 @@
package com.changhu.controller;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.dto.DataViewDTO;
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -26,6 +28,8 @@ import java.util.List;
@Tag(name = "开放接口")
@JsonBody
@RequestMapping("/open")
@IsWhiteList
@RestController
public class OpenController {
@Autowired

View File

@ -0,0 +1,36 @@
package com.changhu.controller;
import com.changhu.common.annotation.JsonBody;
import com.changhu.service.WxService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author 20252
* @createTime 2024/11/22 上午11:42
* @desc WeChatController...
*/
@Tag(name = "微信相关")
@Controller
@RequestMapping("/wx")
public class WeChatController {
@Autowired
private WxService wxService;
@JsonBody(value = false)
@Operation(summary = "获取小程序页面二维码")
@GetMapping(value = "/qrCode")
public ResponseEntity<Resource> qrCode(@Schema(description = "要生成的路径") @RequestParam String path,
@Schema(description = "生成二维码的宽度") @RequestParam(defaultValue = "430") Integer width) {
return wxService.qrCode(path, width);
}
}

View File

@ -1,4 +1,4 @@
package com.changhu.support.filter;
package com.changhu.filter;
import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;

View File

@ -1,4 +1,4 @@
package com.changhu.support.filter;
package com.changhu.filter;
import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;

View File

@ -1,4 +1,4 @@
package com.changhu.support.handler;
package com.changhu.handler;
import cn.dev33.satoken.exception.NotLoginException;
import cn.hutool.core.exceptions.ExceptionUtil;

View File

@ -1,7 +1,7 @@
package com.changhu.support.handler;
package com.changhu.handler;
import com.changhu.common.pojo.model.JsonResult;
import com.changhu.support.interceptor.JsonBodyInterceptor;
import com.changhu.interceptor.JsonBodyInterceptor;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;

View File

@ -1,4 +1,4 @@
package com.changhu.support.interceptor;
package com.changhu.interceptor;
import cn.hutool.core.collection.ConcurrentHashSet;
import com.changhu.common.annotation.JsonBody;

View File

@ -1,4 +1,4 @@
package com.changhu.support.interceptor;
package com.changhu.interceptor;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.IpUtil;
import com.changhu.filter.CustomHttpServletRequestWrapper;
import com.changhu.pojo.entity.AccessKeys;
import com.changhu.support.filter.CustomHttpServletRequestWrapper;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
@ -26,10 +26,10 @@ import java.util.stream.Collectors;
/**
* @author 20252
* @createTime 2024/11/19 下午1:58
* @desc SignInterceptor...
* @desc 开放接口认证拦截器
*/
@Slf4j
public class SignInterceptor implements HandlerInterceptor {
public class OpenApiAuthInterceptor implements HandlerInterceptor {
private static final String ACCESS_KEY = "Access-Key";//调用者身份唯一标识
private static final String TIMESTAMP = "Time-Stamp";//时间戳

View File

@ -1,4 +1,4 @@
package com.changhu.support.interceptor;
package com.changhu.interceptor;
import cn.hutool.core.util.ArrayUtil;
import com.changhu.common.annotation.CheckUserType;
@ -14,7 +14,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
/**
* @author 20252
* @createTime 2024/9/4 下午4:00
* @desc UserTypeInterceptor...
* @desc 用户类型校验拦截器
*/
public class UserTypeInterceptor implements HandlerInterceptor {

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper;
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails;
import com.changhu.pojo.entity.CkAssessmentRecordDetails;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.CkAssessmentRecord;
import org.apache.ibatis.annotations.Mapper;
/**
* ck_assessment_record (考核记录) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface CkAssessmentRecordMapper extends BaseMapper<CkAssessmentRecord> {
}

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper;
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup;
import com.changhu.pojo.entity.CkGroup;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper;
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkItem;
import com.changhu.pojo.entity.CkItem;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.CkProject;
import org.apache.ibatis.annotations.Mapper;
/**
* ck_project (考核项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface CkProjectMapper extends BaseMapper<CkProject> {
}

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper;
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard;
import com.changhu.pojo.entity.CkStandard;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -1,10 +1,10 @@
package com.changhu.module.management.mapper;
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.pojo.entity.EnterprisesUnit;
import com.changhu.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.pojo.vo.EnterprisesUnitPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@ -0,0 +1,28 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 20252
* @createTime 2024/11/22 上午9:05
* @desc ManagementMapper...
*/
@Mapper
public interface ManagementMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @param identity 用户身份
* @return 结果
*/
Page<UnitMiniProgramUserPagerVo> miniProgramUserPager(@Param("page") Page<UnitMiniProgramUserPagerVo> page,
@Param("params") UnitMiniProgramUserPagerQueryParams params,
@Param("identity") MiniProgramUserIdentity identity);
}

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.ManagementPoliceUnitUser;
import org.apache.ibatis.annotations.Mapper;
/**
* management_police_user (后台-公安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementPoliceUnitUserMapper extends BaseMapper<ManagementPoliceUnitUser> {
}

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.ManagementSecurityUnitUser;
import org.apache.ibatis.annotations.Mapper;
/**
* management_security_unit_user (后台-保安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementSecurityUnitUserMapper extends BaseMapper<ManagementSecurityUnitUser> {
}

View File

@ -1,7 +1,7 @@
package com.changhu.module.management.mapper;
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.management.pojo.entity.ManagementSuperUser;
import com.changhu.pojo.entity.ManagementSuperUser;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -0,0 +1,14 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.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

@ -3,6 +3,7 @@ package com.changhu.mapper;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO;
import com.changhu.pojo.dto.SecurityUserRosterDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.pojo.params.EnterprisesUnitOrServiceProjectType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -27,6 +28,14 @@ public interface OpenApiMapper {
List<SelectNodeVo<Long>> getEnterprisesUnit(@Param("code") String code,
@Param("level") Integer level);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(@Param("enterprisesUnitId") Long enterprisesUnitId);
/**
* 保安单位使用情况统计
*

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.PoliceUnit;
import org.apache.ibatis.annotations.Mapper;
/**
* police_unit (公安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface PoliceUnitMapper extends BaseMapper<PoliceUnit> {
}

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.SecurityUnit;
import org.apache.ibatis.annotations.Mapper;
/**
* security_unit (保安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface SecurityUnitMapper extends BaseMapper<SecurityUnit> {
}

View File

@ -1,10 +1,10 @@
package com.changhu.module.miniProgram.mapper;
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.pojo.entity.SecurityUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@ -0,0 +1,27 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.pojo.entity.ServiceProject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* service_project (服务项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
/**
* 获取服务项目
*
* @return 服务项目列表
*/
List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId,
@Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId);
}

View File

@ -1,39 +0,0 @@
package com.changhu.module.assessmentCriteria.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.assessmentCriteria.pojo.entity.CkProject;
import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ck_project (考核项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface CkProjectMapper extends BaseMapper<CkProject> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 分页数据
*/
Page<CkProjectPagerVo> pager(@Param("page") Page<CkProjectPagerVo> page,
@Param("params") CkProjectPagerQueryParams params);
/**
* 考核项目详情
*
* @param ckProjectId 考核项目id
* @return 详情
*/
List<CkProjectDetailTableVo> ckProjectDetail(@Param("ckProjectId") Long ckProjectId);
}

View File

@ -1,35 +0,0 @@
package com.changhu.module.assessmentCriteria.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord;
import com.changhu.module.assessmentCriteria.pojo.queryParams.AssessmentRecordPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordDetailVo;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* ck_assessment_record (考核记录) 服务类
* author: luozhun
* desc 由groovy脚本自动生成
*/
public interface CkAssessmentRecordService extends IService<CkAssessmentRecord> {
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<AssessmentRecordPagerVo> pager(PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> queryParams);
/**
* 扣分详情
*
* @param assessmentRecordId 考核记录id
* @return 结果
*/
List<AssessmentRecordDetailVo> deductedDetail(Long assessmentRecordId);
}

View File

@ -1,51 +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.db.enums.UserType;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import com.changhu.module.management.service.PoliceService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author 20252
* @createTime 2024/9/11 上午9:39
* @desc PoliceController...
*/
@Tag(name = "后台-公安")
@JsonBody
@RequestMapping("/management/police")
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
public class PoliceController {
@Autowired
private PoliceService policeService;
@Operation(summary = "新增或保存后台用户")
@PostMapping("/user/saveOrUpdate")
public void userSaveOrUpdate(@RequestBody @Valid ManagementPoliceUserSaveOrUpdateParams params) {
policeService.userSaveOrUpdate(params);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/user/pager")
public Page<ManagementPoliceUnitUserPagerVo> userPager(@RequestBody PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams) {
return policeService.userPager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/user/deleteById")
public void userDeleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) {
policeService.userDeleteById(managementPoliceUnitUserId);
}
}

View File

@ -1,59 +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.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import com.changhu.module.management.service.SecurityService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/11 上午9:39
* @desc SecurityController...
*/
@Tag(name = "后台-保安")
@JsonBody
@RequestMapping("/management/security")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public class SecurityController {
@Autowired
private SecurityService securityService;
@Operation(summary = "新增或修改后台用户")
@PostMapping("/user/saveOrUpdate")
public void userSaveOrUpdate(@RequestBody @Valid ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
securityService.userSaveOrUpdate(saveOrUpdateParams);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/user/pager")
public Page<ManagementSecurityUnitUserPagerVo> userPager(@RequestBody PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams) {
return securityService.userPager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/user/deleteById")
public void userDeleteById(@RequestParam @Schema(description = "后台保安用户id") Long managementSecurityUnitUserId) {
securityService.userDeleteById(managementSecurityUnitUserId);
}
@Operation(summary = "查询单位下的项目经理")
@GetMapping("/listProjectManager")
public List<SelectNodeVo<Long>> listProjectManager() {
return securityService.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.db.enums.UserType;
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import com.changhu.module.management.service.SuperService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
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/11 上午9:38
* @desc ManagementSuperController...
*/
@Tag(name = "超级后台")
@JsonBody
@RequestMapping("/management/super")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
public class SuperController {
@Autowired
private SuperService superService;
@Operation(summary = "新增或保存后台用户")
@PostMapping("/saveOrUpdateUser")
public void saveOrUpdateUser(@RequestBody @Valid ManagementSuperUserSaveOrUpdateParams params) {
superService.saveOrUpdateUser(params);
}
@Operation(summary = "公安单位分页查询")
@PostMapping("/policeUnit/pager")
public Page<PoliceUnitPagerVo> policeUnitPager(@RequestBody PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) {
return superService.policeUnitPager(queryParams);
}
@Operation(summary = "保安单位分页查询")
@PostMapping("/securityUnit/pager")
public Page<SecurityUnitPagerVo> securityUnitPager(@RequestBody PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
return superService.securityUnitPager(queryParams);
}
}

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.ManagementPoliceUnitUser;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* management_police_user (后台-公安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementPoliceUnitUserMapper extends BaseMapper<ManagementPoliceUnitUser> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<ManagementPoliceUnitUserPagerVo> pager(@Param("page") Page<ManagementPoliceUnitUserPagerVo> page,
@Param("params") ManagementPoliceUnitUserPagerQueryParams 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.ManagementSecurityUnitUser;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* management_security_unit_user (后台-保安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementSecurityUnitUserMapper extends BaseMapper<ManagementSecurityUnitUser> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<ManagementSecurityUnitUserPagerVo> pager(@Param("page") Page<ManagementSecurityUnitUserPagerVo> page,
@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.PoliceUnit;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* police_unit (公安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface PoliceUnitMapper extends BaseMapper<PoliceUnit> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<PoliceUnitPagerVo> pager(@Param("page") Page<PoliceUnitPagerVo> page,
@Param("params") PoliceUnitPagerQueryParams 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.SecurityUnit;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* security_unit (保安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface SecurityUnitMapper extends BaseMapper<SecurityUnit> {
/**
* 分页查询
*
* @param page 分页对象
* @param params 查询参数
* @return 结果
*/
Page<SecurityUnitPagerVo> pager(@Param("page") Page<SecurityUnitPagerVo> page,
@Param("params") SecurityUnitPagerQueryParams params);
}

View File

@ -1,48 +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 com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.pojo.dto.ServiceProjectDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 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);
/**
* 获取服务项目
*
* @return 服务项目列表
*/
List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId,
@Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(@Param("enterprisesUnitId") Long enterprisesUnitId);
}

View File

@ -1,63 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;
import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/9/2 上午9:49
* @desc IndexService...
*/
public interface ManagementService {
/**
* 审核通过
*
* @param params 审核参数
*/
void checkPass(IndexCheckPassParams params);
/**
* 获取审核状态
*
* @param params 参数
* @return 结果
*/
UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params);
/**
* 启用或者禁用单位
*
* @param params 参数
*/
void disableOrEnable(IndexDisableOrEnableParams params);
/**
* 查询单位下的小程序用户
*
* @param queryParams 查询参数
* @return 结果
*/
Page<UnitMiniProgramUserPagerVo> miniProgramUserPager(PageParams<UnitMiniProgramUserPagerQueryParams, UnitMiniProgramUserPagerVo> queryParams);
/**
* 审核通过小程序用户
*
* @param params 参数
*/
void passMiniProgramUser(IndexDisableOrEnableParams params);
/**
* 禁用或启用小程序用户
*
* @param params 参数
*/
void disableOrEnableMiniProgramUser(IndexDisableOrEnableParams params);
}

View File

@ -1,37 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/9/11 上午9:59
* @desc MPoliceService...
*/
public interface PoliceService {
/**
* 新增或保存后台用户
*
* @param params 参数
*/
void userSaveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params);
/**
* 后台用户分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<ManagementPoliceUnitUserPagerVo> userPager(PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams);
/**
* 根据id删除后台用户
*
* @param managementPoliceUnitUserId 后台用户id
*/
void userDeleteById(Long managementPoliceUnitUserId);
}

View File

@ -1,46 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/11 上午10:17
* @desc SecurityService...
*/
public interface SecurityService {
/**
* 新增或修改后台用户
*
* @param saveOrUpdateParams 参数
*/
void userSaveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams);
/**
* 分页查询后台用户
*
* @param queryParams 分页查询后台用户
* @return 结果
*/
Page<ManagementSecurityUnitUserPagerVo> userPager(PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams);
/**
* 根据id删除后台用户
*
* @param managementSecurityUnitUserId 用户id
*/
void userDeleteById(Long managementSecurityUnitUserId);
/**
* 查询单位下的项目经理
*
* @return 项目经理
*/
List<SelectNodeVo<Long>> listProjectManager();
}

View File

@ -1,43 +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.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* 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);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId);
}

View File

@ -1,40 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.apache.ibatis.annotations.Param;
/**
* @author 20252
* @createTime 2024/9/11 上午9:52
* @desc SuperService...
*/
public interface SuperService {
/**
* 新增或保存后台用户
*
* @param params 参数
*/
void saveOrUpdateUser(ManagementSuperUserSaveOrUpdateParams params);
/**
* 公安单位分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<PoliceUnitPagerVo> policeUnitPager(@Param("queryParams") PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams);
/**
* 保安单位分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<SecurityUnitPagerVo> securityUnitPager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams);
}

View File

@ -1,47 +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.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 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();
}
}
@Override
public List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId) {
return baseMapper.getServiceProjectByEnterprisesUnitId(enterprisesUnitId);
}
}

View File

@ -1,49 +0,0 @@
package com.changhu.module.miniProgram.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
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);
}
@Operation(summary = "二维码表单录入保安人员")
@PostMapping("/qrCodeFormInputSecurityUser")
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
miniProgramUserService.qrCodeFormInputSecurityUser(params);
}
@Operation(summary = "服务项目保安人员分页")
@PostMapping("/securityUserPager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return miniProgramUserService.securityUserPager(queryParams);
}
}

View File

@ -6,12 +6,13 @@ import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.MPoliceService;
import com.changhu.module.miniProgram.service.PoliceIndexService;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -20,13 +21,14 @@ import java.util.List;
* @createTime 2024/9/11 上午10:44
* @desc PoliceIndexController...
*/
@Tag(name = "公安人员首页")
@Tag(name = "微信小程序-首页-公安")
@JsonBody
@RequestMapping("/policeIndex")
@RestController
public class PoliceIndexController {
@Autowired
private MPoliceService policeIndexService;
private PoliceIndexService policeIndexService;
@Operation(summary = "首页数据统计")
@GetMapping("/dataStatistics")

View File

@ -3,17 +3,14 @@ package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -22,38 +19,20 @@ import java.util.List;
* @createTime 2024/9/10 下午3:48
* @desc 项目经理首页控制器
*/
@Tag(name = "项目经理首页")
@Tag(name = "微信小程序-首页-项目经理")
@JsonBody
@RequestMapping("/projectManageIndex")
@RequestMapping("/mp/pmi")
@RestController
public class ProjectManageIndexController {
@Autowired
private ProjectManageIndexService projectManageIndexService;
@Operation(summary = "获取我的服务项目")
@GetMapping("/getMyServiceProject")
@GetMapping("/get_my_sp")
@CheckUserType(userTypes = UserType.MINI_PROGRAM_PROJECT_MANAGE)
public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return projectManageIndexService.getMyServiceProjectList();
}
@Operation(summary = "根据id删除保安人员")
@DeleteMapping("/deleteSecurityUserByServiceProjectId")
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
projectManageIndexService.deleteSecurityUserByServiceProjectId(securityUserId);
}
@Operation(summary = "保存或更新保安人员")
@PostMapping("/saveOrUpdateSecurityUser")
public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params);
}
@JsonBody(value = false)
@Operation(summary = "获取表单分享二维码")
@GetMapping(value = "/shareForm_QR_Code")
public ResponseEntity<Resource> shareForm_QR_Code(@Schema(description = "要生成的路径") @RequestParam String path,
@Schema(description = "生成二维码的宽度") @RequestParam(defaultValue = "430") Integer width) {
return projectManageIndexService.shareForm_QR_Code(path, width);
}
}

View File

@ -0,0 +1,51 @@
package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.miniProgram.pojo.params.AssessmentRecordParams;
import com.changhu.module.miniProgram.pojo.vo.AssessmentCriteriaRuleVo;
import com.changhu.module.miniProgram.service.SupervisionAssessmentService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/22 下午2:47
* @desc SupervisionAssessmentController...
*/
@Tag(name = "微信小程序-监督考核")
@JsonBody
@RequestMapping("/mp/sa")
@CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE)
@RestController
public class SupervisionAssessmentController {
@Autowired
private SupervisionAssessmentService supervisionAssessmentService;
@Operation(summary = "根据类型获取考核项目列表")
@GetMapping("/ckProjectListByType")
public List<SelectNodeVo<Long>> ckProjectListByType(@RequestParam EnterprisesUnitType type) {
return supervisionAssessmentService.assessmentCriteriaListByType(type);
}
@Operation(summary = "根据考核项目获取考核规则")
@GetMapping("/assessmentCriteriaRulesByCkProjectId")
public List<AssessmentCriteriaRuleVo> assessmentCriteriaRulesByCkProjectId(@RequestParam Long ckProjectId) {
return supervisionAssessmentService.assessmentCriteriaRulesByCkProjectId(ckProjectId);
}
@Operation(summary = "提交考核记录")
@PostMapping("/submitAssessmentRecord")
public void submitAssessmentRecord(@Validated @RequestBody AssessmentRecordParams params) {
supervisionAssessmentService.submitAssessmentRecord(params);
}
}

View File

@ -0,0 +1,64 @@
package com.changhu.module.miniProgram.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.UserService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author 20252
* @createTime 2024/9/6 上午10:42
* @desc UserController...
*/
@Tag(name = "微信小程序-用户相关")
@JsonBody
@RequestMapping("/mp/user")
@RestController("miniProgramUserController")
public class UserController {
@Autowired
private UserService userService;
@Operation(summary = "注册小程序用户")
@PostMapping("/register")
@IsWhiteList
public void register(@RequestBody @Valid UserRegisterParams params) {
userService.register(params);
}
@Operation(summary = "保存或更新保安人员")
@PostMapping("/add_security_user_upd")
public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
userService.saveOrUpdateSecurityUser(params);
}
@Operation(summary = "根据id删除保安人员")
@DeleteMapping("/del_security_user_id")
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
userService.deleteSecurityUserByServiceProjectId(securityUserId);
}
@Operation(summary = "二维码表单录入保安人员")
@PostMapping("/qrCodeFormInputSecurityUser")
@IsWhiteList
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
userService.qrCodeFormInputSecurityUser(params);
}
@Operation(summary = "服务项目保安人员分页")
@PostMapping("/securityUserPager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return userService.securityUserPager(queryParams);
}
}

View File

@ -1,31 +0,0 @@
package com.changhu.module.miniProgram.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* mini_program_user (小程序用户) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface MiniProgramUserMapper extends BaseMapper<MiniProgramUser> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @param identity 用户身份
* @return 结果
*/
Page<UnitMiniProgramUserPagerVo> pager(@Param("page") Page<UnitMiniProgramUserPagerVo> page,
@Param("params") UnitMiniProgramUserPagerQueryParams params,
@Param("identity") MiniProgramUserIdentity identity);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.assessmentCriteria.pojo.params;
package com.changhu.module.miniProgram.pojo.params;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;

View File

@ -10,10 +10,10 @@ import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/6 上午10:47
* @desc MiniProgramUserRegisterParams...
* @desc UserRegisterParams...
*/
@Data
public class MiniProgramUserRegisterParams {
public class UserRegisterParams {
@Schema(description = "微信code")
@NotBlank(message = "code不能为空")
private String code;

View File

@ -1,4 +1,4 @@
package com.changhu.module.assessmentCriteria.pojo.vo;
package com.changhu.module.miniProgram.pojo.vo;
import com.changhu.common.db.enums.SelectType;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -3,7 +3,7 @@ package com.changhu.module.miniProgram.pojo.vo;
import cn.hutool.core.lang.Dict;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.db.enums.ServiceProjectType;
import com.changhu.module.management.pojo.model.ContactPersonInfo;
import com.changhu.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -11,7 +11,7 @@ import java.util.List;
* @createTime 2024/9/11 上午10:52
* @desc MPoliceService...
*/
public interface MPoliceService {
public interface PoliceIndexService {
/**
* 首页数据统计

View File

@ -1,9 +1,6 @@
package com.changhu.module.miniProgram.service;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import java.util.List;
@ -20,22 +17,4 @@ public interface ProjectManageIndexService {
*/
List<IndexServiceProjectListVo> getMyServiceProjectList();
/**
* 根据id删除保安人员
*
* @param securityUserId 保安人员id
*/
void deleteSecurityUserByServiceProjectId(Long securityUserId);
/**
* 保存或更新保安人员
*
* @param params 保安人员参数
*/
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
/**
* 分享表单录入的二维码
*/
ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width);
}

View File

@ -0,0 +1,38 @@
package com.changhu.module.miniProgram.service;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.miniProgram.pojo.params.AssessmentRecordParams;
import com.changhu.module.miniProgram.pojo.vo.AssessmentCriteriaRuleVo;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/22 下午2:48
* @desc SupervisionAssessmentService...
*/
public interface SupervisionAssessmentService {
/**
* 根据类型获取考核标准列表
*
* @param type 类型
* @return 结果
*/
List<SelectNodeVo<Long>> assessmentCriteriaListByType(EnterprisesUnitType type);
/**
* 根据考核项目获取考核规则
*
* @param ckProjectId 考核项目id
* @return 结果
*/
List<AssessmentCriteriaRuleVo> assessmentCriteriaRulesByCkProjectId(Long ckProjectId);
/**
* 提交考核记录
*
* @param params 参数
*/
void submitAssessmentRecord(AssessmentRecordParams params);
}

View File

@ -1,27 +1,38 @@
package com.changhu.module.miniProgram.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* mini_program_user (小程序用户) 服务类
* author: luozhun
* desc 由groovy脚本自动生成
* @author 20252
* @createTime 2024/11/22 下午4:14
* @desc UserService...
*/
public interface MiniProgramUserService extends IService<MiniProgramUser> {
public interface UserService {
/**
* 注册
*
* @param params 参数
*/
void register(MiniProgramUserRegisterParams params);
void register(UserRegisterParams params);
/**
* 保存或更新保安人员
*
* @param params 保安人员参数
*/
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
/**
* 根据id删除保安人员
*
* @param securityUserId 保安人员id
*/
void deleteSecurityUserByServiceProjectId(Long securityUserId);
/**
* 服务项目内的保安人员分页

View File

@ -1,73 +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.plugins.pagination.Page;
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.mapper.SecurityUserMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
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;
@Autowired
private SecurityUserMapper securityUserMapper;
@Autowired
private ProjectManageIndexService projectManageIndexService;
@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("该用户已存在,请勿重复注册!");
}
long userId = SnowFlakeIdUtil.snowflakeId();
miniProgramUser.setSnowFlakeId(userId);
boolean save = this.save(miniProgramUser);
if (!save) {
throw new MessageException();
}
}
@Override
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params);
}
}

View File

@ -5,13 +5,13 @@ import cn.hutool.core.lang.func.LambdaUtil;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.ServiceProjectMapper;
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.mapper.ServiceProjectMapper;
import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.MPoliceService;
import com.changhu.module.miniProgram.service.PoliceIndexService;
import com.changhu.pojo.entity.EnterprisesUnit;
import com.changhu.pojo.entity.SecurityUser;
import com.changhu.pojo.entity.ServiceProject;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,7 +24,7 @@ import java.util.List;
* @desc MPoliceServiceImpl...
*/
@Service
public class MPoliceServiceImpl implements MPoliceService {
public class PoliceIndexServiceImpl implements PoliceIndexService {
@Autowired
private ServiceProjectMapper serviceProjectMapper;

View File

@ -1,27 +1,13 @@
package com.changhu.module.miniProgram.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.ServiceProjectMapper;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.mapper.ServiceProjectMapper;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.List;
/**
@ -36,66 +22,9 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
@Autowired
private ServiceProjectMapper serviceProjectMapper;
@Autowired
private WxMaService wxMaService;
@Override
public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId());
}
@Override
public void deleteSecurityUserByServiceProjectId(Long securityUserId) {
boolean b = Db.removeById(securityUserId, SecurityUser.class);
if (!b) {
throw new MessageException();
}
}
@Override
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
//新增的情况
Long snowFlakeId = securityUser.getSnowFlakeId();
if (snowFlakeId == null) {
//判断是否已经存在
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
} else {
//如果修改了身份证 需要查重
SecurityUser byId = Db.getById(snowFlakeId, SecurityUser.class);
if (!securityUser.getIdCard().equals(byId.getIdCard())) {
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
}
}
boolean b = Db.saveOrUpdate(securityUser);
if (!b) {
throw new MessageException();
}
}
@Override
public ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width) {
WxMaQrcodeService qrcodeService = wxMaService.getQrcodeService();
try {
File qrcodeFile = qrcodeService.createQrcode(path, width);
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + qrcodeFile.getName())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileSystemResource(qrcodeFile));
} catch (WxErrorException e) {
throw new MessageException("生成表单二维码失败:{}", e.getMessage());
}
}
}

View File

@ -1,26 +1,18 @@
package com.changhu.module.assessmentCriteria.service.impl;
package com.changhu.module.miniProgram.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
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.toolkit.Db;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.SnowFlakeIdUtil;
import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.*;
import com.changhu.module.assessmentCriteria.pojo.params.*;
import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo;
import com.changhu.module.assessmentCriteria.service.AssessmentCriteriaService;
import com.changhu.module.miniProgram.pojo.params.AssessmentRecordParams;
import com.changhu.module.miniProgram.pojo.vo.AssessmentCriteriaRuleVo;
import com.changhu.module.miniProgram.service.SupervisionAssessmentService;
import com.changhu.pojo.entity.*;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -30,14 +22,11 @@ import java.util.stream.Collectors;
/**
* @author 20252
* @createTime 2024/11/6 上午10:08
* @desc AssessmentCriteriaServiceImpl...
* @createTime 2024/11/22 下午2:48
* @desc SupervisionAssessmentServiceImpl...
*/
@Service
public class AssessmentCriteriaServiceImpl implements AssessmentCriteriaService {
@Autowired
private CkProjectMapper ckProjectMapper;
public class SupervisionAssessmentServiceImpl implements SupervisionAssessmentService {
@Override
public List<SelectNodeVo<Long>> assessmentCriteriaListByType(EnterprisesUnitType type) {
@ -119,61 +108,6 @@ public class AssessmentCriteriaServiceImpl implements AssessmentCriteriaService
return groupList;
}
@Override
public Page<CkProjectPagerVo> ckProjectPagerVoPager(PageParams<CkProjectPagerQueryParams, CkProjectPagerVo> queryParams) {
return ckProjectMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkProject(CkProjectSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkProject.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteCkProjectById(Long ckProjectId) {
boolean b = Db.removeById(ckProjectId, CkProject.class);
if (!b) {
throw new MessageException();
}
}
@Override
public List<CkProjectDetailTableVo> ckProjectDetail(Long ckProjectId) {
return ckProjectMapper.ckProjectDetail(ckProjectId);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkGroup(CkGroupSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkGroup.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkItem(CkItemSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkItem.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkStandard(CkStandardSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkStandard.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void submitAssessmentRecord(AssessmentRecordParams params) {

View File

@ -0,0 +1,112 @@
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.SnowFlakeIdUtil;
import com.changhu.mapper.SecurityUserMapper;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.module.miniProgram.service.UserService;
import com.changhu.pojo.entity.MiniProgramUser;
import com.changhu.pojo.entity.SecurityUser;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author 20252
* @createTime 2024/11/22 下午4:14
* @desc UserServiceImpl...
*/
@Service("miniProgramUserService")
public class UserServiceImpl implements UserService {
@Autowired
private WxMaService wxMaService;
@Autowired
private SecurityUserMapper securityUserMapper;
@Autowired
private ProjectManageIndexService projectManageIndexService;
@Override
public void register(UserRegisterParams 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 = Db.lambdaQuery(MiniProgramUser.class).eq(MiniProgramUser::getOpenId, miniProgramUser.getOpenId()).exists();
if (exists) {
throw new MessageException("该用户已存在,请勿重复注册!");
}
long userId = SnowFlakeIdUtil.snowflakeId();
miniProgramUser.setSnowFlakeId(userId);
boolean save = Db.save(miniProgramUser);
if (!save) {
throw new MessageException();
}
}
@Override
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) {
this.saveOrUpdateSecurityUser(params);
}
@Override
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
//新增的情况
Long snowFlakeId = securityUser.getSnowFlakeId();
if (snowFlakeId == null) {
//判断是否已经存在
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
} else {
//如果修改了身份证 需要查重
SecurityUser byId = Db.getById(snowFlakeId, SecurityUser.class);
if (!securityUser.getIdCard().equals(byId.getIdCard())) {
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
}
}
boolean b = Db.saveOrUpdate(securityUser);
if (!b) {
throw new MessageException();
}
}
@Override
public void deleteSecurityUserByServiceProjectId(Long securityUserId) {
boolean b = Db.removeById(securityUserId, SecurityUser.class);
if (!b) {
throw new MessageException();
}
}
}

View File

@ -0,0 +1,51 @@
package com.changhu.module.policeManagement.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.db.enums.UserType;
import com.changhu.module.policeManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import com.changhu.module.policeManagement.service.UserService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author 20252
* @createTime 2024/11/22 上午9:26
* @desc UserController...
*/
@Tag(name = "公安后台-用户管理")
@JsonBody
@RequestMapping("/m2/user")
@RestController("policeUserManagement")
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
public class UserController {
@Autowired
private UserService userService;
@Operation(summary = "新增或保存后台用户")
@PostMapping("/add_upd")
public void userSaveOrUpdate(@RequestBody @Valid UserSaveOrUpdateParams params) {
userService.saveOrUpdate(params);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/pager")
public Page<UserPagerVo> userPager(@RequestBody PageParams<UserPagerQueryParams, UserPagerVo> queryParams) {
return userService.pager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/del_id")
public void userDeleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) {
userService.deleteById(managementPoliceUnitUserId);
}
}

View File

@ -0,0 +1,27 @@
package com.changhu.module.policeManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author 20252
* @createTime 2024/11/22 上午9:34
* @desc UserMapper...
*/
@Mapper
@Repository("policeManagementUserMapper")
public interface UserMapper {
/**
* 分页查询用户
*
* @param page 分页参数
* @param params 查询参数
* @return 用户
*/
Page<UserPagerVo> pager(@Param("page") Page<UserPagerVo> page,
@Param("params") UserPagerQueryParams params);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.params;
package com.changhu.module.policeManagement.pojo.params;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.Sex;
@ -11,10 +11,10 @@ import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/4 下午3:04
* @desc ManagementPoliceUserSaveOrUpdateParams...
* @desc UserSaveOrUpdateParams...
*/
@Data
public class ManagementPoliceUserSaveOrUpdateParams {
public class UserSaveOrUpdateParams {
@Schema(description = "id")
private Long snowFlakeId;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.queryParams;
package com.changhu.module.policeManagement.pojo.queryParams;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.Sex;
@ -8,10 +8,10 @@ import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/4 下午3:22
* @desc ManagementPoliceUnitUserPagerQueryParams...
* @desc UserPagerQueryParams...
*/
@Data
public class ManagementPoliceUnitUserPagerQueryParams {
public class UserPagerQueryParams {
@Schema(description = "名字")
private String name;
@Schema(description = "手机号")

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.vo;
package com.changhu.module.policeManagement.pojo.vo;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.IsOrNot;
@ -11,10 +11,10 @@ import java.time.LocalDateTime;
/**
* @author 20252
* @createTime 2024/9/3 上午10:59
* @desc ManagementSecurityUnitUserPagerVo...
* @desc UserPagerVo...
*/
@Data
public class ManagementPoliceUnitUserPagerVo {
public class UserPagerVo {
@Schema(description = "id")
private Long snowFlakeId;

View File

@ -0,0 +1,36 @@
package com.changhu.module.policeManagement.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.policeManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/11/22 上午9:30
* @desc UserService...
*/
public interface UserService {
/**
* 新增或保存用户
*
* @param params 参数
*/
void saveOrUpdate(UserSaveOrUpdateParams params);
/**
* 分页查询用户
*
* @param queryParams 查询参数
* @return 结果
*/
Page<UserPagerVo> pager(PageParams<UserPagerQueryParams, UserPagerVo> queryParams);
/**
* 根据id删除用户
*
* @param managementPoliceUnitUserId 公安单位用户id
*/
void deleteById(Long managementPoliceUnitUserId);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.service.impl;
package com.changhu.module.policeManagement.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.RandomUtil;
@ -8,13 +8,12 @@ import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.EnterprisesUnitMapper;
import com.changhu.module.management.mapper.ManagementPoliceUnitUserMapper;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import com.changhu.module.management.service.PoliceService;
import com.changhu.module.policeManagement.mapper.UserMapper;
import com.changhu.module.policeManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import com.changhu.module.policeManagement.service.UserService;
import com.changhu.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,21 +24,18 @@ import java.util.List;
/**
* @author 20252
* @createTime 2024/9/11 上午9:59
* @desc MPoliceServiceImpl...
* @createTime 2024/11/22 上午9:30
* @desc UserServiceImpl...
*/
@Service
public class PoliceServiceImpl implements PoliceService {
@Service("policeManagementUserService")
public class UserServiceImpl implements UserService {
@Autowired
private ManagementPoliceUnitUserMapper managementPoliceUnitUserMapper;
@Autowired
private EnterprisesUnitMapper enterprisesUnitMapper;
private UserMapper userMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public void userSaveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params) {
public void saveOrUpdate(UserSaveOrUpdateParams params) {
//查看手机号是否存在
boolean exists = Db.lambdaQuery(ManagementPoliceUnitUser.class)
.ne(params.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, params.getSnowFlakeId())
@ -70,12 +66,12 @@ public class PoliceServiceImpl implements PoliceService {
}
@Override
public Page<ManagementPoliceUnitUserPagerVo> userPager(PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams) {
return managementPoliceUnitUserMapper.pager(queryParams.getPage(), queryParams.getParams());
public Page<UserPagerVo> pager(PageParams<UserPagerQueryParams, UserPagerVo> queryParams) {
return userMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void userDeleteById(Long managementPoliceUnitUserId) {
public void deleteById(Long managementPoliceUnitUserId) {
Long unitId = UserUtil.getUnitId();
Long l = Db.lambdaQuery(ManagementPoliceUnitUser.class)
.eq(BaseEntity::getSnowFlakeId, managementPoliceUnitUserId)
@ -90,5 +86,4 @@ public class PoliceServiceImpl implements PoliceService {
throw new MessageException();
}
}
}

View File

@ -0,0 +1,55 @@
package com.changhu.module.securityManagement.controller;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.func.LambdaUtil;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil;
import com.changhu.pojo.entity.MiniProgramUser;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/22 上午10:16
* @desc SecurityController...
*/
@Tag(name = "保安后台-通用接口")
@JsonBody
@RequestMapping("/m3")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
@RestController
public class SecurityController {
@Operation(summary = "查询单位下的项目经理")
@GetMapping("/list_p_m")
public List<SelectNodeVo<Long>> listProjectManager() {
String tel = LambdaUtil.getFieldName(MiniProgramUser::getTelephone);
String sex = LambdaUtil.getFieldName(MiniProgramUser::getSex);
return Db.lambdaQuery(MiniProgramUser.class)
.eq(MiniProgramUser::getIsEnable, IsEnable.TRUE)
.eq(MiniProgramUser::getIdentity, MiniProgramUserIdentity.PROJECT_MANAGER)
.eq(MiniProgramUser::getUnitId, UserUtil.getUnitId())
.list()
.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,14 +1,16 @@
package com.changhu.module.management.controller;
package com.changhu.module.securityManagement.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException;
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.module.securityManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.securityManagement.service.Service_ProjectService;
import com.changhu.pojo.entity.ServiceProject;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -17,34 +19,35 @@ import org.springframework.web.bind.annotation.*;
/**
* @author 20252
* @createTime 2024/9/5 上午11:09
* @createTime 2024/11/22 上午10:19
* @desc ServiceProjectController...
*/
@Tag(name = "服务项目")
@Tag(name = "保安后台-服务项目管理")
@JsonBody
@RequestMapping("/serviceProject")
@RequestMapping("/m3/sp")
@RestController("securityServiceProjectManagement")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public class ServiceProjectController {
@Autowired
private ServiceProjectService serviceProjectService;
private Service_ProjectService service_projectService;
@Operation(summary = "分页查询")
@PostMapping("/pager")
public Page<ServiceProjectPagerVo> pager(@RequestBody PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
return serviceProjectService.pager(queryParams);
return service_projectService.pager(queryParams);
}
@Operation(summary = "新增或者保存")
@PostMapping("/saveOrUpdate")
@PostMapping("/add_upd")
public void saveOrUpdate(@RequestBody ServiceProjectSaveOrUpdateParams params) {
serviceProjectService.saveOrUpdate(params);
service_projectService.saveOrUpdate(params);
}
@Operation(summary = "根据id删除")
@DeleteMapping("/deleteById")
@DeleteMapping("/del_id")
public void deleteById(@RequestParam Long serviceProjectId) {
boolean b = serviceProjectService.removeById(serviceProjectId);
boolean b = Db.removeById(serviceProjectId, ServiceProject.class);
if (!b) {
throw new MessageException();
}

View File

@ -0,0 +1,52 @@
package com.changhu.module.securityManagement.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.db.enums.UserType;
import com.changhu.module.securityManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.UserPagerVo;
import com.changhu.module.securityManagement.service.UserService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author 20252
* @createTime 2024/11/22 上午9:46
* @desc UserController...
*/
@Tag(name = "保安后台-用户管理")
@JsonBody
@RequestMapping("/m3/user")
@RestController("securityUserManagement")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public class UserController {
@Autowired
private UserService userService;
@Operation(summary = "新增或修改后台用户")
@PostMapping("/add_upd")
public void userSaveOrUpdate(@RequestBody @Valid UserSaveOrUpdateParams saveOrUpdateParams) {
userService.saveOrUpdate(saveOrUpdateParams);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/pager")
public Page<UserPagerVo> userPager(@RequestBody PageParams<UserPagerQueryParams, UserPagerVo> queryParams) {
return userService.pager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/del_id")
public void userDeleteById(@RequestParam @Schema(description = "后台保安用户id") Long managementSecurityUnitUserId) {
userService.deleteById(managementSecurityUnitUserId);
}
}

View File

@ -0,0 +1,23 @@
package com.changhu.module.securityManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 20252
* @createTime 2024/11/22 上午10:25
* @desc Service_ProjectMapper...
*/
@Mapper
public interface Service_ProjectMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(Page<ServiceProjectPagerVo> page, ServiceProjectPagerQueryParams params);
}

View File

@ -0,0 +1,27 @@
package com.changhu.module.securityManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.UserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author 20252
* @createTime 2024/11/22 上午9:53
* @desc UserMapper...
*/
@Mapper
@Repository("securityManagementUserMapper")
public interface UserMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<UserPagerVo> pager(@Param("page") Page<UserPagerVo> page,
@Param("params") UserPagerQueryParams params);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.params;
package com.changhu.module.securityManagement.pojo.params;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectTwoType;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.params;
package com.changhu.module.securityManagement.pojo.params;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.Sex;
@ -11,10 +11,10 @@ import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/3 上午10:26
* @desc ManagementSecurityUnitUserSaveOrUpdateParams...
* @desc UserSaveOrUpdateParams...
*/
@Data
public class ManagementSecurityUnitUserSaveOrUpdateParams {
public class UserSaveOrUpdateParams {
@Schema(description = "id")
private Long snowFlakeId;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.queryParams;
package com.changhu.module.securityManagement.pojo.queryParams;
import com.changhu.common.db.enums.ServiceProjectType;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.queryParams;
package com.changhu.module.securityManagement.pojo.queryParams;
import com.changhu.common.db.enums.Sex;
import io.swagger.v3.oas.annotations.media.Schema;
@ -7,10 +7,10 @@ import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/3 上午11:02
* @desc ManagementSecurityUnitUserPagerQueryParams...
* @desc UserPagerQueryParams...
*/
@Data
public class ManagementSecurityUnitUserPagerQueryParams {
public class UserPagerQueryParams {
@Schema(description = "名字")
private String name;
@Schema(description = "手机号")

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.vo;
package com.changhu.module.securityManagement.pojo.vo;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectTwoType;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.vo;
package com.changhu.module.securityManagement.pojo.vo;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.IsOrNot;
@ -11,10 +11,10 @@ import java.time.LocalDateTime;
/**
* @author 20252
* @createTime 2024/9/3 上午10:59
* @desc ManagementSecurityUnitUserPagerVo...
* @desc UserPagerVo...
*/
@Data
public class ManagementSecurityUnitUserPagerVo {
public class UserPagerVo {
@Schema(description = "id")
private Long snowFlakeId;

View File

@ -0,0 +1,29 @@
package com.changhu.module.securityManagement.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/11/22 上午10:21
* @desc Service_ProjectService...
*/
public interface Service_ProjectService {
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams);
/**
* 新增或者保存
*
* @param params 参数
*/
void saveOrUpdate(ServiceProjectSaveOrUpdateParams params);
}

View File

@ -0,0 +1,36 @@
package com.changhu.module.securityManagement.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.UserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/11/22 上午9:49
* @desc UserService...
*/
public interface UserService {
/**
* 新增或修改
*
* @param saveOrUpdateParams 参数
*/
void saveOrUpdate(UserSaveOrUpdateParams saveOrUpdateParams);
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<UserPagerVo> pager(PageParams<UserPagerQueryParams, UserPagerVo> queryParams);
/**
* 根据id删除
*
* @param managementSecurityUnitUserId 用户id
*/
void deleteById(Long managementSecurityUnitUserId);
}

View File

@ -0,0 +1,43 @@
package com.changhu.module.securityManagement.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.securityManagement.mapper.Service_ProjectMapper;
import com.changhu.module.securityManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.securityManagement.service.Service_ProjectService;
import com.changhu.pojo.entity.ServiceProject;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author 20252
* @createTime 2024/11/22 上午10:22
* @desc Service_ProjectServiceImpl...
*/
@Service
public class Service_ProjectServiceImpl implements Service_ProjectService {
@Autowired
private Service_ProjectMapper service_projectMapper;
@Override
public Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
return service_projectMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void saveOrUpdate(ServiceProjectSaveOrUpdateParams params) {
ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class);
serviceProject.setSecurityUnitId(UserUtil.getUnitId());
boolean b = Db.saveOrUpdate(serviceProject);
if (!b) {
throw new MessageException();
}
}
}

View File

@ -1,28 +1,20 @@
package com.changhu.module.management.service.impl;
package com.changhu.module.securityManagement.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.func.LambdaUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.ManagementSecurityUnitUserMapper;
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import com.changhu.module.management.service.SecurityService;
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.securityManagement.mapper.UserMapper;
import com.changhu.module.securityManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.UserPagerVo;
import com.changhu.module.securityManagement.service.UserService;
import com.changhu.pojo.entity.ManagementSecurityUnitUser;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,21 +25,18 @@ import java.util.List;
/**
* @author 20252
* @createTime 2024/9/11 上午10:17
* @desc SecurityServiceImpl...
* @createTime 2024/11/22 上午9:49
* @desc UserServiceImpl...
*/
@Service
public class SecurityServiceImpl implements SecurityService {
@Service("securityManagementUserService")
public class UserServiceImpl implements UserService {
@Autowired
private ManagementSecurityUnitUserMapper managementSecurityUnitUserMapper;
@Autowired
private MiniProgramUserMapper miniProgramUserMapper;
private UserMapper userMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public void userSaveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
public void saveOrUpdate(UserSaveOrUpdateParams saveOrUpdateParams) {
//查看手机号是否已存在
boolean exists = Db.lambdaQuery(ManagementSecurityUnitUser.class)
.ne(saveOrUpdateParams.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, saveOrUpdateParams.getSnowFlakeId())
@ -84,12 +73,12 @@ public class SecurityServiceImpl implements SecurityService {
}
@Override
public Page<ManagementSecurityUnitUserPagerVo> userPager(PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams) {
return managementSecurityUnitUserMapper.pager(queryParams.getPage(), queryParams.getParams());
public Page<UserPagerVo> pager(PageParams<UserPagerQueryParams, UserPagerVo> queryParams) {
return userMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void userDeleteById(Long managementSecurityUnitUserId) {
public void deleteById(Long managementSecurityUnitUserId) {
Long unitId = UserUtil.getUnitId();
Long l = Db.lambdaQuery(ManagementSecurityUnitUser.class)
.eq(BaseEntity::getSnowFlakeId, managementSecurityUnitUserId)
@ -104,24 +93,4 @@ public class SecurityServiceImpl implements SecurityService {
throw new MessageException();
}
}
@Override
public List<SelectNodeVo<Long>> listProjectManager() {
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

@ -1,4 +1,4 @@
package com.changhu.controller;
package com.changhu.module.superManagement.controller;
import cn.hutool.core.annotation.AnnotationUtil;
import cn.hutool.core.lang.Dict;
@ -6,17 +6,15 @@ import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.controller.OpenController;
import com.changhu.module.superManagement.pojo.params.GeneratedAccessKeyParams;
import com.changhu.pojo.entity.AccessKeys;
import com.changhu.pojo.params.GeneratedAccessKeyParams;
import com.changhu.service.AccessKeysService;
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.core.annotation.AnnotatedElementUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.*;
import java.util.Arrays;
import java.util.List;
@ -26,10 +24,11 @@ import java.util.List;
* @createTime 2024/11/19 上午10:38
* @desc AccessKeysController...
*/
@Tag(name = "开放平台")
@RequestMapping("/accessKeys")
@Tag(name = "超级后台-开放平台")
@RequestMapping("/m1/accessKeys")
@JsonBody
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
@RestController
public class AccessKeysController {
@Autowired

View File

@ -1,67 +1,43 @@
package com.changhu.module.assessmentCriteria.controller;
package com.changhu.module.superManagement.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup;
import com.changhu.module.assessmentCriteria.pojo.entity.CkItem;
import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard;
import com.changhu.module.assessmentCriteria.pojo.params.*;
import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo;
import com.changhu.module.assessmentCriteria.service.AssessmentCriteriaService;
import com.changhu.module.superManagement.pojo.params.CkGroupSaveOrUpdateParams;
import com.changhu.module.superManagement.pojo.params.CkItemSaveOrUpdateParams;
import com.changhu.module.superManagement.pojo.params.CkProjectSaveOrUpdateParams;
import com.changhu.module.superManagement.pojo.params.CkStandardSaveOrUpdateParams;
import com.changhu.module.superManagement.pojo.queryParams.CkProjectPagerQueryParams;
import com.changhu.module.superManagement.pojo.vo.CkProjectDetailTableVo;
import com.changhu.module.superManagement.pojo.vo.CkProjectPagerVo;
import com.changhu.module.superManagement.service.AssessmentCriteriaService;
import com.changhu.pojo.entity.CkGroup;
import com.changhu.pojo.entity.CkItem;
import com.changhu.pojo.entity.CkStandard;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/6 上午10:02
* @createTime 2024/11/22 下午2:36
* @desc AssessmentCriteriaController...
*/
@Tag(name = "考核标准")
@Tag(name = "超级后台-考核标准")
@JsonBody
@RequestMapping("/assessmentCriteria")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
@RequestMapping("/m1/ac")
@RestController
public class AssessmentCriteriaController {
@Autowired
private AssessmentCriteriaService assessmentCriteriaService;
@Operation(summary = "根据类型获取考核项目列表")
@GetMapping("/ckProjectListByType")
@CheckUserType(value = false)
public List<SelectNodeVo<Long>> ckProjectListByType(@RequestParam EnterprisesUnitType type) {
return assessmentCriteriaService.assessmentCriteriaListByType(type);
}
@Operation(summary = "根据考核项目获取考核规则")
@GetMapping("/assessmentCriteriaRulesByCkProjectId")
@CheckUserType(value = false)
public List<AssessmentCriteriaRuleVo> assessmentCriteriaRulesByCkProjectId(@RequestParam Long ckProjectId) {
return assessmentCriteriaService.assessmentCriteriaRulesByCkProjectId(ckProjectId);
}
@Operation(summary = "提交考核记录")
@PostMapping("/submitAssessmentRecord")
@CheckUserType(value = false)
public void submitAssessmentRecord(@Validated @RequestBody AssessmentRecordParams params) {
assessmentCriteriaService.submitAssessmentRecord(params);
}
@Operation(summary = "考核项目分页查询")
@PostMapping("/ckProjectPagerVoPager")
public Page<CkProjectPagerVo> ckProjectPagerVoPager(@RequestBody PageParams<CkProjectPagerQueryParams, CkProjectPagerVo> queryParams) {
@ -130,5 +106,4 @@ public class AssessmentCriteriaController {
throw new MessageException();
}
}
}

View File

@ -1,13 +1,13 @@
package com.changhu.module.assessmentCriteria.controller;
package com.changhu.module.superManagement.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.db.enums.UserType;
import com.changhu.module.assessmentCriteria.pojo.queryParams.AssessmentRecordPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordDetailVo;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo;
import com.changhu.module.assessmentCriteria.service.CkAssessmentRecordService;
import com.changhu.module.superManagement.pojo.queryParams.AssessmentRecordPagerQueryParams;
import com.changhu.module.superManagement.pojo.vo.AssessmentRecordDetailVo;
import com.changhu.module.superManagement.pojo.vo.AssessmentRecordPagerVo;
import com.changhu.module.superManagement.service.AssessmentRecordService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -21,24 +21,24 @@ import java.util.List;
* @createTime 2024/11/8 下午3:51
* @desc AssessmentRecordController...
*/
@Tag(name = "考核记录详情")
@Tag(name = "超级后台-考核记录")
@JsonBody
@RequestMapping("/assessmentRecord")
@RequestMapping("/m1/ar")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
@RestController
public class AssessmentRecordController {
@Autowired
private CkAssessmentRecordService assessmentRecordService;
private AssessmentRecordService assessmentRecordService;
@Operation(summary = "考核记录分页")
@PostMapping("/pager")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public Page<AssessmentRecordPagerVo> pager(@RequestBody PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> queryParams) {
return assessmentRecordService.pager(queryParams);
}
@Operation(summary = "扣分详情")
@GetMapping("/deductedDetail")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public List<AssessmentRecordDetailVo> deductedDetail(@RequestParam Long assessmentRecordId) {
return assessmentRecordService.deductedDetail(assessmentRecordId);
}

View File

@ -2,13 +2,15 @@ package com.changhu.module.superManagement.controller;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.superManagement.pojo.vo.EnterprisesUnitServiceProjectSecurityUserTotalVo;
import com.changhu.module.superManagement.service.SuperIndexService;
import com.changhu.pojo.entity.EnterprisesUnit;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -18,17 +20,24 @@ import java.util.List;
* @desc SuperIndexController...
*/
@JsonBody
@Tag(name = "超级后台首页")
@RequestMapping("/super/index")
@Tag(name = "超级后台-首页")
@RequestMapping("/m1/index")
@RestController
public class SuperIndexController {
@Autowired
private SuperIndexService superIndexService;
@Operation(summary = "企事业单位地图点位")
@GetMapping("/mapPoint")
public List<EnterprisesUnit> mapPoint() {
@GetMapping("/points")
public List<EnterprisesUnit> points() {
return Db.lambdaQuery(EnterprisesUnit.class).list();
}
@Operation(summary = "统计事业单位 服务项目及保安人数")
@GetMapping("/statistics")
public EnterprisesUnitServiceProjectSecurityUserTotalVo statistics() {
return superIndexService.statistics();
}
}

View File

@ -0,0 +1,70 @@
package com.changhu.module.superManagement.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.db.enums.UserType;
import com.changhu.module.superManagement.pojo.params.ManagementSuperUserSaveOrUpdateParams;
import com.changhu.module.superManagement.pojo.params.UnitCheckPassParams;
import com.changhu.module.superManagement.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.superManagement.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.superManagement.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.superManagement.pojo.vo.SecurityUnitPagerVo;
import com.changhu.module.superManagement.service.SuperUnitService;
import com.changhu.pojo.params.UnitDisableOrEnableParams;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
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;
import org.springframework.web.bind.annotation.RestController;
/**
* @author 20252
* @createTime 2024/9/11 上午9:38
* @desc ManagementSuperController...
*/
@Tag(name = "超级后台-单位管理")
@JsonBody
@RequestMapping("/m1/unit")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
@RestController
public class SuperUnitController {
@Autowired
private SuperUnitService superUnitService;
@Operation(summary = "新增或保存后台用户")
@PostMapping("/add_upd/user")
public void saveOrUpdateUser(@RequestBody @Valid ManagementSuperUserSaveOrUpdateParams params) {
superUnitService.saveOrUpdateUser(params);
}
@Operation(summary = "公安单位分页查询")
@PostMapping("/police/pager")
public Page<PoliceUnitPagerVo> policeUnitPager(@RequestBody PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) {
return superUnitService.policeUnitPager(queryParams);
}
@Operation(summary = "保安单位分页查询")
@PostMapping("/security/pager")
public Page<SecurityUnitPagerVo> securityUnitPager(@RequestBody PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
return superUnitService.securityUnitPager(queryParams);
}
@Operation(summary = "审核通过")
@PostMapping("/check_pass")
public void checkPass(@RequestBody @Valid UnitCheckPassParams params) {
superUnitService.checkPass(params);
}
@Operation(summary = "启用或禁用状态")
@PostMapping("/disable_enable")
public void disableOrEnable(@RequestBody @Valid UnitDisableOrEnableParams params) {
superUnitService.disableOrEnable(params);
}
}

View File

@ -0,0 +1,36 @@
package com.changhu.module.superManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.superManagement.pojo.queryParams.CkProjectPagerQueryParams;
import com.changhu.module.superManagement.pojo.vo.CkProjectDetailTableVo;
import com.changhu.module.superManagement.pojo.vo.CkProjectPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/22 下午2:42
* @desc AssessmentCriteriaMapper...
*/
@Mapper
public interface AssessmentCriteriaMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 分页数据
*/
Page<CkProjectPagerVo> ckProjectPager(@Param("page") Page<CkProjectPagerVo> page,
@Param("params") CkProjectPagerQueryParams params);
/**
* 考核项目详情
*
* @param ckProjectId 考核项目id
* @return 详情
*/
List<CkProjectDetailTableVo> ckProjectDetail(@Param("ckProjectId") Long ckProjectId);
}

View File

@ -1,21 +1,18 @@
package com.changhu.module.assessmentCriteria.mapper;
package com.changhu.module.superManagement.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord;
import com.changhu.module.assessmentCriteria.pojo.queryParams.AssessmentRecordPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo;
import com.changhu.module.superManagement.pojo.queryParams.AssessmentRecordPagerQueryParams;
import com.changhu.module.superManagement.pojo.vo.AssessmentRecordPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* ck_assessment_record (考核记录) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
* @author 20252
* @createTime 2024/11/22 下午3:05
* @desc AssessmentRecordMapper...
*/
@Mapper
public interface CkAssessmentRecordMapper extends BaseMapper<CkAssessmentRecord> {
public interface AssessmentRecordMapper {
/**
* 分页查询
*

View File

@ -0,0 +1,37 @@
package com.changhu.module.superManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.superManagement.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.superManagement.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.superManagement.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.superManagement.pojo.vo.SecurityUnitPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 20252
* @createTime 2024/11/21 下午3:15
* @desc SuperUnitMapper...
*/
@Mapper
public interface SuperUnitMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<PoliceUnitPagerVo> policeUnitPager(@Param("page") Page<PoliceUnitPagerVo> page,
@Param("params") PoliceUnitPagerQueryParams params);
/**
* 分页查询
*
* @param page 分页对象
* @param params 查询参数
* @return 结果
*/
Page<SecurityUnitPagerVo> securityUnitPager(@Param("page") Page<SecurityUnitPagerVo> page,
@Param("params") SecurityUnitPagerQueryParams params);
}

Some files were not shown because too many files have changed in this diff Show More