Merge branch 'main' of http://175.6.124.250:3100/luozhun/policeSecurity
This commit is contained in:
commit
5825ea2767
|
@ -7,7 +7,7 @@ import java.lang.annotation.*;
|
|||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/4 下午4:01
|
||||
* @desc CheckClientType...
|
||||
* @desc 检查访问接口的用户类型
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.changhu.common.pojo.vo;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -15,9 +16,17 @@ public class TokenInfo {
|
|||
private String name;
|
||||
@Schema(description = "token的值")
|
||||
private String value;
|
||||
@Schema(description = "拓展属性")
|
||||
private Dict extData;
|
||||
|
||||
public TokenInfo(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public TokenInfo(String name, String value, Dict dict) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.extData = dict;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class UserUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取客户端类型
|
||||
* 获取用户类型
|
||||
*/
|
||||
public static UserType getUserType() {
|
||||
Object clientType = StpUtil.getExtra("userType");
|
||||
|
|
|
@ -4,7 +4,10 @@ import com.changhu.common.annotation.JsonBody;
|
|||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
import com.changhu.pojo.params.LoginParams;
|
||||
import com.changhu.service.LoginService;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
|
@ -13,14 +16,22 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
* @createTime 2024/8/28 下午5:12
|
||||
* @desc LoginController...
|
||||
*/
|
||||
@Tag(name = "登录相关")
|
||||
@JsonBody
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
|
||||
@Operation(summary = "登录")
|
||||
@PostMapping("/login")
|
||||
public TokenInfo login(@RequestBody LoginParams loginParams) {
|
||||
return loginService.login(loginParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "登出")
|
||||
@GetMapping("/logout")
|
||||
public void logout() {
|
||||
loginService.logout();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,14 @@ package com.changhu.enums.handler;
|
|||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.CheckStatus;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
|
@ -49,6 +53,14 @@ public class MiniProgramUserLogin extends AbstractLoginHandler {
|
|||
.oneOpt()
|
||||
.orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND));
|
||||
|
||||
if (CheckStatus.unChecked.equals(miniProgramUser.getCheckStatus())) {
|
||||
throw new MessageException("该账号还未审核");
|
||||
}
|
||||
|
||||
if (IsEnable.FALSE.equals(miniProgramUser.getIsEnable())) {
|
||||
throw new MessageException(ResultCode.USER_IS_DISABLE);
|
||||
}
|
||||
|
||||
UserType userType = switch (miniProgramUser.getIdentity()) {
|
||||
case POLICE -> UserType.MINI_PROGRAM_POLICE;
|
||||
case PROJECT_MANAGER -> UserType.MINI_PROGRAM_PROJECT_MANAGE;
|
||||
|
@ -60,6 +72,10 @@ public class MiniProgramUserLogin extends AbstractLoginHandler {
|
|||
userType,
|
||||
miniProgramUser.getUnitId());
|
||||
//返回token
|
||||
return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue());
|
||||
return new TokenInfo(
|
||||
saTokenInfo.getTokenName(),
|
||||
saTokenInfo.getTokenValue(),
|
||||
Dict.of(LambdaUtil.getFieldName(MiniProgramUser::getIdentity), miniProgramUser.getIdentity())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ManagementController {
|
|||
|
||||
@Operation(summary = "审核通过")
|
||||
@PostMapping("/checkPass")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
|
||||
public void checkPass(@RequestBody @Valid IndexCheckPassParams params) {
|
||||
managementService.checkPass(params);
|
||||
}
|
||||
|
@ -47,6 +48,7 @@ public class ManagementController {
|
|||
|
||||
@Operation(summary = "启用或禁用状态")
|
||||
@PostMapping("/disableOrEnable")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
|
||||
public void disableOrEnable(@RequestBody @Valid IndexDisableOrEnableParams params) {
|
||||
managementService.disableOrEnable(params);
|
||||
}
|
||||
|
@ -60,12 +62,14 @@ public class ManagementController {
|
|||
|
||||
@Operation(summary = "审核通过小程序用户")
|
||||
@PostMapping("/passMiniProgramUser")
|
||||
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
|
||||
public void passMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) {
|
||||
managementService.passMiniProgramUser(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "禁用或启用小程序用户")
|
||||
@PostMapping("/disableOrEnableMiniProgramUser")
|
||||
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
|
||||
public void disableOrEnableMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) {
|
||||
managementService.disableOrEnableMiniProgramUser(params);
|
||||
}
|
||||
|
|
|
@ -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.annotation.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.ManagementPoliceUnitUserService;
|
||||
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/3 上午10:21
|
||||
* @desc ManagementPoliceUnitUserController...
|
||||
*/
|
||||
@Tag(name = "后台-公安用户")
|
||||
@JsonBody
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
|
||||
@RequestMapping("/managementPoliceUnitUser")
|
||||
public class ManagementPoliceUnitUserController {
|
||||
|
||||
@Autowired
|
||||
private ManagementPoliceUnitUserService managementPoliceUnitUserService;
|
||||
|
||||
@Operation(summary = "新增或保存")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public void saveOrUpdate(@RequestBody @Valid ManagementPoliceUserSaveOrUpdateParams params) {
|
||||
managementPoliceUnitUserService.saveOrUpdate(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询")
|
||||
@PostMapping("/pager")
|
||||
public Page<ManagementPoliceUnitUserPagerVo> pager(@RequestBody PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams) {
|
||||
return managementPoliceUnitUserService.pager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除")
|
||||
@DeleteMapping("/deleteById")
|
||||
public void deleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) {
|
||||
managementPoliceUnitUserService.deleteById(managementPoliceUnitUserId);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.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.ManagementSecurityUnitUserService;
|
||||
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/3 上午10:22
|
||||
* @desc ManagementSecurityUnitUserController...
|
||||
*/
|
||||
@Tag(name = "后台-保安用户")
|
||||
@JsonBody
|
||||
@RequestMapping("/managementSecurityUnitUser")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
|
||||
public class ManagementSecurityUnitUserController {
|
||||
|
||||
@Autowired
|
||||
private ManagementSecurityUnitUserService managementSecurityUnitUserService;
|
||||
|
||||
@Operation(summary = "新增或修改")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public void saveOrUpdate(@RequestBody @Valid ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
|
||||
managementSecurityUnitUserService.saveOrUpdate(saveOrUpdateParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询")
|
||||
@PostMapping("/pager")
|
||||
public Page<ManagementSecurityUnitUserPagerVo> pager(@RequestBody PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams) {
|
||||
return managementSecurityUnitUserService.pager(queryParams);
|
||||
}
|
||||
|
||||
@DeleteMapping("/deleteById")
|
||||
public void deleteById(@RequestParam @Schema(description = "后台保安用户id") Long managementSecurityUnitUserId) {
|
||||
managementSecurityUnitUserService.deleteById(managementSecurityUnitUserId);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.service.ManagementSuperUserService;
|
||||
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/8/28 下午5:12
|
||||
* @desc 超级后台用户控制器
|
||||
*/
|
||||
@Tag(name = "后台用户-超级后台")
|
||||
@JsonBody
|
||||
@RequestMapping("/managementSuperUser")
|
||||
public class ManagementSuperUserController {
|
||||
|
||||
@Autowired
|
||||
private ManagementSuperUserService managementSuperUserService;
|
||||
|
||||
@Operation(summary = "新增或保存")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public void saveOrUpdate(@RequestBody @Valid ManagementSuperUserSaveOrUpdateParams params) {
|
||||
managementSuperUserService.saveOrUpdate(params);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
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.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
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);
|
||||
}
|
||||
|
||||
@Operation(summary = "公安单位下的企事业单位分页")
|
||||
@PostMapping("/enterprisesUnitPager")
|
||||
public Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(@RequestBody PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
|
||||
return policeService.enterprisesUnitPager(queryParams);
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.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 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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/8/30 下午3:45
|
||||
* @desc PoliceUnitController...
|
||||
*/
|
||||
@Tag(name = "单位-公安")
|
||||
@JsonBody
|
||||
@RequestMapping("/policeUnit")
|
||||
public class PoliceUnitController {
|
||||
|
||||
@Autowired
|
||||
private PoliceUnitService policeUnitService;
|
||||
|
||||
@Operation(summary = "分页查询")
|
||||
@PostMapping("/pager")
|
||||
public Page<PoliceUnitPagerVo> pager(@RequestBody PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) {
|
||||
return policeUnitService.pager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "公安单位下的企事业单位分页")
|
||||
@PostMapping("/policeEnterprisesUnitPager")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
|
||||
public Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(@RequestBody PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
|
||||
return policeUnitService.policeEnterprisesUnitPager(queryParams);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
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.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();
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
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 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
|
||||
* @desc SecurityUnitController...
|
||||
*/
|
||||
@Tag(name = "单位-保安")
|
||||
@JsonBody
|
||||
@RequestMapping("/securityUnit")
|
||||
public class SecurityUnitController {
|
||||
|
||||
@Autowired
|
||||
private SecurityUnitService securityUnitService;
|
||||
|
||||
@Operation(summary = "分页查询")
|
||||
@PostMapping("/pager")
|
||||
public Page<SecurityUnitPagerVo> pager(@RequestBody PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
|
||||
return securityUnitService.pager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增或修改")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public void saveOrUpdate(@RequestBody @Valid SecurityUnitSaveOrUpdateParams params) {
|
||||
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.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);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,10 +3,7 @@ package com.changhu.module.management.enums.handler;
|
|||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.changhu.common.db.enums.CheckStatus;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.Sex;
|
||||
import com.changhu.common.db.enums.*;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
|
@ -15,6 +12,8 @@ import com.changhu.module.management.pojo.entity.PoliceUnit;
|
|||
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
|
||||
import com.changhu.module.management.service.ManagementPoliceUnitUserService;
|
||||
import com.changhu.module.management.service.PoliceUnitService;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.miniProgram.service.MiniProgramUserService;
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
@ -35,6 +34,8 @@ public class PoliceUnitTypeHandler extends AbstractUnitTypeHandler {
|
|||
|
||||
private final ManagementPoliceUnitUserService policeUnitUserService = SpringUtil.getBean(ManagementPoliceUnitUserService.class);
|
||||
|
||||
private final MiniProgramUserService miniProgramUserService = SpringUtil.getBean(MiniProgramUserService.class);
|
||||
|
||||
@Override
|
||||
public void pass(Long checkDataId) {
|
||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||
|
@ -127,11 +128,36 @@ public class PoliceUnitTypeHandler extends AbstractUnitTypeHandler {
|
|||
|
||||
@Override
|
||||
public void passMiniProgramUser(Long miniProgramUserId) {
|
||||
|
||||
boolean update = miniProgramUserService.lambdaUpdate()
|
||||
.set(MiniProgramUser::getCheckStatus, CheckStatus.checked)
|
||||
.eq(BaseEntity::getSnowFlakeId, miniProgramUserId)
|
||||
.eq(MiniProgramUser::getIdentity, MiniProgramUserIdentity.POLICE)
|
||||
.update();
|
||||
if (!update) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableOrEnableMiniProgramUser(Long miniProgramUserId) {
|
||||
MiniProgramUser miniProgramUser = miniProgramUserService.lambdaQuery()
|
||||
.eq(BaseEntity::getSnowFlakeId, miniProgramUserId)
|
||||
.eq(MiniProgramUser::getIdentity, MiniProgramUserIdentity.POLICE)
|
||||
.oneOpt()
|
||||
.orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
|
||||
|
||||
//取反
|
||||
IsEnable isEnable = switch (miniProgramUser.getIsEnable()) {
|
||||
case TRUE -> IsEnable.FALSE;
|
||||
case FALSE -> IsEnable.TRUE;
|
||||
};
|
||||
|
||||
boolean update = miniProgramUserService.lambdaUpdate()
|
||||
.set(MiniProgramUser::getIsEnable, isEnable)
|
||||
.eq(BaseEntity::getSnowFlakeId, miniProgramUserId)
|
||||
.update();
|
||||
if (!update) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ package com.changhu.module.management.enums.handler;
|
|||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.changhu.common.db.enums.CheckStatus;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.Sex;
|
||||
import com.changhu.common.db.enums.*;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
|
@ -135,6 +132,7 @@ public class SecurityUnitTypeHandler extends AbstractUnitTypeHandler {
|
|||
boolean update = miniProgramUserService.lambdaUpdate()
|
||||
.set(MiniProgramUser::getCheckStatus, CheckStatus.checked)
|
||||
.eq(BaseEntity::getSnowFlakeId, miniProgramUserId)
|
||||
.eq(MiniProgramUser::getIdentity, MiniProgramUserIdentity.PROJECT_MANAGER)
|
||||
.update();
|
||||
if (!update) {
|
||||
throw new MessageException();
|
||||
|
@ -145,6 +143,7 @@ public class SecurityUnitTypeHandler extends AbstractUnitTypeHandler {
|
|||
public void disableOrEnableMiniProgramUser(Long miniProgramUserId) {
|
||||
MiniProgramUser miniProgramUser = miniProgramUserService.lambdaQuery()
|
||||
.eq(BaseEntity::getSnowFlakeId, miniProgramUserId)
|
||||
.eq(MiniProgramUser::getIdentity, MiniProgramUserIdentity.PROJECT_MANAGER)
|
||||
.oneOpt()
|
||||
.orElseThrow(() -> new MessageException(ResultCode.DATA_NOT_FOUND));
|
||||
|
||||
|
|
|
@ -5,9 +5,12 @@ 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 org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* service_project (服务项目) 固化类
|
||||
* author: luozhun
|
||||
|
@ -25,4 +28,12 @@ public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
|
|||
*/
|
||||
Page<ServiceProjectPagerVo> pager(@Param("page") Page<ServiceProjectPagerVo> page,
|
||||
@Param("params") ServiceProjectPagerQueryParams params);
|
||||
|
||||
/**
|
||||
* 获取服务项目
|
||||
*
|
||||
* @return 服务项目列表
|
||||
*/
|
||||
List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId,
|
||||
@Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId);
|
||||
}
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
package com.changhu.module.management.pojo.params;
|
||||
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.module.management.pojo.model.LegalPersonInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/8/30 下午3:07
|
||||
* @desc SecurityUnitSaveOrUpdateParams...
|
||||
*/
|
||||
@Data
|
||||
public class SecurityUnitSaveOrUpdateParams {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
@NotBlank(message = "名字不能为空")
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "社会编码不能为空")
|
||||
@Schema(description = "社会编码")
|
||||
private String socialCode;
|
||||
|
||||
@NotBlank(message = "营业执照不能为空")
|
||||
@Schema(description = "营业执照")
|
||||
private String businessLicense;
|
||||
|
||||
@NotBlank(message = "法人信息不能为空")
|
||||
@Schema(description = "法人信息")
|
||||
private LegalPersonInfo legalPersonInfo;
|
||||
|
||||
@NotBlank(message = "公司性质不能为空")
|
||||
@Schema(description = "性质")
|
||||
private String nature;
|
||||
|
||||
@NotEmpty(message = "行政区划不能为空")
|
||||
@Schema(description = "行政区划编码")
|
||||
private List<String> administrativeDivisionCodes;
|
||||
|
||||
@NotBlank(message = "详细地址不能为空")
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private IsEnable isEnable;
|
||||
}
|
|
@ -1,12 +1,7 @@
|
|||
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.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.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
/**
|
||||
* management_police_user (后台-公安单位用户表) 服务类
|
||||
|
@ -15,25 +10,4 @@ import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
|||
*/
|
||||
public interface ManagementPoliceUnitUserService extends IService<ManagementPoliceUnitUser> {
|
||||
|
||||
/**
|
||||
* 新增或者保持
|
||||
*
|
||||
* @param params 参数
|
||||
*/
|
||||
void saveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<ManagementPoliceUnitUserPagerVo> pager(PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
*
|
||||
* @param managementPoliceUnitUserId 后台公安用户id
|
||||
*/
|
||||
void deleteById(Long managementPoliceUnitUserId);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
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.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.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
/**
|
||||
* management_security_unit_user (后台-保安单位用户表) 服务类
|
||||
|
@ -15,25 +10,4 @@ import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
|||
*/
|
||||
public interface ManagementSecurityUnitUserService extends IService<ManagementSecurityUnitUser> {
|
||||
|
||||
/**
|
||||
* 新增或者修改
|
||||
*
|
||||
* @param saveOrUpdateParams 参数
|
||||
*/
|
||||
void saveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<ManagementSecurityUnitUserPagerVo> pager(PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
*
|
||||
* @param managementSecurityUnitUserId 后台保安用户id
|
||||
*/
|
||||
void deleteById(Long managementSecurityUnitUserId);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.changhu.module.management.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.module.management.pojo.entity.ManagementSuperUser;
|
||||
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
|
||||
|
||||
/**
|
||||
* management_super_user (后台-超级后台) 服务类
|
||||
|
@ -11,10 +10,4 @@ import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdate
|
|||
*/
|
||||
public interface ManagementSuperUserService extends IService<ManagementSuperUser> {
|
||||
|
||||
/**
|
||||
* 新增或保存
|
||||
*
|
||||
* @param params 参数
|
||||
*/
|
||||
void saveOrUpdate(ManagementSuperUserSaveOrUpdateParams params);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
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.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
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);
|
||||
|
||||
/**
|
||||
* 公安单位下的企事业单位分页
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams);
|
||||
}
|
|
@ -1,13 +1,7 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* police_unit (公安单位) 服务类
|
||||
|
@ -16,19 +10,5 @@ import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
|||
*/
|
||||
public interface PoliceUnitService extends IService<PoliceUnit> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<PoliceUnitPagerVo> pager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 公安单位下的企事业单位分页
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
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();
|
||||
}
|
|
@ -1,15 +1,7 @@
|
|||
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 (保安单位) 服务类
|
||||
|
@ -18,25 +10,4 @@ import java.util.List;
|
|||
*/
|
||||
public interface SecurityUnitService extends IService<SecurityUnit> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<SecurityUnitPagerVo> pager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 新增或修改保安单位
|
||||
*
|
||||
* @param params 参数
|
||||
*/
|
||||
void saveOrUpdate(SecurityUnitSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 查询单位下的项目经理
|
||||
*
|
||||
* @return 项目经理
|
||||
*/
|
||||
List<SelectNodeVo<Long>> listProjectManager();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
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);
|
||||
}
|
|
@ -1,25 +1,11 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
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.ManagementPoliceUnitUserService;
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* management_police_user (后台-公安单位用户表) 服务实现类
|
||||
|
@ -29,58 +15,4 @@ import java.util.List;
|
|||
@Service
|
||||
public class ManagementPoliceUnitUserServiceImpl extends ServiceImpl<ManagementPoliceUnitUserMapper, ManagementPoliceUnitUser> implements ManagementPoliceUnitUserService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
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) {
|
||||
throw new MessageException("该手机号已存在");
|
||||
}
|
||||
ManagementPoliceUnitUser managementPoliceUnitUser = BeanUtil.copyProperties(params, ManagementPoliceUnitUser.class);
|
||||
//新增 补全信息
|
||||
if (managementPoliceUnitUser.getSnowFlakeId() == null) {
|
||||
String account = RandomUtil.randomString(6);
|
||||
boolean accExits = this.lambdaQuery().eq(ManagementPoliceUnitUser::getAccount, account).exists();
|
||||
if (accExits) {
|
||||
throw new MessageException("生成的账号已存在 请重新提交生成");
|
||||
}
|
||||
//生成账号
|
||||
managementPoliceUnitUser.setAccount(account);
|
||||
//补全单位
|
||||
managementPoliceUnitUser.setPoliceUnitId(UserUtil.getUnitId());
|
||||
//生成密码
|
||||
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
|
||||
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
|
||||
managementPoliceUnitUser.setSalt(saltAndPassWord.get(0));
|
||||
managementPoliceUnitUser.setPassword(saltAndPassWord.get(1));
|
||||
}
|
||||
this.saveOrUpdate(managementPoliceUnitUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ManagementPoliceUnitUserPagerVo> pager(PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams) {
|
||||
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long managementPoliceUnitUserId) {
|
||||
Long unitId = UserUtil.getUnitId();
|
||||
Long l = this.lambdaQuery()
|
||||
.eq(BaseEntity::getSnowFlakeId, managementPoliceUnitUserId)
|
||||
.oneOpt()
|
||||
.map(ManagementPoliceUnitUser::getPoliceUnitId)
|
||||
.orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND));
|
||||
if (!unitId.equals(l)) {
|
||||
throw new MessageException("单位不匹配,无权操作");
|
||||
}
|
||||
boolean b = this.removeById(managementPoliceUnitUserId);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,10 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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;
|
||||
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.ManagementSecurityUnitUserService;
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* management_security_unit_user (后台-保安单位用户表) 服务实现类
|
||||
|
@ -30,63 +14,4 @@ import java.util.List;
|
|||
@Service
|
||||
public class ManagementSecurityUnitUserServiceImpl extends ServiceImpl<ManagementSecurityUnitUserMapper, ManagementSecurityUnitUser> implements ManagementSecurityUnitUserService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
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) {
|
||||
throw new MessageException("该手机号已存在");
|
||||
}
|
||||
|
||||
ManagementSecurityUnitUser managementSecurityUnitUser = BeanUtil.copyProperties(saveOrUpdateParams, ManagementSecurityUnitUser.class);
|
||||
//新增 需要补全一些信息
|
||||
if (managementSecurityUnitUser.getSnowFlakeId() == null) {
|
||||
String account = RandomUtil.randomString(6);
|
||||
boolean accExits = this.lambdaQuery()
|
||||
.eq(ManagementSecurityUnitUser::getAccount, account)
|
||||
.exists();
|
||||
if (accExits) {
|
||||
throw new MessageException("生成的账号已存在 请重新提交生成");
|
||||
}
|
||||
//生成账号
|
||||
managementSecurityUnitUser.setAccount(account);
|
||||
if (!UserType.MANAGEMENT_SECURITY.equals(UserUtil.getUserType())) {
|
||||
throw new MessageException("客户端类型不对");
|
||||
}
|
||||
//补全单位
|
||||
managementSecurityUnitUser.setSecurityUnitId(UserUtil.getUnitId());
|
||||
//生成密码
|
||||
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
|
||||
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
|
||||
managementSecurityUnitUser.setSalt(saltAndPassWord.get(0));
|
||||
managementSecurityUnitUser.setPassword(saltAndPassWord.get(1));
|
||||
}
|
||||
this.saveOrUpdate(managementSecurityUnitUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ManagementSecurityUnitUserPagerVo> pager(PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams) {
|
||||
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long managementSecurityUnitUserId) {
|
||||
Long unitId = UserUtil.getUnitId();
|
||||
Long l = this.lambdaQuery()
|
||||
.eq(BaseEntity::getSnowFlakeId, managementSecurityUnitUserId)
|
||||
.oneOpt()
|
||||
.map(ManagementSecurityUnitUser::getSecurityUnitId)
|
||||
.orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND));
|
||||
if (!unitId.equals(l)) {
|
||||
throw new MessageException("单位不匹配,无权操作");
|
||||
}
|
||||
boolean b = this.removeById(managementSecurityUnitUserId);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.management.mapper.ManagementSuperUserMapper;
|
||||
import com.changhu.module.management.pojo.entity.ManagementSuperUser;
|
||||
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.service.ManagementSuperUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* management_super_user (后台-超级后台) 服务实现类
|
||||
* author: luozhun
|
||||
|
@ -22,36 +14,4 @@ import java.util.List;
|
|||
@Service
|
||||
public class ManagementSuperUserServiceImpl extends ServiceImpl<ManagementSuperUserMapper, ManagementSuperUser> implements ManagementSuperUserService {
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(ManagementSuperUserSaveOrUpdateParams params) {
|
||||
//查看手机号是否存在
|
||||
boolean exists = this.lambdaQuery()
|
||||
.eq(ManagementSuperUser::getTelephone, params.getTelephone())
|
||||
.exists();
|
||||
if (exists) {
|
||||
throw new MessageException("手机号已注册");
|
||||
}
|
||||
|
||||
//构建用户
|
||||
ManagementSuperUser managementSuperUser = ManagementSuperUser.builder()
|
||||
.snowFlakeId(params.getSnowFlakeId())
|
||||
.name(params.getName())
|
||||
.telephone(params.getTelephone())
|
||||
.build();
|
||||
|
||||
//如果是新增需要初始化密码
|
||||
if (managementSuperUser.getSnowFlakeId() == null) {
|
||||
//生成加密密码: salt$$uuid
|
||||
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
|
||||
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
|
||||
if (CollUtil.size(saltAndPassWord) != 2) {
|
||||
throw new MessageException(ResultCode.ERROR);
|
||||
}
|
||||
managementSuperUser.setSalt(saltAndPassWord.get(0));
|
||||
managementSuperUser.setPassword(saltAndPassWord.get(1));
|
||||
}
|
||||
|
||||
//保存到数据库
|
||||
this.saveOrUpdate(managementSuperUser);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.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.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.service.PoliceService;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/11 上午9:59
|
||||
* @desc MPoliceServiceImpl...
|
||||
*/
|
||||
@Service
|
||||
public class PoliceServiceImpl implements PoliceService {
|
||||
|
||||
@Autowired
|
||||
private ManagementPoliceUnitUserMapper managementPoliceUnitUserMapper;
|
||||
|
||||
@Autowired
|
||||
private EnterprisesUnitMapper enterprisesUnitMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void userSaveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params) {
|
||||
//查看手机号是否存在
|
||||
boolean exists = Db.lambdaQuery(ManagementPoliceUnitUser.class)
|
||||
.ne(params.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, params.getSnowFlakeId())
|
||||
.eq(ManagementPoliceUnitUser::getTelephone, params.getTelephone())
|
||||
.exists();
|
||||
if (exists) {
|
||||
throw new MessageException("该手机号已存在");
|
||||
}
|
||||
ManagementPoliceUnitUser managementPoliceUnitUser = BeanUtil.copyProperties(params, ManagementPoliceUnitUser.class);
|
||||
//新增 补全信息
|
||||
if (managementPoliceUnitUser.getSnowFlakeId() == null) {
|
||||
String account = RandomUtil.randomString(6);
|
||||
boolean accExits = Db.lambdaQuery(ManagementPoliceUnitUser.class).eq(ManagementPoliceUnitUser::getAccount, account).exists();
|
||||
if (accExits) {
|
||||
throw new MessageException("生成的账号已存在 请重新提交生成");
|
||||
}
|
||||
//生成账号
|
||||
managementPoliceUnitUser.setAccount(account);
|
||||
//补全单位
|
||||
managementPoliceUnitUser.setPoliceUnitId(UserUtil.getUnitId());
|
||||
//生成密码
|
||||
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
|
||||
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
|
||||
managementPoliceUnitUser.setSalt(saltAndPassWord.get(0));
|
||||
managementPoliceUnitUser.setPassword(saltAndPassWord.get(1));
|
||||
}
|
||||
Db.saveOrUpdate(managementPoliceUnitUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ManagementPoliceUnitUserPagerVo> userPager(PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams) {
|
||||
return managementPoliceUnitUserMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userDeleteById(Long managementPoliceUnitUserId) {
|
||||
Long unitId = UserUtil.getUnitId();
|
||||
Long l = Db.lambdaQuery(ManagementPoliceUnitUser.class)
|
||||
.eq(BaseEntity::getSnowFlakeId, managementPoliceUnitUserId)
|
||||
.oneOpt()
|
||||
.map(ManagementPoliceUnitUser::getPoliceUnitId)
|
||||
.orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND));
|
||||
if (!unitId.equals(l)) {
|
||||
throw new MessageException("单位不匹配,无权操作");
|
||||
}
|
||||
boolean b = Db.removeById(managementPoliceUnitUserId, ManagementPoliceUnitUser.class);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
|
||||
return enterprisesUnitMapper.policeEnterprisesUnitPager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
}
|
|
@ -1,17 +1,9 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
|
@ -22,16 +14,4 @@ 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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
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 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.annotation.UserType;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
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.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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/11 上午10:17
|
||||
* @desc SecurityServiceImpl...
|
||||
*/
|
||||
@Service
|
||||
public class SecurityServiceImpl implements SecurityService {
|
||||
|
||||
@Autowired
|
||||
private ManagementSecurityUnitUserMapper managementSecurityUnitUserMapper;
|
||||
|
||||
@Autowired
|
||||
private MiniProgramUserMapper miniProgramUserMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void userSaveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
|
||||
//查看手机号是否已存在
|
||||
boolean exists = Db.lambdaQuery(ManagementSecurityUnitUser.class)
|
||||
.ne(saveOrUpdateParams.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, saveOrUpdateParams.getSnowFlakeId())
|
||||
.eq(ManagementSecurityUnitUser::getTelephone, saveOrUpdateParams.getTelephone())
|
||||
.exists();
|
||||
if (exists) {
|
||||
throw new MessageException("该手机号已存在");
|
||||
}
|
||||
|
||||
ManagementSecurityUnitUser managementSecurityUnitUser = BeanUtil.copyProperties(saveOrUpdateParams, ManagementSecurityUnitUser.class);
|
||||
//新增 需要补全一些信息
|
||||
if (managementSecurityUnitUser.getSnowFlakeId() == null) {
|
||||
String account = RandomUtil.randomString(6);
|
||||
boolean accExits = Db.lambdaQuery(ManagementSecurityUnitUser.class)
|
||||
.eq(ManagementSecurityUnitUser::getAccount, account)
|
||||
.exists();
|
||||
if (accExits) {
|
||||
throw new MessageException("生成的账号已存在 请重新提交生成");
|
||||
}
|
||||
//生成账号
|
||||
managementSecurityUnitUser.setAccount(account);
|
||||
if (!UserType.MANAGEMENT_SECURITY.equals(UserUtil.getUserType())) {
|
||||
throw new MessageException("客户端类型不对");
|
||||
}
|
||||
//补全单位
|
||||
managementSecurityUnitUser.setSecurityUnitId(UserUtil.getUnitId());
|
||||
//生成密码
|
||||
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
|
||||
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
|
||||
managementSecurityUnitUser.setSalt(saltAndPassWord.get(0));
|
||||
managementSecurityUnitUser.setPassword(saltAndPassWord.get(1));
|
||||
}
|
||||
Db.saveOrUpdate(managementSecurityUnitUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ManagementSecurityUnitUserPagerVo> userPager(PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams) {
|
||||
return managementSecurityUnitUserMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userDeleteById(Long managementSecurityUnitUserId) {
|
||||
Long unitId = UserUtil.getUnitId();
|
||||
Long l = Db.lambdaQuery(ManagementSecurityUnitUser.class)
|
||||
.eq(BaseEntity::getSnowFlakeId, managementSecurityUnitUserId)
|
||||
.oneOpt()
|
||||
.map(ManagementSecurityUnitUser::getSecurityUnitId)
|
||||
.orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND));
|
||||
if (!unitId.equals(l)) {
|
||||
throw new MessageException("单位不匹配,无权操作");
|
||||
}
|
||||
boolean b = Db.removeById(managementSecurityUnitUserId, ManagementSecurityUnitUser.class);
|
||||
if (!b) {
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -1,30 +1,11 @@
|
|||
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.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.management.mapper.SecurityUnitMapper;
|
||||
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.module.miniProgram.mapper.MiniProgramUserMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
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;
|
||||
|
||||
/**
|
||||
* security_unit (保安单位) 服务实现类
|
||||
* author: luozhun
|
||||
|
@ -33,53 +14,4 @@ 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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(SecurityUnitSaveOrUpdateParams params) {
|
||||
SecurityUnit securityUnit = BeanUtil.copyProperties(params, SecurityUnit.class);
|
||||
Optional.ofNullable(params.getAdministrativeDivisionCodes())
|
||||
.ifPresent(codes -> {
|
||||
if (!codes.isEmpty()) {
|
||||
securityUnit.setProvince(codes.get(0));
|
||||
}
|
||||
if (codes.size() >= 2) {
|
||||
securityUnit.setCity(codes.get(1));
|
||||
}
|
||||
if (codes.size() >= 3) {
|
||||
securityUnit.setDistricts(codes.get(2));
|
||||
}
|
||||
if (codes.size() >= 4) {
|
||||
securityUnit.setStreet(codes.get(3));
|
||||
}
|
||||
});
|
||||
this.saveOrUpdate(securityUnit);
|
||||
}
|
||||
|
||||
@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,81 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.PoliceUnitMapper;
|
||||
import com.changhu.module.management.mapper.SecurityUnitMapper;
|
||||
import com.changhu.module.management.pojo.entity.ManagementSuperUser;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/11 上午9:52
|
||||
* @desc SuperServiceImpl...
|
||||
*/
|
||||
@Service
|
||||
public class SuperServiceImpl implements SuperService {
|
||||
|
||||
@Autowired
|
||||
private PoliceUnitMapper policeUnitMapper;
|
||||
|
||||
@Autowired
|
||||
private SecurityUnitMapper securityUnitMapper;
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateUser(ManagementSuperUserSaveOrUpdateParams params) {
|
||||
//查看手机号是否存在
|
||||
boolean exists = Db.lambdaQuery(ManagementSuperUser.class)
|
||||
.eq(ManagementSuperUser::getTelephone, params.getTelephone())
|
||||
.exists();
|
||||
if (exists) {
|
||||
throw new MessageException("手机号已注册");
|
||||
}
|
||||
|
||||
//构建用户
|
||||
ManagementSuperUser managementSuperUser = ManagementSuperUser.builder()
|
||||
.snowFlakeId(params.getSnowFlakeId())
|
||||
.name(params.getName())
|
||||
.telephone(params.getTelephone())
|
||||
.build();
|
||||
|
||||
//如果是新增需要初始化密码
|
||||
if (managementSuperUser.getSnowFlakeId() == null) {
|
||||
//生成加密密码: salt$$uuid
|
||||
String passWordEncrypt = UserUtil.passWordEncrypt(UserUtil.DEFAULT_PASSWORD);
|
||||
List<String> saltAndPassWord = StrUtil.split(passWordEncrypt, "$$");
|
||||
if (CollUtil.size(saltAndPassWord) != 2) {
|
||||
throw new MessageException(ResultCode.ERROR);
|
||||
}
|
||||
managementSuperUser.setSalt(saltAndPassWord.get(0));
|
||||
managementSuperUser.setPassword(saltAndPassWord.get(1));
|
||||
}
|
||||
|
||||
//保存到数据库
|
||||
Db.saveOrUpdate(managementSuperUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PoliceUnitPagerVo> policeUnitPager(PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) {
|
||||
return policeUnitMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SecurityUnitPagerVo> securityUnitPager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
|
||||
return securityUnitMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.changhu.module.miniProgram.controller;
|
||||
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
import com.changhu.module.miniProgram.service.MiniProgramUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -27,7 +26,7 @@ public class MiniProgramUserController {
|
|||
|
||||
@Operation(summary = "注册")
|
||||
@PostMapping("/register")
|
||||
public TokenInfo register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
|
||||
return miniProgramUserService.register(params);
|
||||
public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
|
||||
miniProgramUserService.register(params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
import com.changhu.module.miniProgram.service.MPoliceService;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/11 上午10:44
|
||||
* @desc PoliceIndexController...
|
||||
*/
|
||||
@Tag(name = "公安人员首页")
|
||||
@JsonBody
|
||||
@RequestMapping("/policeIndex")
|
||||
public class PoliceIndexController {
|
||||
|
||||
@Autowired
|
||||
private MPoliceService policeIndexService;
|
||||
|
||||
@Operation(summary = "获取单位内的服务项目")
|
||||
@GetMapping("/getUnitServiceProjectList")
|
||||
@CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE)
|
||||
public List<IndexServiceProjectListVo> getUnitServiceProjectList() {
|
||||
return policeIndexService.getUnitServiceProjectList();
|
||||
}
|
||||
}
|
|
@ -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.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.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/10 下午3:48
|
||||
* @desc 项目经理首页控制器
|
||||
*/
|
||||
@Tag(name = "项目经理首页")
|
||||
@JsonBody
|
||||
@RequestMapping("/projectManageIndex")
|
||||
public class ProjectManageIndexController {
|
||||
|
||||
@Autowired
|
||||
private ProjectManageIndexService projectManageIndexService;
|
||||
|
||||
@Operation(summary = "获取我的服务项目")
|
||||
@GetMapping("/getMyServiceProject")
|
||||
@CheckUserType(userTypes = UserType.MINI_PROGRAM_PROJECT_MANAGE)
|
||||
public List<IndexServiceProjectListVo> getMyServiceProjectList() {
|
||||
return projectManageIndexService.getMyServiceProjectList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.changhu.module.miniProgram.pojo.vo;
|
||||
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.ServiceProjectType;
|
||||
import com.changhu.module.management.pojo.model.ContactPersonInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/10 下午3:55
|
||||
* @desc 首页服务项目列表
|
||||
*/
|
||||
@Data
|
||||
public class IndexServiceProjectListVo {
|
||||
|
||||
@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 List<ServiceProjectVo> serviceProjectList;
|
||||
|
||||
@Data
|
||||
static class ServiceProjectVo {
|
||||
@Schema(description = "服务项目id")
|
||||
private Long snowFlakeId;
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/11 上午10:52
|
||||
* @desc MPoliceService...
|
||||
*/
|
||||
public interface MPoliceService {
|
||||
/**
|
||||
* 获取单位内的服务项目
|
||||
*
|
||||
* @return 服务项目
|
||||
*/
|
||||
List<IndexServiceProjectListVo> getUnitServiceProjectList();
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
|
||||
|
@ -17,5 +16,5 @@ public interface MiniProgramUserService extends IService<MiniProgramUser> {
|
|||
*
|
||||
* @param params 参数
|
||||
*/
|
||||
TokenInfo register(MiniProgramUserRegisterParams params);
|
||||
void register(MiniProgramUserRegisterParams params);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/10 下午3:49
|
||||
* @desc ProjectManageIndexService...
|
||||
*/
|
||||
public interface ProjectManageIndexService {
|
||||
/**
|
||||
* 获取我的服务项目
|
||||
*
|
||||
* @return 服务项目列表
|
||||
*/
|
||||
List<IndexServiceProjectListVo> getMyServiceProjectList();
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.changhu.module.miniProgram.service.impl;
|
||||
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.management.mapper.ServiceProjectMapper;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
import com.changhu.module.miniProgram.service.MPoliceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/11 上午10:53
|
||||
* @desc MPoliceServiceImpl...
|
||||
*/
|
||||
@Service
|
||||
public class MPoliceServiceImpl implements MPoliceService {
|
||||
|
||||
@Autowired
|
||||
private ServiceProjectMapper serviceProjectMapper;
|
||||
|
||||
@Override
|
||||
public List<IndexServiceProjectListVo> getUnitServiceProjectList() {
|
||||
return serviceProjectMapper.getServiceProjectList(UserUtil.getUnitId(), null);
|
||||
}
|
||||
}
|
|
@ -2,15 +2,11 @@ package com.changhu.module.miniProgram.service.impl;
|
|||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
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.annotation.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
import com.changhu.common.utils.SnowFlakeIdUtil;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
|
||||
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
|
||||
|
@ -31,7 +27,7 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
|
|||
private WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public TokenInfo register(MiniProgramUserRegisterParams params) {
|
||||
public void register(MiniProgramUserRegisterParams params) {
|
||||
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
|
||||
try {
|
||||
WxMaJscode2SessionResult sessionInfo = wxMaService.getUserService().getSessionInfo(params.getCode());
|
||||
|
@ -50,9 +46,5 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
|
|||
if (!save) {
|
||||
throw new MessageException();
|
||||
}
|
||||
|
||||
//登录
|
||||
SaTokenInfo saTokenInfo = UserUtil.loginAndTokenInfo(userId, UserType.MINI_PROGRAM_PROJECT_MANAGE, miniProgramUser.getUnitId());
|
||||
return new TokenInfo(saTokenInfo.getTokenName(), saTokenInfo.getTokenValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.changhu.module.miniProgram.service.impl;
|
||||
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.management.mapper.ServiceProjectMapper;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/10 下午3:50
|
||||
* @desc ProjectManageIndexServiceImpl...
|
||||
*/
|
||||
@Service
|
||||
public class ProjectManageIndexServiceImpl implements ProjectManageIndexService {
|
||||
|
||||
@Autowired
|
||||
private ServiceProjectMapper serviceProjectMapper;
|
||||
|
||||
@Override
|
||||
public List<IndexServiceProjectListVo> getMyServiceProjectList() {
|
||||
return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId());
|
||||
}
|
||||
}
|
|
@ -41,7 +41,6 @@ public class SecurityUnitRegisterParams {
|
|||
@Schema(description = "行政区划编码")
|
||||
private List<String> administrativeDivisionCodes;
|
||||
|
||||
@NotBlank(message = "详细地址不能为空")
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
}
|
||||
|
|
|
@ -16,4 +16,9 @@ public interface LoginService {
|
|||
* @return token
|
||||
*/
|
||||
TokenInfo login(LoginParams loginParams);
|
||||
|
||||
/**
|
||||
* 登出
|
||||
*/
|
||||
void logout();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.changhu.service.impl;
|
||||
|
||||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.pojo.params.LoginParams;
|
||||
import com.changhu.service.LoginService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -18,4 +19,9 @@ public class LoginServiceImpl implements LoginService {
|
|||
.getLoginHandler()
|
||||
.login(loginParams.getLoginParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logout() {
|
||||
UserUtil.logout();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,52 @@
|
|||
</if>
|
||||
order by sp.create_time desc
|
||||
</select>
|
||||
<resultMap id="ProjectManageServiceProjectListVoResultMap"
|
||||
type="com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo">
|
||||
<result
|
||||
column="contact_person_info"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
|
||||
property="contactPersonInfo"/>
|
||||
<result
|
||||
column="service_project_list"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
|
||||
property="serviceProjectList"/>
|
||||
</resultMap>
|
||||
<select id="getServiceProjectList"
|
||||
resultMap="ProjectManageServiceProjectListVoResultMap">
|
||||
select eu.*,
|
||||
ad1.name as 'provinceName',
|
||||
ad2.name as 'cityName',
|
||||
ad3.name as 'districtsName',
|
||||
ad4.name as 'streetName',
|
||||
JSON_ARRAYAGG(JSON_OBJECT(
|
||||
'snowFlakeId', sp.snow_flake_id,
|
||||
'name', sp.name,
|
||||
'type', sp.type,
|
||||
'isRecruitSecurity', sp.is_recruit_security,
|
||||
'idNumber', sp.id_number,
|
||||
'serviceArea', sp.service_area,
|
||||
'buildingTotal', sp.building_total,
|
||||
'houseTotal', sp.house_total,
|
||||
'staffTotal', sp.staff_total,
|
||||
'securityUserTotal', sp.security_user_total,
|
||||
'remark', sp.remark)) as 'service_project_list'
|
||||
from enterprises_unit eu
|
||||
join service_project sp on eu.snow_flake_id = sp.enterprises_unit_id and sp.delete_flag = 0
|
||||
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
|
||||
<choose>
|
||||
<when test="policeUnitId!=null">
|
||||
and eu.police_unit_id = #{policeUnitId}
|
||||
</when>
|
||||
<otherwise>
|
||||
and sp.project_manager_mini_program_user_id = #{projectManagerMiniProgramUserId}
|
||||
</otherwise>
|
||||
</choose>
|
||||
group by eu.snow_flake_id
|
||||
order by any_value(sp.create_time) desc;
|
||||
</select>
|
||||
</mapper>
|
|
@ -32,7 +32,7 @@ type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams
|
|||
const {administrativeDivisionTree} = useSelectAndTreeNodeVos('administrativeDivisionTree')
|
||||
|
||||
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/policeUnit/pager', params)
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/management/super/policeUnit/pager', params)
|
||||
const columns: TableProps['columns'] = [
|
||||
{
|
||||
dataIndex: 'name',
|
||||
|
@ -140,8 +140,7 @@ const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
|
|||
const saveOrUpdateEnterprisesUnit = (data?: EnterprisesUnitSaveOrUpdateParams & {
|
||||
contactPersonInfoName?: string;
|
||||
contactPersonInfoTelephone?: string
|
||||
}) => {
|
||||
submitSimpleFormModal<EnterprisesUnitSaveOrUpdateParams & {
|
||||
}) => submitSimpleFormModal<EnterprisesUnitSaveOrUpdateParams & {
|
||||
contactPersonInfoName?: string;
|
||||
contactPersonInfoTelephone?: string
|
||||
}>({
|
||||
|
@ -189,7 +188,6 @@ const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
|
|||
await _tableRef.value?.requestGetTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
|
||||
const _columns: _TableProps['columns'] = [
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ import {UNIT_TYPE} from "@/config";
|
|||
type TableProps = TableProMaxProps<SecurityUnitPagerVo, SecurityUnitPagerQueryParams>
|
||||
|
||||
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/securityUnit/pager', params)
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/management/super/securityUnit/pager', params)
|
||||
const columns: TableProps['columns'] = [
|
||||
{
|
||||
dataIndex: 'name',
|
||||
|
|
Loading…
Reference in New Issue