Compare commits

...

2 Commits

Author SHA1 Message Date
luozhun 11dac87237 Merge remote-tracking branch 'origin/main' 2024-11-13 09:31:48 +08:00
luozhun c684606410 refactor(management): 重构企事业单位相关功能
- 移除 PoliceEnterprisesUnitPager 相关代码
- 为 EnterprisesUnit 添加创建人信息
- 优化 EnterprisesUnit 分页查询逻辑
- 更新相关控制器和服务实现
-调整枚举类型和注解
2024-11-13 09:31:37 +08:00
44 changed files with 420 additions and 263 deletions

View File

@ -1,5 +1,6 @@
package com.changhu.common.annotation; package com.changhu.common.annotation;
import com.changhu.common.db.enums.UserType;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.lang.annotation.*; import java.lang.annotation.*;

View File

@ -1,22 +0,0 @@
package com.changhu.common.annotation;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20252
* @createTime 2024/9/6 上午11:13
* @desc UserType...
*/
@AllArgsConstructor
@Getter
public enum UserType {
MANAGEMENT_POLICE("公安后台用户"),
MANAGEMENT_SECURITY("保安后台用户"),
MANAGEMENT_SUPER("超级后台用户"),
MINI_PROGRAM_POLICE("小程序公安用户"),
MINI_PROGRAM_PROJECT_MANAGE("小程序项目经理");
private final String remark;
}

View File

@ -1,6 +1,8 @@
package com.changhu.common.db.enums; package com.changhu.common.db.enums;
import cn.hutool.core.lang.Dict;
import com.baomidou.mybatisplus.annotation.IEnum; import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.annotation.IsExtData;
import com.changhu.common.db.BaseEnum; import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@ -17,28 +19,38 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public enum EnterprisesUnitType implements BaseEnum<String>, IEnum<String> { public enum EnterprisesUnitType implements BaseEnum<String>, IEnum<String> {
party_government("party_government", "党政机关"), party_government("party_government", "党政机关", "party_government.png"),
medical("medical", "医疗机构"), medical("medical", "医疗机构", "medical.png"),
residential("residential", "小区"), residential("residential", "小区", "residential.png"),
higher_learning("higher_learning", "高等院校"), higher_learning("higher_learning", "高等院校", "higher_learning.png"),
primary_and_secondary("primary_and_secondary", "中小学幼儿园"), primary_and_secondary("primary_and_secondary", "中小学幼儿园", "primary_and_secondary.png"),
shopping_supermarkets("shopping_supermarkets", "商场超市"), shopping_supermarkets("shopping_supermarkets", "商场超市", "shopping_supermarkets.png"),
financial("financial", "金融机构"), financial("financial", "金融机构", "financial.png"),
hydropower("hydropower", "水电油气"), hydropower("hydropower", "水电油气", "hydropower.png"),
key_projects("key_projects", "重点工程建设单位"), key_projects("key_projects", "重点工程建设单位", "key_projects.png"),
delivery_logistics("delivery_logistics", "寄递物流"), delivery_logistics("delivery_logistics", "寄递物流", "delivery_logistics.png"),
military("military", "军工、科研单位"), military("military", "军工、科研单位", "military.png"),
wen_bo("wen_bo", "文博单位"), wen_bo("wen_bo", "文博单位", "wen_bo.png"),
important_news("important_news ", "重要新闻单位"), important_news("important_news ", "重要新闻单位", "important_news.png"),
large_scale_material("large_scale_material ", "大型物资储备"), large_scale_material("large_scale_material ", "大型物资储备", "large_scale_material.png"),
transportation("transportation", "交通运输企业"), transportation("transportation", "交通运输企业", "transportation.png"),
industrial_park("industrial_park", "工业园区企业"), industrial_park("industrial_park", "工业园区企业", "industrial_park.png"),
complex_public_security("complex_public_security", "治安复杂场所"), complex_public_security("complex_public_security", "治安复杂场所", "complex_public_security.png"),
making_explosive_easily("making_explosive_easily ", "易制爆"), making_explosive_easily("making_explosive_easily ", "易制爆", "making_explosive_easily.png"),
hazardous_materials("hazardous_materials ", "危化物品存放场所"), hazardous_materials("hazardous_materials ", "危化物品存放场所", "hazardous_materials.png"),
other("other", "其他单位"); other("other", "其他单位", "other.png");
private final String value; private final String value;
private final String label; private final String label;
@IsExtData
private final String icon;
@Override
public Object serializer() {
return Dict.of(
"value", this.getValue(),
"label", this.getLabel(),
"extData", Dict.of("icon", "/resources/icon/gaode/marker/" + this.icon)
);
}
} }

