feat(module/assessmentCriteria): 新增考核标准模块

- 添加了考核标准相关的实体类、枚举类、参数类、VO类等- 实现了考核标准的CRUD接口和相关服务
- 新增了考核标准的分页查询和详情查询功能
- 优化了用户类型检查的注解
This commit is contained in:
luozhun 2024-11-07 17:14:01 +08:00
parent a35abcd9cd
commit a7a050fb33
75 changed files with 2756 additions and 54 deletions

View File

@ -23,5 +23,5 @@ public @interface CheckUserType {
/**
* 需要的客户端类型
*/
UserType[] userTypes();
UserType[] userTypes() default {};
}

View File

@ -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<String>, IEnum<String> {
school("school", "学校"),
hospital("hospital", "医院"),
community("community", "社区/小区"),
bank("bank", "银行"),
;
private final String value;
private final String label;
}

View File

@ -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<String>, IEnum<String> {
RADIO("radio", "单选"),
MULTIPLE("multiple", "多选"),
;
private final String value;
private final String label;
}

View File

@ -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)) {

View File

@ -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<SelectNodeVo<Long>> ckProjectListByType(@RequestParam EnterprisesUnitType type) {
return assessmentCriteriaService.assessmentCriteriaListByType(type);
}
@Operation(summary = "根据考核项目获取考核规则")
@GetMapping("/assessmentCriteriaRulesByCkProjectId")
@CheckUserType(value = false)
public List<AssessmentCriteriaRuleVo> 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<CkProjectPagerVo> ckProjectPagerVoPager(@RequestBody PageParams<CkProjectPagerQueryParams, CkProjectPagerVo> 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<CkProjectDetailTableVo> 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();
}
}
}

View File

@ -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<CkAssessmentRecordDetails> {
}

View File

@ -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<CkAssessmentRecord> {
}

View File

@ -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<CkGroup> {
}

View File

@ -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<CkItem>{
}

View File

@ -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<CkProject> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 分页数据
*/
Page<CkProjectPagerVo> pager(@Param("page") Page<CkProjectPagerVo> page,
@Param("params") CkProjectPagerQueryParams params);
/**
* 考核项目详情
*
* @param ckProjectId 考核项目id
* @return 详情
*/
List<CkProjectDetailTableVo> ckProjectDetail(@Param("ckProjectId") Long ckProjectId);
}

View File

@ -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<CkStandard>{
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<RecordDetailParams> 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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<Item> 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<Standard> 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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<SelectNodeVo<Long>> assessmentCriteriaListByType(EnterprisesUnitType type);
/**
* 根据考核项目获取考核规则
*
* @param ckProjectId 考核项目id
* @return 结果
*/
List<AssessmentCriteriaRuleVo> assessmentCriteriaRulesByCkProjectId(Long ckProjectId);
/**
* 考核项目分页查询
*
* @param queryParams 查询参数
* @return 查询结果
*/
Page<CkProjectPagerVo> ckProjectPagerVoPager(PageParams<CkProjectPagerQueryParams, CkProjectPagerVo> queryParams);
/**
* 新增或修改考核项目
*
* @param params 参数
*/
void saveOrUpdateCkProject(CkProjectSaveOrUpdateParams params);
/**
* 删除考核项目
*
* @param ckProjectId 考核项目id
*/
void deleteCkProjectById(Long ckProjectId);
/**
* 考核项目详情
*
* @param ckProjectId 考核项目id
* @return 结果
*/
List<CkProjectDetailTableVo> 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);
}

View File

@ -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<CkAssessmentRecordDetails> {
}

View File

@ -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<CkAssessmentRecord> {
}

View File

@ -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<CkGroup>{
}

View File

@ -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<CkItem> {
}

View File

@ -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<CkProject>{
}

View File

@ -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<CkStandard> {
}

View File

