Explorar el Código

质量巡检相关2

qianxb hace 1 año
padre
commit
46fc781c4c

+ 4 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/InspectionRectify.java

@@ -19,9 +19,12 @@ import java.time.LocalDate;
 @EqualsAndHashCode(callSuper = true)
 public class InspectionRectify extends BaseEntity {
 
-    @ApiModelProperty(value = "项目名称")
+    @ApiModelProperty(value = "项目id")
     private Long projectId;
 
+    @ApiModelProperty(value = "合同id")
+    private Long contractId;
+
     @ApiModelProperty(value = "巡检id")
     private Long inspectId;
 

+ 5 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/RoutingInspection.java

@@ -20,16 +20,19 @@ import java.time.LocalDateTime;
 @EqualsAndHashCode(callSuper = true)
 public class RoutingInspection extends BaseEntity {
 
-    @ApiModelProperty(value = "项目名称")
+    @ApiModelProperty(value = "项目id")
     private Long projectId;
 
+    @ApiModelProperty(value = "合同id")
+    private Long contractId;
+
     @ApiModelProperty(value = "检查名称")
     private String inspectName;
 
     @ApiModelProperty(value = "巡检类别 1安全巡检2质量巡检")
     private Integer inspectType;
 
-    @ApiModelProperty(value = "是否需要整改 1需要2不需要")
+    @ApiModelProperty(value = "是否需要整改 1需要2不需要3已整改")
     private Integer isRectify;
 
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/RoutingInspectionVO.java

@@ -25,4 +25,7 @@ public class RoutingInspectionVO extends RoutingInspection {
 
     @ApiModelProperty(value = "是否需要整改名称")
     private String isRectifyName;
+
+    @ApiModelProperty(value = "整改人是否当前用户,0否1是")
+    private Integer isRectifyUser;
 }

+ 5 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/RoutingInspectionMapper.xml

@@ -8,13 +8,15 @@
                (select dict_value from blade_dict where code = 'inspect_type' and dict_key = mri.inspect_type) as inspectTypeName,
                (select dict_value from blade_dict where code = 'review_inspect_status' and dict_key = mri.review_inspect_status) as reviewInspectStatusName,
                case mri.is_rectify
-                   when 1 then '未开始'
-                   when 2 then '进行中'
+                   when 1 then '需要'
+                   when 2 then '不需要'
+                   when 3 then '已整改'
                    end as isRectifyName
         from m_routing_inspection mri
-        where mri.is_deleted = 0 and mri.project_id = #{inspection.projectId}
+        where mri.is_deleted = 0 and mri.project_id = #{inspection.projectId} and contract_id = #{inspection.contractId}
         <if test="inspection.isRectify != null and inspection.isRectify != ''">
             and mri.is_rectify = #{inspection.isRectify}
         </if>
+        order by mri.create_time desc
     </select>
 </mapper>

+ 15 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/RoutingInspectionServiceImpl.java

@@ -54,6 +54,7 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
         RoutingInspection inspection = new RoutingInspection();
         BeanUtils.copyProperties(dto,inspection);
         inspection.setId(id);
+        inspection.setCreateTime(new Date());
         this.save(inspection);
         //再保存具体的巡检项目
         List<InspectionRectify> list1 = list.stream().map(l -> {
@@ -96,6 +97,19 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
     public IPage<RoutingInspectionVO> page(Query query, RoutingInspection inspection) {
         IPage<RoutingInspectionVO> iPage = new Page<>(query.getCurrent(), query.getSize());
         baseMapper.page(iPage,inspection);
+        //设置权限,只能整改人可以点
+        Long userId = AuthUtil.getUserId();
+        List<RoutingInspectionVO> records = iPage.getRecords();
+        for (RoutingInspectionVO record : records) {
+            String rectifyUser = record.getRectifyUser();
+            String[] split = rectifyUser.split("-");
+            Long user = Long.parseLong(split[split.length-1]);
+            if (userId.equals(user)){
+                record.setIsRectifyUser(1);
+            }else {
+                record.setIsRectifyUser(0);
+            }
+        }
         return iPage;
     }
 
@@ -134,7 +148,7 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
             //复检通过,修改复检状态为3通过,修改整改状态为2不用整改
             this.update(new LambdaUpdateWrapper<RoutingInspection>()
                     .set(RoutingInspection::getReviewInspectStatus,3)
-                    .set(RoutingInspection::getIsRectify,2)
+                    .set(RoutingInspection::getIsRectify,3)
                     .eq(RoutingInspection::getId,id));
         }else {
             throw new ServiceException("参数错误");