View File

@ -0,0 +1,24 @@
package com.changhu.common.db.enums;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20252
* @createTime 2024/9/6 上午11:13
* @desc UserType...
*/
@AllArgsConstructor
@Getter
public enum UserType implements BaseEnum<String> {
MANAGEMENT_POLICE("management_police", "公安后台用户"),
MANAGEMENT_SECURITY("management_security", "保安后台用户"),
MANAGEMENT_SUPER("management_super", "超级后台用户"),
MINI_PROGRAM_POLICE("mini_program_police", "小程序公安用户"),
MINI_PROGRAM_PROJECT_MANAGE("mini_program_project_manage", "小程序项目经理");
private final String value;
private final String label;
}

View File

@ -0,0 +1,20 @@
package com.changhu.common.pojo.vo;
import com.changhu.common.db.enums.UserType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/11/12 下午3:27
* @desc 通过视图去找出数据创建人
*/
@Data
public class CreateOrUpdateUser {
@Schema(description = "用户id")
private Long snowFlakeId;
@Schema(description = "用户名字")
private String name;
@Schema(description = "用户类型")
private UserType type;
}

View File

@ -6,7 +6,7 @@ import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -3,7 +3,7 @@ package com.changhu.enums.handler;
import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.SaTokenInfo;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;

View File

@ -3,7 +3,7 @@ package com.changhu.enums.handler;
import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.SaTokenInfo;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;

View File

@ -3,7 +3,7 @@ package com.changhu.enums.handler;
import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.SaTokenInfo;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.common.pojo.vo.TokenInfo;

View File

@ -8,7 +8,7 @@ import cn.hutool.core.lang.func.LambdaUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;

View File

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;

View File

@ -1,7 +1,9 @@
package com.changhu.module.management.controller; package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.module.management.pojo.entity.EnterprisesUnit;
@ -34,18 +36,21 @@ public class EnterprisesUnitController {
@Operation(summary = "分页查询") @Operation(summary = "分页查询")
@PostMapping("/pager") @PostMapping("/pager")
public Page<EnterprisesUnitPagerVo> pager(@RequestBody @Valid PageParams<EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo> queryParams) { @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public Page<EnterprisesUnitPagerVo> pager(@RequestBody PageParams<EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo> queryParams) {
return enterprisesUnitService.pager(queryParams); return enterprisesUnitService.pager(queryParams);
} }
@Operation(summary = "新增或保存") @Operation(summary = "新增或保存")
@PostMapping("/saveOrUpdate") @PostMapping("/saveOrUpdate")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public void saveOrUpdate(@RequestBody @Valid EnterprisesUnitSaveOrUpdateParams params) { public void saveOrUpdate(@RequestBody @Valid EnterprisesUnitSaveOrUpdateParams params) {
enterprisesUnitService.saveOrUpdate(params); enterprisesUnitService.saveOrUpdate(params);
} }
@Operation(summary = "根据id删除") @Operation(summary = "根据id删除")
@DeleteMapping("/deleteById") @DeleteMapping("/deleteById")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) { public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) {
boolean b = enterprisesUnitService.removeById(enterprisesUnitId); boolean b = enterprisesUnitService.removeById(enterprisesUnitId);
if (!b) { if (!b) {

View File

@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.module.management.pojo.params.IndexCheckPassParams; import com.changhu.module.management.pojo.params.IndexCheckPassParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams; import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams; import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;

View File

@ -3,12 +3,10 @@ package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo; 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.module.management.service.PoliceService;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -50,9 +48,4 @@ public class PoliceController {
policeService.userDeleteById(managementPoliceUnitUserId); policeService.userDeleteById(managementPoliceUnitUserId);
} }
@Operation(summary = "公安单位下的企事业单位分页")
@PostMapping("/enterprisesUnitPager")
public Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(@RequestBody PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
return policeService.enterprisesUnitPager(queryParams);
}
} }

View File

@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;

View File

@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;

View File

@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;

View File

@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams; import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo; import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -26,15 +24,7 @@ public interface EnterprisesUnitMapper extends BaseMapper<EnterprisesUnit> {
* @return 结果 * @return 结果
*/ */
Page<EnterprisesUnitPagerVo> pager(@Param("page") Page<EnterprisesUnitPagerVo> page, Page<EnterprisesUnitPagerVo> pager(@Param("page") Page<EnterprisesUnitPagerVo> page,
@Param("unitId") Long unitId,
@Param("params") EnterprisesUnitPagerQueryParams params); @Param("params") EnterprisesUnitPagerQueryParams params);
/**
* 公安单位下的企事业单位分页
*
* @param page 分页对象
* @param params 查询参数
* @return 结果
*/
Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(@Param("page") Page<PoliceEnterprisesUnitPagerVo> page,
@Param("params") PoliceEnterprisesUnitPagerQueryParams params);
} }

View File

@ -23,7 +23,6 @@ public class EnterprisesUnitSaveOrUpdateParams {
private Long snowFlakeId; private Long snowFlakeId;
@Schema(description = "公安单位id") @Schema(description = "公安单位id")
@NotNull(message = "公安单位不能为空")
private Long policeUnitId; private Long policeUnitId;
@Schema(description = "名称") @Schema(description = "名称")

View File

@ -1,7 +1,6 @@
package com.changhu.module.management.pojo.queryParams; package com.changhu.module.management.pojo.queryParams;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
/** /**
@ -12,7 +11,13 @@ import lombok.Data;
@Data @Data
public class EnterprisesUnitPagerQueryParams { public class EnterprisesUnitPagerQueryParams {
@NotNull(message = "公安单位id不能为空")
@Schema(description = "公安单位id") @Schema(description = "公安单位id")
private Long policeUnitId; private Long policeUnitId;
@Schema(description = "名称")
private String name;
@Schema(description = "详细地址")
private String address;
@Schema(description = "备注")
private String remark;
} }

View File

@ -1,19 +0,0 @@
package com.changhu.module.management.pojo.queryParams;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/9/5 下午2:49
* @desc PoliceEnterprisesUnitPagerQueryParams...
*/
@Data
public class PoliceEnterprisesUnitPagerQueryParams {
@Schema(description = "名称")
private String name;
@Schema(description = "详细地址")
private String address;
@Schema(description = "备注")
private String remark;
}

View File

@ -1,6 +1,7 @@
package com.changhu.module.management.pojo.vo; package com.changhu.module.management.pojo.vo;
import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.pojo.vo.CreateOrUpdateUser;
import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.module.management.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@ -47,7 +48,7 @@ public class EnterprisesUnitPagerVo {
@Schema(description = "地址") @Schema(description = "地址")
private String address; private String address;
@Schema(description = "坐标") @Schema(description = "位置")
private Point point; private Point point;
@Schema(description = "联系方式") @Schema(description = "联系方式")
@ -56,6 +57,8 @@ public class EnterprisesUnitPagerVo {
@Schema(description = "备注") @Schema(description = "备注")
private String remark; private String remark;
@Schema(description = "创建人")
private CreateOrUpdateUser createUser;
@Schema(description = "创建时间") @Schema(description = "创建时间")
private String createTime; private String createTime;

View File

@ -1,46 +0,0 @@
package com.changhu.module.management.pojo.vo;
import com.changhu.module.management.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author 20252
* @createTime 2024/9/5 下午2:46
* @desc PoliceEnterprisesUnitPagerVo...
*/
@Data
public class PoliceEnterprisesUnitPagerVo {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "名称")
private String name;
@Schema(description = "省编码")
private String province;
@Schema(description = "省名称")
private String provinceName;
@Schema(description = "市编码")
private String city;
@Schema(description = "市名称")
private String cityName;
@Schema(description = "县编码")
private String districts;
@Schema(description = "县名称")
private String districtsName;
@Schema(description = "乡镇编码")
private String street;
@Schema(description = "乡镇名称")
private String streetName;
@Schema(description = "详细地址")
private String address;
@Schema(description = "联系人")
private ContactPersonInfo contactPersonInfo;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -3,9 +3,7 @@ package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo; import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
/** /**
@ -36,11 +34,4 @@ public interface PoliceService {
*/ */
void userDeleteById(Long managementPoliceUnitUserId); void userDeleteById(Long managementPoliceUnitUserId);
/**
* 公安单位下的企事业单位分页
*
* @param queryParams 查询参数
* @return 结果
*/
Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams);
} }

View File

@ -5,8 +5,10 @@ import cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.func.LambdaUtil; import cn.hutool.core.lang.func.LambdaUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.EnterprisesUnitMapper; import com.changhu.module.management.mapper.EnterprisesUnitMapper;
import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams; import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams;
@ -29,12 +31,17 @@ public class EnterprisesUnitServiceImpl extends ServiceImpl<EnterprisesUnitMappe
@Override @Override
public Page<EnterprisesUnitPagerVo> pager(PageParams<EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo> queryParams) { public Page<EnterprisesUnitPagerVo> pager(PageParams<EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo> queryParams) {
return baseMapper.pager(queryParams.getPage(), queryParams.getParams()); return switch (UserUtil.getUserType()) {
case MANAGEMENT_POLICE -> baseMapper.pager(queryParams.getPage(), UserUtil.getUnitId(), queryParams.getParams());
case MANAGEMENT_SUPER -> baseMapper.pager(queryParams.getPage(), null, queryParams.getParams());
default -> throw new MessageException();
};
} }
@Override @Override
public void saveOrUpdate(EnterprisesUnitSaveOrUpdateParams params) { public void saveOrUpdate(EnterprisesUnitSaveOrUpdateParams params) {
EnterprisesUnit enterprisesUnit = BeanUtil.copyProperties(params, EnterprisesUnit.class); EnterprisesUnit enterprisesUnit = BeanUtil.copyProperties(params, EnterprisesUnit.class);
//需要将行政区划编码转换为省市区
Optional.ofNullable(params.getAdministrativeDivisionCodes()) Optional.ofNullable(params.getAdministrativeDivisionCodes())
.ifPresent(codes -> { .ifPresent(codes -> {
if (!codes.isEmpty()) { if (!codes.isEmpty()) {
@ -50,6 +57,10 @@ public class EnterprisesUnitServiceImpl extends ServiceImpl<EnterprisesUnitMappe
enterprisesUnit.setStreet(codes.get(3)); enterprisesUnit.setStreet(codes.get(3));
} }
}); });
//如果身份是公安的 是不会携带单位id的 从用户信息里取出来
if (UserType.MANAGEMENT_POLICE.equals(UserUtil.getUserType())) {
enterprisesUnit.setPoliceUnitId(UserUtil.getUnitId());
}
boolean b = this.saveOrUpdate(enterprisesUnit); boolean b = this.saveOrUpdate(enterprisesUnit);
if (!b) { if (!b) {
throw new MessageException(); throw new MessageException();

View File

@ -1,7 +1,7 @@
package com.changhu.module.management.service.impl; package com.changhu.module.management.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.db.enums.MiniProgramUserIdentity; import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.UserUtil;

View File

@ -13,9 +13,7 @@ import com.changhu.module.management.mapper.ManagementPoliceUnitUserMapper;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams; import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams; import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo; 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.module.management.service.PoliceService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
@ -93,8 +91,4 @@ public class PoliceServiceImpl implements PoliceService {
} }
} }
@Override
public Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
return enterprisesUnitMapper.policeEnterprisesUnitPager(queryParams.getPage(), queryParams.getParams());
}
} }

View File

@ -8,7 +8,7 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.MiniProgramUserIdentity; import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;

View File

@ -2,7 +2,7 @@ package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;

View File

@ -2,14 +2,13 @@ package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService; import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;

View File

@ -2,7 +2,7 @@ package com.changhu.support.interceptor;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.UserUtil;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;

View File

@ -6,44 +6,33 @@
column="contact_person_info" column="contact_person_info"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler" typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="contactPersonInfo"/> property="contactPersonInfo"/>
<result
column="createUser"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="createUser"/>
</resultMap> </resultMap>
<select id="pager" resultMap="EnterprisesUnitPagerVoResultMap"> <select id="pager" resultMap="EnterprisesUnitPagerVoResultMap">
select eu.*, select eu.*,
ad1.name as provinceName, ad1.name as provinceName,
ad2.name as cityName, ad2.name as cityName,
ad3.name as districtsName, ad3.name as districtsName,
ad4.name as streetName ad4.name as streetName,
json_object('snowFlakeId',spu.snow_flake_id,'name',spu.name,'type', spu.type) as 'createUser'
from enterprises_unit eu from enterprises_unit eu
left join administrative_division ad1 on eu.province = ad1.code and ad1.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 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 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 left join administrative_division ad4 on eu.street = ad4.code and ad4.delete_flag = 0
left join super_police_users spu on eu.create_by = spu.snow_flake_id
where eu.delete_flag = 0 where eu.delete_flag = 0
<choose>
<when test="unitId != null">
and eu.police_unit_id = #{unitId}
</when>
<otherwise>
and eu.police_unit_id = #{params.policeUnitId} and eu.police_unit_id = #{params.policeUnitId}
order by eu.create_time desc </otherwise>
</select> </choose>
<resultMap id="PoliceEnterprisesUnitPagerVoResultMap"
type="com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo">
<result
column="contact_person_info"
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
property="contactPersonInfo"/>
</resultMap>
<select id="policeEnterprisesUnitPager"
resultMap="PoliceEnterprisesUnitPagerVoResultMap">
select eu.*,
ad1.name as provinceName,
ad2.name as cityName,
ad3.name as districtsName,
ad4.name as streetName
from enterprises_unit eu
left join administrative_division ad1 on eu.province = ad1.code and ad1.delete_flag = 0
left join administrative_division ad2 on eu.city = ad2.code and ad2.delete_flag = 0
left join administrative_division ad3 on eu.districts = ad3.code and ad3.delete_flag = 0
left join administrative_division ad4 on eu.street = ad4.code and ad4.delete_flag = 0
where eu.delete_flag = 0
and eu.police_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
and eu.name like concat('%', #{params.name}, '%') and eu.name like concat('%', #{params.name}, '%')
</if> </if>
@ -55,4 +44,5 @@
</if> </if>
order by eu.create_time desc order by eu.create_time desc
</select> </select>
</mapper> </mapper>

View File

@ -7,16 +7,13 @@
<script setup lang="ts"> <script setup lang="ts">
import {onMounted, onUnmounted, shallowRef} from "vue"; import {onMounted, onUnmounted, shallowRef} from "vue";
import {initMap} from "@/utils/aMapUtil"; import {initMap} from "@/utils/aMapUtil";
import {MapContainerProps, MapPlugins} from "@/types/components/map";
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<MapContainerProps>(), {
plugins?: string[], plugins: (): MapPlugins[] => {
initCallback?: (map: AMap.Map) => void,
mapOptions?: AMap.MapOptions
}>(), {
plugins: () => {
return [] return []
}, },
mapOptions: () => { mapOptions: (): AMap.MapOptions => {
return { return {
// 3D // 3D
viewMode: "3D", viewMode: "3D",

View File

@ -6,18 +6,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {IconFontProps} from "@/types/components/iconfont/IconFont"; import {IconFontProps} from "@/types/components/iconfont/IconFont";
withDefaults(defineProps<IconFontProps>(), { withDefaults(defineProps<IconFontProps>(), {
size: 25, size: 25,
type: "svg" type: "svg"
}); });
// import {onMounted} from "vue";
// onMounted(() => {
// console.log(props.fontClass, props.type);
// });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -6,6 +6,7 @@
:form-item-options="props.searchFormOptions" :form-item-options="props.searchFormOptions"
v-model:value="searchParams" v-model:value="searchParams"
v-bind="props.searchFormProps" v-bind="props.searchFormProps"
:size="props.size"
> >
<template v-slot:formOperation> <template v-slot:formOperation>
<a-space class="margin-right flex-end"> <a-space class="margin-right flex-end">
@ -67,6 +68,7 @@
v-bind="props.paginationProps" v-bind="props.paginationProps"
@change="handleCurrentChange" @change="handleCurrentChange"
@showSizeChange="handleSizeChange" @showSizeChange="handleSizeChange"
:size="props.size"
/> />
</div> </div>
</div> </div>

View File

@ -59,5 +59,6 @@ declare interface Grid {
interface BaseEnum<T> { interface BaseEnum<T> {
value: T; value: T;
label: string label: string,
extData?: Record<string, any>
} }

View File

@ -0,0 +1,44 @@
/**
*
* @link https://lbs.amap.com/api/javascript-api-v2/guide/abc/plugins-list
*/
export type MapPlugins =
'AMap.ElasticMarker'
| 'AMap.ToolBar'
| 'AMap.Scale'
| 'AMap.HawkEye'
| 'AMap.ControlBar'
| 'AMap.MapType'
| 'AMap.Geolocation'
| 'AMap.AutoComplete'
| 'AMap.PlaceSearch'
| 'AMap.DistrictSearch'
| 'AMap.LineSearch'
| 'AMap.StationSearch'
| 'AMap.Driving'
| 'AMap.TruckDriving'
| 'AMap.Transfer'
| 'AMap.Walking'
| 'AMap.Riding'
| 'AMap.DragRoute'
| 'AMap.Geocoder'
| 'AMap.CitySearch'
| 'AMap.IndoorMap'
| 'AMap.MouseTool'
| 'AMap.CircleEditor'
| 'AMap.PolygonEditor'
| 'AMap.PolylineEditor'
| 'AMap.RectangleEditor'
| 'AMap.EllipseEditor'
| 'AMap.BezierCurveEditor'
| 'AMap.MarkerCluster'
| 'AMap.RangingTool'
| 'AMap.CloudDataSearch'
| 'AMap.Weather'
| 'AMap.HeatMap'
export interface MapContainerProps {
plugins?: MapPlugins[],
initCallback?: (map: AMap.Map) => void,
mapOptions?: AMap.MapOptions
}

View File

@ -0,0 +1,28 @@
export interface EnterprisesUnit {
snowFlakeId?: string;
/** policeUnitId **/
policeUnitId?: string;
/** name **/
name?: string;
/** type **/
type?: BaseEnum<string>;
/** province **/
province?: string;
/** city **/
city?: string;
/** districts **/
districts?: string;
/** street **/
street?: string;
/** address **/
address?: string;
/** point **/
point?: [number, number];
/** contactPersonInfo **/
contactPersonInfo?: {
name: string;
telephone: string;
};
/** remark **/
remark?: string;
}

View File

@ -1,7 +1,7 @@
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import {MapPlugins} from "@/types/components/map";
type Amap = typeof AMap; export const initMap = (plugins?: MapPlugins[]): Promise<typeof AMap> => new Promise((resolve, reject) => {
export const initMap = (plugins?: string[]): Promise<Amap> => new Promise((resolve, reject) => {
//@ts-ignore //@ts-ignore
window._AMapSecurityConfig = { window._AMapSecurityConfig = {
securityJsCode: __APP_ENV.VITE_APP_SECURITY_JS_CODE securityJsCode: __APP_ENV.VITE_APP_SECURITY_JS_CODE
@ -10,8 +10,8 @@ export const initMap = (plugins?: string[]): Promise<Amap> => new Promise((resol
key: __APP_ENV.VITE_APP_GAODE_KEY, key: __APP_ENV.VITE_APP_GAODE_KEY,
version: __APP_ENV.VITE_APP_GAODE_VERSION, version: __APP_ENV.VITE_APP_GAODE_VERSION,
plugins plugins
}).then((AMap: Amap) => { }).then((aMap: typeof AMap) => {
resolve(AMap) resolve(aMap)
}).catch(err => { }).catch(err => {
reject(err) reject(err)
}) })

View File

@ -0,0 +1,68 @@
<template>
<div class="card">
<div class="card-content">
<h2 class="card-title">{{ name }}</h2>
<p>单位类型: {{ type.label }}</p>
<p>详细地址: {{ address }}</p>
<p>联系人: {{ contactPersonInfo.name }}/{{ contactPersonInfo.telephone }}</p>
<p class="card-text">备注: {{ remark }}</p>
</div>
</div>
</template>
<script setup lang="ts">
import {EnterprisesUnit} from "@/types/views/data/dataOverview.ts";
defineProps<EnterprisesUnit>()
</script>
<style scoped lang="scss">
.card {
width: 300px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transition: 0.3s;
border-radius: 5px;
overflow: hidden;
background-color: white;
}
.card:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.card-image {
width: 100%;
height: auto;
}
.card-content {
padding: 16px;
}
.card-title {
margin-bottom: 10px;
font-size: 18px;
}
.card-text {
font-size: 14px;
color: #777;
margin-bottom: 15px;
}
.card-button {
display: inline-block;
padding: 8px 16px;
text-align: center;
text-decoration: none;
color: white;
background-color: #007BFF;
border-radius: 5px;
transition: background-color 0.3s;
}
.card-button:hover {
background-color: #0056b3;
}
</style>

View File

@ -1,9 +1,9 @@
<template> <template>
<div class="container"> <div class="container">
<div class="header"> <div class="header">
<h1>地图页面标题</h1> <h1>警保联动数据总览</h1>
</div> </div>
<MapContainer class="map-container" ref="mapRef" :map-options="mapOptions" :init-callback="initMap"> <MapContainer class="map-container" ref="mapRef" :init-callback="initMap">
<div class="left-panel panel"> <div class="left-panel panel">
<h2>左侧统计面板</h2> <h2>左侧统计面板</h2>
<!-- 添加你的统计数据 --> <!-- 添加你的统计数据 -->
@ -18,31 +18,52 @@
<script setup lang="ts"> <script setup lang="ts">
import MapContainer from "@/components/aMap/MapContainer.vue"; import MapContainer from "@/components/aMap/MapContainer.vue";
import {ref} from "vue"; import {createApp, h, ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers"; import {ComponentExposed} from "vue-component-type-helpers";
import api from "@/axios"; import api from "@/axios";
import EnterprisesUnitInfoWindowContent from "@/views/data/components/EnterprisesUnitInfoWindowContent.vue";
import {EnterprisesUnit} from "@/types/views/data/dataOverview.ts";
const mapRef = ref<ComponentExposed<typeof MapContainer>>(null) const mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
const mapOptions: AMap.MapOptions = {
// 3D let infoWindow: AMap.InfoWindow = null;
viewMode: "3D",
//
zoom: 16,
mapStyle: 'amap://styles/darkblue'
}
const initMap = async () => { const initMap = async () => {
const {data} = await api.get<any[]>('/enterprisesUnit/mapPoint') const {data} = await api.get<EnterprisesUnit[]>('/enterprisesUnit/mapPoint')
mapRef.value?.mapInstance?.clearMap() mapRef.value?.mapInstance?.clearMap()
const markers = data.map(item => { const markers = data.map(item => {
if (!item.point) { if (!item.point) {
return null; return null;
} }
return new AMap.Marker({ const marker = new AMap.Marker({
position: item.point icon: new AMap.Icon({
image: __APP_ENV.VITE_APP_MINIO_URL + item.type.extData.icon,
size: new AMap.Size(66, 66),
imageSize: new AMap.Size(66, 66),
}),
position: item.point,
offset: new AMap.Pixel(-33, -66)
}) })
marker.on('click', () => {
if (!infoWindow) {
infoWindow = new AMap.InfoWindow({
isCustom: true,
offset: new AMap.Pixel(66, -66),
closeWhenClickMap: true
});
}
const element = document.createElement('div')
//h vue
const _InfoWindow = h(EnterprisesUnitInfoWindowContent, item)
const app = createApp(_InfoWindow)
app.mount(element)
infoWindow.setContent(element)
infoWindow.open(mapRef.value?.mapInstance, item.point)
})
return marker
}).filter(Boolean) }).filter(Boolean)
mapRef.value.mapInstance.add(markers) mapRef.value.mapInstance.add(markers)
mapRef.value.mapInstance.setFitView()
} }
</script> </script>
@ -80,10 +101,12 @@ const initMap = async () => {
} }
.left-panel { .left-panel {
width: 15%;
left: 10px; left: 10px;
} }
.right-panel { .right-panel {
width: 15%;
right: 10px; right: 10px;
} }
</style> </style>

View File

@ -10,12 +10,13 @@ import {ComponentExposed} from "vue-component-type-helpers";
import MapContainer from "@/components/aMap/MapContainer.vue"; import MapContainer from "@/components/aMap/MapContainer.vue";
import {FormProMaxItemOptions} from "@/types/components/form"; import {FormProMaxItemOptions} from "@/types/components/form";
import {dictSelectNodes} from "@/config/dict.ts"; import {dictSelectNodes} from "@/config/dict.ts";
import {Button, message, Modal, Space} from "ant-design-vue"; import {AutoComplete, Button, Input, message, Modal, Space} from "ant-design-vue";
import api from "@/axios"; import api from "@/axios";
import TableProMax from "@/components/table/TableProMax.vue"; import TableProMax from "@/components/table/TableProMax.vue";
import {deleteDataModal} from "@/components/tsx/ModalPro.tsx"; import {deleteDataModal} from "@/components/tsx/ModalPro.tsx";
import {PageParams} from "@/types/hooks/useTableProMax.ts"; import {PageParams} from "@/types/hooks/useTableProMax.ts";
import FormProMax from "@/components/form/FormProMax.vue"; import FormProMax from "@/components/form/FormProMax.vue";
import {debounce} from "lodash-es";
type _TableProps = TableProMaxProps<EnterprisesUnitPagerVo, EnterprisesUnitPagerQueryParams>; type _TableProps = TableProMaxProps<EnterprisesUnitPagerVo, EnterprisesUnitPagerQueryParams>;
type _FormType = EnterprisesUnitSaveOrUpdateParams & { type _FormType = EnterprisesUnitSaveOrUpdateParams & {
@ -28,7 +29,6 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
const _formParams = ref<_FormType>({...params}) const _formParams = ref<_FormType>({...params})
let city = ''; let city = '';
const initMarker = (map: AMap.Map) => { const initMarker = (map: AMap.Map) => {
//添加maker点 设置point //添加maker点 设置point
const maker = new AMap.Marker({ const maker = new AMap.Marker({
@ -42,12 +42,61 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
map.add(maker) map.add(maker)
map.setFitView() map.setFitView()
} }
const autoAddress = ref<SelectNodeVo<string>[]>([])
const _formOptions = ref<FormProMaxItemOptions<_FormType>>({ const _formOptions = ref<FormProMaxItemOptions<_FormType>>({
name: { name: {
type: 'input', type: 'custom',
label: '单位名称', label: '单位名称',
required: true, required: true,
customRender: () => {
return <AutoComplete
v-model:value={_formParams.value.name}
options={autoAddress.value}
onSelect={(_, options: SelectNodeVo<string>) => {
_formParams.value.point = options.extData?.location;
_formParams.value.address = options.extData?.address;
initMarker(_mapRef.value?.mapInstance)
}}
onSearch={debounce((val: string) => {
//@ts-ignore
const auto = new AMap.AutoComplete({
city: city,
input: "tipinput",
citylimit: true
});
auto.search(val, (status, result) => {
if (status === 'complete') {
autoAddress.value = result.tips?.map(e => {
return {
value: e.name,
label: e.name,
extData: {
district: e.district,
address: e.address,
location: e.location
}
} as SelectNodeVo<string>
})
} else {
autoAddress.value = [];
}
})
}, 300)}
v-slots={{
option: (item: SelectNodeVo<string>) => {
return <div>
<p>{item.label}</p>
<p style={{color: '#9a9c9d'}}>{item.extData?.district} {item.extData?.address}</p>
</div>
}
}}
>
<Input
placeholder="请输入单位名称"
/>
</AutoComplete>
}
}, },
type: { type: {
type: 'select', type: 'select',
@ -75,44 +124,23 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
label: '经纬度', label: '经纬度',
customRender: () => <MapContainer customRender: () => <MapContainer
ref={_mapRef} ref={_mapRef}
plugins={['AMap.AutoComplete']}
style={{width: '100%', height: '300px', position: 'relative'}} style={{width: '100%', height: '300px', position: 'relative'}}
initCallback={(map) => { initCallback={(map) => {
const contextMenu = new AMap.ContextMenu();
contextMenu.addItem('标记', () => {
const {lng, lat} = contextMenu.getPosition()
_formParams.value.point = [lng, lat]
initMarker(map)
}, 0)
map.on('rightclick', ({lnglat}) => {
contextMenu.open(map, lnglat)
})
if (_formParams.value.point) { if (_formParams.value.point) {
initMarker(map) initMarker(map)
} }
}} }}
> >
<div style={{position: 'absolute', left: '10px', top: '10px', zIndex: 9999}}>
<input id={'tipinput'}
placeholder={'请输入详细地址'}
autocomplete="off"
onFocus={() => {
if (!_mapRef.value?.mapInstance) {
message.error('地图组件尚未初始化成功 请重新打开页面')
return
}
//@ts-ignore
_mapRef.value.mapInstance.plugin(['AMap.AutoComplete'], () => {
//@ts-ignore
const auto = new AMap.AutoComplete({
city: city,
input: "tipinput",
citylimit: true
});
//注册监听,当选中某条记录时会触发
auto.on("select", (e) => {
//有些点位可能没有经纬度信息
if (!e.poi.location) {
message.error('所选点位没有经纬度信息 建议选则附近的手动移动!');
return
}
_formParams.value.point = e.poi.location
initMarker(_mapRef.value.mapInstance)
});
})
}}
/>
</div>
</MapContainer> </MapContainer>
}, },
contactPersonInfoName: { contactPersonInfoName: {
@ -165,14 +193,17 @@ export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
}, { }, {
dataIndex: 'contactPersonInfo', dataIndex: 'contactPersonInfo',
title: '联系人', title: '联系人',
ellipsis: true,
customRender: ({text}) => text?.name + "/" + text.telephone customRender: ({text}) => text?.name + "/" + text.telephone
}, { }, {
dataIndex: 'province', dataIndex: 'province',
title: '行政区划', title: '行政区划',
ellipsis: true,
customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join("/") customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join("/")
}, { }, {
dataIndex: 'address', dataIndex: 'address',
title: '详细地址' title: '详细地址',
ellipsis: true
}, { }, {
dataIndex: 'remark', dataIndex: 'remark',
title: '备注' title: '备注'
@ -217,10 +248,25 @@ export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
Modal.info({ Modal.info({
title: `${policeUnitPagerVo.name}】 管辖企事业单位`, title: `${policeUnitPagerVo.name}】 管辖企事业单位`,
width: '80%', width: '80%',
centered: true,
maskClosable: true,
content: () => <TableProMax content: () => <TableProMax
ref={_tableRef} ref={_tableRef}
size="small"
columns={_columns} columns={_columns}
requestApi={_reqApi} requestApi={_reqApi}
searchFormOptions={{
name: {
type: 'input',
label: '单位名称'
}, address: {
type: 'input',
label: '地址'
}, remark: {
type: 'input',
label: '备注'
}
}}
v-slots={{ v-slots={{
tableHeader: (_) => { tableHeader: (_) => {
return <Space> return <Space>

View File

@ -5,7 +5,6 @@
:columns="columns" :columns="columns"
:searchFormOptions="searchFormOptions" :searchFormOptions="searchFormOptions"
> >
</TableProMax> </TableProMax>
</template> </template>

View File

@ -78,6 +78,11 @@ export default defineConfig(({mode}) => {
} }
} }
}, },
css: {
preprocessorOptions: {
api: 'modern-compiler'
}
}
} }
}) })