From f33cfe86447c16df8ca665e2e1a5f3333ff57792 Mon Sep 17 00:00:00 2001 From: heheng <475597332@qq.com> Date: 星期三, 27 八月 2025 17:02:27 +0800 Subject: [PATCH] 版本改造 --- expert-admin/src/main/resources/application.yml | 6 expert-system/src/main/java/com/gkhy/system/service/IProjectManagementService.java | 5 expert-system/src/main/resources/mapper/system/ProjectExpertMapper.xml | 101 ++++ expert-system/src/main/java/com/gkhy/system/domain/ProjectManagement.java | 11 expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertScoreSaveReq.java | 4 expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertManagementInfoRes.java | 4 expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertMapper.java | 19 expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpertDetail.java | 71 +++ expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertCheckResp.java | 2 expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpert.java | 197 +++++++++ expert-system/src/main/resources/mapper/system/OutProjectExpertMapper.xml | 5 expert-system/src/main/java/com/gkhy/system/domain/vo/request/SysProjectExpertReq.java | 3 expert-admin/src/main/java/com/gkhy/web/controller/bussiness/ProjectManagementController.java | 18 expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveReqDto.java | 3 expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveBatchReqDto.java | 10 expert-system/src/main/java/com/gkhy/system/mapper/ProjectExpertMapper.java | 3 expert-system/src/main/resources/mapper/system/ProjectManagementMapper.xml | 83 +++ expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertDetailMapper.java | 19 expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertExportInfoRes.java | 2 expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java | 611 ++++++++++++++++++++++-------- expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertResp.java | 3 expert-system/src/main/resources/mapper/system/SysExpertInfoMapper.xml | 2 expert-admin/src/main/resources/application-dev.yml | 6 expert-system/src/main/resources/mapper/system/OutProjectExpertDetailMapper.xml | 5 24 files changed, 997 insertions(+), 196 deletions(-) diff --git a/expert-admin/src/main/java/com/gkhy/web/controller/bussiness/ProjectManagementController.java b/expert-admin/src/main/java/com/gkhy/web/controller/bussiness/ProjectManagementController.java index 1505552..aad4c0c 100644 --- a/expert-admin/src/main/java/com/gkhy/web/controller/bussiness/ProjectManagementController.java +++ b/expert-admin/src/main/java/com/gkhy/web/controller/bussiness/ProjectManagementController.java @@ -102,6 +102,17 @@ return R.ok(); } + @ApiOperation(value = "项目生成审批单") + @PostMapping("/projectBuildCheck") + @RepeatSubmit + public R projectBuildCheck(@Validated @RequestBody ProjectExpertSaveBatchReqDto projectManagement) + { + projectManagementService.projectBuildCheck(projectManagement); + return R.ok(); + } + + + //@PreAuthorize("@ss.hasPermi('system:management:info')") @ApiOperation(value = "获取项目专家审批用(获取项目信息和专家数据)") @GetMapping("/projectExpertCheckInfo") @@ -217,11 +228,12 @@ //@PreAuthorize("@ss.hasPermi('system:management:list')") @GetMapping("/selectProjectExpertDetail") @ApiImplicitParams({ - @ApiImplicitParam(paramType = "query", name = "projectExpertId", dataType = "long", required = true, value = "项目专家id") + @ApiImplicitParam(paramType = "query", name = "projectExpertId", dataType = "long", required = true, value = "项目专家id"), + @ApiImplicitParam(paramType = "query", name = "expertType", dataType = "long", required = true, value = "专家类型1库内2库外") }) - public R<ProjectDetailResp> selectProjectExpertDetail(@RequestParam("projectExpertId") Long projectExpertId) + public R<ProjectDetailResp> selectProjectExpertDetail(@RequestParam("projectExpertId") Long projectExpertId,@RequestParam("expertType") Long expertType) { - return R.ok(projectManagementService.selectProjectExpertDetail(projectExpertId)); + return R.ok(projectManagementService.selectProjectExpertDetail(projectExpertId,expertType)); } diff --git a/expert-admin/src/main/resources/application-dev.yml b/expert-admin/src/main/resources/application-dev.yml index 03e130d..5eafcf6 100644 --- a/expert-admin/src/main/resources/application-dev.yml +++ b/expert-admin/src/main/resources/application-dev.yml @@ -34,9 +34,9 @@ druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/expert_management?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true + url: jdbc:mysql://192.168.2.90:7006/expert_management?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&allowMultiQueries=true username: root - password: 123456 + password: 2farwL3yPXfbH2AP # 从库数据源 slave: # 从数据源开关/默认关闭 @@ -90,7 +90,7 @@ # redis 配置 redis: # 地址 - host: localhost + host: 192.168.2.90 # 端口,默认为6379 port: 6379 # 数据库索引 diff --git a/expert-admin/src/main/resources/application.yml b/expert-admin/src/main/resources/application.yml index be98b19..ff8140b 100644 --- a/expert-admin/src/main/resources/application.yml +++ b/expert-admin/src/main/resources/application.yml @@ -48,13 +48,13 @@ basename: i18n/messages profiles: # 环境配置,dev开发环境,prod生产环境 - active: dev - #active: prod + #active: dev + active: prod # 文件上传 servlet: multipart: # 单个文件大小 - max-file-size: 20MB + max-file-size: 25MB # 设置总上传的文件大小 max-request-size: 100MB # 服务模块 diff --git a/expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpert.java b/expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpert.java new file mode 100644 index 0000000..eaa66b1 --- /dev/null +++ b/expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpert.java @@ -0,0 +1,197 @@ +package com.gkhy.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * <p> + * 项目专家关联表 + * </p> + * + * @author hh + * @since 2025-08-26 13:11:13 + */ +@Getter +@Setter +@TableName("out_project_expert") +@ApiModel(value = "OutProjectExpert对象", description = "项目专家关联表") +public class OutProjectExpert implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目id") + @TableField("project_id") + private Long projectId; + + @ApiModelProperty("专家名称") + @TableField("name") + private String name; + + @ApiModelProperty("性别(0男,1女,2未知,默认2)") + @TableField("sex") + private Integer sex; + + @ApiModelProperty("身份证号码") + @TableField("id_card") + private String idCard; + + @ApiModelProperty("专家领域") + @TableField("domain") + private String domain; + + @ApiModelProperty("入库分级") + @TableField("level") + private String level; + + @ApiModelProperty("评定等级1、一级,2、二级,3、三级") + @TableField("rating_level") + private String ratingLevel; + + @NotBlank(message ="职称不能为空" ) + @ApiModelProperty("职称") + @TableField("title") + private String title; + + @NotBlank(message ="单位名称不能为空" ) + @Length(min=1,max=30,message = "专家名称不能超过30个字") + @ApiModelProperty("单位名称") + @TableField("company_name") + private String companyName; + + @ApiModelProperty("总分") + @TableField("score") + private Integer score; + + @ApiModelProperty("评估状态0未评估1已评估") + @TableField("evaluation_state") + private Integer evaluationState; + + @ApiModelProperty("选取方式1固定2随机") + @TableField("selection_mode") + private Integer selectionMode; + + @ApiModelProperty("是否组长0否1是") + @TableField("team_leader") + private Integer teamLeader; + + @ApiModelProperty("删除标志(0代表存在,1代表删除,默认0)") + @TableField("del_flag") + private Integer delFlag; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("职业道德1优秀2合格3基本合格4不合格") + @TableField("professional_ethics") + private Integer professionalEthics; + + @ApiModelProperty("公正廉洁1优秀2合格3基本合格4不合格") + @TableField("impartial_honest") + private Integer impartialHonest; + + @ApiModelProperty("综合协调1优秀2合格3基本合格4不合格") + @TableField("comprehensive_coordination") + private Integer comprehensiveCoordination; + + @ApiModelProperty("专业能力1优秀2合格3基本合格4不合格") + @TableField("professional_ability") + private Integer professionalAbility; + + @ApiModelProperty("意见表达1优秀2合格3基本合格4不合格") + @TableField("expressing_opinions") + private Integer expressingOpinions; + + @ApiModelProperty("其他意见") + @TableField("others") + private String others; + + @ApiModelProperty("综合评价1优秀2合格3基本合格4不合格") + @TableField("comprehensive_evaluation") + private Integer comprehensiveEvaluation; + + @ApiModelProperty("重大隐患") + @TableField("major_dangers") + private Integer majorDangers; + + @ApiModelProperty("一般隐患") + @TableField("general_hazards") + private Integer generalHazards; + + @ApiModelProperty("内容描述") + @TableField("content") + private String content; + + @ApiModelProperty("计费标准") + @TableField("freight_basis") + private String freightBasis; + + @ApiModelProperty("计费时长") + @TableField("billing_duration") + private BigDecimal billingDuration; + + @ApiModelProperty("税后金额") + @TableField("after_tax_amount") + private BigDecimal afterTaxAmount; + + @ApiModelProperty("开户行") + @TableField("open_bank") + private String openBank; + + @ApiModelProperty("卡号") + @TableField("bank_card") + private String bankCard; + + @ApiModelProperty("应纳税所得额") + @TableField("taxable_income") + private BigDecimal taxableIncome; + + @ApiModelProperty("应缴个税") + @TableField("income_tax_payable") + private BigDecimal incomeTaxPayable; + + @ApiModelProperty("专家费(税前)") + @TableField("tax_expert_fee") + private BigDecimal taxExpertFee; + + @ApiModelProperty("计费表准说明") + @TableField("billing_instructions") + private String billingInstructions; + + @ApiModelProperty("交通费") + @TableField("travel_expenses") + private BigDecimal travelExpenses; + + @ApiModelProperty("住宿费") + @TableField("accommodation_fee") + private BigDecimal accommodationFee; + + +} diff --git a/expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpertDetail.java b/expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpertDetail.java new file mode 100644 index 0000000..b576a07 --- /dev/null +++ b/expert-system/src/main/java/com/gkhy/system/domain/OutProjectExpertDetail.java @@ -0,0 +1,71 @@ +package com.gkhy.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * <p> + * 项目专家得分明细表 + * </p> + * + * @author hh + * @since 2025-08-26 13:11:13 + */ +@Getter +@Setter +@TableName("out_project_expert_detail") +@ApiModel(value = "OutProjectExpertDetail对象", description = "项目专家得分明细表") +public class OutProjectExpertDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目专家表id") + @TableField("out_project_expert_id") + private Long outProjectExpertId; + + @ApiModelProperty("内容") + @TableField("content") + private String content; + + @ApiModelProperty("类型1加分项2扣分项") + @TableField("score_type") + private String scoreType; + + @ApiModelProperty("分值") + @TableField("score") + private Integer score; + + @ApiModelProperty("删除标志(0代表存在,1代表删除,默认0)") + @TableField("del_flag") + private Integer delFlag; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField("update_time") + private LocalDateTime updateTime; + + +} diff --git a/expert-system/src/main/java/com/gkhy/system/domain/ProjectManagement.java b/expert-system/src/main/java/com/gkhy/system/domain/ProjectManagement.java index 3fac159..3a2581c 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/ProjectManagement.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/ProjectManagement.java @@ -148,6 +148,9 @@ @ApiModelProperty(value = "专家名称组长") private String expertName; + @ApiModelProperty(value = "1、内部专家2、外部专家") + private Long expertType; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "项目结束日期") private Date projectEndTime; @@ -378,4 +381,12 @@ public void setDeptIds(List<Long> deptIds) { this.deptIds = deptIds; } + + public Long getExpertType() { + return expertType; + } + + public void setExpertType(Long expertType) { + this.expertType = expertType; + } } \ No newline at end of file diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveBatchReqDto.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveBatchReqDto.java index 263b8dc..8ca4b88 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveBatchReqDto.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveBatchReqDto.java @@ -1,10 +1,10 @@ package com.gkhy.system.domain.vo.request; +import com.gkhy.system.domain.OutProjectExpert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.List; @@ -19,8 +19,13 @@ private List<Long> delData; @ApiModelProperty(value = "新增编辑数据") - @NotEmpty private List<ProjectExpertSaveReqDto> saveData; + + @ApiModelProperty(value = "删除外部专家数据") + private List<Long> delOutData; + + @ApiModelProperty(value = "新增外部专家数据") + private List<OutProjectExpert> saveOutData; /** * 项目id */ @@ -30,4 +35,5 @@ @ApiModelProperty(value = "步骤1暂存2专家选取3审批4完结") private Long step; + } diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveReqDto.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveReqDto.java index a05bb20..99aa2f7 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveReqDto.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertSaveReqDto.java @@ -57,5 +57,8 @@ @NotNull(message = "是否组长不能为空") private Long teamLeader; + @ApiModelProperty(value = "专家类型1库内2库外",required = false) + private Long expertType; + } \ No newline at end of file diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertScoreSaveReq.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertScoreSaveReq.java index 8d9a413..590865f 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertScoreSaveReq.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/ProjectExpertScoreSaveReq.java @@ -29,6 +29,10 @@ @NotNull(message = "得分不能为空") private Long score; + @ApiModelProperty(value = "专家类型1库内2库外") + @NotNull(message = "专家类型不能为空") + private Long expertType; + @ApiModelProperty(value = "职业道德1优秀2合格3基本合格4不合格") @NotNull(message = "职业道德不能为空") diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/SysProjectExpertReq.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/SysProjectExpertReq.java index 7721f8a..1f519e6 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/request/SysProjectExpertReq.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/request/SysProjectExpertReq.java @@ -35,4 +35,7 @@ @ApiModelProperty(value = "部门处室",hidden = true) private Long deptId; + + @ApiModelProperty(value = "专家类型1库内专家2库外专家",required = true) + private Long expertType; } diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertCheckResp.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertCheckResp.java index 87d0ca3..896a8d8 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertCheckResp.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertCheckResp.java @@ -50,6 +50,8 @@ @ApiModelProperty("备注") private String expertRemark; + @ApiModelProperty("专家类型 1、库内2库外" ) + private Long expertType; } diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertExportInfoRes.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertExportInfoRes.java index e55e1d1..60c31d4 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertExportInfoRes.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertExportInfoRes.java @@ -28,6 +28,8 @@ @ApiModelProperty(name = "项目编码") private String projectCode; + @ApiModelProperty(name = "项目id") + private Integer id; /** diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertManagementInfoRes.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertManagementInfoRes.java index 7cfeddf..c572686 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertManagementInfoRes.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertManagementInfoRes.java @@ -88,6 +88,10 @@ @ApiModelProperty(name = "项目概况") private String remark; + @ApiModelProperty(name = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + @ApiModelProperty(name = "专家数据") private List<ProjectExpertCheckResp> projectExpertCheckResp; diff --git a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertResp.java b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertResp.java index 6e3dae1..2e42aa1 100644 --- a/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertResp.java +++ b/expert-system/src/main/java/com/gkhy/system/domain/vo/response/ProjectExpertResp.java @@ -37,6 +37,9 @@ @ApiModelProperty("专家名称") private String name; + @ApiModelProperty(value = "专家类型1库内2库外") + private Long expertType; + @ApiModelProperty("身份证号码") private String idCard; diff --git a/expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertDetailMapper.java b/expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertDetailMapper.java new file mode 100644 index 0000000..1cb894c --- /dev/null +++ b/expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertDetailMapper.java @@ -0,0 +1,19 @@ +package com.gkhy.system.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.system.domain.OutProjectExpertDetail; +import org.apache.ibatis.annotations.Mapper; + +/** + * <p> + * 项目专家得分明细表 Mapper 接口 + * </p> + * + * @author hh + * @since 2025-08-26 13:11:13 + */ +@Mapper +public interface OutProjectExpertDetailMapper extends BaseMapper<OutProjectExpertDetail> { + +} diff --git a/expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertMapper.java b/expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertMapper.java new file mode 100644 index 0000000..b98cd51 --- /dev/null +++ b/expert-system/src/main/java/com/gkhy/system/mapper/OutProjectExpertMapper.java @@ -0,0 +1,19 @@ +package com.gkhy.system.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.system.domain.OutProjectExpert; +import org.apache.ibatis.annotations.Mapper; + +/** + * <p> + * 项目专家关联表 Mapper 接口 + * </p> + * + * @author hh + * @since 2025-08-26 13:11:13 + */ +@Mapper +public interface OutProjectExpertMapper extends BaseMapper<OutProjectExpert> { + +} diff --git a/expert-system/src/main/java/com/gkhy/system/mapper/ProjectExpertMapper.java b/expert-system/src/main/java/com/gkhy/system/mapper/ProjectExpertMapper.java index 29e40af..3d3ec7c 100644 --- a/expert-system/src/main/java/com/gkhy/system/mapper/ProjectExpertMapper.java +++ b/expert-system/src/main/java/com/gkhy/system/mapper/ProjectExpertMapper.java @@ -92,6 +92,9 @@ */ List<ProjectExpertResp> projectExpertEvaList(SysProjectExpertReq req); + + List<ProjectExpertResp> projectExpertEvaOutList(SysProjectExpertReq req); + /** * 导出报销 * @param projectId diff --git a/expert-system/src/main/java/com/gkhy/system/service/IProjectManagementService.java b/expert-system/src/main/java/com/gkhy/system/service/IProjectManagementService.java index ca7928f..60c401a 100644 --- a/expert-system/src/main/java/com/gkhy/system/service/IProjectManagementService.java +++ b/expert-system/src/main/java/com/gkhy/system/service/IProjectManagementService.java @@ -77,6 +77,9 @@ */ void projectCheck(ProjectCheckReq req); + + void projectBuildCheck(ProjectExpertSaveBatchReqDto projectManagement); + /** * 项目归档 * @param req @@ -126,7 +129,7 @@ ProjectNumResp getProjectNum(); - ProjectDetailResp selectProjectExpertDetail(Long projectExpertId); + ProjectDetailResp selectProjectExpertDetail(Long projectExpertId,Long expertType); /** * 导出项目报销 diff --git a/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java b/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java index 3c2b179..e17abc1 100644 --- a/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java +++ b/expert-system/src/main/java/com/gkhy/system/service/impl/ProjectManagementServiceImpl.java @@ -2,6 +2,8 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.common.enums.DeleteFlagEnum; import com.gkhy.common.exception.ServiceException; @@ -19,6 +21,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -47,6 +50,12 @@ @Autowired private SysExpertInfoMapper sysExpertInfoMapper; + @Autowired + private OutProjectExpertMapper outProjectExpertMapper; + + @Autowired + private OutProjectExpertDetailMapper outProjectExpertDetailMapper; + /** * 查询项目管理 * @@ -66,8 +75,8 @@ */ @Override public List<ProjectManagement> selectProjectManagementList(ProjectManagement projectManagement) { - if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && SecurityUtils.getUserId() != 130L){ - projectManagement.setDeptId(SecurityUtils.getDeptId()); + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && SecurityUtils.getUserId() != 130L) { + projectManagement.setDeptId(SecurityUtils.getDeptId()); } return projectManagementMapper.selectProjectManagementList(projectManagement); } @@ -81,25 +90,25 @@ @Override public Long insertProjectManagement(ProjectManageSaveReq projectManagement) { ProjectManagement projectManagementSave = new ProjectManagement(); - if (SecurityUtils.isAdmin(SecurityUtils.getUserId())){ + if (SecurityUtils.isAdmin(SecurityUtils.getUserId())) { throw new ServiceException("无权新增"); } projectManagementSave.setDelFlag(DeleteFlagEnum.UN_DELETE.getCode()); BeanUtil.copyProperties(projectManagement, projectManagementSave); - if (projectManagement.getId() != null){ + if (projectManagement.getId() != null) { checkDataPer(projectManagement.getId()); projectManagementSave.setUpdateBy(SecurityUtils.getUsername()); projectManagementSave.setUpdateTime(DateUtils.getNowDate()); - // projectManagementMapper.updateProjectManagement(projectManagementSave); + // projectManagementMapper.updateProjectManagement(projectManagementSave); updateById(projectManagementSave); - }else { + } else { projectManagementSave.setProjectCode(RandomStringGenerator.generateRandomString(10)); projectManagementSave.setStep(1L); projectManagementSave.setCreateBy(SecurityUtils.getUsername()); projectManagementSave.setCreateTime(DateUtils.getNowDate()); save(projectManagementSave); - // projectManagementMapper.insertProjectManagement(projectManagementSave); + // projectManagementMapper.insertProjectManagement(projectManagementSave); } @@ -114,7 +123,7 @@ */ @Override @Transactional - public void updateProjectManagement(ProjectExpertSaveBatchReqDto projectManagement) { + public void updateProjectManagement(ProjectExpertSaveBatchReqDto projectManagement) { ProjectManagement projectManagement1 = checkDataPer(projectManagement.getId()); //专家选取 @@ -122,99 +131,227 @@ projectManagementSave.setUpdateBy(SecurityUtils.getUsername()); projectManagementSave.setUpdateTime(DateUtils.getNowDate()); projectManagementSave.setId(projectManagement.getId()); - if (projectManagement1.getState() != 1 && projectManagement1.getState() != 0 ){ + if (projectManagement1.getState() != 1 && projectManagement1.getState() != 0) { throw new ServiceException("该步骤不可操作专家数据!"); } + //outExpertInfoMapper List<ProjectExpertSaveReqDto> saveData = projectManagement.getSaveData(); - if (!StringUtils.isNotEmpty(saveData)){ + List<OutProjectExpert> saveOutData = projectManagement.getSaveOutData(); + if (ObjectUtil.isEmpty(saveData) && ObjectUtil.isEmpty(saveOutData)) { throw new ServiceException("专家不可为空!"); } - if (hasDuplicateExpertId(saveData)){ - throw new ServiceException("专家重复!"); + //专家库校验重复 + if (ObjectUtil.isNotEmpty(saveData)) { + if (hasDuplicateExpertId(saveData)) { + throw new ServiceException("专家重复!"); + } } -// long count = saveData.stream() -// .filter(dto -> dto.getSelectionMode() == 1) -// .count(); -// if (count < 1){ -// throw new ServiceException("固定专家不能为空!"); -// } + if (ObjectUtil.isNotEmpty(saveOutData)){ + List<OutProjectExpert> uniqueList = saveOutData.stream() + .collect(Collectors.collectingAndThen( + Collectors.toMap(OutProjectExpert::getIdCard, o -> o, (existing, replacement) -> existing, LinkedHashMap::new), + map -> new ArrayList<>(map.values()) + )); + if (uniqueList.size() != saveOutData.size()){ + throw new ServiceException("外部专家身份证重复!"); + } - if ((projectManagement1.getStep() == 1 || projectManagement1.getStep() == 2) && (projectManagement.getStep() == 2 ) ){ + } + + boolean flag = false; + + + if ((projectManagement1.getStep() == 1 || projectManagement1.getStep() == 2) && (projectManagement.getStep() == 2)) { projectManagementSave.setStep(2L); projectManagementSave.setState(1L); - List<ProjectExpertSaveReqDto> collect = saveData.stream() - .filter(dto -> "1".equals(dto.getTeamLeader().toString())) - .collect(Collectors.toList()); - if (StringUtils.isEmpty(collect)){ + List<ProjectExpertSaveReqDto> collect = new ArrayList<>(); + List<OutProjectExpert> saveOutDataSp = new ArrayList<>(); + List<OutProjectExpert> saveOutDataSp11 = new ArrayList<>(); + if (ObjectUtil.isNotEmpty(saveData)) { + collect = saveData.stream() + .filter(dto -> "1".equals(dto.getTeamLeader().toString())) + .collect(Collectors.toList()); + } + if (ObjectUtil.isNotEmpty(saveOutData)) { + saveOutDataSp = saveOutData.stream() + .filter(dto -> "1".equals(dto.getTeamLeader().toString())) + .collect(Collectors.toList()); + saveOutDataSp11 = saveOutData.stream() + .filter(dto -> "0".equals(dto.getTeamLeader().toString())) + .collect(Collectors.toList()); + } + if (StringUtils.isEmpty(collect) && StringUtils.isEmpty(saveOutDataSp)) { throw new ServiceException("缺少组长!"); } - if (collect.size() > 1){ + if (collect.size()+saveOutDataSp.size() > 1) { throw new ServiceException("组长只能选一人!"); } - projectManagementSave.setExpertName(collect.get(0).getExpertName()); - projectManagementSave.setExpertId(collect.get(0).getExpertId()); - }else if (projectManagement1.getStep() == 2 && projectManagement.getStep() == 3){ + if (ObjectUtil.isNotEmpty( collect)){ + projectManagementSave.setExpertName(collect.get(0).getExpertName()); + projectManagementSave.setExpertId(collect.get(0).getExpertId()); + projectManagementSave.setExpertType(1L); + }else { + OutProjectExpert outExpertInfo = saveOutDataSp.get(0); + flag = true; + if (outExpertInfo.getId() != null){ + outExpertInfo.setUpdateTime(LocalDateTime.now()); + outExpertInfo.setUpdateBy(SecurityUtils.getUsername()); + int update = outProjectExpertMapper.updateById(outExpertInfo); + if (update < 1) { + throw new ServiceException("保存专家失败!"); + } + }else { + outExpertInfo.setProjectId(projectManagement.getId()); + int insert = outProjectExpertMapper.insert(outExpertInfo); + if (insert < 1) { + throw new ServiceException("保存专家失败!"); + } + } + + projectManagementSave.setExpertName(saveOutDataSp.get(0).getName()); + projectManagementSave.setExpertId(saveOutDataSp.get(0).getId()); + projectManagementSave.setExpertType(2L); + if (ObjectUtil.isNotEmpty(saveOutDataSp11)){ + flag = true; + saveOutDataSp11.forEach( + outExpertInfo1 -> { + if (outExpertInfo1.getId() != null){ + outExpertInfo1.setUpdateTime(LocalDateTime.now()); + outExpertInfo1.setUpdateBy(SecurityUtils.getUsername()); + int insert2 = outProjectExpertMapper.updateById(outExpertInfo1); + if (insert2 < 1) { + throw new ServiceException("保存专家失败!"); + } + }else { + outExpertInfo1.setProjectId(projectManagement.getId()); + outExpertInfo1.setCreateTime(LocalDateTime.now()); + outExpertInfo1.setCreateBy(SecurityUtils.getUsername()); + int insert2 = outProjectExpertMapper.insert(outExpertInfo1); + if (insert2 < 1) { + throw new ServiceException("保存专家失败!"); + } + } + + } + ); + } + + } + + + + } else if (projectManagement1.getStep() == 2 && projectManagement.getStep() == 3) { projectManagementSave.setStep(2L); projectManagementSave.setState(2L); projectManagementSave.setProjectCheckTime(new Date()); } + if (ObjectUtil.isNotEmpty(saveData)){ + List<ProjectExpertSaveReqDto> saveList = saveData.stream() + .filter(dto -> dto.getId() == null) + .collect(Collectors.toList()); + if (StringUtils.isNotEmpty(saveList)) { + List<ProjectExpert> projectExperts = convertToProjectExpertList(saveList, projectManagement.getId()); + int i = projectExpertMapper.batchInsertProjectExpert(projectExperts); + if (i < 1) { + throw new ServiceException("保存专家失败!"); + } + } + List<ProjectExpertSaveReqDto> editList = saveData.stream() + .filter(dto -> dto.getId() != null) + .collect(Collectors.toList()); + if (StringUtils.isNotEmpty(editList)) { + List<ProjectExpert> projectExperts = convertToProjectExpertList(editList, projectManagement.getId()); + int i = projectExpertMapper.batchUpdateProjectExpert(projectExperts); + if (i < 1) { + throw new ServiceException("保存专家失败!"); + } + } + } + if (!flag){ + if (ObjectUtil.isNotEmpty(saveOutData)){ + saveOutData.forEach( + outExpertInfo1 -> { + if (outExpertInfo1.getId() != null){ + outExpertInfo1.setUpdateTime(LocalDateTime.now()); + outExpertInfo1.setUpdateBy(SecurityUtils.getUsername()); + int insert2 = outProjectExpertMapper.updateById(outExpertInfo1); + if (insert2 < 1) { + throw new ServiceException("保存专家失败!"); + } + }else { + outExpertInfo1.setProjectId(projectManagement.getId()); + outExpertInfo1.setCreateTime(LocalDateTime.now()); + outExpertInfo1.setCreateBy(SecurityUtils.getUsername()); + int insert2 = outProjectExpertMapper.insert(outExpertInfo1); + if (insert2 < 1) { + throw new ServiceException("保存专家失败!"); + } + } - List<ProjectExpertSaveReqDto> saveList = saveData.stream() - .filter(dto -> dto.getId() == null) - .collect(Collectors.toList()); - if (StringUtils.isNotEmpty(saveList)){ - List<ProjectExpert> projectExperts = convertToProjectExpertList(saveList, projectManagement.getId()); - int i = projectExpertMapper.batchInsertProjectExpert(projectExperts); - if (i < 1){ - throw new ServiceException("保存专家失败!"); + } + + ); } } - List<ProjectExpertSaveReqDto> editList = saveData.stream() - .filter(dto -> dto.getId() != null) - .collect(Collectors.toList()); - if (StringUtils.isNotEmpty(editList)){ - List<ProjectExpert> projectExperts = convertToProjectExpertList(editList, projectManagement.getId()); - int i = projectExpertMapper.batchUpdateProjectExpert(projectExperts); - if (i < 1){ - throw new ServiceException("保存专家失败!"); - } - } - projectManagementSave.setExpertNum((long) saveData.size()); +// int outData = 0; +// if(!ObjectUtil.isEmpty(saveOutData)){ +// outData = saveOutData.size(); +// } +// int inData = 0; +// if (!ObjectUtil.isEmpty(saveData)){ +// inData = saveData.size(); +// } + List<Long> delData = projectManagement.getDelData(); if (delData != null && delData.size() > 0) { int i = projectExpertMapper.deleteProjectExpertByIds(delData.toArray(new Long[delData.size()])); - if (i < 1){ + if (i < 1) { throw new ServiceException("保存专家失败!"); } } + List<Long> delOutData = projectManagement.getDelOutData(); + if (ObjectUtil.isNotEmpty(delOutData)){ + // 删除外部专家数据 + int update = outProjectExpertMapper.update(new OutProjectExpert(), + new LambdaUpdateWrapper<OutProjectExpert>().set(OutProjectExpert::getDelFlag, 1) + .set(OutProjectExpert::getUpdateTime, new Date()).set(OutProjectExpert::getUpdateBy, SecurityUtils.getUsername()) + .in(OutProjectExpert::getId, delOutData)); + if (update < 1) { + throw new ServiceException("保存外部专家失败!"); + } + } + Long l = outProjectExpertMapper.selectCount(new LambdaQueryWrapper<OutProjectExpert>().eq(OutProjectExpert::getDelFlag, 0).eq(OutProjectExpert::getProjectId, projectManagement.getId())); + Long l1 = projectExpertMapper.selectCount(new LambdaQueryWrapper<ProjectExpert>().eq(ProjectExpert::getDelFlag, 0).eq(ProjectExpert::getProjectId, projectManagement.getId())); + projectManagementSave.setExpertNum(l+l1); + int i = projectManagementMapper.updateProjectManagement(projectManagementSave); - if (i < 1){ + if (i < 1) { throw new ServiceException("保存专家失败!"); } } - public List<ProjectExpert> convertToProjectExpertList(List<ProjectExpertSaveReqDto> reqDtos,Long projectId) { + public List<ProjectExpert> convertToProjectExpertList(List<ProjectExpertSaveReqDto> reqDtos, Long projectId) { List<ProjectExpert> projectExpertList = new ArrayList<>(); - reqDtos.forEach(reqDto -> { - ProjectExpert projectExpert = convertToProjectExpert(reqDto,projectId); - projectExpertList.add(projectExpert); - }); - return projectExpertList; + reqDtos.forEach(reqDto -> { + ProjectExpert projectExpert = convertToProjectExpert(reqDto, projectId); + projectExpertList.add(projectExpert); + }); + return projectExpertList; } - private ProjectExpert convertToProjectExpert(ProjectExpertSaveReqDto reqDto,Long projectId) { + private ProjectExpert convertToProjectExpert(ProjectExpertSaveReqDto reqDto, Long projectId) { ProjectExpert projectExpert = new ProjectExpert(); projectExpert.setProjectId(projectId); projectExpert.setExpertId(reqDto.getExpertId()); projectExpert.setSelectionMode(reqDto.getSelectionMode()); projectExpert.setTeamLeader(reqDto.getTeamLeader()); - if (reqDto.getId() == null){ + if (reqDto.getId() == null) { projectExpert.setCreateBy(SecurityUtils.getUsername()); - }else { + } else { projectExpert.setUpdateBy(SecurityUtils.getUsername()); projectExpert.setId(reqDto.getId()); } @@ -222,14 +359,13 @@ } - - public boolean hasDuplicateExpertId(List<ProjectExpertSaveReqDto> saveData) { + public boolean hasDuplicateExpertId(List<ProjectExpertSaveReqDto> saveData) { // 使用 Stream API 收集 expertId 的频率 Map<Long, Long> frequencyMap = saveData.stream() .collect(Collectors.groupingBy(ProjectExpertSaveReqDto::getExpertId, Collectors.counting())); // 检查是否有任何 expertId 的频率大于 1 - return frequencyMap.values().stream().anyMatch(count -> count > 1); + return frequencyMap.values().stream().anyMatch(count -> count > 1); } /** @@ -263,7 +399,20 @@ @Override public ProjectExpertManagementInfoRes projectExpertCheckInfo(Long id) { - return projectManagementMapper.projectExpertCheckInfo(id); + // 查询 + ProjectExpertManagementInfoRes projectExpertManagementInfoRes = projectManagementMapper.projectExpertCheckInfo(id); + + List<ProjectExpertCheckResp> projectExpertCheckResps = projectExpertManagementInfoRes.getProjectExpertCheckResp(); + if (ObjectUtil.isNotEmpty(projectExpertCheckResps)){ + projectExpertCheckResps.forEach(projectExpertCheckResp -> { + projectExpertCheckResp.setSelectionTime(projectExpertManagementInfoRes.getCreateTime()); + }); + projectExpertCheckResps.sort(Comparator + .comparing(ProjectExpertCheckResp::getTeamLeader, Comparator.nullsLast(Comparator.reverseOrder())) + .thenComparing(ProjectExpertCheckResp::getExpertType, Comparator.nullsLast(Comparator.naturalOrder()))); + } + + return projectExpertManagementInfoRes; } @Override @@ -271,11 +420,11 @@ public void projectCheck(ProjectCheckReq req) { ProjectManagement projectManagement = checkDataPer(req.getId()); - if (req.getState() != 3L && req.getState() != 1 ){ + if (req.getState() != 3L && req.getState() != 1) { throw new ServiceException("参数异常!"); } Long state = projectManagement.getState(); - if (state != 2){ + if (state != 2) { throw new ServiceException("未生成审批单不可审批通过操作!"); } @@ -284,9 +433,9 @@ projectManagementUp.setId(req.getId()); projectManagementUp.setState(req.getState()); projectManagementUp.setUpdateBy(SecurityUtils.getUsername()); - if (req.getState() == 3){ + if (req.getState() == 3) { projectManagementUp.setStep(3L); - }else if (req.getState() == 1){ + } else if (req.getState() == 1) { projectManagementUp.setExpertName(""); projectManagementUp.setExpertId(0l); projectManagementUp.setExpertNum(0L); @@ -294,11 +443,11 @@ } int i = projectManagementMapper.updateProjectManagement(projectManagementUp); //驳回删 - if (req.getState() == 1){ + if (req.getState() == 1) { projectFileMapper.deleteProjectFileByIdAndType(req.getId(), "1"); projectExpertMapper.deleteProjectExpertByProjectId(req.getId()); } - if (i > 0 && StringUtils.isNotEmpty(projectFile) && req.getState() == 3){ + if (i > 0 && StringUtils.isNotEmpty(projectFile) && req.getState() == 3) { //删除之前的该类型 projectFileMapper.deleteProjectFileByIdAndType(req.getId(), "1"); String username = SecurityUtils.getUsername(); @@ -308,10 +457,34 @@ }); //int i1 = projectFileMapper.insertProjectFiles(projectFile); Boolean b = projectFileService.saveBatchProjectFile(projectFile); - if (!b){ + if (!b) { throw new ServiceException("保存附件失败!"); } } + } + + @Override + public void projectBuildCheck(ProjectExpertSaveBatchReqDto projectManagement) { + ProjectManagement projectManagement1 = checkDataPer(projectManagement.getId()); + //专家选取 + + ProjectManagement projectManagementSave = new ProjectManagement(); + projectManagementSave.setUpdateBy(SecurityUtils.getUsername()); + projectManagementSave.setUpdateTime(DateUtils.getNowDate()); + projectManagementSave.setId(projectManagement.getId()); + if (projectManagement1.getStep() == 2 && projectManagement.getStep() == 3) { + projectManagementSave.setStep(2L); + projectManagementSave.setState(2L); + projectManagementSave.setProjectCheckTime(new Date()); + + }else { + throw new ServiceException("该步骤无法生成审批单!"); + } + int i = projectManagementMapper.updateProjectManagement(projectManagementSave); + if (i<0){ + throw new ServiceException("生成审批单失败!"); + } + } @Override @@ -319,7 +492,7 @@ ProjectManagement projectManagement = checkDataPer(req.getId()); Long state = projectManagement.getState(); - if (state != 3L){ + if (state != 3L) { throw new ServiceException("此状态不可归档!"); } List<ProjectFile> projectFile = req.getProjectFile(); @@ -331,7 +504,7 @@ projectManagementUp.setProjectEndTime(req.getProjectEndTime()); projectManagementUp.setUpdateBy(SecurityUtils.getUsername()); int i = projectManagementMapper.updateProjectManagement(projectManagementUp); - if (i > 0 && StringUtils.isNotEmpty(projectFile)){ + if (i > 0 && StringUtils.isNotEmpty(projectFile)) { String username = SecurityUtils.getUsername(); projectFile.forEach(file -> { file.setCreateBy(username); @@ -342,7 +515,7 @@ // throw new ServiceException("保存附件失败!"); // } Boolean b = projectFileService.saveBatchProjectFile(projectFile); - if (!b){ + if (!b) { throw new ServiceException("保存附件失败!"); } } @@ -352,7 +525,7 @@ @Override public List<ProjectExpertStateResp> getProjectExpertSate(ProjectExpertStateReq req) { - if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { req.setDeptId(SecurityUtils.getDeptId()); } return projectManagementMapper.getProjectExpertSate(req); @@ -360,72 +533,119 @@ @Override public List<ProjectExpertEvaluationResp> projectExpertEvaluationList(Long projectId) { - return projectExpertMapper.projectExpertEvaluationList(projectId); + List<ProjectExpertEvaluationResp> projectExpertEvaluationResps = projectExpertMapper.projectExpertEvaluationList(projectId); + projectExpertEvaluationResps.sort(Comparator + .comparing(ProjectExpertCheckResp::getTeamLeader, Comparator.nullsLast(Comparator.reverseOrder())) + .thenComparing(ProjectExpertCheckResp::getSelectionMode, Comparator.nullsLast(Comparator.reverseOrder())) + .thenComparing(ProjectExpertCheckResp::getExpertType, Comparator.nullsLast(Comparator.naturalOrder()))); + return projectExpertEvaluationResps; } @Override @Transactional public void projectExpertDetailSave(ProjectExpertScoreSaveReq req) { + + Long projectId = null; + Long expertType = req.getExpertType(); List<Long> delData = req.getDelData(); - if (StringUtils.isNotEmpty(delData)){ - projectExpertDetailMapper.deleteProjectExpertDetailByIds(delData.toArray(new Long[delData.size()])); - } - - - ProjectExpert projectExpert1 = projectExpertMapper.selectProjectExpertById(req.getProjectExpertId()); - if (projectExpert1 == null){ - throw new ServiceException("项目专家不存在!"); - } - ProjectManagement projectManagement1 = checkData(projectExpert1.getProjectId()); - if (projectManagement1.getState() != 4){ - throw new ServiceException("项目未完成!"); - } - - //更新项目专家表 - ProjectExpert projectExpert = new ProjectExpert(); - BeanUtil.copyProperties(req, projectExpert); - projectExpert.setId(req.getProjectExpertId()); - projectExpert.setScore(req.getScore()); - projectExpert.setEvaluationState(1L); - int i = projectExpertMapper.updateProjectExpert(projectExpert); - if (i < 1){ - throw new ServiceException("保存失败!"); - } - List<ProjectExpertScoreSaveReq.Score> saveData = req.getSaveData(); + if (expertType == 1) { + ProjectExpert projectExpert1 = projectExpertMapper.selectProjectExpertById(req.getProjectExpertId()); + if (projectExpert1 == null) { + throw new ServiceException("项目专家不存在!"); + } + ProjectManagement projectManagement1 = checkData(projectExpert1.getProjectId()); + if (projectManagement1.getState() != 4) { + throw new ServiceException("项目未完成!"); + } + projectId = projectExpert1.getProjectId(); - if (StringUtils.isNotEmpty(saveData)){ - List<ProjectExpertDetail> projectExpertDetails = dealData(saveData, req.getProjectExpertId()); - List<ProjectExpertDetail> saveList = projectExpertDetails.stream() - .filter(dto -> dto.getId() == null) - .collect(Collectors.toList()); - if (StringUtils.isNotEmpty(saveList)){ - int i12 = projectExpertDetailMapper.batchInsertProjectExpertDetail(saveList); - if (i12 < 1){ - throw new ServiceException("保存失败!"); + if (StringUtils.isNotEmpty(delData)) { + projectExpertDetailMapper.deleteProjectExpertDetailByIds(delData.toArray(new Long[delData.size()])); + } + //更新项目专家表 + ProjectExpert projectExpert = new ProjectExpert(); + BeanUtil.copyProperties(req, projectExpert); + projectExpert.setId(req.getProjectExpertId()); + projectExpert.setScore(req.getScore()); + projectExpert.setEvaluationState(1L); + int i = projectExpertMapper.updateProjectExpert(projectExpert); + if (i < 1) { + throw new ServiceException("保存失败!"); + } + + if (StringUtils.isNotEmpty(saveData)) { + List<ProjectExpertDetail> projectExpertDetails = dealData(saveData, req.getProjectExpertId()); + List<ProjectExpertDetail> saveList = projectExpertDetails.stream() + .filter(dto -> dto.getId() == null) + .collect(Collectors.toList()); + if (StringUtils.isNotEmpty(saveList)) { + int i12 = projectExpertDetailMapper.batchInsertProjectExpertDetail(saveList); + if (i12 < 1) { + throw new ServiceException("保存失败!"); + } + } + List<ProjectExpertDetail> updateList = projectExpertDetails.stream() + .filter(dto -> dto.getId() != null) + .collect(Collectors.toList()); + if (StringUtils.isNotEmpty(updateList)) { + int i1 = projectExpertDetailMapper.batchUpdateProjectExpertDetail(updateList); + if (i1 < 1) { + throw new ServiceException("保存失败!"); + } } } - List<ProjectExpertDetail> updateList = projectExpertDetails.stream() - .filter(dto -> dto.getId() != null) - .collect(Collectors.toList()); - if (StringUtils.isNotEmpty(updateList)){ - int i1 = projectExpertDetailMapper.batchUpdateProjectExpertDetail(updateList); - if (i1 < 1){ - throw new ServiceException("保存失败!"); - } + + }else { + OutProjectExpert outProjectExpert1 = outProjectExpertMapper.selectById(req.getProjectExpertId()); + if (outProjectExpert1 == null) { + throw new ServiceException("项目专家不存在!"); + } + ProjectManagement projectManagement1 = checkData(outProjectExpert1.getProjectId()); + if (projectManagement1.getState() != 4) { + throw new ServiceException("项目未完成!"); + } + projectId = outProjectExpert1.getProjectId(); + if (StringUtils.isNotEmpty(delData)){ + outProjectExpertDetailMapper.update(new OutProjectExpertDetail(), + new LambdaUpdateWrapper<OutProjectExpertDetail>().in(OutProjectExpertDetail::getId, delData) + .set(OutProjectExpertDetail::getDelFlag, 1).set(OutProjectExpertDetail::getUpdateBy, SecurityUtils.getUsername()) + .set(OutProjectExpertDetail::getUpdateTime, new Date())); + } + OutProjectExpert outProjectExpert = new OutProjectExpert(); + BeanUtil.copyProperties(req, outProjectExpert); + outProjectExpert.setId(req.getProjectExpertId()); + outProjectExpert.setScore(req.getScore().intValue()); + outProjectExpert.setEvaluationState(1); + int update = outProjectExpertMapper.updateById(outProjectExpert); + if (update < 1) { + throw new ServiceException("保存失败!"); + } + if (StringUtils.isNotEmpty(saveData)) { + List<OutProjectExpertDetail> outProjectExpertDetails = dealOutData(saveData, req.getProjectExpertId()); + outProjectExpertDetails.forEach(outProjectExpertDetail -> { + if (outProjectExpertDetail.getId() == null){ + outProjectExpertDetailMapper.insert(outProjectExpertDetail); + }else { + outProjectExpertDetailMapper.updateById(outProjectExpertDetail); + } + }); } } + //验证是否都已考评 - int unEva = projectExpertMapper.getUnEva(projectExpert1.getProjectId()); - if (unEva == 0){ + int unEva = projectExpertMapper.getUnEva(projectId); + Long l = outProjectExpertMapper.selectCount(new LambdaQueryWrapper<OutProjectExpert>().eq(OutProjectExpert::getProjectId, projectId) + .eq(OutProjectExpert::getDelFlag, 0).eq(OutProjectExpert::getEvaluationState, 0)); + if (unEva+l == 0) { ProjectManagement projectManagement = new ProjectManagement(); - projectManagement.setId(projectExpert1.getProjectId()); + projectManagement.setId(projectId); projectManagement.setEvaluationState(1L); projectManagement.setUpdateBy(SecurityUtils.getUsername()); int i1 = projectManagementMapper.updateProjectManagement(projectManagement); - if (i1 < 1){ + if (i1 < 1) { throw new ServiceException("保存失败!"); } } @@ -434,10 +654,17 @@ @Override public List<ProjectExpertResp> projectExpertEvaList(SysProjectExpertReq req) { - if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) { req.setDeptId(SecurityUtils.getDeptId()); } + return projectExpertMapper.projectExpertEvaList(req); +// if (req.getExpertType() == 1){ +// return projectExpertMapper.projectExpertEvaList(req); +// }else { +// return projectExpertMapper.projectExpertEvaOutList(req); +// } + } @Override @@ -448,12 +675,12 @@ } @Override - public List<ProjectFile> selectProjectFileList(Long projectId,String module ) { + public List<ProjectFile> selectProjectFileList(Long projectId, String module) { ProjectFile projectFile = new ProjectFile(); projectFile.setProjectId(projectId); projectFile.setModule(module); List<ProjectFile> projectFiles = projectFileMapper.selectProjectFileList(projectFile); - if (StringUtils.isNotEmpty(projectFiles)){ + if (StringUtils.isNotEmpty(projectFiles)) { return projectFiles; } return Collections.emptyList(); @@ -463,7 +690,7 @@ public ProjectNumResp getProjectNum() { ProjectNumResp projectNumResp = new ProjectNumResp(); List<Integer> dataNum = projectManagementMapper.getDataNum(SecurityUtils.isAdmin(SecurityUtils.getUserId()) ? null : SecurityUtils.getDeptId()); - if (!StringUtils.isEmpty(dataNum)){ + if (!StringUtils.isEmpty(dataNum)) { Map<Integer, Long> statusCounts = dataNum.stream() .collect(Collectors.groupingBy( status -> status, @@ -471,56 +698,90 @@ )); projectNumResp.setTotal(dataNum.size()); int i = statusCounts.get(2) == null ? 0 : statusCounts.get(2).intValue(); - projectNumResp.setApproval(statusCounts.get(3) == null ? 0+i: statusCounts.get(3).intValue()+i); + projectNumResp.setApproval(statusCounts.get(3) == null ? 0 + i : statusCounts.get(3).intValue() + i); projectNumResp.setExpert(statusCounts.get(1) == null ? 0 : statusCounts.get(1).intValue()); - projectNumResp.setStaging(statusCounts.get(0) == null ? 0:statusCounts.get(0).intValue()); - projectNumResp.setEnd(statusCounts.get(4) == null ? 0:statusCounts.get(4).intValue()); + projectNumResp.setStaging(statusCounts.get(0) == null ? 0 : statusCounts.get(0).intValue()); + projectNumResp.setEnd(statusCounts.get(4) == null ? 0 : statusCounts.get(4).intValue()); } return projectNumResp; } @Override - public ProjectDetailResp selectProjectExpertDetail(Long projectExpertId) { + public ProjectDetailResp selectProjectExpertDetail(Long projectExpertId,Long expertType) { ProjectDetailResp projectDetailResp = new ProjectDetailResp(); - ProjectExpert projectExpert = projectExpertMapper.selectProjectExpertById(projectExpertId); - BeanUtil.copyProperties(projectExpert, projectDetailResp); - if (projectDetailResp != null){ - ProjectExpertDetail projectExpertDetail = new ProjectExpertDetail(); - projectExpertDetail.setProjectExpertId(projectExpertId); - List<ProjectExpertDetail> projectExpertDetails = projectExpertDetailMapper.selectProjectExpertDetailList(projectExpertDetail); - if (StringUtils.isNotEmpty(projectExpertDetails)){ - projectDetailResp.setExpertDetails(projectExpertDetails); - } - Long projectId = projectDetailResp.getProjectId(); - ProjectManagement projectManagement = projectManagementMapper.selectProjectManagementById(projectId); - projectDetailResp.setDeptId(projectManagement.getDeptId()); - projectDetailResp.setDeptName(projectDetailResp.getDeptName()); - projectDetailResp.setProjectName(projectManagement.getProjectName()); - projectDetailResp.setProjectDateStart(projectManagement.getProjectDateStart()); - projectDetailResp.setProjectDateEnd(projectManagement.getProjectDateEnd()); - if (StringUtils.isNotEmpty(projectManagement.getJobCategory())){ - projectDetailResp.setJobCategory(projectManagement.getJobCategory()); - } - SysExpertInfo sysExpertInfo = sysExpertInfoMapper.selectById(projectDetailResp.getExpertId()); - if (sysExpertInfo != null){ - projectDetailResp.setTitle(sysExpertInfo.getTitle()); - projectDetailResp.setJob(sysExpertInfo.getJob()); - } + if (expertType == 1){ + ProjectExpert projectExpert = projectExpertMapper.selectProjectExpertById(projectExpertId); + BeanUtil.copyProperties(projectExpert, projectDetailResp); + if (projectDetailResp != null) { + ProjectExpertDetail projectExpertDetail = new ProjectExpertDetail(); + projectExpertDetail.setProjectExpertId(projectExpertId); + List<ProjectExpertDetail> projectExpertDetails = projectExpertDetailMapper.selectProjectExpertDetailList(projectExpertDetail); + if (StringUtils.isNotEmpty(projectExpertDetails)) { + projectDetailResp.setExpertDetails(projectExpertDetails); + } + Long projectId = projectDetailResp.getProjectId(); + ProjectManagement projectManagement = projectManagementMapper.selectProjectManagementById(projectId); + projectDetailResp.setDeptId(projectManagement.getDeptId()); + projectDetailResp.setDeptName(projectDetailResp.getDeptName()); + projectDetailResp.setProjectName(projectManagement.getProjectName()); + projectDetailResp.setProjectDateStart(projectManagement.getProjectDateStart()); + projectDetailResp.setProjectDateEnd(projectManagement.getProjectDateEnd()); + if (StringUtils.isNotEmpty(projectManagement.getJobCategory())) { + projectDetailResp.setJobCategory(projectManagement.getJobCategory()); + } + SysExpertInfo sysExpertInfo = sysExpertInfoMapper.selectById(projectDetailResp.getExpertId()); + if (sysExpertInfo != null) { + projectDetailResp.setTitle(sysExpertInfo.getTitle()); + projectDetailResp.setJob(sysExpertInfo.getJob()); + } + } + }else if (expertType == 2){ + + OutProjectExpert outProjectExpert = outProjectExpertMapper.selectById(projectExpertId); + BeanUtil.copyProperties(outProjectExpert, projectDetailResp); + if (projectDetailResp != null) { + + LambdaQueryWrapper<OutProjectExpertDetail> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(OutProjectExpertDetail::getOutProjectExpertId, projectExpertId); + List<OutProjectExpertDetail> outProjectExpertDetails = outProjectExpertDetailMapper.selectList(queryWrapper); + if (StringUtils.isNotEmpty(outProjectExpertDetails)) { + List<ProjectExpertDetail> projectExpertDetails = new ArrayList<>(); + outProjectExpertDetails.forEach(outProjectExpertDetail -> { + ProjectExpertDetail projectExpertDetail = new ProjectExpertDetail(); + BeanUtil.copyProperties(outProjectExpertDetail, projectExpertDetail); + projectExpertDetails.add(projectExpertDetail); + + }); + projectDetailResp.setExpertDetails(projectExpertDetails); + } + Long projectId = projectDetailResp.getProjectId(); + ProjectManagement projectManagement = projectManagementMapper.selectProjectManagementById(projectId); + projectDetailResp.setDeptId(projectManagement.getDeptId()); + projectDetailResp.setDeptName(projectDetailResp.getDeptName()); + projectDetailResp.setProjectName(projectManagement.getProjectName()); + projectDetailResp.setProjectDateStart(projectManagement.getProjectDateStart()); + projectDetailResp.setProjectDateEnd(projectManagement.getProjectDateEnd()); + if (StringUtils.isNotEmpty(projectManagement.getJobCategory())) { + projectDetailResp.setJobCategory(projectManagement.getJobCategory()); + } + + } } + return projectDetailResp; } @Override public List<ProjectExpertExportInfoRes> projectExpertExportList(Long projectId) { ProjectManagement projectManagement = checkData(projectId); - if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && projectManagement.getDeptId().intValue() != SecurityUtils.getDeptId().intValue()){ + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && projectManagement.getDeptId().intValue() != SecurityUtils.getDeptId().intValue()) { throw new ServiceException("非本部门数据,无权操作!"); } - if (projectManagement.getState() != 4){ + if (projectManagement.getState() != 4) { throw new ServiceException("项目未完成,无权操作!"); } - if (projectManagement.getEvaluationState() == 0){ + if (projectManagement.getEvaluationState() == 0) { throw new ServiceException("有专家未完成评定与报销,请完善后再试"); } @@ -533,7 +794,7 @@ return projectManagementMapper.selectProjectData(projectManagement); } - private List<ProjectExpertDetail> dealData(List<ProjectExpertScoreSaveReq.Score> data,Long projectExpertId){ + private List<ProjectExpertDetail> dealData(List<ProjectExpertScoreSaveReq.Score> data, Long projectExpertId) { List<ProjectExpertDetail> dealData = new ArrayList<>(); data.forEach(dto -> { ProjectExpertDetail projectExpertDetail = new ProjectExpertDetail(); @@ -541,9 +802,9 @@ projectExpertDetail.setContent(dto.getContent()); projectExpertDetail.setScore(dto.getScore()); projectExpertDetail.setScoreType(dto.getScoreType()); - if (dto.getId() == null){ + if (dto.getId() == null) { projectExpertDetail.setCreateBy(SecurityUtils.getUsername()); - }else { + } else { projectExpertDetail.setId(dto.getId()); projectExpertDetail.setUpdateBy(SecurityUtils.getUsername()); } @@ -554,37 +815,57 @@ } - public ProjectManagement checkData(Long id){ + private List<OutProjectExpertDetail> dealOutData(List<ProjectExpertScoreSaveReq.Score> data, Long projectExpertId) { + List<OutProjectExpertDetail> dealData = new ArrayList<>(); + data.forEach(dto -> { + OutProjectExpertDetail projectExpertDetail = new OutProjectExpertDetail(); + projectExpertDetail.setOutProjectExpertId(projectExpertId); + projectExpertDetail.setContent(dto.getContent()); + projectExpertDetail.setScore(dto.getScore().intValue()); + projectExpertDetail.setScoreType(dto.getScoreType()); + if (dto.getId() == null) { + projectExpertDetail.setCreateBy(SecurityUtils.getUsername()); + } else { + projectExpertDetail.setId(dto.getId()); + projectExpertDetail.setUpdateBy(SecurityUtils.getUsername()); + } + + dealData.add(projectExpertDetail); + }); + return dealData; + } + + + public ProjectManagement checkData(Long id) { ProjectManagement projectManagement = projectManagementMapper.selectProjectManagementById(id); - if (ObjectUtil.isNull(projectManagement)){ + if (ObjectUtil.isNull(projectManagement)) { throw new ServiceException("数据不存在!"); } return projectManagement; } - public ProjectManagement checkDataPer(Long id){ + public ProjectManagement checkDataPer(Long id) { ProjectManagement projectManagement = checkData(id); Long deptId = projectManagement.getDeptId(); // 本部门审批? - if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()){ + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()) { throw new ServiceException("非本处室数据,无权操作!"); } - if (projectManagement.getState() == 4){ + if (projectManagement.getState() == 4) { throw new ServiceException("已结项,无权操作!"); } return projectManagement; } - private void checkDelData(Long id){ + private void checkDelData(Long id) { ProjectManagement projectManagement = checkData(id); Long deptId = projectManagement.getDeptId(); // 本部门审批? - if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()){ + if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && deptId.intValue() != SecurityUtils.getDeptId().intValue()) { throw new ServiceException("非本处室数据,无权操作!"); } } - } \ No newline at end of file diff --git a/expert-system/src/main/resources/mapper/system/OutProjectExpertDetailMapper.xml b/expert-system/src/main/resources/mapper/system/OutProjectExpertDetailMapper.xml new file mode 100644 index 0000000..37ab0c8 --- /dev/null +++ b/expert-system/src/main/resources/mapper/system/OutProjectExpertDetailMapper.xml @@ -0,0 +1,5 @@ +<?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.gkhy.system.mapper.OutProjectExpertDetailMapper"> + +</mapper> diff --git a/expert-system/src/main/resources/mapper/system/OutProjectExpertMapper.xml b/expert-system/src/main/resources/mapper/system/OutProjectExpertMapper.xml new file mode 100644 index 0000000..ec8766b --- /dev/null +++ b/expert-system/src/main/resources/mapper/system/OutProjectExpertMapper.xml @@ -0,0 +1,5 @@ +<?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.gkhy.system.mapper.OutProjectExpertMapper"> + +</mapper> diff --git a/expert-system/src/main/resources/mapper/system/ProjectExpertMapper.xml b/expert-system/src/main/resources/mapper/system/ProjectExpertMapper.xml index fa80caa..af90f18 100644 --- a/expert-system/src/main/resources/mapper/system/ProjectExpertMapper.xml +++ b/expert-system/src/main/resources/mapper/system/ProjectExpertMapper.xml @@ -44,7 +44,9 @@ <result property="projectName" column="project_name" /> <result property="deptName" column="dept_name" /> <result property="projectCode" column="project_code" /> - <collection property="projectExpertExportResps" javaType="java.util.List" resultMap="ExpertExport" /> + <result property="id" column="id" /> + <collection property="projectExpertExportResps" ofType="com.gkhy.system.domain.vo.response.ProjectExpertExportResp" javaType="java.util.List" select="projectExpertExportDataList" + column="id"/> </resultMap> <resultMap id="ExpertExport" type="com.gkhy.system.domain.vo.response.ProjectExpertExportResp"> <result property="name" column="name" /> @@ -259,19 +261,27 @@ <select id="projectExpertEvaluationList" parameterType="Long" resultType="com.gkhy.system.domain.vo.response.ProjectExpertEvaluationResp"> select b.id ,b.expert_id expertId ,c.name,c.sex,c.id_card idCard,c.domain,c.rating_level ratingLevel, b.selection_mode selectionMode,b.team_leader teamLeader,b.score,b.evaluation_state evaluationState, - d.classify_name bigClassifyName + d.classify_name bigClassifyName,1 as expertType from project_expert b left join sys_expert_info c on b.expert_id = c.id left join sys_expert_classify d on c.big_classify = d.id where b.del_flag = 0 and b.project_id = #{projectId} - order by b.team_leader asc , b.selection_mode asc, b.create_time desc + union all + select b.id ,b.id expertId ,b.name,b.sex,b.id_card idCard,b.domain,b.rating_level ratingLevel, + b.selection_mode selectionMode,b.team_leader teamLeader,b.score,b.evaluation_state evaluationState, + "空" bigClassifyName,2 as expertType + from out_project_expert b + where b.del_flag = 0 and b.project_id = #{projectId} + + order by teamLeader asc , selectionMode asc + </select> <select id="projectExpertEvaList" parameterType="com.gkhy.system.domain.vo.request.SysProjectExpertReq" resultType="com.gkhy.system.domain.vo.response.ProjectExpertResp"> select a.id projectId, a.project_name projectName, b.id projectExpertId,b.expert_id expertId,c.name,c.id_card idCard,c.domain,b.selection_mode selectionMode, - b.team_leader teamLeader,b.update_time updateTime,b.score + b.team_leader teamLeader,b.update_time updateTime,b.score,1 as expertType from project_management a left join project_expert b on a.id = b.project_id and b.del_flag = 0 left join sys_expert_info c on b.expert_id = c.id @@ -293,20 +303,91 @@ <if test="endTime != null "><!-- 结束时间检索 --> and date_format(b.update_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') </if> + union all + + select a.id projectId, a.project_name projectName, + b.id projectExpertId,b.id expertId,b.name,b.id_card idCard,b.domain,b.selection_mode selectionMode, + b.team_leader teamLeader,b.update_time updateTime,b.score,2 as expertType + from project_management a + left join out_project_expert b on a.id = b.project_id and b.del_flag = 0 + where 1=1 and b.evaluation_state = 1 + <if test="deptId != null "> and a.dept_id = #{deptId}</if> + <if test="projectName != null and projectName != ''"> and a.project_name like concat('%', #{projectName}, '%')</if> + <if test="name != null and name != ''"> + and b.name like concat('%', #{name}, '%') + </if> + <if test="idCard != null and idCard != ''"> + and b.id_card like concat('%', #{idCard}, '%') + </if> + <if test="domain != null and domain != ''"> + and b.domain like concat('%', #{domain}, '%') + </if> + <if test="startTime != null "><!-- 开始时间检索 --> + and date_format(b.update_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') + </if> + <if test="endTime != null "><!-- 结束时间检索 --> + and date_format(b.update_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') + </if> + + order by updateTime desc + </select> + + + <select id="projectExpertEvaOutList" parameterType="com.gkhy.system.domain.vo.request.SysProjectExpertReq" resultType="com.gkhy.system.domain.vo.response.ProjectExpertResp"> + select a.id projectId, a.project_name projectName, + b.id projectExpertId,b.expert_id expertId,b.name,b.id_card idCard,b.domain,b.selection_mode selectionMode, + b.team_leader teamLeader,b.update_time updateTime,b.score + from project_management a + left join out_project_expert b on a.id = b.project_id and b.del_flag = 0 + where 1=1 and b.evaluation_state = 1 + <if test="deptId != null "> and a.dept_id = #{deptId}</if> + <if test="projectName != null and projectName != ''"> and a.project_name like concat('%', #{projectName}, '%')</if> + <if test="name != null and name != ''"> + and b.name like concat('%', #{name}, '%') + </if> + <if test="idCard != null and idCard != ''"> + and b.id_card like concat('%', #{idCard}, '%') + </if> + <if test="domain != null and domain != ''"> + and b.domain like concat('%', #{domain}, '%') + </if> + <if test="startTime != null "><!-- 开始时间检索 --> + and date_format(b.update_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') + </if> + <if test="endTime != null "><!-- 结束时间检索 --> + and date_format(b.update_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') + </if> order by b.update_time desc </select> + <select id="projectExpertExportList" parameterType="Long" resultMap="ProjectExpertExportInfoResult"> - select a.project_name ,a.dept_name,a.project_code - ,c.name,c.id_card,c.name,c.job,c.title,c.company_name,b.freight_basis,b.billing_instructions, - b.billing_duration, b.after_tax_amount, b.open_bank, b.bank_card,b.taxable_income,b.income_tax_payable,b.tax_expert_fee,b.travel_expenses,b.accommodation_fee + select a.project_name ,a.dept_name,a.project_code,a.id from project_management a - left join project_expert b on a.id = b.project_id and b.del_flag = 0 - left join sys_expert_info c on b.expert_id = c.id where a.id = #{projectId} - order by b.team_leader asc , b.create_time desc + + </select> + <select id="projectExpertExportDataList" parameterType="Long" resultMap="ExpertExport"> + select c.name,c.id_card,c.job,c.title,c.company_name,b.freight_basis,b.billing_instructions, + b.billing_duration, b.after_tax_amount, b.open_bank, b.bank_card,b.taxable_income,b.income_tax_payable,b.tax_expert_fee,b.travel_expenses,b.accommodation_fee + ,b.team_leader,b.create_time + from project_expert b + left join sys_expert_info c on b.expert_id = c.id + where b.project_id = #{id} and b.del_flag = 0 + union all + select b.name,b.id_card,'' as job, b.title,b.company_name,b.freight_basis,b.billing_instructions, + b.billing_duration, b.after_tax_amount, b.open_bank, b.bank_card,b.taxable_income,b.income_tax_payable,b.tax_expert_fee,b.travel_expenses,b.accommodation_fee + ,b.team_leader,b.create_time + from out_project_expert b + where b.project_id = #{id} and b.del_flag = 0 + + order by team_leader asc , create_time desc + + </select> + + </mapper> \ No newline at end of file diff --git a/expert-system/src/main/resources/mapper/system/ProjectManagementMapper.xml b/expert-system/src/main/resources/mapper/system/ProjectManagementMapper.xml index 7795254..59c70fb 100644 --- a/expert-system/src/main/resources/mapper/system/ProjectManagementMapper.xml +++ b/expert-system/src/main/resources/mapper/system/ProjectManagementMapper.xml @@ -50,7 +50,15 @@ <result property="projectDateStart" column="project_date_start" /> <result property="projectDateEnd" column="project_date_end" /> <result property="projectCheckTime" column="project_check_time" /> - <collection property="projectExpertCheckResp" javaType="java.util.List" resultMap="ExpertCheck" /> + <result property="createTime" column="create_time"/> +<!-- <collection property="projectExpertCheckResp" javaType="java.util.List" resultMap="ExpertCheck" />--> + <collection property="projectExpertCheckResp" + javaType="java.util.List" + ofType="com.gkhy.system.domain.vo.response.ProjectExpertCheckResp" + select="selectExpertsByProjectId" + column="id"> + </collection> + </resultMap> <resultMap id="ExpertCheck" type="com.gkhy.system.domain.vo.response.ProjectExpertCheckResp"> <result property="id" column="project_expert_id" /> @@ -66,6 +74,7 @@ <result property="phone" column="phone" /> <result property="selectionTime" column="selection_time" /> <result property="expertRemark" column="expert_remark" /> + <result property="expertType" column="expert_type" /> </resultMap> <sql id="selectProjectManagementVo"> @@ -123,8 +132,50 @@ </if> <if test="projectDateStart != null "> and date_format(a.project_date_start,'%Y%m%d') >= date_format(#{projectDateStart},'%Y%m%d')</if> <if test="projectDateEnd != null "> and date_format(a.project_date_end,'%Y%m%d') <= date_format(#{projectDateEnd},'%Y%m%d')</if> - order BY a.dept_name asc ,c.`name` desc + + UNION ALL + + select a.dept_name deptName,b.name expertName,b.tax_expert_fee expertFee,a.create_time createTime,a.project_name projectName, + b.major_dangers majorDangers,b.general_hazards generalHazards,b.travel_expenses travelExpenses,b.accommodation_fee accommodationFee + from project_management a + left join out_project_expert b on a.id = b.project_id and b.del_flag = 0 and b.evaluation_state = 1 + where a.del_flag = 0 and a.state = 4 and a.evaluation_state = 1 + <if test="projectName != null and projectName != ''"> and a.project_name like concat('%', #{projectName}, '%')</if> + <if test="projectCode != null and projectCode != ''"> and a.project_code like concat('%', #{projectCode}, '%')</if> + <if test="deptId != null "> and a.dept_id = #{deptId}</if> + <if test="deptIds != null and deptIds.size() > 0"> + AND a.dept_id IN + <foreach item="deptId" collection="deptIds" open="(" separator="," close=")"> + #{deptId} + </foreach> + </if> + <if test="projectDateStart != null "> and date_format(a.project_date_start,'%Y%m%d') >= date_format(#{projectDateStart},'%Y%m%d')</if> + <if test="projectDateEnd != null "> and date_format(a.project_date_end,'%Y%m%d') <= date_format(#{projectDateEnd},'%Y%m%d')</if> + + + order BY deptName asc ,expertName desc </select> + + <select id="selectProjectDataOut" parameterType="ProjectManagement" resultType="com.gkhy.system.domain.vo.response.ProjectDataResp"> + select a.dept_name deptName,b.name expertName,b.tax_expert_fee expertFee,a.create_time createTime,a.project_name projectName, + b.major_dangers majorDangers,b.general_hazards generalHazards,b.travel_expenses travelExpenses,b.accommodation_fee accommodationFee + from project_management a + left join out_project_expert b on a.id = b.project_id and b.del_flag = 0 and b.evaluation_state = 1 + where a.del_flag = 0 and a.state = 4 and a.evaluation_state = 1 + <if test="projectName != null and projectName != ''"> and a.project_name like concat('%', #{projectName}, '%')</if> + <if test="projectCode != null and projectCode != ''"> and a.project_code like concat('%', #{projectCode}, '%')</if> + <if test="deptId != null "> and a.dept_id = #{deptId}</if> + <if test="deptIds != null and deptIds.size() > 0"> + AND a.dept_id IN + <foreach item="deptId" collection="deptIds" open="(" separator="," close=")"> + #{deptId} + </foreach> + </if> + <if test="projectDateStart != null "> and date_format(a.project_date_start,'%Y%m%d') >= date_format(#{projectDateStart},'%Y%m%d')</if> + <if test="projectDateEnd != null "> and date_format(a.project_date_end,'%Y%m%d') <= date_format(#{projectDateEnd},'%Y%m%d')</if> + order BY a.dept_name asc ,b.`name` desc + </select> + <select id="selectProjectManagementById" parameterType="Long" resultMap="ProjectManagementResult"> @@ -206,6 +257,7 @@ <if test="expertNum != null">expert_num = #{expertNum},</if> <if test="expertId != null">expert_id = #{expertId},</if> <if test="expertName != null">expert_name = #{expertName},</if> + <if test="expertType != null">expert_type = #{expertType},</if> <if test="projectEndTime != null">project_end_time = #{projectEndTime},</if> <if test="desc != null and desc != ''">`desc` = #{desc},</if> <if test="delFlag != null">del_flag = #{delFlag},</if> @@ -229,15 +281,30 @@ </update> <select id="projectExpertCheckInfo" parameterType="Long" resultMap="ProjectManagementInfoResult"> - select a.id,a.step, a.project_name, a.dept_name, a.job_category, a.project_address, a.project_date_start, a.project_date_end, a.remark,a.project_check_time,a.state, - b.id project_expert_id,b.expert_id expert_id_info,c.name,c.sex,c.id_card,c.domain,c.rating_level,b.selection_mode,b.team_leader, - c.company_name,c.phone,a.create_time selection_time,c.remark expert_remark,a.project_code,a.expert_num + select a.id,a.step, a.project_name, a.dept_name, a.job_category, a.project_address, a.project_date_start, + a.project_date_end, a.remark,a.project_check_time,a.state, + a.project_code,a.expert_num from project_management a - left join project_expert b on a.id = b.project_id and b.del_flag = 0 - left join sys_expert_info c on b.expert_id = c.id where a.id = #{id} - order by b.team_leader desc , b.create_time desc + </select> + + <select id="selectExpertsByProjectId" parameterType="long" resultMap="ExpertCheck"> + select b.id project_expert_id,b.expert_id expert_id_info,c.name,c.sex,c.id_card,c.domain,c.rating_level,b.selection_mode,b.team_leader, + c.company_name,c.phone,null selection_time,c.remark expert_remark, 1 as expert_type + from project_expert b + left join sys_expert_info c on b.expert_id = c.id + where b.project_id = #{id} and b.del_flag = 0 + union all + select b.id project_expert_id,b.id expert_id_info,b.name,b.sex,b.id_card,b.domain,b.rating_level,b.selection_mode,b.team_leader, + b.company_name,'' as phone,null selection_time,'' as expert_remark, 2 as expert_type + from out_project_expert b + where b.project_id = #{id} and b.del_flag = 0 + order by team_leader desc + </select> + + + <select id="getProjectExpertSate" parameterType="com.gkhy.system.domain.vo.request.ProjectExpertStateReq" resultType="com.gkhy.system.domain.vo.response.ProjectExpertStateResp"> select a.id, a.project_name, a.evaluation_state, a.project_check_time, a.project_end_time, a.dept_name, a.expert_num from project_management a diff --git a/expert-system/src/main/resources/mapper/system/SysExpertInfoMapper.xml b/expert-system/src/main/resources/mapper/system/SysExpertInfoMapper.xml index b0131ec..8ded090 100644 --- a/expert-system/src/main/resources/mapper/system/SysExpertInfoMapper.xml +++ b/expert-system/src/main/resources/mapper/system/SysExpertInfoMapper.xml @@ -148,7 +148,7 @@ <select id="getExpertRound" parameterType="com.gkhy.system.domain.vo.request.SysExpertInfoRoundReq" resultType="com.gkhy.system.domain.vo.response.ProjectExpertSectionResp"> - select id,name,sex,id_card idCard, + select id ,name,sex,id_card idCard, domain,rating_level ratingLevel from sys_expert_info where del_flag = 0 <if test="deptId != null "> and dept_id = #{deptId}</if> -- Gitblit v1.9.2