@ -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<SelectNodeVo<Long>> assessmentCriteriaListByType(EnterprisesUnitType type) {
return Db.lambdaQuery(CkProject.class).eq(CkProject::getType, type).list()
.stream()
.map(e -> SelectNodeVo.<Long>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<AssessmentCriteriaRuleVo> assessmentCriteriaRulesByCkProjectId(Long ckProjectId) {
//根据考核项目拿到考核分组
List<AssessmentCriteriaRuleVo> 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<AssessmentCriteriaRuleVo.Item> 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<AssessmentCriteriaRuleVo.Standard> 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<Long, List<AssessmentCriteriaRuleVo.Standard>> standardMap = standardList.stream().collect(Collectors.groupingBy(AssessmentCriteriaRuleVo.Standard::getCkItemId));
itemList.forEach(e -> e.setStandardList(standardMap.get(e.getSnowFlakeId())));
//将考核项塞到考核分组内
Map<Long, List<AssessmentCriteriaRuleVo.Item>> itemMap = itemList.stream().collect(Collectors.groupingBy(AssessmentCriteriaRuleVo.Item::getCkGroupId));
groupList.forEach(e -> e.setItemList(itemMap.get(e.getSnowFlakeId())));
return groupList;
}
@Override
public Page<CkProjectPagerVo> ckProjectPagerVoPager(PageParams<CkProjectPagerQueryParams, CkProjectPagerVo> 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<CkProjectDetailTableVo> 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<AssessmentRecordParams.RecordDetailParams> 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();
}
}
}

View File

@ -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<CkAssessmentRecordDetailsMapper, CkAssessmentRecordDetails> implements CkAssessmentRecordDetailsService {
}

View File

@ -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<CkAssessmentRecordMapper, CkAssessmentRecord> implements CkAssessmentRecordService {
}

View File

@ -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<CkGroupMapper, CkGroup> implements CkGroupService {
}

View File

@ -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<CkItemMapper, CkItem> implements CkItemService {
}

View File

@ -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<CkProjectMapper, CkProject> implements CkProjectService {
}

View File

@ -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<CkStandardMapper, CkStandard> implements CkStandardService {
}

View File

@ -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;
/**
*
*/

View File

@ -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<String> administrativeDivisionCodes;

View File

@ -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;

View File

@ -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<IndexServiceProjectListVo> getUnitServiceProjectList() {
return policeIndexService.getUnitServiceProjectList();
}
@Operation(summary = "获取单位内的企事业单位列表")
@GetMapping("/getUnitEnterprisesUnitList")
@CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE)
public List<SelectNodeVo<Long>> getUnitEnterprisesUnitList() {
return policeIndexService.getUnitEnterprisesUnitList();
}
}

View File

@ -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;
}

View File

@ -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 = "服务项目类型")

View File

@ -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<IndexServiceProjectListVo> getUnitServiceProjectList();
/**
* 获取单位内的企事业单位列表
*
* @return 企事业单位列表
*/
List<SelectNodeVo<Long>> getUnitEnterprisesUnitList();
}

View File

@ -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<Long> 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<Long> 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<IndexServiceProjectListVo> getUnitServiceProjectList() {
return serviceProjectMapper.getServiceProjectList(UserUtil.getUnitId(), null);
}
@Override
public List<SelectNodeVo<Long>> getUnitEnterprisesUnitList() {
return Db.lambdaQuery(EnterprisesUnit.class)
.eq(EnterprisesUnit::getPoliceUnitId, UserUtil.getUnitId())
.list()
.stream()
.map(item -> SelectNodeVo.<Long>builder()
.value(item.getSnowFlakeId())
.label(item.getName())
.extData(Dict.of(LambdaUtil.getFieldName(EnterprisesUnit::getType), item.getType()))
.build())
.toList();
}
}

View File

@ -131,6 +131,9 @@
<logger name="com.changhu.module.miniProgram.mapper">
<appender-ref ref="MpConsole"/>
</logger>
<logger name="com.changhu.module.assessmentCriteria.mapper">
<appender-ref ref="MpConsole"/>
</logger>
<!--spring日志-->
<logger name="org.springframework" level="DEBUG"/>
<!--建立一个默认的root的logger -->

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.changhu.module.assessmentCriteria.mapper.CkProjectMapper">
<select id="pager" resultType="com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo">
select cp.*, msu.name as 'createUserName'
from ck_project cp
left join management_super_user msu on cp.create_by = msu.snow_flake_id
where cp.delete_flag = 0
<if test="params.name != null and params.name != ''">
and cp.name like concat('%',#{params.name},'%')
</if>
<if test="params.type != null">
and cp.type = #{params.type.value}
</if>
order by cp.create_time desc
</select>
<select id="ckProjectDetail"
resultType="com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo">
select cg.snow_flake_id as 'ckGroupId',
cg.name as 'groupName',
cg.total_score as 'groupTotalScore',
cg.remark as 'groupRemark',
ci.snow_flake_id as 'ckItemId',
ci.name as 'itemName',
ci.type,
ci.remark as 'itemRemark',
cs.snow_flake_id as 'ckStandardId',
cs.`name` as 'standardName',
cs.deduction_points
from ck_project cp
left join ck_group cg on cp.snow_flake_id = cg.ck_project_id and cg.delete_flag = 0
left join ck_item ci on cg.snow_flake_id = ci.ck_group_id and ci.delete_flag = 0
left join ck_standard cs on ci.snow_flake_id = cs.ck_item_id and cs.delete_flag = 0
where cp.delete_flag = 0
and cp.snow_flake_id = #{ckProjectId}
</select>
</mapper>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -0,0 +1,57 @@
<template>
<div :id="mapId" class="mapContainer">
<slot></slot>
</div>
</template>
<script setup lang="ts">
import {onMounted, onUnmounted, shallowRef} from "vue";
import {initMap} from "@/utils/aMapUtil";
const props = withDefaults(defineProps<{
plugins?: string[],
initCallback?: () => void,
mapOptions?: AMap.MapOptions
}>(), {
plugins: () => {
return []
},
mapOptions: () => {
return {
// 3D
viewMode: "3D",
//
zoom: 11,
mapStyle: 'amap://styles/darkblue'
}
}
})
const mapId = "mapContainer"
const map = shallowRef<AMap.Map>(null);
defineExpose({
mapInstance: map
})
onMounted(() => {
initMap(props.plugins).then(AMap => {
props.initCallback && props.initCallback()
map.value = new AMap.Map(mapId, props.mapOptions)
})
})
onUnmounted(() => {
map.value?.destroy()
})
</script>
<style scoped lang="scss">
#mapContainer {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
</style>

View File

@ -19,7 +19,6 @@
>
<template #icon>
<icon-font :font-class="item.icon"/>
<!-- <icon-font font-class="icon-guanlianbaoan" type="class" size="10"/>-->
</template>
<span class="margin-left-xs">{{ item.title }}</span>
</a-menu-item>

View File

@ -1,11 +1,9 @@
<template>
<a-cascader
v-model:value="modelValue"
:placeholder="placeholder"
:change-on-select="changeOnSelect"
:options="administrativeDivisionTree"
:load-data="loadData"
:allow-clear="allowClear"
v-bind="props"
/>
</template>
@ -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<AdministrativeDivisionTreeProps>(), {
placeholder: '请选择行政区划',
changeOnSelect: true,
allowClear: true
allowClear: true,
})
const modelValue = defineModel('value', {
default: []
})

View File

@ -8,6 +8,8 @@ type DictType =
| 'Sex'
| 'ServiceProjectType'
| 'MiniProgramUserIdentity'
| 'EnterprisesUnitType'
| 'SelectType'
export const initDict = () => {
api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {

View File

@ -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')
}
]

View File

@ -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();

View File

@ -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"),

View File

@ -0,0 +1,7 @@
export interface AdministrativeDivisionTreeProps {
placeholder?: string,
changeOnSelect?: boolean
allowClear?: boolean
onChange?: (value: (string | number[]), selectedOptions: TreeNodeVo<string | number>[]) => void
displayRender?: (opt: { labels: string[], selectedOptions: TreeNodeVo<string | number>[] }) => string
}

View File

@ -4,6 +4,7 @@ export interface SystemMenu {
type: 'dir' | 'menu';
title: string;
path: string;
isFull?: boolean;
name: string;
icon?: string;

View File

@ -0,0 +1,90 @@
import {BaseTableRowRecord} from "@/types/components/table";
export interface CkProjectPagerVo extends BaseTableRowRecord {
name: string;
type: BaseEnum<string>
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<string>;
}

View File

@ -55,6 +55,7 @@ export interface EnterprisesUnitPagerQueryParams {
export interface EnterprisesUnitPagerVo extends BaseTableRowRecord {
/** 名字 **/
name?: string;
type: BaseEnum<string>
/** 公安单位id **/
policeUnitId: string;
/** 省编码 **/
@ -91,6 +92,8 @@ export interface EnterprisesUnitSaveOrUpdateParams {
policeUnitId: string;
/** 名称 **/
name: string;
/** 类型 **/
type: string;
/** 行政区划编码 **/
administrativeDivisionCodes: string[];
/** 详细地址 **/

View File

@ -0,0 +1,18 @@
import AMapLoader from "@amap/amap-jsapi-loader";
type Amap = typeof AMap;
export const initMap = (plugins?: string[]): Promise<Amap> => 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)
})
})

View File

@ -0,0 +1,13 @@
<template>
<div style="width: 100vw;height: 100vh">
<map-container/>
</div>
</template>
<script setup lang="ts">
import MapContainer from "@/components/aMap/MapContainer.vue";
</script>
<style scoped lang="scss">
</style>

View File

@ -1,13 +1,41 @@
<template>
<administrative-division-tree style="width: 500px" :value='[ "430000"]'/>
<MapContainer ref="mapRef" style="width: 800px;height: 800px" :init-callback="callback"/>
<div id="myPageTop">
<table>
<tr>
<td>
<label>请输入关键字</label>
</td>
</tr>
<tr>
<td>
<input id="tipinput"/>
</td>
</tr>
</table>
</div>
</template>
<script lang="ts" setup>
import MapContainer from "@/components/aMap/MapContainer.vue";
import {onMounted, ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers";
<script setup lang="ts">
import AdministrativeDivisionTree from "@/components/tree/AdministrativeDivisionTree.vue";
const mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
//
const objUrl = "/police-security/2024/10/30/55f99091b88c4c80ab90036d2b4914c6.jpg";
const callback = () => {
AMap.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], () => {
var auto = new AMap.AutoComplete({
input: "tipinput"
});
var placeSearch = new AMap.PlaceSearch({
map: mapRef.value.mapInstance
}); //
auto.on("select", select);//
function select(e) {
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name); //
}
})
}
</script>
<style scoped lang="scss">
</style>

View File

@ -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<SaveOrUpdateCkProjectParams>({
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<CkProjectDetailRes[]> => {
const {data} = await api.get<CkProjectDetailRes[]>('/assessmentCriteria/ckProjectDetail', {ckProjectId})
const groupRowSpan: Record<string, { firstIndex: number, count: number }> = {}
const itemRowSpan: Record<string, { firstIndex: number, count: number }> = {}
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<SaveOrUpdateCkGroupParams>({
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<SaveOrUpdateCkItemParams>({
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<SaveOrUpdateCkStandardParams>({
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()
}
})
}

View File

@ -0,0 +1,284 @@
<template>
<div>
<TableProMax
ref="ckProjectTableRef"
:request-api="ckProjectPagerVoPager"
:search-form-options="ckProjectTableSearchOptions"
:columns="ckProjectTableColumns"
>
<template #tableHeader>
<a-space>
<a-button class="btn-success"
@click="saveOrUpdateCkProject(undefined,ckProjectTableRef?.requestGetTableData)">添加考核项目
</a-button>
</a-space>
</template>
</TableProMax>
</div>
</template>
<script setup lang="tsx">
import {TableProMaxProps} from "@/types/components/table";
import {
CkProjectDetailRes,
CkProjectPagerQueryParams,
CkProjectPagerVo
} from "@/types/views/unitManage/police/assessmentCriteria.ts";
import TableProMax from "@/components/table/TableProMax.vue";
import api from "@/axios";
import {ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers";
import {dictSelectNodes} from "@/config/dict.ts";
import {deleteDataModal} from "@/components/tsx/ModalPro.tsx";
import {message, Modal} from "ant-design-vue";
import {ColumnsType} from "ant-design-vue/es/table";
import {
ckProjectDetail,
deleteCkProjectById,
saveOrUpdateCkGroup,
saveOrUpdateCkItem,
saveOrUpdateCkProject,
saveOrUpdateCkStandard
} from "@/views/unitManage/police/assessmentCriteria/index.ts";
type CkProjectTableProps = TableProMaxProps<CkProjectPagerVo, CkProjectPagerQueryParams>
const ckProjectTableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const ckProjectPagerVoPager: CkProjectTableProps['requestApi'] = (params) => {
return api.post('/assessmentCriteria/ckProjectPagerVoPager', params)
}
const ckProjectTableSearchOptions: CkProjectTableProps['searchFormOptions'] = {
name: {
type: 'input',
label: '名字'
},
type: {
type: 'select',
label: '类型',
options: [{
value: null,
label: '全部'
}, ...dictSelectNodes('EnterprisesUnitType')]
}
}
const ckProjectTableColumns: CkProjectTableProps['columns'] = [
{
dataIndex: 'name',
title: '考核项目'
}, {
dataIndex: 'type',
title: '类型',
customRender: ({text}) => text?.label
}, {
dataIndex: 'totalScore',
title: '考核总分'
}, {
dataIndex: 'remark',
title: '备注'
}, {
dataIndex: 'createUserName',
title: '创建人'
}, {
dataIndex: 'createTime',
title: '创建时间'
}, {
dataIndex: 'opt',
title: '操作',
customRender: ({record}) => {
return <a-space>
<a-button class="btn-warn" onClick={() => saveOrUpdateCkProject({
snowFlakeId: record.snowFlakeId,
name: record.name,
totalScore: record.totalScore,
remark: record.remark,
type: record.type.value
}, ckProjectTableRef.value?.requestGetTableData)}>编辑
</a-button>
<a-button class="btn-danger"
onClick={() => deleteCkProjectById(record.name, record.snowFlakeId, ckProjectTableRef.value?.requestGetTableData)}>删除
</a-button>
<a-button class="btn-purple" onClick={() => {
const dataSource = ref<CkProjectDetailRes[]>([])
const initData = async () => dataSource.value = await ckProjectDetail(record.snowFlakeId);
const ckProjectDetailTableColumns: ColumnsType<CkProjectDetailRes> = [
{
dataIndex: 'groupName',
title: '考核分组',
customCell: (_record) => {
return {
rowspan: _record.groupRowSpan
}
},
customRender: ({record: _record}) => {
return <div class={'flex-justify-between'}>
<div>
<p>{_record.groupName}({_record.groupTotalScore})</p>
<p>{_record.groupRemark}</p>
</div>
<div class="flex-column-center">
<a-dropdown trigger={['click']} v-slots={{
overlay: () => <a-menu>
<a-menu-item key="0">
<a-button type="text" style={{color: 'green'}} onClick={() => saveOrUpdateCkItem({
ckGroupId: _record.ckGroupId,
name: "",
type: 'radio'
}, initData)}>添加考核项
</a-button>
</a-menu-item>
<a-menu-item key="1">
<a-button type="text" style={'color:rgb(251, 177, 27)'} onClick={() => saveOrUpdateCkGroup({
snowFlakeId: _record.ckGroupId,
ckProjectId: record.snowFlakeId,
name: _record.groupName,
totalScore: _record.groupTotalScore,
remark: _record.groupRemark
}, initData)}>编辑
</a-button>
</a-menu-item>
<a-menu-item key="3">
<a-button type="text" style={'color:red'}
onClick={() => deleteDataModal(_record.groupName, async () => {
const resp = await api.delete('/assessmentCriteria/deleteCkGroupById', {ckGroupId: _record.ckGroupId}, {loading: true})
message.success(resp.message)
await initData()
})}>删除
</a-button>
</a-menu-item>
</a-menu>
}}>
<a class="ant-dropdown-link">
操作
</a>
</a-dropdown>
</div>
</div>
}
}, {
dataIndex: 'itemName',
title: '考核项',
customCell: (_record) => {
return {
rowspan: _record.itemRowSpan
}
},
customRender: ({record: _record}) => {
if (!_record.ckItemId) {
return '/'
}
return <div class="flex-justify-between">
<p>{_record.itemName}({_record.type?.label})
</p>
<a-dropdown trigger={['click']} v-slots={{
overlay: () => <a-menu>
<a-menu-item key="0">
<a-button type="text" style={{color: 'green'}} onClick={() => saveOrUpdateCkStandard({
ckItemId: _record.ckItemId,
name: '',
deductionPoints: 0
}, initData)}>
添加考核标准
</a-button>
</a-menu-item>
<a-menu-item key="1">
<a-button type="text" style={'color:rgb(251, 177, 27)'} onClick={() => saveOrUpdateCkItem({
snowFlakeId: _record.ckItemId,
ckGroupId: _record.ckGroupId,
name: _record.itemName,
type: _record.type.value,
remark: _record.itemRemark
}, initData)}>编辑
</a-button>
</a-menu-item>
<a-menu-item key="3">
<a-button type="text" style={'color:red'}
onClick={() => deleteDataModal(_record.itemName, async () => {
const resp = await api.delete('/assessmentCriteria/deleteCkItemById', {ckItemId: _record.ckItemId}, {loading: true})
message.success(resp.message)
await initData()
})}>删除
</a-button>
</a-menu-item>
</a-menu>
}}>
<a class="ant-dropdown-link">
操作
</a>
</a-dropdown>
</div>
}
}, {
dataIndex: 'standardName',
title: '标准',
customRender: ({record: _record}) => {
if (!_record.ckStandardId) {
return '/'
}
return <div class="flex-justify-between">
<p>{_record.standardName}{_record.deductionPoints}</p>
<a-dropdown trigger={['click']} v-slots={{
overlay: () => <a-menu>
<a-menu-item key="1">
<a-button type="text" style={'color:rgb(251, 177, 27)'} onClick={() => saveOrUpdateCkStandard({
snowFlakeId: _record.ckStandardId,
ckItemId: _record.ckItemId,
name: _record.standardName,
deductionPoints: _record.deductionPoints
}, initData)}>编辑
</a-button>
</a-menu-item>
<a-menu-item key="3">
<a-button type="text" style={'color:red'}
onClick={() => deleteDataModal(_record.itemName, async () => {
const resp = await api.delete('/assessmentCriteria/deleteCkStandardById', {ckStandardId: _record.ckStandardId}, {loading: true})
message.success(resp.message)
await initData()
})}>删除
</a-button>
</a-menu-item>
</a-menu>
}}>
<a class="ant-dropdown-link">
操作
</a>
</a-dropdown>
</div>
}
}
]
initData();
Modal.info({
title: `${record.name}】详情`,
icon: ' ',
width: '80%',
centered: true,
content: () => <div style={{height: '80vh', overflow: 'auto'}}>
<a-space>
<a-button class="btn-success" onClick={() => saveOrUpdateCkGroup({
ckProjectId: record.snowFlakeId,
name: '',
totalScore: 0
}, initData)}>添加考核分组
</a-button>
</a-space>
<a-table
bordered
pagination={false}
class="margin-top-xs"
columns={ckProjectDetailTableColumns}
data-source={dataSource.value}
></a-table>
</div>
})
}}>考核详情
</a-button>
</a-space>
}
}
]
</script>
<style scoped lang="scss">
</style>

View File

@ -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<EnterprisesUnitPagerVo, EnterprisesUnitPagerQueryParams>;
type _FormType = EnterprisesUnitSaveOrUpdateParams & {
contactPersonInfoName?: string;
contactPersonInfoTelephone?: string
}
const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
const _formRef = ref<FormExpose>(null)
const _mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
const _formParams = ref<_FormType>({...params})
let city = '';
const _formOptions = ref<FormProMaxItemOptions<_FormType>>({
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: () => <MapContainer
ref={_mapRef}
style={{width: '100%', height: '300px', position: 'relative'}}
initCallback={() => {
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()
});
})
}}
>
<div style={{position: 'absolute', left: '10px', top: '10px', zIndex: 9999}}>
<input id={'tipinput'}
placeholder={'请输入详细地址'}
/>
</div>
</MapContainer>
},
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: () => <FormProMax
ref={_formRef}
v-model:value={_formParams.value}
formItemOptions={_formOptions.value}/>,
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<ComponentExposed<typeof TableProMax>>(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}) => <Space>
<Button
class="btn-warn"
onClick={() => saveOrUpdateEnterprisesUnit({
snowFlakeId: record.snowFlakeId,
policeUnitId: record.policeUnitId,
name: record.name,
type: record.type.value,
administrativeDivisionCodes: [record.province, record.city, record.districts, record.street].filter(Boolean),
address: record.address,
contactPersonInfoName: record.contactPersonInfo?.name,
contactPersonInfoTelephone: record.contactPersonInfo?.telephone,
remark: record.remark
}, _tableRef.value?.requestGetTableData)}
>
</Button>
<Button class="btn-danger" onClick={() => deleteDataModal(record.name, async () => {
const resp = await api.delete('/enterprisesUnit/deleteById', {
enterprisesUnitId: record.snowFlakeId
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
})}>
</Button>
</Space>
}
]
const _reqApi: _TableProps["requestApi"] = (params) => {
(params as PageParams<EnterprisesUnitPagerQueryParams>).params.policeUnitId = policeUnitPagerVo.snowFlakeId
return api.post('/enterprisesUnit/pager', params)
}
Modal.info({
title: `${policeUnitPagerVo.name}】 管辖企事业单位`,
width: '80%',
content: () => <TableProMax
ref={_tableRef}
columns={_columns}
requestApi={_reqApi}
v-slots={{
tableHeader: (_) => {
return <Space>
<Button
class="btn-success"
onClick={() => saveOrUpdateEnterprisesUnit({
name: undefined,
type: 'school',
policeUnitId: policeUnitPagerVo.snowFlakeId,
administrativeDivisionCodes: [policeUnitPagerVo.province, policeUnitPagerVo.city, policeUnitPagerVo.districts, policeUnitPagerVo.street].filter(Boolean)
}, _tableRef.value?.requestGetTableData)}
>
</Button>
<Button disabled></Button>
</Space>
}
} as TableProMaxSlots<PoliceUnitPagerVo>}
/>
})
}

View File

@ -0,0 +1,136 @@
<template>
<TableProMax
ref="tableRef"
:request-api="reqApi"
:columns="columns"
:searchFormOptions="searchFormOptions"
>
</TableProMax>
</template>
<script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue";
import {ref} from "vue";
import {ComponentExposed} from "vue-component-type-helpers";
import {TableProMaxProps} from "@/types/components/table";
import {
PoliceUnitPagerQueryParams,
PoliceUnitPagerVo
} from "@/types/views/unitManage/police/policeUnit.ts";
import api from "@/axios";
import {dictSelectNodes} from "@/config/dict.ts";
import {message} from "ant-design-vue";
import {UNIT_TYPE} from "@/config";
import {showEnterprisesUnit} from "@/views/unitManage/police/unitManage/index.tsx";
type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams>
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
const reqApi: TableProps['requestApi'] = (params) => api.post('/management/super/policeUnit/pager', params)
const columns: TableProps['columns'] = [
{
dataIndex: 'name',
title: '名称'
}, {
dataIndex: 'code',
title: '代码'
}, {
dataIndex: 'contactPersonInfo',
title: '联系人',
customRender({record}) {
return record.contactPersonInfo?.name + "/" + record.contactPersonInfo?.telephone
},
}, {
dataIndex: 'provinceName',
title: '行政区划',
customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join('/')
}, {
dataIndex: 'isEnable',
title: '是否启用',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
}, {
dataIndex: 'checkStatus',
title: '审核状态',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
}, {
dataIndex: 'createTime',
title: '创建时间'
}, {
dataIndex: 'opt',
title: '操作',
customRender({record}) {
if (record.checkStatus.value === 1) {
return <a-space>
<a-popconfirm
title="确认审核通过嘛?"
onConfirm={async () => {
const resp = await api.post('/management/checkPass', {
checkDataId: record.snowFlakeId,
unitOptType: UNIT_TYPE.police
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}>
<a-button type="primary">审核通过
</a-button>
</a-popconfirm>
</a-space>
}
return <a-space>
<a-button
class="btn-success"
onClick={() => showEnterprisesUnit(record)}
>企事业单位
</a-button>
<a-button
class={record.isEnable.value === 0 ? 'btn-danger' : 'btn-success'}
onClick={async () => {
const resp = await api.post('/management/disableOrEnable', {
dataId: record.snowFlakeId,
unitOptType: UNIT_TYPE.police
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}
>{record.isEnable.value === 0 ? '禁用' : '启用'}</a-button>
</a-space>
},
}
]
const searchFormOptions = ref<TableProps["searchFormOptions"]>({
name: {
type: 'input',
label: '名称'
}, code: {
type: 'input',
label: '代码'
}, administrativeDivisionCodes: {
type: 'administrativeDivisionTree',
label: '行政区划',
}, isEnable: {
type: 'select',
label: '是否启用',
options: [
{
value: null,
label: '全部'
}, ...dictSelectNodes('IsEnable')
]
}, checkStatus: {
type: 'select',
label: '审核状态',
options: [
{
value: null,
label: '全部'
}, ...dictSelectNodes('CheckStatus')
]
}
})
</script>
<style scoped lang="scss">
</style>

View File

@ -1,11 +0,0 @@
<script setup lang="ts">
</script>
<template>
123
</template>
<style scoped lang="scss">
</style>

View File

@ -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' {