feat(module): 新增公安后台企事业单位功能
- 新增企事业单位下服务项目列表接口 - 实现服务项目新增、编辑和删除功能 - 添加保安人员新增、编辑和删除功能 -集成保安协会接口,实现身份证查询保安证功能 - 优化单位和用户选择接口
This commit is contained in:
parent
ca06b59e55
commit
f5f9212a88
|
@ -17,4 +17,8 @@ public class CreateOrUpdateUser {
|
|||
private String name;
|
||||
@Schema(description = "用户类型")
|
||||
private UserType type;
|
||||
@Schema(description = "单位id")
|
||||
private Long unitId;
|
||||
@Schema(description = "单位名字")
|
||||
private String unitName;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.changhu.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.changhu.common.annotation.IsWhiteList;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.cache.GlobalCacheManager;
|
||||
|
@ -94,4 +95,10 @@ public class CommonController {
|
|||
return enumsResult;
|
||||
}
|
||||
|
||||
@Operation(summary = "根据身份证查询保安证")
|
||||
@GetMapping("/querySecurityNumberByIdCard")
|
||||
public JSONObject querySecurityNumberByIdCard(@RequestParam @Schema(description = "身份证") String idCard) {
|
||||
return commonService.querySecurityNumberByIdCard(idCard);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.IsWhiteList;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.pojo.params.CheckStatusParams;
|
||||
import com.changhu.pojo.params.UnitDisableOrEnableParams;
|
||||
import com.changhu.pojo.vo.UnitCheckStatusVo;
|
||||
|
@ -13,13 +15,13 @@ import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
|
|||
import com.changhu.service.ManagementService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.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.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
|
@ -61,4 +63,17 @@ public class ManagementController {
|
|||
public void disableOrEnableMiniProgramUser(@RequestBody @Valid UnitDisableOrEnableParams params) {
|
||||
managementService.disableOrEnableMiniProgramUser(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "所有的保安单位列表")
|
||||
@GetMapping("/listSecurityUnit")
|
||||
public List<SelectNodeVo<Long>> listSecurityUnit() {
|
||||
return managementService.listSecurityUnit();
|
||||
}
|
||||
|
||||
@Operation(summary = "保安单位下的项目经理")
|
||||
@GetMapping("/listMinUserByUnitId")
|
||||
public List<SelectNodeVo<Long>> listMinUserByUnitId(@RequestParam @Schema(description = "保安单位id") Long securityUnitId,
|
||||
@RequestParam @Schema(description = "身份类型") MiniProgramUserIdentity identity) {
|
||||
return managementService.listMinUserByUnitId(securityUnitId, identity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.module.miniProgram.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.IsWhiteList;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
|
||||
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
|
||||
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
|
@ -39,20 +39,14 @@ public class UserController {
|
|||
|
||||
@Operation(summary = "保存或更新保安人员")
|
||||
@PostMapping("/add_security_user_upd")
|
||||
public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
|
||||
public void saveOrUpdateSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) {
|
||||
userService.saveOrUpdateSecurityUser(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除保安人员")
|
||||
@DeleteMapping("/del_security_user_id")
|
||||
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
|
||||
userService.deleteSecurityUserByServiceProjectId(securityUserId);
|
||||
}
|
||||
|
||||
@Operation(summary = "二维码表单录入保安人员")
|
||||
@PostMapping("/qrCodeFormInputSecurityUser")
|
||||
@IsWhiteList
|
||||
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
|
||||
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) {
|
||||
userService.qrCodeFormInputSecurityUser(params);
|
||||
}
|
||||
|
||||
|
@ -61,4 +55,10 @@ public class UserController {
|
|||
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
|
||||
return userService.securityUserPager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除保安人员")
|
||||
@DeleteMapping("/del_security_user_id")
|
||||
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
|
||||
userService.deleteSecurityUserById(securityUserId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import lombok.Data;
|
|||
* @desc SaveOrUpdateSecurityUserParams...
|
||||
*/
|
||||
@Data
|
||||
public class SaveOrUpdateSecurityUserParams {
|
||||
public class SecurityUserSaveOrUpdateParams {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
|
@ -27,6 +27,9 @@ public class SaveOrUpdateSecurityUserParams {
|
|||
@Schema(description = "保安单位id")
|
||||
private Long securityUnitId;
|
||||
|
||||
@Schema(description = "照片")
|
||||
private String photo;
|
||||
|
||||
@NotBlank(message = "名字不能为空")
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
@ -57,6 +60,9 @@ public class SaveOrUpdateSecurityUserParams {
|
|||
@Schema(description = "保安证号")
|
||||
private String securityNumber;
|
||||
|
||||
@Schema(description = "无证说明")
|
||||
private String noSecurityNumberDesc;
|
||||
|
||||
@Schema(description = "家庭住址")
|
||||
private String homeAddress;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.changhu.module.miniProgram.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
|
||||
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
|
||||
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
|
@ -25,14 +25,14 @@ public interface UserService {
|
|||
*
|
||||
* @param params 保安人员参数
|
||||
*/
|
||||
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
|
||||
void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 根据id删除保安人员
|
||||
* 二维码表单录入保安人员
|
||||
*
|
||||
* @param securityUserId 保安人员id
|
||||
* @param params 参数
|
||||
*/
|
||||
void deleteSecurityUserByServiceProjectId(Long securityUserId);
|
||||
void qrCodeFormInputSecurityUser(SecurityUserSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 服务项目内的保安人员分页
|
||||
|
@ -43,9 +43,9 @@ public interface UserService {
|
|||
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 二维码表单录入保安人员
|
||||
* 根据id删除保安人员
|
||||
*
|
||||
* @param params 参数
|
||||
* @param securityUserId 保安人员id
|
||||
*/
|
||||
void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params);
|
||||
void deleteSecurityUserById(Long securityUserId);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ 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.Assert;
|
||||
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.SnowFlakeIdUtil;
|
||||
import com.changhu.mapper.SecurityUserMapper;
|
||||
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
|
||||
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
|
||||
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
|
@ -56,17 +58,7 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
|
||||
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) {
|
||||
this.saveOrUpdateSecurityUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
|
||||
public void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params) {
|
||||
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
|
||||
//新增的情况
|
||||
Long snowFlakeId = securityUser.getSnowFlakeId();
|
||||
|
@ -92,17 +84,21 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
}
|
||||
}
|
||||
boolean b = Db.saveOrUpdate(securityUser);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
Assert.isTrue(Db.saveOrUpdate(securityUser), ResultCode.ERROR.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSecurityUserByServiceProjectId(Long securityUserId) {
|
||||
boolean b = Db.removeById(securityUserId, SecurityUser.class);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
}
|
||||
public void qrCodeFormInputSecurityUser(SecurityUserSaveOrUpdateParams params) {
|
||||
this.saveOrUpdateSecurityUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
|
||||
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSecurityUserById(Long securityUserId) {
|
||||
Assert.isTrue(Db.removeById(securityUserId, SecurityUser.class), ResultCode.ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
package com.changhu.module.policeManagement.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
|
||||
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
|
||||
import com.changhu.module.policeManagement.service.PoliceEnterprisesUnitService;
|
||||
import com.changhu.pojo.entity.ServiceProject;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.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/11/27 下午2:37
|
||||
* @desc EnterprisesUnitController...
|
||||
*/
|
||||
@Tag(name = "公安后台-企事业单位")
|
||||
@JsonBody
|
||||
@RequestMapping("/m2/eu")
|
||||
@RestController("policeManagementEnterprisesUnit")
|
||||
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
|
||||
public class EnterprisesUnitController {
|
||||
|
||||
@Autowired
|
||||
private PoliceEnterprisesUnitService policeEnterprisesUnitService;
|
||||
|
||||
@Operation(summary = "事业单位下服务项目列表")
|
||||
@GetMapping("/listSp")
|
||||
public List<ServiceProjectListVo> listSp(@RequestParam @Schema(description = "事业单位id") Long enterprisesUnitId) {
|
||||
return policeEnterprisesUnitService.listSp(enterprisesUnitId);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增或保存服务项目")
|
||||
@PostMapping("/add_upd_sp")
|
||||
public void saveOrUpdateSp(@RequestBody @Valid ServiceProjectSaveOrUpdateParams params) {
|
||||
policeEnterprisesUnitService.saveOrUpdateSp(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除服务项目")
|
||||
@DeleteMapping("/deleteSpById")
|
||||
public void deleteSpById(@RequestParam Long serviceProjectId) {
|
||||
Assert.isTrue(Db.removeById(serviceProjectId, ServiceProject.class), ResultCode.ERROR.getMessage());
|
||||
}
|
||||
|
||||
@Operation(summary = "新增或修改保安人员")
|
||||
@PostMapping("/add_upd_sec_user")
|
||||
public void saveOrUpdateSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) {
|
||||
policeEnterprisesUnitService.saveOrUpdateSecurityUser(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "服务项目保安人员分页")
|
||||
@PostMapping("/sec_user_pager")
|
||||
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
|
||||
return policeEnterprisesUnitService.securityUserPager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除保安人员")
|
||||
@DeleteMapping("/del_security_user_id")
|
||||
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
|
||||
policeEnterprisesUnitService.deleteSecurityUserById(securityUserId);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.changhu.module.policeManagement.mapper;
|
||||
|
||||
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/11/27 下午2:39
|
||||
* @desc PoliceEnterprisesUnitMapper...
|
||||
*/
|
||||
@Mapper
|
||||
public interface PoliceEnterprisesUnitMapper {
|
||||
|
||||
/**
|
||||
* 事业单位下的服务项目
|
||||
*/
|
||||
List<ServiceProjectListVo> listSp(@Param("unitId") Long unitId,
|
||||
@Param("enterprisesUnitId") Long enterprisesUnitId);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.changhu.module.policeManagement.pojo.params;
|
||||
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.ServiceProjectTwoType;
|
||||
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/11/27 下午3:24
|
||||
* @desc ServiceProjectSaveOrUpdateParams...
|
||||
*/
|
||||
@Data
|
||||
public class ServiceProjectSaveOrUpdateParams {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
@Schema(description = "企事业单位id")
|
||||
@NotNull(message = "企事业单位不能为空")
|
||||
private Long enterprisesUnitId;
|
||||
|
||||
@Schema(description = "保安单位id")
|
||||
@NotNull(message = "保安单位不能为空")
|
||||
private Long securityUnitId;
|
||||
|
||||
@Schema(description = "项目经理小程序用户id")
|
||||
private Long projectManagerMiniProgramUserId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
@NotNull(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "服务类型")
|
||||
@NotNull(message = "服务类型不能为空")
|
||||
private ServiceProjectType type;
|
||||
|
||||
@Schema(description = "二级类型")
|
||||
private ServiceProjectTwoType twoType;
|
||||
|
||||
@Schema(description = "外包公司名称")
|
||||
private String outsourceName;
|
||||
|
||||
@Schema(description = "是否备案")
|
||||
private IsOrNot isFiling;
|
||||
|
||||
@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,63 @@
|
|||
package com.changhu.module.policeManagement.pojo.vo;
|
||||
|
||||
import com.changhu.common.db.enums.IsOrNot;
|
||||
import com.changhu.common.db.enums.ServiceProjectTwoType;
|
||||
import com.changhu.common.db.enums.ServiceProjectType;
|
||||
import com.changhu.common.pojo.vo.CreateOrUpdateUser;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/11/27 下午2:42
|
||||
* @desc ServiceProjectListVo...
|
||||
*/
|
||||
@Data
|
||||
public class ServiceProjectListVo {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
|
||||
@Schema(description = "企事业单位id")
|
||||
private Long enterprisesUnitId;
|
||||
@Schema(description = "保安单位id")
|
||||
private Long securityUnitId;
|
||||
|
||||
@Schema(description = "项目经理小程序用户id")
|
||||
private Long projectManagerMiniProgramUserId;
|
||||
@Schema(description = "项目经理小程序用户名称")
|
||||
private String projectManagerMiniProgramUserName;
|
||||
|
||||
@Schema(description = "服务项目名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "服务类型")
|
||||
private ServiceProjectType type;
|
||||
@Schema(description = "二级类型")
|
||||
private ServiceProjectTwoType twoType;
|
||||
@Schema(description = "外包公司名称")
|
||||
private String outsourceName;
|
||||
|
||||
@Schema(description = "是否备案")
|
||||
private IsOrNot isFiling;
|
||||
@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 CreateOrUpdateUser createUserInfo;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.changhu.module.policeManagement.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
|
||||
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/11/27 下午2:38
|
||||
* @desc PoliceEnterprisesUnitService...
|
||||
*/
|
||||
public interface PoliceEnterprisesUnitService {
|
||||
/**
|
||||
* 事业单位下服务项目列表
|
||||
*
|
||||
* @param enterprisesUnitId 事业单位id
|
||||
* @return 服务项目列表
|
||||
*/
|
||||
List<ServiceProjectListVo> listSp(Long enterprisesUnitId);
|
||||
|
||||
/**
|
||||
* 新增或者保存服务项目
|
||||
*/
|
||||
void saveOrUpdateSp(ServiceProjectSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 保险人员新增或者保存
|
||||
*/
|
||||
void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params);
|
||||
|
||||
/**
|
||||
* 服务项目下的保安人员分页
|
||||
*/
|
||||
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
|
||||
|
||||
/**
|
||||
* 根据保安人员id删除人员
|
||||
*/
|
||||
void deleteSecurityUserById(Long securityUserId);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.changhu.module.policeManagement.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
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.utils.UserUtil;
|
||||
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
|
||||
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
|
||||
import com.changhu.module.miniProgram.service.UserService;
|
||||
import com.changhu.module.policeManagement.mapper.PoliceEnterprisesUnitMapper;
|
||||
import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
|
||||
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
|
||||
import com.changhu.module.policeManagement.service.PoliceEnterprisesUnitService;
|
||||
import com.changhu.pojo.entity.ServiceProject;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/11/27 下午2:38
|
||||
* @desc PoliceEnterprisesUnitServiceImpl...
|
||||
*/
|
||||
@Service
|
||||
public class PoliceEnterprisesUnitServiceImpl implements PoliceEnterprisesUnitService {
|
||||
|
||||
@Autowired
|
||||
private PoliceEnterprisesUnitMapper policeEnterprisesUnitMapper;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
public List<ServiceProjectListVo> listSp(Long enterprisesUnitId) {
|
||||
return policeEnterprisesUnitMapper.listSp(UserUtil.getUnitId(), enterprisesUnitId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateSp(ServiceProjectSaveOrUpdateParams params) {
|
||||
ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class);
|
||||
Assert.isTrue(Db.saveOrUpdate(serviceProject), ResultCode.ERROR.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params) {
|
||||
userService.saveOrUpdateSecurityUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
|
||||
return userService.securityUserPager(queryParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSecurityUserById(Long securityUserId) {
|
||||
userService.deleteSecurityUserById(securityUserId);
|
||||
}
|
||||
}
|
|
@ -39,6 +39,11 @@ public class SecurityUser extends BaseEntity implements Serializable {
|
|||
*/
|
||||
private Long serviceProjectId;
|
||||
|
||||
/**
|
||||
* 本人照片
|
||||
*/
|
||||
private String photo;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
|
@ -79,6 +84,11 @@ public class SecurityUser extends BaseEntity implements Serializable {
|
|||
*/
|
||||
private String securityNumber;
|
||||
|
||||
/**
|
||||
* 无证说明
|
||||
*/
|
||||
private String noSecurityNumberDesc;
|
||||
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.changhu.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.changhu.common.pojo.model.JsonResult;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.pojo.params.PoliceUnitRegisterParams;
|
||||
|
@ -36,4 +37,9 @@ public interface CommonService {
|
|||
* @return 结果
|
||||
*/
|
||||
List<SelectNodeVo<Long>> queryUnitListByIdentity(QueryUnitListByIdentityQueryParams queryParams);
|
||||
|
||||
/**
|
||||
* 根据身份证查询保安证
|
||||
*/
|
||||
JSONObject querySecurityNumberByIdCard(String idCard);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.changhu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.pojo.params.CheckStatusParams;
|
||||
import com.changhu.pojo.params.UnitDisableOrEnableParams;
|
||||
import com.changhu.pojo.vo.UnitCheckStatusVo;
|
||||
|
@ -8,6 +10,8 @@ import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams;
|
|||
import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/2 上午9:49
|
||||
|
@ -45,4 +49,13 @@ public interface ManagementService {
|
|||
*/
|
||||
void disableOrEnableMiniProgramUser(UnitDisableOrEnableParams params);
|
||||
|
||||
/**
|
||||
* 所有保安单位列表
|
||||
*/
|
||||
List<SelectNodeVo<Long>> listSecurityUnit();
|
||||
|
||||
/**
|
||||
* 保安单位下的项目经理
|
||||
*/
|
||||
List<SelectNodeVo<Long>> listMinUserByUnitId(Long securityUnitId, MiniProgramUserIdentity identity);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.changhu.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.changhu.common.db.enums.CheckStatus;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
|
@ -16,6 +17,7 @@ import com.changhu.pojo.params.PoliceUnitRegisterParams;
|
|||
import com.changhu.pojo.params.SecurityUnitRegisterParams;
|
||||
import com.changhu.pojo.queryParams.QueryUnitListByIdentityQueryParams;
|
||||
import com.changhu.service.CommonService;
|
||||
import com.changhu.task.SecurityAssociationDockingServiceTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -36,6 +38,9 @@ public class CommonServiceImpl implements CommonService {
|
|||
@Autowired
|
||||
private PoliceUnitMapper policeUnitMapper;
|
||||
|
||||
@Autowired
|
||||
private SecurityAssociationDockingServiceTask securityAssociationDockingServiceTask;
|
||||
|
||||
|
||||
@Override
|
||||
public JsonResult<Void> securityUnitRegister(SecurityUnitRegisterParams params) {
|
||||
|
@ -131,4 +136,9 @@ public class CommonServiceImpl implements CommonService {
|
|||
.toList();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject querySecurityNumberByIdCard(String idCard) {
|
||||
return securityAssociationDockingServiceTask.querySecurityNumberByIdCard(idCard);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
package com.changhu.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.mapper.ManagementMapper;
|
||||
import com.changhu.pojo.entity.MiniProgramUser;
|
||||
import com.changhu.pojo.entity.SecurityUnit;
|
||||
import com.changhu.pojo.params.CheckStatusParams;
|
||||
import com.changhu.pojo.params.UnitDisableOrEnableParams;
|
||||
import com.changhu.pojo.vo.UnitCheckStatusVo;
|
||||
|
@ -16,6 +23,8 @@ import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
|||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/2 上午9:49
|
||||
|
@ -58,4 +67,43 @@ public class ManagementServiceImpl implements ManagementService {
|
|||
.getHandler()
|
||||
.disableOrEnableMiniProgramUser(params.getDataId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectNodeVo<Long>> listSecurityUnit() {
|
||||
String addressName = LambdaUtil.getFieldName(SecurityUnit::getAddress);
|
||||
String legalPersonInfoName = LambdaUtil.getFieldName(SecurityUnit::getLegalPersonInfo);
|
||||
return Db.lambdaQuery(SecurityUnit.class)
|
||||
.eq(SecurityUnit::getIsEnable, IsEnable.TRUE)
|
||||
.list()
|
||||
.stream()
|
||||
.map(unit -> SelectNodeVo.<Long>builder()
|
||||
.value(unit.getSnowFlakeId())
|
||||
.label(unit.getName())
|
||||
.extData(Dict.of(
|
||||
addressName, unit.getAddress(),
|
||||
legalPersonInfoName, unit.getLegalPersonInfo()))
|
||||
.build())
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectNodeVo<Long>> listMinUserByUnitId(Long securityUnitId, MiniProgramUserIdentity identity) {
|
||||
String tel = LambdaUtil.getFieldName(MiniProgramUser::getTelephone);
|
||||
String sex = LambdaUtil.getFieldName(MiniProgramUser::getSex);
|
||||
return Db.lambdaQuery(MiniProgramUser.class)
|
||||
.eq(MiniProgramUser::getIsEnable, IsEnable.TRUE)
|
||||
.eq(MiniProgramUser::getIdentity, identity)
|
||||
.eq(MiniProgramUser::getUnitId, securityUnitId)
|
||||
.list()
|
||||
.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,34 @@
|
|||
package com.changhu.support.mybatisplus.handler.global.json;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
|
||||
import com.changhu.common.pojo.vo.CreateOrUpdateUser;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/11/27 下午3:09
|
||||
* @desc CreateOrUpdateUserTypeHandler...
|
||||
*/
|
||||
@MappedJdbcTypes(JdbcType.VARCHAR)
|
||||
@MappedTypes({CreateOrUpdateUser.class})
|
||||
public class CreateOrUpdateUserTypeHandler extends AbstractJsonTypeHandler<CreateOrUpdateUser> {
|
||||
public CreateOrUpdateUserTypeHandler(Class<?> type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateOrUpdateUser parse(String json) {
|
||||
if (!JSON.isValid(json)) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parseObject(json, CreateOrUpdateUser.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toJson(CreateOrUpdateUser obj) {
|
||||
return JSON.toJSONString(obj);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.changhu.task;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/11/27 下午4:59
|
||||
* @desc SecurityAssociationDockingServiceTask...
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SecurityAssociationDockingServiceTask {
|
||||
|
||||
private static final String BASE_HOST = "http://tkgl.3589hn.cn";
|
||||
|
||||
private static String TOKEN;
|
||||
|
||||
/**
|
||||
* 每小时续一次token
|
||||
*/
|
||||
@PostConstruct
|
||||
@Scheduled(cron = "0 0 * * * *")
|
||||
public void getToken() {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("appid", "anfang");
|
||||
params.put("appkey", "fcfefda716dc4760af44973bcf157a01");
|
||||
//创建请求
|
||||
HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/get_token");
|
||||
//设置参数
|
||||
request.body(params.toJSONString());
|
||||
try (HttpResponse response = request.execute()) {
|
||||
int status = response.getStatus();
|
||||
if (!(status == 200)) {
|
||||
log.error("保安协会 获取token接口出错 status={} msg={}", status, response.body());
|
||||
return;
|
||||
}
|
||||
String body = response.body();
|
||||
log.info("getToken 接收到值:{}", body);
|
||||
if (!JSON.isValid(body)) {
|
||||
log.warn("返回数据不是json格式");
|
||||
return;
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(body);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
TOKEN = data.getString("token");
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject querySecurityNumberByIdCard(String idCard) {
|
||||
HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/query");
|
||||
//请求头参数
|
||||
request.form("token", TOKEN);
|
||||
//请求体参数
|
||||
request.body(JSONObject.of("idcard", idCard).toJSONString());
|
||||
try (HttpResponse response = request.execute()) {
|
||||
int status = response.getStatus();
|
||||
if (!(status == 200)) {
|
||||
log.error("保安协会 身份证查保安证接口出错 status={} msg={}", status, response.body());
|
||||
return null;
|
||||
}
|
||||
String body = response.body();
|
||||
log.info("querySecurityNumberByIdCard 接收到返回值:{}", body);
|
||||
if (!JSON.isValid(body)) {
|
||||
log.warn("返回数据不是json格式");
|
||||
return null;
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(body);
|
||||
return jsonObject.getJSONObject("data");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?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.policeManagement.mapper.PoliceEnterprisesUnitMapper">
|
||||
<select id="listSp" resultType="com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo">
|
||||
select sp.*,
|
||||
JSON_OBJECT('snowFlakeId', psu.snow_flake_id, 'name', psu.name, 'type', psu.type, 'unitId', psu.unitId,
|
||||
'unitName', psu.unitName) as 'createUserInfo'
|
||||
from enterprises_unit eu
|
||||
join service_project sp on eu.snow_flake_id = sp.enterprises_unit_id and sp.delete_flag = 0
|
||||
left join mini_program_user mpu on sp.project_manager_mini_program_user_id = mpu.snow_flake_id
|
||||
left join police_security_users psu on sp.create_by = psu.snow_flake_id
|
||||
where eu.delete_flag = 0
|
||||
and eu.snow_flake_id = #{enterprisesUnitId}
|
||||
and eu.police_unit_id = #{unitId}
|
||||
order by sp.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue