diff --git a/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java b/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java index 4621a12..ccac842 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java @@ -23,5 +23,5 @@ public @interface CheckUserType { /** * 需要的客户端类型 */ - UserType[] userTypes(); + UserType[] userTypes() default {}; } diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java new file mode 100644 index 0000000..a45370a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java @@ -0,0 +1,25 @@ +package com.changhu.common.db.enums; + +import com.baomidou.mybatisplus.annotation.IEnum; +import com.changhu.common.db.BaseEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author 20252 + * @createTime 2024/11/5 下午4:22 + * @desc EnterprisesUnitType... + */ +@Getter +@AllArgsConstructor +public enum EnterprisesUnitType implements BaseEnum, IEnum { + + school("school", "学校"), + hospital("hospital", "医院"), + community("community", "社区/小区"), + bank("bank", "银行"), + ; + + private final String value; + private final String label; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/SelectType.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/SelectType.java new file mode 100644 index 0000000..abdc606 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/SelectType.java @@ -0,0 +1,25 @@ +package com.changhu.common.db.enums; + +import com.baomidou.mybatisplus.annotation.IEnum; +import com.changhu.common.db.BaseEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * author: luozhun + * desc: 单选或多选 + * createTime: 2023/8/16 17:39 + */ +@Getter +@AllArgsConstructor +public enum SelectType implements BaseEnum, IEnum { + + RADIO("radio", "单选"), + MULTIPLE("multiple", "多选"), + ; + + private final String value; + private final String label; + +} + diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java index 37790bb..7205ccb 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java @@ -42,7 +42,7 @@ public class ManagementSecurityUnitLogin extends AbstractLoginHandler { .or() .eq(ManagementSecurityUnitUser::getTelephone, accountOrTelephone) .oneOpt() - .orElseThrow(() -> new MessageException(ResultCode.ERROR)); + .orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND)); //判断用户是否禁用 if (managementSecurityUnitUser.getIsEnable().equals(IsEnable.FALSE)) { diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java new file mode 100644 index 0000000..8024a93 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java @@ -0,0 +1,134 @@ +package com.changhu.module.assessmentCriteria.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.annotation.CheckUserType; +import com.changhu.common.annotation.JsonBody; +import com.changhu.common.annotation.UserType; +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; +import com.changhu.module.assessmentCriteria.pojo.params.*; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import com.changhu.module.assessmentCriteria.service.AssessmentCriteriaService; +import com.changhu.support.mybatisplus.pojo.params.PageParams; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:02 + * @desc AssessmentCriteriaController... + */ +@Tag(name = "考核标准") +@JsonBody +@RequestMapping("/assessmentCriteria") +@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER) +public class AssessmentCriteriaController { + + @Autowired + private AssessmentCriteriaService assessmentCriteriaService; + + @Operation(summary = "根据类型获取考核项目列表") + @GetMapping("/ckProjectListByType") + @CheckUserType(value = false) + public List> ckProjectListByType(@RequestParam EnterprisesUnitType type) { + return assessmentCriteriaService.assessmentCriteriaListByType(type); + } + + @Operation(summary = "根据考核项目获取考核规则") + @GetMapping("/assessmentCriteriaRulesByCkProjectId") + @CheckUserType(value = false) + public List assessmentCriteriaRulesByCkProjectId(@RequestParam Long ckProjectId) { + return assessmentCriteriaService.assessmentCriteriaRulesByCkProjectId(ckProjectId); + } + + @Operation(summary = "提交考核记录") + @PostMapping("/submitAssessmentRecord") + @CheckUserType(value = false) + public void submitAssessmentRecord(@Validated @RequestBody AssessmentRecordParams params) { + assessmentCriteriaService.submitAssessmentRecord(params); + } + + @Operation(summary = "考核项目分页查询") + @PostMapping("/ckProjectPagerVoPager") + public Page ckProjectPagerVoPager(@RequestBody PageParams queryParams) { + return assessmentCriteriaService.ckProjectPagerVoPager(queryParams); + } + + @Operation(summary = "新增或修改考核项目") + @PostMapping("/saveOrUpdateCkProject") + public void saveOrUpdateCkProject(@Valid @RequestBody CkProjectSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkProject(params); + } + + @Operation(summary = "删除考核项目") + @DeleteMapping("/deleteCkProjectById") + public void deleteCkProjectById(@RequestParam Long ckProjectId) { + assessmentCriteriaService.deleteCkProjectById(ckProjectId); + } + + @Operation(summary = "考核项目详情") + @GetMapping("/ckProjectDetail") + public List ckProjectDetail(@RequestParam Long ckProjectId) { + return assessmentCriteriaService.ckProjectDetail(ckProjectId); + } + + @Operation(summary = "新增或修改考核分组") + @PostMapping("/saveOrUpdateCkGroup") + public void saveOrUpdateCkGroup(@Valid @RequestBody CkGroupSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkGroup(params); + } + + @Operation(summary = "新增或修改考核项") + @PostMapping("/saveOrUpdateCkItem") + public void saveOrUpdateCkItem(@Valid @RequestBody CkItemSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkItem(params); + } + + @Operation(summary = "新增或修改考核标准") + @PostMapping("/saveOrUpdateCkStandard") + public void saveOrUpdateCkStandard(@Valid @RequestBody CkStandardSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkStandard(params); + } + + @Operation(summary = "删除考核分组") + @DeleteMapping("/deleteCkGroupById") + public void deleteCkGroupById(@RequestParam Long ckGroupId) { + boolean b = Db.removeById(ckGroupId, CkGroup.class); + if (!b) { + throw new MessageException(); + } + } + + @Operation(summary = "删除考核项") + @DeleteMapping("/deleteCkItemById") + public void deleteCkItemById(@RequestParam Long ckItemId) { + boolean b = Db.removeById(ckItemId, CkItem.class); + if (!b) { + throw new MessageException(); + } + } + + @Operation(summary = "删除考核标准") + @DeleteMapping("/deleteCkStandardById") + public void deleteCkStandardById(@RequestParam Long ckStandardId) { + boolean b = Db.removeById(ckStandardId, CkStandard.class); + if (!b) { + throw new MessageException(); + } + } + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordDetailsMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordDetailsMapper.java new file mode 100644 index 0000000..a3d91bc --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordDetailsMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_assessment_record_details (考核记录明细) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkAssessmentRecordDetailsMapper extends BaseMapper { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java new file mode 100644 index 0000000..36dea56 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_assessment_record (考核记录) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkAssessmentRecordMapper extends BaseMapper { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkGroupMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkGroupMapper.java new file mode 100644 index 0000000..eb83633 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkGroupMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_group (考核组) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkGroupMapper extends BaseMapper { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkItemMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkItemMapper.java new file mode 100644 index 0000000..027c61d --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkItemMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_item (分组内的考核项) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkItemMapper extends BaseMapper{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkProjectMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkProjectMapper.java new file mode 100644 index 0000000..0827f55 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkProjectMapper.java @@ -0,0 +1,39 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.module.assessmentCriteria.pojo.entity.CkProject; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * ck_project (考核项目) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkProjectMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页参数 + * @param params 查询参数 + * @return 分页数据 + */ + Page pager(@Param("page") Page page, + @Param("params") CkProjectPagerQueryParams params); + + /** + * 考核项目详情 + * + * @param ckProjectId 考核项目id + * @return 详情 + */ + List ckProjectDetail(@Param("ckProjectId") Long ckProjectId); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkStandardMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkStandardMapper.java new file mode 100644 index 0000000..fa97775 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkStandardMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_standard (扣分标准) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkStandardMapper extends BaseMapper{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java new file mode 100644 index 0000000..bc8ee3d --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java @@ -0,0 +1,57 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核记录 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkAssessmentRecord extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 企事业单位id + */ + private Long enterprisesUnitId; + + /** + * 考核项目id + */ + private Long ckProjectId; + + /** + * 考核人员签字 + */ + private String assessmentUserSignature; + + /** + * 被考核单位人员签字 + */ + private String byAssessmentEnterprisesUnitUserSignature; + + /** + * 考核备注 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java new file mode 100644 index 0000000..7b99f6c --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java @@ -0,0 +1,57 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核记录明细 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkAssessmentRecordDetails extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核记录id + */ + private Long ckAssessmentRecordId; + + /** + * 考核项目id + */ + private Long ckProjectId; + + /** + * 考核分组id + */ + private Long ckGroupId; + + /** + * 考核项id + */ + private Long ckItemId; + + /** + * 考核标准id + */ + private Long ckStandardId; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java new file mode 100644 index 0000000..4b2e86d --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java @@ -0,0 +1,52 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核组 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkGroup extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核项目id + */ + private Long ckProjectId; + + /** + * 考核组名称 + */ + private String name; + + /** + * 总分 + */ + private Integer totalScore; + + /** + * 备注信息 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java new file mode 100644 index 0000000..f969bd6 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java @@ -0,0 +1,53 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.common.db.enums.SelectType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 分组内的考核项 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkItem extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核组id + */ + private Long ckGroupId; + + /** + * 考核项名称 + */ + private String name; + + /** + * 单选或多选 + */ + private SelectType type; + + /** + * 备注信息 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java new file mode 100644 index 0000000..f9f1bb3 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java @@ -0,0 +1,53 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核项目 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkProject extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核项目名字 + */ + private String name; + + /** + * 类型(对应企事业单位类型) + */ + private EnterprisesUnitType type; + + /** + * 总分 + */ + private Integer totalScore; + + /** + * 备注信息 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java new file mode 100644 index 0000000..1a561a2 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java @@ -0,0 +1,47 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.common.db.enums.SelectType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 扣分标准 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkStandard extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核项id + */ + private Long ckItemId; + + /** + * 条件 + */ + private String name; + + /** + * 扣多少分 + */ + private Double deductionPoints; + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/AssessmentRecordParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/AssessmentRecordParams.java new file mode 100644 index 0000000..af66d88 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/AssessmentRecordParams.java @@ -0,0 +1,54 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/7 上午11:15 + * @desc AssessmentRecordParams... + */ +@Data +public class AssessmentRecordParams { + @Schema(description = "企事业单位id") + @NotNull(message = "被考核单位不能为空") + private Long enterprisesUnitId; + + @Schema(description = "考核项目") + @NotNull(message = "考核项目不能为空") + private Long ckProjectId; + + @Schema(description = "考核人员签字") + @NotEmpty(message = "考核人员需签字") + private String assessmentUserSignature; + @Schema(description = "被考核单位人员签字") + @NotEmpty(message = "被考核单位需人员签字") + private String byAssessmentEnterprisesUnitUserSignature; + + @Schema(description = "考核备注") + private String remark; + + @Valid + @Schema(description = "考核记录详情") + private List assessmentRecordDetails; + + @Data + public static class RecordDetailParams { + @NotNull(message = "考核分组不能为空") + @Schema(description = "考核分组id") + private Long ckGroupId; + + @NotNull(message = "考核项不能为空") + @Schema(description = "考核项id") + private Long ckItemId; + + @NotNull(message = "考核标准不能为空") + @Schema(description = "考核标准id") + private Long ckStandardId; + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java new file mode 100644 index 0000000..d0e464c --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java @@ -0,0 +1,33 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:31 + * @desc CkProjectSaveOrUpdateParams... + */ +@Data +public class CkGroupSaveOrUpdateParams { + @Schema(description = "考核分组id") + private Long snowFlakeId; + + @Schema(description = "考核项目id") + @NotNull(message = "所属考核项目不能为空") + private Long ckProjectId; + + @NotBlank(message = "考核组名不能为空") + @Schema(description = "考核组名称") + private String name; + + @NotNull(message = "考核组分数不能为空") + @Schema(description = "考核组总分") + private Integer totalScore; + + @Schema(description = "备注") + private String remark; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkItemSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkItemSaveOrUpdateParams.java new file mode 100644 index 0000000..9f9868e --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkItemSaveOrUpdateParams.java @@ -0,0 +1,33 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午11:51 + * @desc CkItemSaveOrUpdateParams... + */ +@Data +public class CkItemSaveOrUpdateParams { + @Schema(description = "id") + private Long snowFlakeId; + + @NotNull(message = "考核组不能为空") + @Schema(description = "考核组id") + private Long ckGroupId; + + @NotBlank(message = "考核项名称不能为空") + @Schema(description = "考核项名称") + private String name; + + @NotNull(message = "组件类型不能为空") + @Schema(description = "组件类型") + private SelectType type; + + @Schema(description = "备注") + private String remark; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java new file mode 100644 index 0000000..fb01afa --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java @@ -0,0 +1,35 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:31 + * @desc CkProjectSaveOrUpdateParams... + */ +@Data +public class CkProjectSaveOrUpdateParams { + @Schema(description = "考核项目id") + private Long snowFlakeId; + + @NotBlank(message = "考核项目名不能为空") + @Schema(description = "考核项目名称") + private String name; + + @NotNull(message = "单位类型不能为空") + @Schema(description = "对应企事业单位类型") + private EnterprisesUnitType type; + + @NotNull(message = "考核分数不能为空") + @Schema(description = "考核总分") + private Integer totalScore; + + @Schema(description = "备注") + private String remark; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java new file mode 100644 index 0000000..9923114 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java @@ -0,0 +1,31 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 下午2:50 + * @desc CkStandardSaveOrUpdateParams... + */ +@Data +public class CkStandardSaveOrUpdateParams { + @Schema(description = "考核标准id") + private Long snowFlakeId; + + @NotNull + @Schema(description = "考核项id") + private Long ckItemId; + + @NotBlank(message = "标准名不能为空") + @Schema(description = "标准名") + private String name; + + @NotNull(message = "扣分值不能为空") + @Schema(description = "扣分值") + private Double deductionPoints; + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/CkProjectPagerQueryParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/CkProjectPagerQueryParams.java new file mode 100644 index 0000000..30b42d7 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/CkProjectPagerQueryParams.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.pojo.queryParams; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:09 + * @desc CkProjectPagerQueryParams... + */ +@Data +public class CkProjectPagerQueryParams { + private String name; + private EnterprisesUnitType type; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentCriteriaRuleVo.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentCriteriaRuleVo.java new file mode 100644 index 0000000..8295151 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentCriteriaRuleVo.java @@ -0,0 +1,57 @@ +package com.changhu.module.assessmentCriteria.pojo.vo; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/7 上午10:00 + * @desc 考核标准规则 + */ +@Data +public class AssessmentCriteriaRuleVo { + @Schema(description = "考核组id") + private Long snowFlakeId; + @Schema(description = "考核组名称") + private String name; + @Schema(description = "考核组总成绩") + private Integer totalScore; + @Schema(description = "考核组备注") + private String remark; + + @Schema(description = "考核项") + private List itemList; + + @Data + public static class Item { + @Schema(description = "考核项id") + private Long snowFlakeId; + @Schema(description = "考核分组id") + private Long ckGroupId; + @Schema(description = "考核项名称") + private String name; + @Schema(description = "考核项组件类型") + private SelectType type; + @Schema(description = "考核项备注") + private String remark; + + @Schema(description = "考核标准") + private List standardList; + } + + @Data + public static class Standard { + @Schema(description = "考核标准id") + private Long snowFlakeId; + @Schema(description = "考核项id") + private Long ckItemId; + @Schema(description = "考核标准名字") + private String name; + @Schema(description = "扣分值") + private Double deductionPoints; + } + +} \ No newline at end of file diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectDetailTableVo.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectDetailTableVo.java new file mode 100644 index 0000000..c83b28f --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectDetailTableVo.java @@ -0,0 +1,39 @@ +package com.changhu.module.assessmentCriteria.pojo.vo; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午11:03 + * @desc CkProjectDetailTableVo... + */ +@Data +public class CkProjectDetailTableVo { + + @Schema(description = "考核分组id") + private Long ckGroupId; + @Schema(description = "考核分组名字") + private String groupName; + @Schema(description = "考核分组总分") + private Integer groupTotalScore; + @Schema(description = "考核分组备注") + private String groupRemark; + + @Schema(description = "考核项id") + private Long ckItemId; + @Schema(description = "考核项名字") + private String itemName; + @Schema(description = "组件类型") + private SelectType type; + @Schema(description = "考核项备注") + private String itemRemark; + + @Schema(description = "考核标准id") + private Long ckStandardId; + @Schema(description = "考核标准") + private String standardName; + @Schema(description = "扣分数") + private Double deductionPoints; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectPagerVo.java new file mode 100644 index 0000000..43589d1 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectPagerVo.java @@ -0,0 +1,31 @@ +package com.changhu.module.assessmentCriteria.pojo.vo; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:05 + * @desc CkProjectPagerVo... + */ +@Data +public class CkProjectPagerVo { + + @Schema(description = "考核项目id") + private Long snowFlakeId; + @Schema(description = "考核项目名称") + private String name; + @Schema(description = "对应企事业单位类型") + private EnterprisesUnitType type; + @Schema(description = "考核总分") + private Integer totalScore; + @Schema(description = "备注") + private String remark; + @Schema(description = "创建时间") + private LocalDateTime createTime; + @Schema(description = "创建人名字") + private String createUserName; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/AssessmentCriteriaService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/AssessmentCriteriaService.java new file mode 100644 index 0000000..d752efa --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/AssessmentCriteriaService.java @@ -0,0 +1,95 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.assessmentCriteria.pojo.params.*; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import com.changhu.support.mybatisplus.pojo.params.PageParams; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:07 + * @desc AssessmentCriteriaService... + */ +public interface AssessmentCriteriaService { + + /** + * 根据类型获取考核标准列表 + * + * @param type 类型 + * @return 结果 + */ + List> assessmentCriteriaListByType(EnterprisesUnitType type); + + /** + * 根据考核项目获取考核规则 + * + * @param ckProjectId 考核项目id + * @return 结果 + */ + List assessmentCriteriaRulesByCkProjectId(Long ckProjectId); + + /** + * 考核项目分页查询 + * + * @param queryParams 查询参数 + * @return 查询结果 + */ + Page ckProjectPagerVoPager(PageParams queryParams); + + /** + * 新增或修改考核项目 + * + * @param params 参数 + */ + void saveOrUpdateCkProject(CkProjectSaveOrUpdateParams params); + + /** + * 删除考核项目 + * + * @param ckProjectId 考核项目id + */ + void deleteCkProjectById(Long ckProjectId); + + /** + * 考核项目详情 + * + * @param ckProjectId 考核项目id + * @return 结果 + */ + List ckProjectDetail(Long ckProjectId); + + /** + * 新增或修改考核分组 + * + * @param params 参数 + */ + void saveOrUpdateCkGroup(CkGroupSaveOrUpdateParams params); + + /** + * 新增或修改考核项 + * + * @param params 参数 + */ + void saveOrUpdateCkItem(CkItemSaveOrUpdateParams params); + + /** + * 新增或修改考核标准 + * + * @param params 参数 + */ + void saveOrUpdateCkStandard(CkStandardSaveOrUpdateParams params); + + /** + * 提交考核记录 + * + * @param params 参数 + */ + void submitAssessmentRecord(AssessmentRecordParams params); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordDetailsService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordDetailsService.java new file mode 100644 index 0000000..03e198c --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordDetailsService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails; + +/** + * ck_assessment_record_details (考核记录明细) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkAssessmentRecordDetailsService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordService.java new file mode 100644 index 0000000..276cf04 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; + +/** + * ck_assessment_record (考核记录) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkAssessmentRecordService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkGroupService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkGroupService.java new file mode 100644 index 0000000..db87089 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkGroupService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; + +/** + * ck_group (考核组) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkGroupService extends IService{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkItemService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkItemService.java new file mode 100644 index 0000000..4cc3fba --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkItemService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; + +/** + * ck_item (分组内的考核项) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkItemService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkProjectService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkProjectService.java new file mode 100644 index 0000000..0357d50 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkProjectService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkProject; + +/** + * ck_project (考核项目) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkProjectService extends IService{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkStandardService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkStandardService.java new file mode 100644 index 0000000..12559a6 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkStandardService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; + +/** + * ck_standard (扣分标准) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkStandardService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java new file mode 100644 index 0000000..7656390 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java @@ -0,0 +1,215 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.changhu.common.db.enums.SelectType; + +import com.changhu.common.utils.SnowFlakeIdUtil; +import com.changhu.module.assessmentCriteria.pojo.entity.*; +import com.changhu.module.assessmentCriteria.pojo.params.*; +import com.google.common.collect.Lists; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.lang.func.LambdaUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import com.changhu.module.assessmentCriteria.service.AssessmentCriteriaService; +import com.changhu.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; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:08 + * @desc AssessmentCriteriaServiceImpl... + */ +@Service +public class AssessmentCriteriaServiceImpl implements AssessmentCriteriaService { + + @Autowired + private CkProjectMapper ckProjectMapper; + + @Override + public List> assessmentCriteriaListByType(EnterprisesUnitType type) { + return Db.lambdaQuery(CkProject.class).eq(CkProject::getType, type).list() + .stream() + .map(e -> SelectNodeVo.builder() + .value(e.getSnowFlakeId()) + .label(e.getName()) + .extData(Dict.create() + .set(LambdaUtil.getFieldName(CkProject::getRemark), e.getRemark()) + .set(LambdaUtil.getFieldName(CkProject::getTotalScore), e.getTotalScore()) + .set(LambdaUtil.getFieldName(CkProject::getType), e.getType()) + .set(LambdaUtil.getFieldName(CkProject::getCreateTime), e.getCreateTime()) + ) + .build()) + .toList(); + } + + @Override + public List assessmentCriteriaRulesByCkProjectId(Long ckProjectId) { + //根据考核项目拿到考核分组 + List groupList = Db.lambdaQuery(CkGroup.class) + .eq(CkGroup::getCkProjectId, ckProjectId) + .orderByAsc(BaseEntity::getCreateTime) + .list() + .stream() + .map(e -> { + AssessmentCriteriaRuleVo assessmentCriteriaRuleVo = new AssessmentCriteriaRuleVo(); + assessmentCriteriaRuleVo.setSnowFlakeId(e.getSnowFlakeId()); + assessmentCriteriaRuleVo.setName(e.getName()); + assessmentCriteriaRuleVo.setTotalScore(e.getTotalScore()); + assessmentCriteriaRuleVo.setRemark(e.getRemark()); + return assessmentCriteriaRuleVo; + }).toList(); + if (groupList.isEmpty()) { + throw new MessageException("该考核项目内暂未制定规则"); + } + //根据考核分组拿到考核项 + List itemList = Db.lambdaQuery(CkItem.class) + .in(CkItem::getCkGroupId, groupList.stream().map(AssessmentCriteriaRuleVo::getSnowFlakeId).toList()) + .orderByAsc(BaseEntity::getCreateTime) + .list() + .stream() + .map(e -> { + AssessmentCriteriaRuleVo.Item item = new AssessmentCriteriaRuleVo.Item(); + item.setSnowFlakeId(e.getSnowFlakeId()); + item.setCkGroupId(e.getCkGroupId()); + item.setName(e.getName()); + item.setType(e.getType()); + item.setRemark(e.getRemark()); + return item; + }).toList(); + if (itemList.isEmpty()) { + throw new MessageException("该考核项目内未制定考核项"); + } + //根据考核项拿到考核标准 + List standardList = Db.lambdaQuery(CkStandard.class) + .in(CkStandard::getCkItemId, itemList.stream().map(AssessmentCriteriaRuleVo.Item::getSnowFlakeId).toList()) + .orderByAsc(BaseEntity::getCreateTime) + .list().stream() + .map(e -> { + AssessmentCriteriaRuleVo.Standard standard = new AssessmentCriteriaRuleVo.Standard(); + standard.setSnowFlakeId(e.getSnowFlakeId()); + standard.setCkItemId(e.getCkItemId()); + standard.setName(e.getName()); + standard.setDeductionPoints(e.getDeductionPoints()); + return standard; + }).toList(); + if (standardList.isEmpty()) { + throw new MessageException("该考核项目内未制定考核标准"); + } + //先将考核标准塞到考核项内 + Map> standardMap = standardList.stream().collect(Collectors.groupingBy(AssessmentCriteriaRuleVo.Standard::getCkItemId)); + itemList.forEach(e -> e.setStandardList(standardMap.get(e.getSnowFlakeId()))); + //将考核项塞到考核分组内 + Map> itemMap = itemList.stream().collect(Collectors.groupingBy(AssessmentCriteriaRuleVo.Item::getCkGroupId)); + groupList.forEach(e -> e.setItemList(itemMap.get(e.getSnowFlakeId()))); + + return groupList; + } + + @Override + public Page ckProjectPagerVoPager(PageParams queryParams) { + return ckProjectMapper.pager(queryParams.getPage(), queryParams.getParams()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkProject(CkProjectSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkProject.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteCkProjectById(Long ckProjectId) { + boolean b = Db.removeById(ckProjectId, CkProject.class); + if (!b) { + throw new MessageException(); + } + } + + @Override + public List ckProjectDetail(Long ckProjectId) { + return ckProjectMapper.ckProjectDetail(ckProjectId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkGroup(CkGroupSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkGroup.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkItem(CkItemSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkItem.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkStandard(CkStandardSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkStandard.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void submitAssessmentRecord(AssessmentRecordParams params) { + CkAssessmentRecord ckAssessmentRecord = CkAssessmentRecord.builder() + .snowFlakeId(SnowFlakeIdUtil.snowflakeId()) + .enterprisesUnitId(params.getEnterprisesUnitId()) + .ckProjectId(params.getCkProjectId()) + .assessmentUserSignature(params.getAssessmentUserSignature()) + .byAssessmentEnterprisesUnitUserSignature(params.getByAssessmentEnterprisesUnitUserSignature()) + .remark(params.getRemark()) + .build(); + //保存考核记录 + boolean save = Db.save(ckAssessmentRecord); + if (!save) { + throw new MessageException(); + } + List assessmentRecordDetails = params.getAssessmentRecordDetails(); + if (CollUtil.isEmpty(assessmentRecordDetails)) { + return; + } + //保存考核明细 + boolean b = Db.saveBatch(assessmentRecordDetails.stream() + .map(e -> CkAssessmentRecordDetails.builder() + .ckAssessmentRecordId(ckAssessmentRecord.getSnowFlakeId()) + .ckProjectId(ckAssessmentRecord.getCkProjectId()) + .ckGroupId(e.getCkGroupId()) + .ckItemId(e.getCkItemId()) + .ckStandardId(e.getCkStandardId()) + .build()) + .toList()); + if (!b) { + throw new MessageException(); + } + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordDetailsServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordDetailsServiceImpl.java new file mode 100644 index 0000000..5b8e36a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordDetailsServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkAssessmentRecordDetailsMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails; +import com.changhu.module.assessmentCriteria.service.CkAssessmentRecordDetailsService; +import org.springframework.stereotype.Service; + +/** + * ck_assessment_record_details (考核记录明细) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkAssessmentRecordDetailsServiceImpl extends ServiceImpl implements CkAssessmentRecordDetailsService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordServiceImpl.java new file mode 100644 index 0000000..489e736 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkAssessmentRecordMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; +import com.changhu.module.assessmentCriteria.service.CkAssessmentRecordService; +import org.springframework.stereotype.Service; + +/** + * ck_assessment_record (考核记录) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkAssessmentRecordServiceImpl extends ServiceImpl implements CkAssessmentRecordService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkGroupServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkGroupServiceImpl.java new file mode 100644 index 0000000..fb5e43b --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkGroupServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkGroupMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; +import com.changhu.module.assessmentCriteria.service.CkGroupService; +import org.springframework.stereotype.Service; + +/** + * ck_group (考核组) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkGroupServiceImpl extends ServiceImpl implements CkGroupService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkItemServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkItemServiceImpl.java new file mode 100644 index 0000000..f89df12 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkItemServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkItemMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; +import com.changhu.module.assessmentCriteria.service.CkItemService; +import org.springframework.stereotype.Service; + +/** + * ck_item (分组内的考核项) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkItemServiceImpl extends ServiceImpl implements CkItemService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkProjectServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkProjectServiceImpl.java new file mode 100644 index 0000000..660fc01 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkProjectServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkProject; +import com.changhu.module.assessmentCriteria.service.CkProjectService; +import org.springframework.stereotype.Service; + +/** + * ck_project (考核项目) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkProjectServiceImpl extends ServiceImpl implements CkProjectService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkStandardServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkStandardServiceImpl.java new file mode 100644 index 0000000..16d8dc1 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkStandardServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkStandardMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; +import com.changhu.module.assessmentCriteria.service.CkStandardService; +import org.springframework.stereotype.Service; + +/** + * ck_standard (扣分标准) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkStandardServiceImpl extends ServiceImpl implements CkStandardService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java index 8569927..b5f5b6a 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java @@ -3,6 +3,7 @@ package com.changhu.module.management.pojo.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import lombok.AllArgsConstructor; @@ -41,6 +42,12 @@ public class EnterprisesUnit extends BaseEntity implements Serializable { */ private String name; + + /** + * 企事业单位类型 + */ + private EnterprisesUnitType type; + /** * 省 */ diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java index 94a6ed6..7751ec3 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java @@ -1,5 +1,6 @@ package com.changhu.module.management.pojo.params; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.module.management.pojo.model.ContactPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; @@ -28,6 +29,10 @@ public class EnterprisesUnitSaveOrUpdateParams { @NotBlank(message = "名称不能为空") private String name; + @Schema(description = "类型") + @NotNull(message = "类型不能为空") + private EnterprisesUnitType type; + @Schema(description = "行政区划编码") @NotEmpty(message = "行政区划不能为空") private List administrativeDivisionCodes; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java index 29a3406..6fac384 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java @@ -1,5 +1,6 @@ package com.changhu.module.management.pojo.vo; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.module.management.pojo.model.ContactPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -16,6 +17,9 @@ public class EnterprisesUnitPagerVo { @Schema(description = "名字") private String name; + @Schema(description = "类型") + private EnterprisesUnitType type; + @Schema(description = "公安单位id") private Long policeUnitId; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java index 7c2c0bc..bc8af47 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java @@ -3,6 +3,8 @@ 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.common.pojo.vo.SelectNodeVo; +import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.service.MPoliceService; import io.swagger.v3.oas.annotations.Operation; @@ -26,10 +28,24 @@ public class PoliceIndexController { @Autowired private MPoliceService policeIndexService; + @Operation(summary = "首页数据统计") + @GetMapping("/dataStatistics") + @CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE) + public IndexDataStatisticsVo dataStatistics() { + return policeIndexService.dataStatistics(); + } + @Operation(summary = "获取单位内的服务项目") @GetMapping("/getUnitServiceProjectList") @CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE) public List getUnitServiceProjectList() { return policeIndexService.getUnitServiceProjectList(); } + + @Operation(summary = "获取单位内的企事业单位列表") + @GetMapping("/getUnitEnterprisesUnitList") + @CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE) + public List> getUnitEnterprisesUnitList() { + return policeIndexService.getUnitEnterprisesUnitList(); + } } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexDataStatisticsVo.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexDataStatisticsVo.java new file mode 100644 index 0000000..5de0f7a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexDataStatisticsVo.java @@ -0,0 +1,21 @@ +package com.changhu.module.miniProgram.pojo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/7 下午2:23 + * @desc IndexDataStatisticsVo... + */ +@Data +public class IndexDataStatisticsVo { + @Schema(description = "企事业单位数量") + private Integer enterprisesUnitCount = 0; + @Schema(description = "服务项目数量") + private Integer serviceProjectCount = 0; + @Schema(description = "保安人员数量") + private Integer securityUserCount = 0; + @Schema(description = "无证保安人员数量") + private Integer noCardSecurityUserCount = 0; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java index ec5e49d..c265925 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java @@ -1,6 +1,7 @@ package com.changhu.module.miniProgram.pojo.vo; import cn.hutool.core.lang.Dict; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.ServiceProjectType; import com.changhu.module.management.pojo.model.ContactPersonInfo; @@ -21,6 +22,8 @@ public class IndexServiceProjectListVo { private Long snowFlakeId; @Schema(description = "企事业单位名称") private String name; + @Schema(description = "单位类型") + private EnterprisesUnitType type; @Schema(description = "省编码") private String province; @@ -53,10 +56,15 @@ public class IndexServiceProjectListVo { static class ServiceProjectVo { @Schema(description = "服务项目id") private Long snowFlakeId; + @Schema(description = "保安单位id") private Long securityUnitId; + @Schema(description = "保安单位名字") + private String securityUnitName; + @Schema(description = "项目经理信息") private Dict projectManagerMiniProgramUserInfo; + @Schema(description = "服务项目名称") private String name; @Schema(description = "服务项目类型") diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java index 60954f9..43ed4ac 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java @@ -1,5 +1,7 @@ package com.changhu.module.miniProgram.service; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import java.util.List; @@ -10,10 +12,26 @@ import java.util.List; * @desc MPoliceService... */ public interface MPoliceService { + + /** + * 首页数据统计 + * + * @return 首页数据统计 + */ + IndexDataStatisticsVo dataStatistics(); + /** * 获取单位内的服务项目 * * @return 服务项目 */ List getUnitServiceProjectList(); + + /** + * 获取单位内的企事业单位列表 + * + * @return 企事业单位列表 + */ + List> getUnitEnterprisesUnitList(); + } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java index d8ec8b6..1877493 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java @@ -1,9 +1,18 @@ package com.changhu.module.miniProgram.service.impl; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.lang.func.LambdaUtil; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.utils.UserUtil; import com.changhu.module.management.mapper.ServiceProjectMapper; +import com.changhu.module.management.pojo.entity.EnterprisesUnit; +import com.changhu.module.management.pojo.entity.ServiceProject; +import com.changhu.module.miniProgram.pojo.entity.SecurityUser; +import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.service.MPoliceService; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,8 +29,61 @@ public class MPoliceServiceImpl implements MPoliceService { @Autowired private ServiceProjectMapper serviceProjectMapper; + @Override + public IndexDataStatisticsVo dataStatistics() { + Long unitId = UserUtil.getUnitId(); + IndexDataStatisticsVo indexDataStatisticsVo = new IndexDataStatisticsVo(); + List enterprisesUnitIds = Db.lambdaQuery(EnterprisesUnit.class) + .eq(EnterprisesUnit::getPoliceUnitId, unitId) + .list() + .stream().map(BaseEntity::getSnowFlakeId) + .toList(); + if (enterprisesUnitIds.isEmpty()) { + return indexDataStatisticsVo; + } + indexDataStatisticsVo.setEnterprisesUnitCount(enterprisesUnitIds.size()); + + List serviceProjectIds = Db.lambdaQuery(ServiceProject.class) + .in(ServiceProject::getEnterprisesUnitId, enterprisesUnitIds) + .list() + .stream() + .map(BaseEntity::getSnowFlakeId) + .toList(); + if (serviceProjectIds.isEmpty()) { + return indexDataStatisticsVo; + } + indexDataStatisticsVo.setServiceProjectCount(serviceProjectIds.size()); + + Long securityUserCount = Db.lambdaQuery(SecurityUser.class) + .in(SecurityUser::getServiceProjectId, serviceProjectIds) + .count(); + indexDataStatisticsVo.setSecurityUserCount(securityUserCount.intValue()); + + Long noCardSecurityUserCount = Db.lambdaQuery(SecurityUser.class) + .in(SecurityUser::getServiceProjectId, serviceProjectIds) + .isNull(SecurityUser::getSecurityNumber) + .count(); + indexDataStatisticsVo.setNoCardSecurityUserCount(noCardSecurityUserCount.intValue()); + + return indexDataStatisticsVo; + } + @Override public List getUnitServiceProjectList() { return serviceProjectMapper.getServiceProjectList(UserUtil.getUnitId(), null); } + + @Override + public List> getUnitEnterprisesUnitList() { + return Db.lambdaQuery(EnterprisesUnit.class) + .eq(EnterprisesUnit::getPoliceUnitId, UserUtil.getUnitId()) + .list() + .stream() + .map(item -> SelectNodeVo.builder() + .value(item.getSnowFlakeId()) + .label(item.getName()) + .extData(Dict.of(LambdaUtil.getFieldName(EnterprisesUnit::getType), item.getType())) + .build()) + .toList(); + } } diff --git a/policeSecurityServer/src/main/resources/conf/log4j2.xml b/policeSecurityServer/src/main/resources/conf/log4j2.xml index e08488c..4b6a1a2 100644 --- a/policeSecurityServer/src/main/resources/conf/log4j2.xml +++ b/policeSecurityServer/src/main/resources/conf/log4j2.xml @@ -131,6 +131,9 @@ + + + diff --git a/policeSecurityServer/src/main/resources/mapper/CkProjectMapper.xml b/policeSecurityServer/src/main/resources/mapper/CkProjectMapper.xml new file mode 100644 index 0000000..582f133 --- /dev/null +++ b/policeSecurityServer/src/main/resources/mapper/CkProjectMapper.xml @@ -0,0 +1,37 @@ + + + + + + \ No newline at end of file diff --git a/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml b/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml index dbe90f9..3a5505a 100644 --- a/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml @@ -49,6 +49,7 @@ JSON_ARRAYAGG(JSON_OBJECT( 'snowFlakeId', sp.snow_flake_id, 'securityUnitId',sp.security_unit_id, + 'securityUnitName',su.name, 'name', sp.name, 'type', sp.type, 'isRecruitSecurity', sp.is_recruit_security, @@ -65,6 +66,7 @@ '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 security_unit su on sp.security_unit_id = su.snow_flake_id and su.delete_flag = 0 left join mini_program_user mpu on sp.project_manager_mini_program_user_id = mpu.snow_flake_id and mpu.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 diff --git a/superManagement/.env.development b/superManagement/.env.development index 4d6d879..e416923 100644 --- a/superManagement/.env.development +++ b/superManagement/.env.development @@ -14,3 +14,7 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R # minio VITE_APP_MINIO_URL=http://118.253.177.137:9000 VITE_APP_MINIO_BUCKET=police-security-dev + +# 高德 +VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +VITE_APP_GAODE_VERSION=2.0 diff --git a/superManagement/.env.production b/superManagement/.env.production index 71171e8..70b36e1 100644 --- a/superManagement/.env.production +++ b/superManagement/.env.production @@ -14,3 +14,7 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpu1C3JHZ+Ng/eVVCZ # minio VITE_APP_MINIO_URL=https://www.hnjinglian.cn:9002 VITE_APP_MINIO_BUCKET=police-security + +# 高德 +VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +VITE_APP_GAODE_VERSION=2.0 diff --git a/superManagement/package.json b/superManagement/package.json index 6a8d6e4..882b02e 100644 --- a/superManagement/package.json +++ b/superManagement/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "dependencies": { + "@amap/amap-jsapi-loader": "^1.0.1", "@vueuse/core": "^11.0.3", "ant-design-vue": "^4.2.3", "axios": "^1.7.5", @@ -24,6 +25,7 @@ "vue-uuid": "^3.0.0" }, "devDependencies": { + "@amap/amap-jsapi-types": "^0.0.15", "@types/lodash-es": "^4.17.8", "@types/node": "^22.5.1", "@vitejs/plugin-vue": "^5.1.2", diff --git a/superManagement/src/components/aMap/MapContainer.vue b/superManagement/src/components/aMap/MapContainer.vue new file mode 100644 index 0000000..d637e87 --- /dev/null +++ b/superManagement/src/components/aMap/MapContainer.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/superManagement/src/components/layout/MenuItem.vue b/superManagement/src/components/layout/MenuItem.vue index feb26ca..6323222 100644 --- a/superManagement/src/components/layout/MenuItem.vue +++ b/superManagement/src/components/layout/MenuItem.vue @@ -19,7 +19,6 @@ > {{ item.title }} diff --git a/superManagement/src/components/tree/AdministrativeDivisionTree.vue b/superManagement/src/components/tree/AdministrativeDivisionTree.vue index c6a45f4..3822dfd 100644 --- a/superManagement/src/components/tree/AdministrativeDivisionTree.vue +++ b/superManagement/src/components/tree/AdministrativeDivisionTree.vue @@ -1,11 +1,9 @@ @@ -14,18 +12,14 @@ import api from "@/axios"; import {onMounted, ref} from "vue"; import {CascaderProps} from "ant-design-vue"; import {isEmpty} from "lodash-es"; +import {AdministrativeDivisionTreeProps} from "@/types/components/tree"; -withDefaults(defineProps<{ - placeholder?: string, - changeOnSelect?: boolean - allowClear?: boolean -}>(), { +const props = withDefaults(defineProps(), { placeholder: '请选择行政区划', changeOnSelect: true, - allowClear: true + allowClear: true, }) - const modelValue = defineModel('value', { default: [] }) diff --git a/superManagement/src/config/dict.ts b/superManagement/src/config/dict.ts index 7175c25..ed69da7 100644 --- a/superManagement/src/config/dict.ts +++ b/superManagement/src/config/dict.ts @@ -8,6 +8,8 @@ type DictType = | 'Sex' | 'ServiceProjectType' | 'MiniProgramUserIdentity' + | 'EnterprisesUnitType' + | 'SelectType' export const initDict = () => { api.get[]>>('/common/enums').then(resp => { diff --git a/superManagement/src/config/index.ts b/superManagement/src/config/index.ts index 3494115..93fcb7f 100644 --- a/superManagement/src/config/index.ts +++ b/superManagement/src/config/index.ts @@ -21,13 +21,23 @@ export const SYSTEM_MENUS: SystemMenu[] = [ type: 'dir', children: [ { - title: '公安单位', - name: 'policeUnit', - path: '/policeUnit', - type: 'menu', - // icon: 'icon-policeman-full', - // size: '16', - component: () => import('@/views/unitManage/policeUnit/index.vue') + title: '公安', + name: 'police', + path: '/police', + type: 'dir', + children: [{ + title: '单位管理', + name: 'policeUnitManage', + path: '/police/unitManage', + type: 'menu', + component: () => import('@/views/unitManage/police/unitManage/index.vue') + }, { + title: '考核标准', + name: 'policeAssessmentCriteria', + path: '/police/assessmentCriteria', + type: 'menu', + component: () => import('@/views/unitManage/police/assessmentCriteria/index.vue') + }] }, { title: '保安单位', name: 'securityUnit', @@ -36,5 +46,12 @@ export const SYSTEM_MENUS: SystemMenu[] = [ component: () => import('@/views/unitManage/securityUnit/index.vue') } ] + }, { + title: '数据总览', + name: 'dataOverview', + path: '/dataOverview', + type: 'menu', + isFull: true, + component: () => import('@/views/data/dataOverview.vue') } ] diff --git a/superManagement/src/main.ts b/superManagement/src/main.ts index fc498ba..27927ba 100644 --- a/superManagement/src/main.ts +++ b/superManagement/src/main.ts @@ -13,6 +13,8 @@ import router from "@/router"; // pinia stores import pinia from "@/stores"; import {initDict} from "@/config/dict.ts"; +//高德类型声明文件 +import "@amap/amap-jsapi-types"; initDict(); diff --git a/superManagement/src/router/staticRouters.ts b/superManagement/src/router/staticRouters.ts index 70c4ab1..a4e2afe 100644 --- a/superManagement/src/router/staticRouters.ts +++ b/superManagement/src/router/staticRouters.ts @@ -2,33 +2,47 @@ import {RouteRecordRaw} from "vue-router"; import {SYSTEM_MENUS} from "@/config"; import {SystemMenu} from "@/types/config"; +const routerClassify: Record<'layout' | 'full', RouteRecordRaw[]> = { + layout: [], + full: [] +} + /** * 提取菜单路由 */ -const extractMenuToRouter = (): RouteRecordRaw[] => { - const result: RouteRecordRaw[] = [] +const extractMenuToRouter = () => { const traverse = (data: SystemMenu[]) => { data.forEach(item => { if (item.type === 'dir' && item.children && item.children.length > 0) { traverse(item.children) } else { - result.push({ - path: item.path, - name: item.name, - meta: { - title: item.title - }, - component: item.component - } as RouteRecordRaw) + if (!item.isFull) { + routerClassify.layout.push({ + path: item.path, + name: item.name, + meta: { + title: item.title + }, + component: item.component + } as RouteRecordRaw) + } else { + routerClassify.full.push({ + path: item.path, + name: item.name, + meta: { + title: item.title + }, + component: item.component + } as RouteRecordRaw) + } } }) } - traverse(SYSTEM_MENUS) - - return result; } +extractMenuToRouter() + export const staticRouter: RouteRecordRaw[] = [ { path: '/login', @@ -45,8 +59,10 @@ export const staticRouter: RouteRecordRaw[] = [ name: 'layout', redirect: '/index', component: () => import("@/components/layout/Layout.vue"), - children: extractMenuToRouter() - }, { + children: routerClassify.layout + }, + ...routerClassify.full, + { path: '/test', name: 'test', component: () => import("@/views/test.vue"), diff --git a/superManagement/src/types/components/tree/index.ts b/superManagement/src/types/components/tree/index.ts new file mode 100644 index 0000000..8b14928 --- /dev/null +++ b/superManagement/src/types/components/tree/index.ts @@ -0,0 +1,7 @@ +export interface AdministrativeDivisionTreeProps { + placeholder?: string, + changeOnSelect?: boolean + allowClear?: boolean + onChange?: (value: (string | number[]), selectedOptions: TreeNodeVo[]) => void + displayRender?: (opt: { labels: string[], selectedOptions: TreeNodeVo[] }) => string +} diff --git a/superManagement/src/types/config/index.ts b/superManagement/src/types/config/index.ts index f81e2db..f9c23a8 100644 --- a/superManagement/src/types/config/index.ts +++ b/superManagement/src/types/config/index.ts @@ -4,6 +4,7 @@ export interface SystemMenu { type: 'dir' | 'menu'; title: string; path: string; + isFull?: boolean; name: string; icon?: string; diff --git a/superManagement/src/types/views/unitManage/police/assessmentCriteria.ts b/superManagement/src/types/views/unitManage/police/assessmentCriteria.ts new file mode 100644 index 0000000..206ea15 --- /dev/null +++ b/superManagement/src/types/views/unitManage/police/assessmentCriteria.ts @@ -0,0 +1,90 @@ +import {BaseTableRowRecord} from "@/types/components/table"; + +export interface CkProjectPagerVo extends BaseTableRowRecord { + name: string; + type: BaseEnum + totalScore: number + remark: string; +} + +export interface CkProjectPagerQueryParams { + name: string; + type: string +} + +export interface SaveOrUpdateCkProjectParams { + /*考核项目id */ + snowFlakeId?: string; + /*考核项目名称 */ + name: string; + /*对应企事业单位类型,可用值:school,hospital,community,bank */ + type: string; + /*考核总分 */ + totalScore: number; + /*备注 */ + remark?: string; +} + +export interface SaveOrUpdateCkGroupParams { + /*考核分组id */ + snowFlakeId?: string; + /*考核项目id */ + ckProjectId?: string; + /*考核组名称 */ + name: string; + /*考核组总分 */ + totalScore: number; + /*备注 */ + remark?: string; +} + +export interface SaveOrUpdateCkItemParams { + /*id */ + snowFlakeId?: string; + /*考核组id */ + ckGroupId: string; + /*考核项名称 */ + name: string; + /*组件类型,可用值:RADIO,MULTIPLE */ + type: string; + /*备注 */ + remark?: string; +} + +export interface SaveOrUpdateCkStandardParams { + /*考核标准id */ + snowFlakeId?: string; + /*考核项id */ + ckItemId: string; + /*标准名 */ + name: string; + /*扣分值 */ + deductionPoints: number; +} + +export interface CkProjectDetailRes { + /*考核分组id */ + ckGroupId: string; + groupRowSpan: number; + /*考核分组名字 */ + groupName: string; + /*考核分组总分 */ + groupTotalScore: number; + /*考核分组备注 */ + groupRemark: string; + /*考核项id */ + ckItemId: string; + itemRowSpan: number; + /*考核项名字 */ + itemName: string; + /*考核项备注 */ + itemRemark: string; + /*考核标准id */ + ckStandardId: string; + /*考核标准条件 */ + standardName: string; + /*扣分数 */ + deductionPoints: number; + /*选择类型,可用值:RADIO,MULTIPLE */ + type: BaseEnum; +} diff --git a/superManagement/src/types/views/unitManage/policeUnit.ts b/superManagement/src/types/views/unitManage/police/policeUnit.ts similarity index 97% rename from superManagement/src/types/views/unitManage/policeUnit.ts rename to superManagement/src/types/views/unitManage/police/policeUnit.ts index ce0e7ec..c3bdb3b 100644 --- a/superManagement/src/types/views/unitManage/policeUnit.ts +++ b/superManagement/src/types/views/unitManage/police/policeUnit.ts @@ -55,6 +55,7 @@ export interface EnterprisesUnitPagerQueryParams { export interface EnterprisesUnitPagerVo extends BaseTableRowRecord { /** 名字 **/ name?: string; + type: BaseEnum /** 公安单位id **/ policeUnitId: string; /** 省编码 **/ @@ -91,6 +92,8 @@ export interface EnterprisesUnitSaveOrUpdateParams { policeUnitId: string; /** 名称 **/ name: string; + /** 类型 **/ + type: string; /** 行政区划编码 **/ administrativeDivisionCodes: string[]; /** 详细地址 **/ diff --git a/superManagement/src/utils/aMapUtil.ts b/superManagement/src/utils/aMapUtil.ts new file mode 100644 index 0000000..574e061 --- /dev/null +++ b/superManagement/src/utils/aMapUtil.ts @@ -0,0 +1,18 @@ +import AMapLoader from "@amap/amap-jsapi-loader"; + +type Amap = typeof AMap; +export const initMap = (plugins?: string[]): Promise => new Promise((resolve, reject) => { + //@ts-ignore + window._AMapSecurityConfig = { + securityJsCode: '432125a0f8d8cad2dac38b77d6f6728f' + } + AMapLoader.load({ + key: __APP_ENV.VITE_APP_GAODE_KEY, + version: __APP_ENV.VITE_APP_GAODE_VERSION, + plugins + }).then((AMap: Amap) => { + resolve(AMap) + }).catch(err => { + reject(err) + }) +}) diff --git a/superManagement/src/views/data/dataOverview.vue b/superManagement/src/views/data/dataOverview.vue new file mode 100644 index 0000000..2383d4d --- /dev/null +++ b/superManagement/src/views/data/dataOverview.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/superManagement/src/views/test.vue b/superManagement/src/views/test.vue index 0ada657..3b996ad 100644 --- a/superManagement/src/views/test.vue +++ b/superManagement/src/views/test.vue @@ -1,13 +1,41 @@ + - - diff --git a/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts new file mode 100644 index 0000000..beb5e85 --- /dev/null +++ b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts @@ -0,0 +1,188 @@ +import { + CkProjectDetailRes, + SaveOrUpdateCkGroupParams, + SaveOrUpdateCkItemParams, SaveOrUpdateCkProjectParams, SaveOrUpdateCkStandardParams +} from "@/types/views/unitManage/police/assessmentCriteria.ts"; +import {deleteDataModal, submitSimpleFormModal} from "@/components/tsx/ModalPro.tsx"; +import api from "@/axios"; +import {message} from "ant-design-vue"; +import {dictSelectNodes} from "@/config/dict.ts"; + +export const saveOrUpdateCkProject = (params: SaveOrUpdateCkProjectParams = { + name: '', + totalScore: 100, + remark: '', + type: 'school' +}, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核项目', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '考核项目名称', + required: true + }, + type: { + type: 'select', + label: '考核类型', + required: true, + options: dictSelectNodes('EnterprisesUnitType') + }, + totalScore: { + type: 'inputNumber', + label: '总分', + required: true, + componentsProps: { + precision: 0 + } + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkProject', params) + message.success(resp.message) + callback && callback() + } + }) +} + +export const deleteCkProjectById = (name: string, ckProjectId: string, callback: Function) => { + deleteDataModal(name, async () => { + const resp = await api.delete('/assessmentCriteria/deleteCkProjectById', { + ckProjectId + }) + message.success(resp.message) + callback && callback(); + }) +} + +export const ckProjectDetail = async (ckProjectId: string): Promise => { + const {data} = await api.get('/assessmentCriteria/ckProjectDetail', {ckProjectId}) + + const groupRowSpan: Record = {} + const itemRowSpan: Record = {} + + data.forEach((item, index) => { + //如果第一次没有值 + if (item.ckGroupId) { + if (!groupRowSpan[item.ckGroupId]) { + groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index} + } else { + groupRowSpan[item.ckGroupId].count++; + data[index].groupRowSpan = 0 + } + } + + if (item.ckItemId) { + if (!itemRowSpan[item.ckItemId]) { + itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index} + } else { + itemRowSpan[item.ckItemId].count++; + data[index].itemRowSpan = 0 + } + } + }) + + Object.values(groupRowSpan).forEach(({count, firstIndex}) => { + data[firstIndex].groupRowSpan = count; + }) + + Object.values(itemRowSpan).forEach(({count, firstIndex}) => { + data[firstIndex].itemRowSpan = count; + }) + + return data +} + +export const saveOrUpdateCkGroup = (params: SaveOrUpdateCkGroupParams, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核分组', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '分组名字', + required: true + }, + totalScore: { + type: 'inputNumber', + label: '分组总分', + required: true, + componentsProps: { + precision: 0 + } + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkGroup', params) + message.success(resp.message) + callback && callback() + } + }) +} + +export const saveOrUpdateCkItem = (params: SaveOrUpdateCkItemParams, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核项', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '考核项', + required: true + }, + type: { + type: 'radioGroup', + label: '控件类型', + required: true, + options: dictSelectNodes('SelectType') + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkItem', params) + message.success(resp.message) + callback && callback() + } + }) +} + +export const saveOrUpdateCkStandard = (params: SaveOrUpdateCkStandardParams, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核标准', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '标准', + required: true + }, + deductionPoints: { + type: 'inputNumber', + label: '扣分值', + required: true, + componentsProps: { + precision: 1 + } + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkStandard', params) + message.success(resp.message) + callback && callback() + } + }) +} + + diff --git a/superManagement/src/views/unitManage/police/assessmentCriteria/index.vue b/superManagement/src/views/unitManage/police/assessmentCriteria/index.vue new file mode 100644 index 0000000..12f2aef --- /dev/null +++ b/superManagement/src/views/unitManage/police/assessmentCriteria/index.vue @@ -0,0 +1,284 @@ + + + + + diff --git a/superManagement/src/views/unitManage/police/unitManage/index.tsx b/superManagement/src/views/unitManage/police/unitManage/index.tsx new file mode 100644 index 0000000..1b615cc --- /dev/null +++ b/superManagement/src/views/unitManage/police/unitManage/index.tsx @@ -0,0 +1,226 @@ +import {TableProMaxProps, TableProMaxSlots} from "@/types/components/table"; +import { + EnterprisesUnitPagerQueryParams, + EnterprisesUnitPagerVo, EnterprisesUnitSaveOrUpdateParams, + PoliceUnitPagerVo +} from "@/types/views/unitManage/police/policeUnit.ts"; +import {ref} from "vue"; +import {FormExpose} from "ant-design-vue/es/form/Form"; +import {ComponentExposed} from "vue-component-type-helpers"; +import MapContainer from "@/components/aMap/MapContainer.vue"; +import {FormProMaxItemOptions} from "@/types/components/form"; +import {dictSelectNodes} from "@/config/dict.ts"; +import {Button, message, Modal, Space} from "ant-design-vue"; +import api from "@/axios"; +import TableProMax from "@/components/table/TableProMax.vue"; +import {deleteDataModal} from "@/components/tsx/ModalPro.tsx"; +import {PageParams} from "@/types/hooks/useTableProMax.ts"; +import FormProMax from "@/components/form/FormProMax.vue"; + +type _TableProps = TableProMaxProps; +type _FormType = EnterprisesUnitSaveOrUpdateParams & { + contactPersonInfoName?: string; + contactPersonInfoTelephone?: string +} +const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { + const _formRef = ref(null) + const _mapRef = ref>(null) + const _formParams = ref<_FormType>({...params}) + + let city = ''; + + const _formOptions = ref>({ + name: { + type: 'input', + label: '单位名称', + required: true, + }, + type: { + type: 'select', + label: '单位类型', + required: true, + options: dictSelectNodes('EnterprisesUnitType') + }, + administrativeDivisionCodes: { + type: 'administrativeDivisionTree', + label: '行政区划', + required: true, + componentsProps: { + displayRender: ({labels}): string => { + city = labels[0] + return labels.join(' / '); + } + } + }, + address: { + type: 'inputTextArea', + label: '详细地址', + }, + map: { + type: 'custom', + label: '经纬度', + customRender: () => { + AMap.plugin(['AMap.AutoComplete'], () => { + //@ts-ignore + const auto = new AMap.AutoComplete({ + city, + input: "tipinput" + }); + //注册监听,当选中某条记录时会触发 + auto.on("select", (e) => { + //有些点位可能没有经纬度信息 + if (!e.poi.location) { + message.error('所选点位没有经纬度信息 建议选则附近的手动移动!'); + return + } + //添加maker点 设置point + const maker = new AMap.Marker({ + position: e.poi.location, + draggable: true + }) + console.log(e); + maker.on("dragend", (e) => { + console.log(e); + + }) + _mapRef.value.mapInstance.add(maker) + _mapRef.value.mapInstance.setFitView() + }); + }) + }} + > +
+ +
+
+ }, + contactPersonInfoName: { + type: 'input', + label: '联系人名称' + }, + contactPersonInfoTelephone: { + type: 'input', + label: '联系人电话' + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }) + Modal.confirm({ + title: params.snowFlakeId ? `【${params.name}】 信息编辑` : '新增企事业单位', + width: 600, + icon: ' ', + centered: true, + content: () => , + onOk: async () => { + await _formRef.value?.validate() + const resp = await api.post('/enterprisesUnit/saveOrUpdate', { + ..._formParams.value, + contactPersonInfo: { + name: _formParams.value.contactPersonInfoName, + telephone: _formParams.value.contactPersonInfoTelephone + } + }) + message.success(resp.message) + callback && callback() + } + }) +} + +export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => { + const _tableRef = ref>(null) + const _columns: _TableProps['columns'] = [ + { + dataIndex: 'name', + title: '名称' + }, { + dataIndex: 'type', + title: '类型', + customRender: ({text}) => text?.label + }, { + dataIndex: 'contactPersonInfo', + title: '联系人', + customRender: ({text}) => text?.name + "/" + text.telephone + }, { + dataIndex: 'province', + title: '行政区划', + customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join("/") + }, { + dataIndex: 'address', + title: '详细地址' + }, { + dataIndex: 'remark', + title: '备注' + }, { + dataIndex: 'createTime', + title: '创建时间' + }, { + dataIndex: 'opt', + title: '操作', + customRender: ({record}) => + + + + } + ] + const _reqApi: _TableProps["requestApi"] = (params) => { + (params as PageParams).params.policeUnitId = policeUnitPagerVo.snowFlakeId + return api.post('/enterprisesUnit/pager', params) + } + Modal.info({ + title: `【${policeUnitPagerVo.name}】 管辖企事业单位`, + width: '80%', + content: () => { + return + + + + } + } as TableProMaxSlots} + /> + }) +} diff --git a/superManagement/src/views/unitManage/police/unitManage/index.vue b/superManagement/src/views/unitManage/police/unitManage/index.vue new file mode 100644 index 0000000..68b9f03 --- /dev/null +++ b/superManagement/src/views/unitManage/police/unitManage/index.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/superManagement/src/views/unitManage/policeUnit/index.vue b/superManagement/src/views/unitManage/police/unitManage/index.vue.bak similarity index 100% rename from superManagement/src/views/unitManage/policeUnit/index.vue rename to superManagement/src/views/unitManage/police/unitManage/index.vue.bak diff --git a/superManagement/src/views/unitManage/test.vue b/superManagement/src/views/unitManage/test.vue deleted file mode 100644 index 5871ec4..0000000 --- a/superManagement/src/views/unitManage/test.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/superManagement/src/vite-env.d.ts b/superManagement/src/vite-env.d.ts index c49a709..a1729cb 100644 --- a/superManagement/src/vite-env.d.ts +++ b/superManagement/src/vite-env.d.ts @@ -19,6 +19,10 @@ interface ImportMetaEnv { // RSA公钥 readonly VITE_APP_RSA_PUBLIC_KEY: string; + + // 高德 + VITE_APP_GAODE_KEY: string + VITE_APP_GAODE_VERSION: string } declare module '*.vue' {