微信小程序注册接口
This commit is contained in:
parent
d4240811e8
commit
3b4e770939
|
@ -27,6 +27,7 @@
|
|||
<minio.version>8.4.3</minio.version>
|
||||
<okhttp.version>4.8.1</okhttp.version>
|
||||
<sa.token.version>1.38.0</sa.token.version>
|
||||
<wx.miniapp.version>4.6.0</wx.miniapp.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -200,6 +201,12 @@
|
|||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp.version}</version>
|
||||
</dependency>
|
||||
<!-- 微信小程序开发工具 -->
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-miniapp</artifactId>
|
||||
<version>${wx.miniapp.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.changhu.enums.ClientType;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
|
@ -14,7 +15,7 @@ import java.lang.annotation.*;
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@RestController
|
||||
public @interface CheckClientType {
|
||||
public @interface CheckUserType {
|
||||
|
||||
/**
|
||||
* 是否需要校验客户端类型
|
||||
|
@ -24,5 +25,5 @@ public @interface CheckClientType {
|
|||
/**
|
||||
* 需要的客户端类型
|
||||
*/
|
||||
ClientType clientType() default ClientType.NONE;
|
||||
UserType[] userTypes();
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.changhu.common.annotation;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/6 上午11:13
|
||||
* @desc UserType...
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum UserType {
|
||||
MANAGEMENT_POLICE("公安后台用户"),
|
||||
MANAGEMENT_SECURITY("保安后台用户"),
|
||||
MANAGEMENT_SUPER("超级后台用户"),
|
||||
|
||||
MINI_PROGRAM_POLICE("小程序公安用户"),
|
||||
MINI_PROGRAM_PROJECT_MANAGE("小程序项目经理");
|
||||
|
||||
private final String remark;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.changhu.common.db.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import com.changhu.common.db.BaseEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 上午11:50
|
||||
* @desc MiniProgramUserIdentity...
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum MiniProgramUserIdentity implements BaseEnum<String>, IEnum<String> {
|
||||
|
||||
POLICE("police", "公安"),
|
||||
PROJECT_MANAGER("project_manager", "项目经理");
|
||||
|
||||
private final String value;
|
||||
private final String label;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.changhu.common.db.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import com.changhu.common.db.BaseEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 上午11:04
|
||||
* @desc 服务项目类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ServiceProjectType implements BaseEnum<String>, IEnum<String> {
|
||||
|
||||
SECURITY("security", "安保"),
|
||||
PROPERTY("property", "物业"),
|
||||
;
|
||||
|
||||
|
||||
private final String value;
|
||||
private final String label;
|
||||
}
|
|
@ -6,6 +6,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
|||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.enums.ClientType;
|
||||
|
@ -45,18 +46,18 @@ public class UserUtil {
|
|||
return getTokenInfo();
|
||||
}
|
||||
|
||||
public static SaTokenInfo loginAndTokenInfo(Long userId, ClientType clientType, Long unitId) {
|
||||
StpUtil.login(userId, SaLoginConfig.setExtra("clientType", clientType).setExtra("unitId", unitId));
|
||||
public static SaTokenInfo loginAndTokenInfo(Long userId, UserType userType, Long unitId) {
|
||||
StpUtil.login(userId, SaLoginConfig.setExtra("userType", userType).setExtra("unitId", unitId));
|
||||
return getTokenInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户端类型
|
||||
*/
|
||||
public static ClientType getClientType() {
|
||||
Object clientType = StpUtil.getExtra("clientType");
|
||||
public static UserType getUserType() {
|
||||
Object clientType = StpUtil.getExtra("userType");
|
||||
if (clientType instanceof String ct) {
|
||||
return ClientType.valueOf(ct);
|
||||
return UserType.valueOf(ct);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.changhu.config;
|
|||
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.changhu.support.interceptor.ClientTypeInterceptor;
|
||||
import com.changhu.support.interceptor.UserTypeInterceptor;
|
||||
import com.changhu.support.interceptor.JsonBodyInterceptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -51,7 +51,7 @@ public class WebConfig implements WebMvcConfigurer {
|
|||
// 注册jsonBody 拦截器 用于标识是否需要JsonResult返回
|
||||
registry.addInterceptor(new JsonBodyInterceptor());
|
||||
// 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端
|
||||
registry.addInterceptor(new ClientTypeInterceptor());
|
||||
registry.addInterceptor(new UserTypeInterceptor());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
@ -51,6 +52,7 @@ public class CommonController {
|
|||
private static final Map<String, List<SelectNodeVo<?>>> enumsResult = new HashMap<>();
|
||||
|
||||
|
||||
@Cacheable(value = "common", key = "'AdministrativeDivisionLevel' + #level + 'Tree'")
|
||||
@Operation(summary = "行政区划树")
|
||||
@GetMapping("/administrativeDivisionTree")
|
||||
public List<TreeNodeVo<String>> AdministrativeDivisionTree(@Schema(description = "等级") @RequestParam(defaultValue = "4") Integer level) {
|
||||
|
|
|
@ -15,7 +15,6 @@ import lombok.Getter;
|
|||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ClientType {
|
||||
NONE("未定义", null),
|
||||
MANAGEMENT_SUPER("超级后台", ManagementSuperLogin.instance),
|
||||
MANAGEMENT_POLICE("公安后台", ManagementPoliceUnitLogin.instance),
|
||||
MANAGEMENT_SECURITY("保安后台", ManagementSecurityUnitLogin.instance),
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.changhu.enums.handler;
|
|||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
|
@ -10,7 +11,6 @@ import com.changhu.common.pojo.vo.TokenInfo;
|
|||
import com.changhu.common.utils.RsaUtil;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.common.utils.ValidatorUtil;
|
||||
import com.changhu.enums.ClientType;
|
||||
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
|
||||
import com.changhu.module.management.pojo.entity.PoliceUnit;
|
||||
import com.changhu.pojo.params.ManagementPoliceUnitLoginParams;
|
||||
|
@ -69,7 +69,7 @@ public class ManagementPoliceUnitLogin extends AbstractLoginHandler {
|
|||
//登录
|
||||
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
|
||||
managementPoliceUnitUser.getSnowFlakeId(),
|
||||
ClientType.MANAGEMENT_POLICE,
|
||||
UserType.MANAGEMENT_POLICE,
|
||||
managementPoliceUnitUser.getPoliceUnitId()
|
||||
);
|
||||
//返回token
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.changhu.enums.handler;
|
|||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
|
@ -67,7 +68,7 @@ public class ManagementSecurityUnitLogin extends AbstractLoginHandler {
|
|||
//登录
|
||||
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
|
||||
managementSecurityUnitUser.getSnowFlakeId(),
|
||||
ClientType.MANAGEMENT_SECURITY,
|
||||
UserType.MANAGEMENT_SECURITY,
|
||||
managementSecurityUnitUser.getSecurityUnitId()
|
||||
);
|
||||
//返回token
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.changhu.enums.handler;
|
|||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
|
@ -45,7 +46,7 @@ public class ManagementSuperLogin extends AbstractLoginHandler {
|
|||
//登录
|
||||
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(
|
||||
user.getSnowFlakeId(),
|
||||
ClientType.MANAGEMENT_SUPER,
|
||||
UserType.MANAGEMENT_SUPER,
|
||||
null);
|
||||
//返回token
|
||||
return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue());
|
||||
|
|
|
@ -3,19 +3,20 @@ package com.changhu.module.management.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
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.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.DeleteMapping;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
|
@ -44,11 +45,17 @@ public class EnterprisesUnitController {
|
|||
|
||||
@Operation(summary = "根据id删除")
|
||||
@DeleteMapping("/deleteById")
|
||||
public void deleteById(@RequestBody Long enterprisesUnitId) {
|
||||
public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) {
|
||||
boolean b = enterprisesUnitService.removeById(enterprisesUnitId);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "根据行政区划编码查询下面的企事业单位")
|
||||
@PostMapping("/queryListByAdministrativeDivisionCodes")
|
||||
public List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(@RequestBody @Schema(description = "行政区划编码") List<String> administrativeDivisionCodes) {
|
||||
return enterprisesUnitService.queryListByAdministrativeDivisionCodes(administrativeDivisionCodes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckClientType;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.enums.ClientType;
|
||||
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
|
||||
|
@ -14,10 +15,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import 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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
|
@ -26,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
*/
|
||||
@Tag(name = "后台-公安用户")
|
||||
@JsonBody
|
||||
@CheckClientType(clientType = ClientType.MANAGEMENT_POLICE)
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
|
||||
@RequestMapping("/managementPoliceUnitUser")
|
||||
public class ManagementPoliceUnitUserController {
|
||||
|
||||
|
@ -46,7 +44,7 @@ public class ManagementPoliceUnitUserController {
|
|||
}
|
||||
|
||||
@Operation(summary = "根据id删除")
|
||||
@PostMapping("/deleteById")
|
||||
@DeleteMapping("/deleteById")
|
||||
public void deleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) {
|
||||
managementPoliceUnitUserService.deleteById(managementPoliceUnitUserId);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckClientType;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.enums.ClientType;
|
||||
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
|
||||
|
@ -24,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
@Tag(name = "后台-保安用户")
|
||||
@JsonBody
|
||||
@RequestMapping("/managementSecurityUnitUser")
|
||||
@CheckClientType(clientType = ClientType.MANAGEMENT_SECURITY)
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
|
||||
public class ManagementSecurityUnitUserController {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.enums.ClientType;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
|
||||
import com.changhu.module.management.service.PoliceUnitService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
@ -32,4 +37,11 @@ public class PoliceUnitController {
|
|||
return policeUnitService.pager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "公安单位下的企事业单位分页")
|
||||
@PostMapping("/policeEnterprisesUnitPager")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
|
||||
public Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(@RequestBody PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
|
||||
return policeUnitService.policeEnterprisesUnitPager(queryParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.enums.ClientType;
|
||||
import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
|
||||
|
@ -11,10 +15,13 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
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.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/8/30 上午10:46
|
||||
|
@ -40,4 +47,11 @@ public class SecurityUnitController {
|
|||
securityUnitService.saveOrUpdate(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "查询单位下的项目经理")
|
||||
@GetMapping("/listProjectManager")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
|
||||
public List<SelectNodeVo<Long>> listProjectManager() {
|
||||
return securityUnitService.listProjectManager();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.enums.ClientType;
|
||||
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
|
||||
import com.changhu.module.management.service.ServiceProjectService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 上午11:09
|
||||
* @desc ServiceProjectController...
|
||||
*/
|
||||
@Tag(name = "服务项目")
|
||||
@JsonBody
|
||||
@RequestMapping("/serviceProject")
|
||||
public class ServiceProjectController {
|
||||
|
||||
@Autowired
|
||||
private ServiceProjectService serviceProjectService;
|
||||
|
||||
@Operation(summary = "分页查询")
|
||||
@PostMapping("/pager")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
|
||||
public Page<ServiceProjectPagerVo> pager(@RequestBody PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
|
||||
return serviceProjectService.pager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增或者保存")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
|
||||
public void saveOrUpdate(@RequestBody ServiceProjectSaveOrUpdateParams params) {
|
||||
serviceProjectService.saveOrUpdate(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除")
|
||||
@DeleteMapping("/deleteById")
|
||||
public void deleteById(@RequestParam Long serviceProjectId) {
|
||||
boolean b = serviceProjectService.removeById(serviceProjectId);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,9 @@ 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.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -25,4 +27,14 @@ public interface EnterprisesUnitMapper extends BaseMapper<EnterprisesUnit> {
|
|||
*/
|
||||
Page<EnterprisesUnitPagerVo> pager(@Param("page") Page<EnterprisesUnitPagerVo> page,
|
||||
@Param("params") EnterprisesUnitPagerQueryParams params);
|
||||
|
||||
/**
|
||||
* 公安单位下的企事业单位分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param params 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(@Param("page") Page<PoliceEnterprisesUnitPagerVo> page,
|
||||
@Param("params") PoliceEnterprisesUnitPagerQueryParams params);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
|
||||
import com.changhu.support.mybatisplus.annotation.DataScope;
|
||||
import com.changhu.support.mybatisplus.handler.permission.management.ManagementPoliceUnitUserPagerPermissionHandler;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -25,7 +23,6 @@ public interface ManagementPoliceUnitUserMapper extends BaseMapper<ManagementPol
|
|||
* @param params 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
@DataScope(permissionHandler = ManagementPoliceUnitUserPagerPermissionHandler.class)
|
||||
Page<ManagementPoliceUnitUserPagerVo> pager(@Param("page") Page<ManagementPoliceUnitUserPagerVo> page,
|
||||
@Param("params") ManagementPoliceUnitUserPagerQueryParams params);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
|
||||
import com.changhu.support.mybatisplus.annotation.DataScope;
|
||||
import com.changhu.support.mybatisplus.handler.permission.management.ManagementSecurityUnitUserPagerPermissionHandler;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -25,7 +23,6 @@ public interface ManagementSecurityUnitUserMapper extends BaseMapper<ManagementS
|
|||
* @param params 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
@DataScope(permissionHandler = ManagementSecurityUnitUserPagerPermissionHandler.class)
|
||||
Page<ManagementSecurityUnitUserPagerVo> pager(@Param("page") Page<ManagementSecurityUnitUserPagerVo> page,
|
||||
@Param("params") ManagementSecurityUnitUserPagerQueryParams params);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.changhu.module.management.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.module.management.pojo.entity.ServiceProject;
|
||||
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* service_project (服务项目) 固化类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Mapper
|
||||
public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param params 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<ServiceProjectPagerVo> pager(@Param("page") Page<ServiceProjectPagerVo> page,
|
||||
@Param("params") ServiceProjectPagerQueryParams params);
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.changhu.module.management.pojo.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.ServiceProjectType;
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
|
||||
/**
|
||||
* 服务项目 实体类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(autoResultMap = true)
|
||||
public class ServiceProject extends BaseEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 保安单位id
|
||||
*/
|
||||
private Long securityUnitId;
|
||||
|
||||
/**
|
||||
* 企事业单位id
|
||||
*/
|
||||
private Long enterprisesUnitId;
|
||||
|
||||
/**
|
||||
* 项目经理小程序用户id
|
||||
*/
|
||||
private Long projectManagerMiniProgramUserId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 服务类型
|
||||
*/
|
||||
private ServiceProjectType type;
|
||||
|
||||
/**
|
||||
* 是否自招保安(只有当type为property 此字段必填)
|
||||
*/
|
||||
private IsOrNot isRecruitSecurity;
|
||||
|
||||
/**
|
||||
* 证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)
|
||||
*/
|
||||
private String idNumber;
|
||||
|
||||
/**
|
||||
* 服务区域面积
|
||||
*/
|
||||
private Double serviceArea;
|
||||
|
||||
/**
|
||||
* 楼栋数量
|
||||
*/
|
||||
private Integer buildingTotal;
|
||||
|
||||
/**
|
||||
* 户数
|
||||
*/
|
||||
private Integer houseTotal;
|
||||
|
||||
/**
|
||||
* 工作人员数量
|
||||
*/
|
||||
private Integer staffTotal;
|
||||
|
||||
/**
|
||||
* 保安人员数量
|
||||
*/
|
||||
private Integer securityUserTotal;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.changhu.module.management.pojo.params;
|
||||
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.ServiceProjectType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 上午11:36
|
||||
* @desc ServiceProjectSaveOrUpdateParams...
|
||||
*/
|
||||
@Data
|
||||
public class ServiceProjectSaveOrUpdateParams {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
@Schema(description = "企事业单位id")
|
||||
@NotNull(message = "企事业单位不能为空")
|
||||
private Long enterprisesUnitId;
|
||||
|
||||
@Schema(description = "项目经理小程序用户id")
|
||||
private Long projectManagerMiniProgramUserId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
@NotNull(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "服务类型")
|
||||
@NotNull(message = "服务类型不能为空")
|
||||
private ServiceProjectType type;
|
||||
|
||||
@Schema(description = "是否自招保安(只有当type为property 此字段必填)")
|
||||
private IsOrNot isRecruitSecurity;
|
||||
|
||||
@Schema(description = "证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)")
|
||||
private String idNumber;
|
||||
|
||||
@Schema(description = "服务区域面积")
|
||||
private Double serviceArea;
|
||||
|
||||
@Schema(description = "楼栋数量")
|
||||
private Integer buildingTotal;
|
||||
|
||||
@Schema(description = "户数")
|
||||
private Integer houseTotal;
|
||||
|
||||
@Schema(description = "工作人员数量")
|
||||
private Integer staffTotal;
|
||||
|
||||
@Schema(description = "保安人员数量")
|
||||
private Integer securityUserTotal;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.changhu.module.management.pojo.queryParams;
|
||||
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.Sex;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -17,4 +18,6 @@ public class ManagementPoliceUnitUserPagerQueryParams {
|
|||
private String telephone;
|
||||
@Schema(description = "性别")
|
||||
private Sex sex;
|
||||
@Schema(description = "是否启用")
|
||||
private IsEnable isEnable;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.changhu.module.management.pojo.queryParams;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 下午2:49
|
||||
* @desc PoliceEnterprisesUnitPagerQueryParams...
|
||||
*/
|
||||
@Data
|
||||
public class PoliceEnterprisesUnitPagerQueryParams {
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.changhu.module.management.pojo.queryParams;
|
||||
|
||||
import com.changhu.common.db.enums.ServiceProjectType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 上午11:15
|
||||
* @desc ServiceProjectPagerQueryParams...
|
||||
*/
|
||||
@Data
|
||||
public class ServiceProjectPagerQueryParams {
|
||||
@Schema(description = "服务项目名称")
|
||||
private String name;
|
||||
@Schema(description = "服务项目类型")
|
||||
private ServiceProjectType type;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
@Schema(description = "项目经理小程序用户名称")
|
||||
private String projectManagerMiniProgramUserName;
|
||||
}
|
|
@ -25,7 +25,7 @@ public class ManagementPoliceUnitUserPagerVo {
|
|||
@Schema(description = "性别")
|
||||
private Sex sex;
|
||||
|
||||
@Schema(description = "性别")
|
||||
@Schema(description = "账号")
|
||||
private String account;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ManagementSecurityUnitUserPagerVo {
|
|||
@Schema(description = "性别")
|
||||
private Sex sex;
|
||||
|
||||
@Schema(description = "性别")
|
||||
@Schema(description = "账号")
|
||||
private String account;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.changhu.module.management.pojo.vo;
|
||||
|
||||
import com.changhu.module.management.pojo.model.ContactPersonInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 下午2:46
|
||||
* @desc PoliceEnterprisesUnitPagerVo...
|
||||
*/
|
||||
@Data
|
||||
public class PoliceEnterprisesUnitPagerVo {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "省编码")
|
||||
private String province;
|
||||
@Schema(description = "省名称")
|
||||
private String provinceName;
|
||||
@Schema(description = "市编码")
|
||||
private String city;
|
||||
@Schema(description = "市名称")
|
||||
private String cityName;
|
||||
@Schema(description = "县编码")
|
||||
private String districts;
|
||||
@Schema(description = "县名称")
|
||||
private String districtsName;
|
||||
@Schema(description = "乡镇编码")
|
||||
private String street;
|
||||
@Schema(description = "乡镇名称")
|
||||
private String streetName;
|
||||
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
@Schema(description = "联系人")
|
||||
private ContactPersonInfo contactPersonInfo;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.changhu.module.management.pojo.vo;
|
||||
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.ServiceProjectType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 上午11:15
|
||||
* @desc ServiceProjectPagerVo...
|
||||
*/
|
||||
@Data
|
||||
public class ServiceProjectPagerVo {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
@Schema(description = "企事业单位id")
|
||||
private Long enterprisesUnitId;
|
||||
@Schema(description = "企事业单位名称")
|
||||
private String enterprisesUnitName;
|
||||
@Schema(description = "企事业单位行政区划编码")
|
||||
private List<String> enterprisesUnitAdministrativeDivisionCodes;
|
||||
|
||||
@Schema(description = "项目经理小程序用户id")
|
||||
private Long projectManagerMiniProgramUserId;
|
||||
@Schema(description = "项目经理小程序用户名称")
|
||||
private String projectManagerMiniProgramUserName;
|
||||
|
||||
@Schema(description = "服务项目名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "服务类型")
|
||||
private ServiceProjectType type;
|
||||
|
||||
@Schema(description = "是否自招保安(只有当type为property 此字段必填)")
|
||||
private IsOrNot isRecruitSecurity;
|
||||
|
||||
@Schema(description = "证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)")
|
||||
private String idNumber;
|
||||
|
||||
@Schema(description = "服务区域面积")
|
||||
private Double serviceArea;
|
||||
|
||||
@Schema(description = "楼栋数量")
|
||||
private Integer buildingTotal;
|
||||
|
||||
@Schema(description = "户数")
|
||||
private Integer houseTotal;
|
||||
|
||||
@Schema(description = "工作人员数量")
|
||||
private Integer staffTotal;
|
||||
|
||||
@Schema(description = "保安人员数量")
|
||||
private Integer securityUserTotal;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人名称")
|
||||
private String createUserName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -2,12 +2,15 @@ package com.changhu.module.management.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
||||
import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* enterprises_unit (企事业单位) 服务类
|
||||
* author: luozhun
|
||||
|
@ -29,4 +32,12 @@ public interface EnterprisesUnitService extends IService<EnterprisesUnit> {
|
|||
* @param params 参数
|
||||
*/
|
||||
void saveOrUpdate(EnterprisesUnitSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 根据行政区划编码查询下面的企事业单位
|
||||
*
|
||||
* @param administrativeDivisionCodes 行政区划编码
|
||||
* @return 结果
|
||||
*/
|
||||
List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(List<String> administrativeDivisionCodes);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@ 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.PoliceUnit;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
|
@ -21,4 +23,12 @@ public interface PoliceUnitService extends IService<PoliceUnit> {
|
|||
* @return 结果
|
||||
*/
|
||||
Page<PoliceUnitPagerVo> pager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 公安单位下的企事业单位分页
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,15 @@ package com.changhu.module.management.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.module.management.pojo.entity.SecurityUnit;
|
||||
import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* security_unit (保安单位) 服务类
|
||||
* author: luozhun
|
||||
|
@ -30,4 +33,10 @@ public interface SecurityUnitService extends IService<SecurityUnit> {
|
|||
*/
|
||||
void saveOrUpdate(SecurityUnitSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 查询单位下的项目经理
|
||||
*
|
||||
* @return 项目经理
|
||||
*/
|
||||
List<SelectNodeVo<Long>> listProjectManager();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.changhu.module.management.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.module.management.pojo.entity.ServiceProject;
|
||||
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
/**
|
||||
* service_project (服务项目) 服务类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
public interface ServiceProjectService extends IService<ServiceProject> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 新增或者修改
|
||||
*
|
||||
* @param params 参数
|
||||
*/
|
||||
void saveOrUpdate(ServiceProjectSaveOrUpdateParams params);
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.module.management.mapper.EnterprisesUnitMapper;
|
||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
||||
import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams;
|
||||
|
@ -13,6 +16,7 @@ import com.changhu.module.management.service.EnterprisesUnitService;
|
|||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
@ -51,4 +55,26 @@ public class EnterprisesUnitServiceImpl extends ServiceImpl<EnterprisesUnitMappe
|
|||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(List<String> administrativeDivisionCodes) {
|
||||
String addr = LambdaUtil.getFieldName(EnterprisesUnit::getAddress);
|
||||
String rem = LambdaUtil.getFieldName(EnterprisesUnit::getRemark);
|
||||
return this.lambdaQuery()
|
||||
.eq(!administrativeDivisionCodes.isEmpty(), EnterprisesUnit::getProvince, administrativeDivisionCodes.get(0))
|
||||
.eq(administrativeDivisionCodes.size() >= 2, EnterprisesUnit::getCity, administrativeDivisionCodes.get(1))
|
||||
.eq(administrativeDivisionCodes.size() >= 3, EnterprisesUnit::getDistricts, administrativeDivisionCodes.get(2))
|
||||
.eq(administrativeDivisionCodes.size() >= 4, EnterprisesUnit::getStreet, administrativeDivisionCodes.get(3))
|
||||
.list()
|
||||
.stream()
|
||||
.map(item -> SelectNodeVo.<Long>builder()
|
||||
.value(item.getSnowFlakeId())
|
||||
.label(item.getName())
|
||||
.extData(Dict.of(
|
||||
addr, item.getAddress(),
|
||||
rem, item.getRemark()
|
||||
))
|
||||
.build())
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ManagementPoliceUnitUserServiceImpl extends ServiceImpl<ManagementP
|
|||
public void saveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params) {
|
||||
//查看手机号是否存在
|
||||
boolean exists = this.lambdaQuery()
|
||||
.ne(params.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, params.getSnowFlakeId())
|
||||
.eq(ManagementPoliceUnitUser::getTelephone, params.getTelephone())
|
||||
.exists();
|
||||
if (exists) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.RandomUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
|
@ -36,6 +37,7 @@ public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<Managemen
|
|||
public void saveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
|
||||
//查看手机号是否已存在
|
||||
boolean exists = this.lambdaQuery()
|
||||
.ne(saveOrUpdateParams.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, saveOrUpdateParams.getSnowFlakeId())
|
||||
.eq(ManagementSecurityUnitUser::getTelephone, saveOrUpdateParams.getTelephone())
|
||||
.exists();
|
||||
if (exists) {
|
||||
|
@ -54,7 +56,7 @@ public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<Managemen
|
|||
}
|
||||
//生成账号
|
||||
managementSecurityUnitUser.setAccount(account);
|
||||
if (!ClientType.MANAGEMENT_SECURITY.equals(UserUtil.getClientType())) {
|
||||
if (!UserType.MANAGEMENT_SECURITY.equals(UserUtil.getUserType())) {
|
||||
throw new MessageException("客户端类型不对");
|
||||
}
|
||||
//补全单位
|
||||
|
|
|
@ -2,12 +2,16 @@ package com.changhu.module.management.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.module.management.mapper.EnterprisesUnitMapper;
|
||||
import com.changhu.module.management.mapper.PoliceUnitMapper;
|
||||
import com.changhu.module.management.pojo.entity.PoliceUnit;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
|
||||
import com.changhu.module.management.service.PoliceUnitService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
@ -18,8 +22,16 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class PoliceUnitServiceImpl extends ServiceImpl<PoliceUnitMapper, PoliceUnit> implements PoliceUnitService {
|
||||
|
||||
@Autowired
|
||||
private EnterprisesUnitMapper enterprisesUnitMapper;
|
||||
|
||||
@Override
|
||||
public Page<PoliceUnitPagerVo> pager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) {
|
||||
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
|
||||
return enterprisesUnitMapper.policeEnterprisesUnitPager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.utils.JavaClassToTsUtil;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
|
||||
import com.changhu.module.management.mapper.SecurityUnitMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.management.pojo.entity.SecurityUnit;
|
||||
import com.changhu.module.management.pojo.params.SecurityUnitSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
|
||||
import com.changhu.module.management.service.SecurityUnitService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +33,9 @@ import java.util.Optional;
|
|||
@Service
|
||||
public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, SecurityUnit> implements SecurityUnitService {
|
||||
|
||||
@Autowired
|
||||
private MiniProgramUserMapper miniProgramUserMapper;
|
||||
|
||||
@Override
|
||||
public Page<SecurityUnitPagerVo> pager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
|
||||
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
|
@ -49,9 +62,24 @@ public class SecurityUnitServiceImpl extends ServiceImpl<SecurityUnitMapper, Sec
|
|||
this.saveOrUpdate(securityUnit);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String parse = JavaClassToTsUtil.parse(SecurityUnitPagerQueryParams.class);
|
||||
System.out.println(parse);
|
||||
@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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.management.mapper.ServiceProjectMapper;
|
||||
import com.changhu.module.management.pojo.entity.ServiceProject;
|
||||
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
|
||||
import com.changhu.module.management.service.ServiceProjectService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* service_project (服务项目) 服务实现类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Service
|
||||
public class ServiceProjectServiceImpl extends ServiceImpl<ServiceProjectMapper, ServiceProject> implements ServiceProjectService {
|
||||
|
||||
@Override
|
||||
public Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
|
||||
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(ServiceProjectSaveOrUpdateParams params) {
|
||||
ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class);
|
||||
serviceProject.setSecurityUnitId(UserUtil.getUnitId());
|
||||
boolean b = this.saveOrUpdate(serviceProject);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.changhu.module.miniProgram.controller;
|
||||
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.enums.ClientType;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
import com.changhu.module.miniProgram.service.MiniProgramUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/6 上午10:42
|
||||
* @desc MiniProgramUserController...
|
||||
*/
|
||||
@Tag(name = "小程序用户接口")
|
||||
@JsonBody
|
||||
@RequestMapping("/miniProgramUser")
|
||||
public class MiniProgramUserController {
|
||||
|
||||
@Autowired
|
||||
private MiniProgramUserService miniProgramUserService;
|
||||
|
||||
@Operation(summary = "注册")
|
||||
@PostMapping("/register")
|
||||
public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
|
||||
miniProgramUserService.register(params);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.changhu.module.miniProgram.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* mini_program_user (小程序用户) 固化类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Mapper
|
||||
public interface MiniProgramUserMapper extends BaseMapper<MiniProgramUser> {
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.changhu.module.miniProgram.pojo.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.db.enums.Sex;
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户 实体类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(autoResultMap = true)
|
||||
public class MiniProgramUser extends BaseEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private Sex sex;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 小程序唯一标识
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* 会话密钥
|
||||
*/
|
||||
private String sessionKey;
|
||||
|
||||
/**
|
||||
* 身份
|
||||
*/
|
||||
private MiniProgramUserIdentity identity;
|
||||
|
||||
/**
|
||||
* 所属单位id
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private IsEnable isEnable;
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.changhu.module.miniProgram.pojo.params;
|
||||
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.db.enums.Sex;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/6 上午10:47
|
||||
* @desc MiniProgramUserRegisterParams...
|
||||
*/
|
||||
@Data
|
||||
public class MiniProgramUserRegisterParams {
|
||||
@NotBlank(message = "code不能为空")
|
||||
private String code;
|
||||
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Sex sex;
|
||||
|
||||
private String telephone;
|
||||
|
||||
@NotNull(message = "身份不能为空")
|
||||
private MiniProgramUserIdentity identity;
|
||||
@NotNull(message = "单位不能为空")
|
||||
private Long unitId;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
|
||||
/**
|
||||
* mini_program_user (小程序用户) 服务类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
public interface MiniProgramUserService extends IService<MiniProgramUser> {
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*
|
||||
* @param params 参数
|
||||
*/
|
||||
void register(MiniProgramUserRegisterParams params);
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.changhu.module.miniProgram.service.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.SnowFlakeIdUtil;
|
||||
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
import com.changhu.module.miniProgram.service.MiniProgramUserService;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* mini_program_user (小程序用户) 服务实现类
|
||||
* author: luozhun
|
||||
* desc 由groovy脚本自动生成
|
||||
*/
|
||||
@Service
|
||||
public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMapper, MiniProgramUser> implements MiniProgramUserService {
|
||||
|
||||
@Autowired
|
||||
private WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public void register(MiniProgramUserRegisterParams params) {
|
||||
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
|
||||
try {
|
||||
WxMaJscode2SessionResult sessionInfo = wxMaService.getUserService().getSessionInfo(params.getCode());
|
||||
miniProgramUser.setOpenId(sessionInfo.getOpenid());
|
||||
miniProgramUser.setSessionKey(sessionInfo.getSessionKey());
|
||||
} catch (WxErrorException e) {
|
||||
throw new MessageException(e.getMessage());
|
||||
}
|
||||
boolean exists = baseMapper.exists(Wrappers.<MiniProgramUser>lambdaQuery().eq(MiniProgramUser::getOpenId, miniProgramUser.getOpenId()));
|
||||
if (exists) {
|
||||
throw new MessageException("该用户已存在,请勿重复注册!");
|
||||
}
|
||||
|
||||
miniProgramUser.setSnowFlakeId(SnowFlakeIdUtil.snowflakeId());
|
||||
boolean save = this.save(miniProgramUser);
|
||||
if (!save) {
|
||||
throw new MessageException();
|
||||
}
|
||||
|
||||
//todo 是否需要返回token直接登录?
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package com.changhu.support.interceptor;
|
||||
|
||||
import com.changhu.common.annotation.CheckClientType;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.enums.ClientType;
|
||||
|
@ -13,9 +15,9 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
|||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/4 下午4:00
|
||||
* @desc ClientTypeInterceptor...
|
||||
* @desc UserTypeInterceptor...
|
||||
*/
|
||||
public class ClientTypeInterceptor implements HandlerInterceptor {
|
||||
public class UserTypeInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(@NotNull HttpServletRequest request,
|
||||
|
@ -23,28 +25,28 @@ public class ClientTypeInterceptor implements HandlerInterceptor {
|
|||
@NotNull Object handler) {
|
||||
if (handler instanceof HandlerMethod handlerMethod) {
|
||||
boolean b = false;
|
||||
ClientType ct = null;
|
||||
UserType[] uts = null;
|
||||
|
||||
CheckClientType clazzJsonBody = handlerMethod.getBeanType().getAnnotation(CheckClientType.class);
|
||||
CheckClientType methodJsonBody = handlerMethod.getMethodAnnotation(CheckClientType.class);
|
||||
CheckUserType clazzJsonBody = handlerMethod.getBeanType().getAnnotation(CheckUserType.class);
|
||||
CheckUserType methodJsonBody = handlerMethod.getMethodAnnotation(CheckUserType.class);
|
||||
|
||||
if (clazzJsonBody != null) {
|
||||
if (methodJsonBody == null) {
|
||||
b = true;
|
||||
ct = clazzJsonBody.clientType();
|
||||
uts = clazzJsonBody.userTypes();
|
||||
} else if (methodJsonBody.value()) {
|
||||
b = true;
|
||||
ct = methodJsonBody.clientType();
|
||||
uts = methodJsonBody.userTypes();
|
||||
}
|
||||
} else {
|
||||
if (methodJsonBody != null && methodJsonBody.value()) {
|
||||
b = true;
|
||||
ct = methodJsonBody.clientType();
|
||||
uts = methodJsonBody.userTypes();
|
||||
}
|
||||
}
|
||||
|
||||
if (b) {
|
||||
if (!ct.equals(UserUtil.getClientType())) {
|
||||
if (b && ArrayUtil.isNotEmpty(uts)) {
|
||||
if (!ArrayUtil.contains(uts, UserUtil.getUserType())) {
|
||||
throw new MessageException("客户端类型不对");
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package com.changhu.support.mybatisplus.handler.permission.management;
|
||||
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.support.mybatisplus.handler.permission.AbstractDataPermissionHandler;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import net.sf.jsqlparser.schema.Table;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/4 下午3:29
|
||||
* @desc ManagementPoliceUnitUserPagerPermissionHandler...
|
||||
*/
|
||||
public class ManagementPoliceUnitUserPagerPermissionHandler implements AbstractDataPermissionHandler {
|
||||
@Override
|
||||
public Expression apply(Table table, Expression where, String mappedStatementId) {
|
||||
if ("mpuu".equals(table.getAlias().getName())) {
|
||||
return sqlFragment();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression sqlFragment() {
|
||||
return new EqualsTo(new Column("mpuu.police_unit_id"), new LongValue(UserUtil.getUnitId()));
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package com.changhu.support.mybatisplus.handler.permission.management;
|
||||
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.support.mybatisplus.handler.permission.AbstractDataPermissionHandler;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import net.sf.jsqlparser.schema.Table;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/3 上午11:11
|
||||
* @desc 后台安保人员分页权限
|
||||
*/
|
||||
public class ManagementSecurityUnitUserPagerPermissionHandler implements AbstractDataPermissionHandler {
|
||||
@Override
|
||||
public Expression apply(Table table, Expression where, String mappedStatementId) {
|
||||
if ("msuu".equals(table.getAlias().getName())) {
|
||||
return sqlFragment();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression sqlFragment() {
|
||||
return new EqualsTo(new Column("msuu.security_unit_id"), new LongValue(UserUtil.getUnitId()));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.changhu.support.wx;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
||||
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* author: luozhun
|
||||
* desc: some...
|
||||
* createTime: 2024/4/15 9:41
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(WxMaProperties.class)
|
||||
public class WxMaConfiguration {
|
||||
@Bean
|
||||
public WxMaService wxMaService(WxMaProperties properties) {
|
||||
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||
config.setAppid(properties.getAppid());
|
||||
config.setSecret(properties.getSecret());
|
||||
config.setMsgDataFormat(properties.getMsgDataFormat());
|
||||
|
||||
WxMaService service = new WxMaServiceImpl();
|
||||
service.setWxMaConfig(config);
|
||||
return service;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.changhu.support.wx;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* author: luozhun
|
||||
* desc: some...
|
||||
* createTime: 2024/4/15 9:40
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "wx.miniapp")
|
||||
public class WxMaProperties {
|
||||
|
||||
/**
|
||||
* 设置微信小程序的appid
|
||||
*/
|
||||
private String appid;
|
||||
|
||||
/**
|
||||
* 设置微信小程序的Secret
|
||||
*/
|
||||
private String secret;
|
||||
|
||||
/**
|
||||
* 消息格式,XML或者JSON
|
||||
*/
|
||||
private String msgDataFormat;
|
||||
}
|
|
@ -128,6 +128,9 @@
|
|||
<logger name="com.changhu.module.management.mapper">
|
||||
<appender-ref ref="MpConsole"/>
|
||||
</logger>
|
||||
<logger name="com.changhu.module.miniProgram.mapper">
|
||||
<appender-ref ref="MpConsole"/>
|
||||
</logger>
|
||||
<!--spring日志-->
|
||||
<logger name="org.springframework" level="DEBUG"/>
|
||||
<!--建立一个默认的root的logger -->
|
||||
|
|
|
@ -141,6 +141,14 @@ sa-token:
|
|||
# jwt秘钥
|
||||
jwt-secret-key: a29216f8-cd60-4e96-89c5-ab6012159052
|
||||
|
||||
wx:
|
||||
miniapp:
|
||||
#微信小程序的appid
|
||||
appid: wx8902ddbfddb820d1
|
||||
#微信小程序的Secret
|
||||
secret: 8674decea33df3362245937444944596
|
||||
msgDataFormat: JSON
|
||||
|
||||
project:
|
||||
env: dev
|
||||
fastjson2:
|
||||
|
|
|
@ -22,4 +22,37 @@
|
|||
and eu.police_unit_id = #{params.policeUnitId}
|
||||
order by eu.create_time desc
|
||||
</select>
|
||||
|
||||
<resultMap id="PoliceEnterprisesUnitPagerVoResultMap"
|
||||
type="com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo">
|
||||
<result
|
||||
column="contact_person_info"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
|
||||
property="contactPersonInfo"/>
|
||||
</resultMap>
|
||||
<select id="policeEnterprisesUnitPager"
|
||||
resultMap="PoliceEnterprisesUnitPagerVoResultMap">
|
||||
select eu.*,
|
||||
ad1.name as provinceName,
|
||||
ad2.name as cityName,
|
||||
ad3.name as districtsName,
|
||||
ad4.name as streetName
|
||||
from enterprises_unit eu
|
||||
left join administrative_division ad1 on eu.province = ad1.code and ad1.delete_flag = 0
|
||||
left join administrative_division ad2 on eu.city = ad2.code and ad2.delete_flag = 0
|
||||
left join administrative_division ad3 on eu.districts = ad3.code and ad3.delete_flag = 0
|
||||
left join administrative_division ad4 on eu.street = ad4.code and ad4.delete_flag = 0
|
||||
where eu.delete_flag = 0
|
||||
and eu.police_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
|
||||
<if test="params.name != null and params.name != ''">
|
||||
and eu.name like concat('%', #{params.name}, '%')
|
||||
</if>
|
||||
<if test="params.address != null and params.address != ''">
|
||||
and eu.address like concat('%', #{params.address}, '%')
|
||||
</if>
|
||||
<if test="params.remark != null and params.remark != ''">
|
||||
and eu.remark like concat('%', #{params.remark}, '%')
|
||||
</if>
|
||||
order by eu.create_time desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -9,6 +9,7 @@
|
|||
left join management_police_unit_user mpuu2 on mpuu.create_by = mpuu2.snow_flake_id
|
||||
where
|
||||
mpuu.delete_flag = 0
|
||||
and mpuu.police_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
|
||||
<if test="params.name!=null and params.name!=''">
|
||||
and mpuu.name like concat('%',#{params.name},'%')
|
||||
</if>
|
||||
|
@ -18,6 +19,9 @@
|
|||
<if test="params.sex!=null">
|
||||
and mpuu.sex = #{params.sex.value}
|
||||
</if>
|
||||
<if test="params.isEnable!=null">
|
||||
and mpuu.sex = #{params.isEnable.value}
|
||||
</if>
|
||||
order by mpuu.create_time desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -9,6 +9,7 @@
|
|||
left join management_security_unit_user msuu2 on msuu.create_by = msuu2.snow_flake_id
|
||||
where
|
||||
msuu.delete_flag = 0
|
||||
and msuu.security_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
|
||||
<if test="params.name!=null and params.name!=''">
|
||||
and msuu.name like concat('%',#{params.name},'%')
|
||||
</if>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.changhu.module.management.mapper.ServiceProjectMapper">
|
||||
<select id="pager" resultType="com.changhu.module.management.pojo.vo.ServiceProjectPagerVo">
|
||||
select
|
||||
sp.*,
|
||||
JSON_ARRAY(eu.province,eu.city,eu.districts,eu.street) as 'enterprisesUnitAdministrativeDivisionCodes',
|
||||
eu.name as 'enterprisesUnitName',
|
||||
mpu.name as 'projectManagerMiniProgramUserName',
|
||||
msuu.name as 'createUserName'
|
||||
from service_project sp
|
||||
left join enterprises_unit eu on sp.enterprises_unit_id = eu.snow_flake_id
|
||||
left join mini_program_user mpu on sp.project_manager_mini_program_user_id = mpu.snow_flake_id
|
||||
left join management_security_unit_user msuu on sp.create_by = msuu.snow_flake_id
|
||||
where sp.delete_flag = 0
|
||||
and sp.security_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
|
||||
<if test="params.name!=null and params.name!=''">
|
||||
and sp.name like concat('%',#{params.name},'%')
|
||||
</if>
|
||||
<if test="params.type!=null">
|
||||
and sp.type = #{params.type.value}
|
||||
</if>
|
||||
<if test="params.remark!=null and params.remark!=''">
|
||||
and sp.remark like concat('%',#{params.remark},'%')
|
||||
</if>
|
||||
<if test="params.projectManagerMiniProgramUserName!=null and params.projectManagerMiniProgramUserName!=''">
|
||||
and mpu.name like concat('%',#{params.projectManagerMiniProgramUserName},'%')
|
||||
</if>
|
||||
order by sp.create_time desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -154,7 +154,7 @@ const tableColumns = computed(() => {
|
|||
if (!(cols?.[0].dataIndex === 'index')) {
|
||||
cols?.unshift({
|
||||
dataIndex: 'index',
|
||||
width: 50,
|
||||
width: 70,
|
||||
title: '序号',
|
||||
customRender: ({index}) => index + 1
|
||||
})
|
||||
|
|
|
@ -6,6 +6,8 @@ type DictType =
|
|||
| 'IsEnable'
|
||||
| 'IsOrNot'
|
||||
| 'Sex'
|
||||
| 'ServiceProjectType'
|
||||
| 'MiniProgramUserIdentity'
|
||||
|
||||
export const initDict = () => {
|
||||
api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {
|
||||
|
|
Loading…
Reference in New Issue