Browse Source

根据区域编号查询设备试验

根据区域编号查询安全检查
月度自查 技能培训 安全生产会议次数
zhongwei
段飞宇 2 years ago
parent
commit
ecb6cf634f
  1. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
  2. 2
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageSmsClient.java
  3. 2
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java
  4. 1
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatTypeVo.java
  5. 3
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatVo.java
  6. 48
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/CheckCompanyFeignClient.java
  7. 35
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeEquipmentTrialFeignClient.java
  8. 48
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeproductFeignClient.java
  9. 41
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/CheckCompanyFeignClientFallback.java
  10. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeEquipmentTrialFeignClientFallback.java
  11. 40
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeproductFeignClientFallback.java
  12. 33
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckCompanyVo.java
  13. 34
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckMonthVo.java
  14. 23
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/SafeEquipmentTrialVO.java
  15. 10
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/SafeEquipmentTrialDTO.java
  16. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckCompanyEntity.java
  17. 25
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java
  18. 7
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java
  19. 21
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
  20. 80
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  21. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java
  22. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.java
  23. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml
  24. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessStatisticsService.java
  25. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java
  26. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java
  27. 335
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
  28. 175
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  29. 47
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java
  30. 122
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java
  31. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckCompanyController.java
  32. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckMonthController.java
  33. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeEquipmentTrialController.java
  34. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.java
  35. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.xml
  36. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckCompanyService.java
  37. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckMonthService.java
  38. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/SafeEquipmentTrialService.java
  39. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckCompanyServiceImpl.java
  40. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckMonthServiceImpl.java
  41. 50
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafeEquipmentTrialServiceImpl.java

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java

@ -104,9 +104,11 @@ public class OperDefectEntity extends TenantEntity {
/** /**
* 区域Id * 区域Id
*/ */
@TableField(exist = false)
private String areaId; private String areaId;
/** /**
* 年月 * 年月
*/ */
@TableField(exist = false)
private YearMonth yearMonth; private YearMonth yearMonth;
} }

2
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageSmsClient.java

@ -4,6 +4,8 @@ package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.req.SmsReq; import com.hnac.hzims.message.req.SmsReq;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;

2
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java

@ -7,6 +7,8 @@ import com.hnac.hzims.message.dto.SmsPushDto;
import com.hnac.hzims.message.dto.WsPushDto; import com.hnac.hzims.message.dto.WsPushDto;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;

1
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatTypeVo.java

@ -27,7 +27,6 @@ public class PushStatTypeVo {
*/ */
private String businessClassifyName; private String businessClassifyName;
/** /**
* 业务分类统计 * 业务分类统计
*/ */

3
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatVo.java

@ -29,15 +29,12 @@ public class PushStatVo {
*/ */
private Integer status; private Integer status;
/** /**
* 状态名称 * 状态名称
*/ */
private String statusName; private String statusName;
/** /**
* 统计数量 * 统计数量
*/ */

48
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/CheckCompanyFeignClient.java

@ -0,0 +1,48 @@
package com.hnac.hzims.safeproduct.areamonthly.feign;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.CheckCompanyFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.SafeproductFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:35
*/
@FeignClient(value = Constants.APP_NAME, fallback = CheckCompanyFeignClientFallback.class)
public interface CheckCompanyFeignClient {
/**
* 查询安全检查
*
* @param req
* @param query
* @return
*/
@GetMapping("/CheckCompany/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status")
R<BladePage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query);
/**
* 详情
* @param id
* @return
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入id")
public R<CheckCompanyVo> detail(@RequestParam Long id);
}

35
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeEquipmentTrialFeignClient.java

@ -0,0 +1,35 @@
package com.hnac.hzims.safeproduct.areamonthly.feign;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.CheckCompanyFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.SafeEquipmentTrialFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:50
*/
@FeignClient(value = Constants.APP_NAME, fallback = SafeEquipmentTrialFeignClientFallback.class)
public interface SafeEquipmentTrialFeignClient {
/**
* 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime")
public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) ;
}

48
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeproductFeignClient.java

@ -0,0 +1,48 @@
package com.hnac.hzims.safeproduct.areamonthly.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.SafeproductFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 18:06
*/
@FeignClient(value = Constants.APP_NAME, fallback = SafeproductFeignClientFallback.class)
public interface SafeproductFeignClient {
/**
* 分页查询安全生产会议次数
*/
@GetMapping("/checkMonth/listconferenceScope/{page}/{size}")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:month,status,createDept")
public R<BladePage<CheckMonthVo>> listconferenceScope(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req);
/**
* 详情
*/
@GetMapping("/checkMonth/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入id")
public R<CheckMonthVo> detail(@RequestParam Long id);
}

41
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/CheckCompanyFeignClientFallback.java

@ -0,0 +1,41 @@
package com.hnac.hzims.safeproduct.areamonthly.feign.fallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.CheckCompanyFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:35
*/
@Service
public class CheckCompanyFeignClientFallback implements CheckCompanyFeignClient {
/**
* 查询安全检查
*
* @param req
* @param query
* @return
*/
@Override
public R<BladePage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query) {
return R.fail("远程调用失败");
}
/**
* 详情
*
* @param id
* @return
*/
@Override
public R<CheckCompanyVo> detail(Long id) {
return null;
}
}

30
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeEquipmentTrialFeignClientFallback.java

@ -0,0 +1,30 @@
package com.hnac.hzims.safeproduct.areamonthly.feign.fallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeEquipmentTrialFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:50
*/
@Service
public class SafeEquipmentTrialFeignClientFallback implements SafeEquipmentTrialFeignClient {
/**
* 分页
*
* @param safeEquipmentTrialDTO
* @param query
*/
@Override
public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) {
return R.fail("远程调用失败");
}
}

40
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeproductFeignClientFallback.java

@ -0,0 +1,40 @@
package com.hnac.hzims.safeproduct.areamonthly.feign.fallback;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeproductFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 18:07
*/
@Service
public class SafeproductFeignClientFallback implements SafeproductFeignClient {
/**
* 分页查询安全生产会议次数
*
* @param page
* @param size
* @param req
*/
@Override
public R<BladePage<CheckMonthVo>> listconferenceScope(Long page, Long size, CheckMonthEntity req) {
return R.fail("远程调用失败");
}
/**
* 详情
*
* @param id
*/
@Override
public R<CheckMonthVo> detail(Long id) {
return R.fail("远程调用失败");
}
}

33
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckCompanyVo.java

@ -0,0 +1,33 @@
package com.hnac.hzims.safeproduct.areamonthly.vo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
import java.util.Map;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:22
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CheckCompanyVo extends CheckCompanyEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("状态文本值")
private String statusText;
@ApiModelProperty(value = "检查项实例")
List<Map<String, Object>> items;
//
// @ApiModelProperty(value = "检查项实例")
// List<Map<String, Object>> list;
}

34
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckMonthVo.java

@ -0,0 +1,34 @@
package com.hnac.hzims.safeproduct.areamonthly.vo;
import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 18:09
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CheckMonthVo extends CheckMonthEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("部门名称")
private String deptName;
@ApiModelProperty("状态文本值")
private String statusText;
@ApiModelProperty(value = "检查项实例")
List<CheckItemInstanceEntity> items;
}

23
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/SafeEquipmentTrialVO.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.areamonthly.vo;
import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 20:04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SafeEquipmentTrialVO extends SafeEquipmentTrialEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("创建人名称")
private String createUserName;
}

10
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/SafeEquipmentTrialDTO.java

@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth;
import java.util.List; import java.util.List;
@ -36,4 +37,13 @@ public class SafeEquipmentTrialDTO extends SafeEquipmentTrialEntity {
@ApiModelProperty("创建部门集合") @ApiModelProperty("创建部门集合")
private List<Long> deptList; private List<Long> deptList;
@ApiModelProperty(value = "区域id")
private String areaId;
@ApiModelProperty(value = "年月")
private YearMonth yearMonth;
} }

13
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckCompanyEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.entity; package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -11,6 +12,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.YearMonth;
/** /**
* Created by Sam Huang 2022/5/6 8:16 * Created by Sam Huang 2022/5/6 8:16
@ -47,4 +49,15 @@ public class CheckCompanyEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "检查机构") @ApiModelProperty(value = "检查机构")
private String orgId; private String orgId;
@TableField(exist = false)
@ApiModelProperty(value = "区域id")
private String areaId;
@TableField(exist = false)
@ApiModelProperty(value = "年月")
private YearMonth yearMonth;
} }

25
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.entity; package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer; import com.fasterxml.jackson.databind.ser.std.NullSerializer;
@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable; import java.io.Serializable;
import java.time.YearMonth;
/** /**
* Created by Sam Huang 2022/5/6 8:16 * Created by Sam Huang 2022/5/6 8:16
@ -32,4 +34,27 @@ public class CheckMonthEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "核查建议") @ApiModelProperty(value = "核查建议")
private String suggest; private String suggest;
/**
* 区域Id
*/
@TableField(exist = false)
@ApiModelProperty(value = "区域Id")
private String areaId;
/**
* 年月
*/
@TableField(exist = false)
private YearMonth yearMonth;
@TableField(exist = false)
private String itemName;
} }

7
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java

@ -36,4 +36,11 @@ public interface MessagePushRecordMapper extends UserDataScopeBaseMapper<Message
*/ */
List<PushStatTypeVo> pushStat(@Param("vo") MessagePushRecordEntityVo vo); List<PushStatTypeVo> pushStat(@Param("vo") MessagePushRecordEntityVo vo);
/**
* 查询出状态信息
* @return
*/
List<Integer> selectByStatus();
} }

21
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml

@ -6,7 +6,7 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatTypeVo"> <resultMap id="BaseResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatTypeVo">
<result column="pusherName" property="pusherName"/> <result column="pusherName" property="pusherName"/>
<collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatVo" > <collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatVo">
<result column="pusherName" property="pusherName"/> <result column="pusherName" property="pusherName"/>
<result column="businessClassify" property="businessClassify"/> <result column="businessClassify" property="businessClassify"/>
<result column="count" property="power"/> <result column="count" property="power"/>
@ -14,8 +14,6 @@
</resultMap> </resultMap>
<!-- 根据type统计数量--> <!-- 根据type统计数量-->
<select id="smsPushStat" resultType="com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordVo"> <select id="smsPushStat" resultType="com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordVo">
select count(1) power, select count(1) power,
@ -26,7 +24,7 @@
IS_DELETED = 0 IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
</where> </where>
group by strMonth, TYPE group by strMonth, TYPE
@ -41,7 +39,7 @@
IS_DELETED = 0 IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
<if test="vo.yearMonth != null"> <if test="vo.yearMonth != null">
and and
@ -65,7 +63,7 @@
IS_DELETED = 0 IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
<if test="vo.yearMonth != null"> <if test="vo.yearMonth != null">
and and
@ -80,11 +78,10 @@
</select> </select>
<!-- 推送成功失败统计--> <!-- 推送成功失败统计-->
<resultMap id="PushStatResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo"> <resultMap id="PushStatResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo">
<result column="businessClassify" property="businessClassify"/> <result column="businessClassify" property="businessClassify"/>
<collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.PushStatVo" > <collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.PushStatVo">
<result column="businessClassify" property="businessClassify"/> <result column="businessClassify" property="businessClassify"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="count" property="power"/> <result column="count" property="power"/>
@ -99,7 +96,7 @@
IS_DELETED = 0 IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
<if test="vo.yearMonth != null"> <if test="vo.yearMonth != null">
and and
@ -112,4 +109,10 @@
</where> </where>
group by businessClassify,status group by businessClassify,status
</select> </select>
<!-- 查询出状态信息-->
<select id="selectByStatus" resultType="java.lang.Integer">
select STATUS
from hzims_message_push_record
group by STATUS
</select>
</mapper> </mapper>

80
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.utils.CacheUtil; import com.hnac.hzims.common.utils.CacheUtil;
@ -56,71 +57,70 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
return this.page(Condition.getPage(query), this.getQueryWrapper(request)); return this.page(Condition.getPage(query), this.getQueryWrapper(request));
} }
/** @Author hx /**
* @return java.lang.Boolean 推送结果
* @Author hx
* @Description 根据ID发送短信 * @Description 根据ID发送短信
* @Date 2023/4/12 10:22 * @Date 2023/4/12 10:22
* @Param [id] 短信记录ID * @Param [id] 短信记录ID
* @return java.lang.Boolean 推送结果
**/ **/
@Override @Override
public Boolean send(Long id) { public Boolean send(Long id) {
MessagePushRecordEntity record = this.getById(id); MessagePushRecordEntity record = this.getById(id);
IMessageService messageSend = MessageFactory.getMessageSend(record.getType()); IMessageService messageSend = MessageFactory.getMessageSend(record.getType());
Boolean result = messageSend.send(record); Boolean result = messageSend.send(record);
Assert.isTrue(result , ()-> { Assert.isTrue(result, () -> {
throw new ServiceException("发送消息失败!"); throw new ServiceException("发送消息失败!");
}); });
// 更新推送状态以及推送时间 // 更新推送状态以及推送时间
LambdaUpdateWrapper<MessagePushRecordEntity> luw = Wrappers.<MessagePushRecordEntity>lambdaUpdate() LambdaUpdateWrapper<MessagePushRecordEntity> luw = Wrappers.<MessagePushRecordEntity>lambdaUpdate().set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()).set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS).eq(MessagePushRecordEntity::getId, id);
.set(MessagePushRecordEntity::getPushTime, LocalDateTime.now())
.set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)
.eq(MessagePushRecordEntity::getId, id);
return this.update(luw); return this.update(luw);
} }
/** @Author hx /**
* @return java.lang.Boolean 推送解雇
* @Author hx
* @Description 保存并推送消息 * @Description 保存并推送消息
* @Date 2023/4/12 10:23 * @Date 2023/4/12 10:23
* @Param [request] 消息记录 * @Param [request] 消息记录
* @return java.lang.Boolean 推送解雇
**/ **/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean saveAndSend(MessagePushRecordEntity request) { public Boolean saveAndSend(MessagePushRecordEntity request) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
if(MessageConstants.IMMEDIATELY.equals(request.getPushType())) { if (MessageConstants.IMMEDIATELY.equals(request.getPushType())) {
request.setPlanTime(now); request.setPlanTime(now);
request.setPushTime(now); request.setPushTime(now);
// 立即推送消息 // 立即推送消息
if(this.save(request) && Func.isNotEmpty(request.getId())) { if (this.save(request) && Func.isNotEmpty(request.getId())) {
return this.send(request.getId()); return this.send(request.getId());
} }
throw new ServiceException("保存消息失败!"); throw new ServiceException("保存消息失败!");
} } else if (MessageConstants.PLAN.equals(request.getPushType())) {
else if(MessageConstants.PLAN.equals(request.getPushType())) {
return this.save(request); return this.save(request);
} } else {
else {
throw new ServiceException("推送类型只能为即时推送或计划推送"); throw new ServiceException("推送类型只能为即时推送或计划推送");
} }
} }
/** /**
* 获取 QueryWrapper * 获取 QueryWrapper
*
* @param request 查询条件 * @param request 查询条件
* @return QueryWrapper * @return QueryWrapper
*/ */
private LambdaQueryWrapper<MessagePushRecordEntity> getQueryWrapper(MessagePushRecordEntity request) { private LambdaQueryWrapper<MessagePushRecordEntity> getQueryWrapper(MessagePushRecordEntity request) {
LambdaQueryWrapper<MessagePushRecordEntity> lambda = Condition.getQueryWrapper(request).lambda(); LambdaQueryWrapper<MessagePushRecordEntity> lambda = Condition.getQueryWrapper(request).lambda();
if(Func.isNotEmpty(request.getStartTime())) { if (Func.isNotEmpty(request.getStartTime())) {
lambda.ge(MessagePushRecordEntity::getPushTime,request.getStartTime()); lambda.ge(MessagePushRecordEntity::getPushTime, request.getStartTime());
} }
if(Func.isNotEmpty(request.getEndTime())) { if (Func.isNotEmpty(request.getEndTime())) {
lambda.le(MessagePushRecordEntity::getPushTime,request.getEndTime()); lambda.le(MessagePushRecordEntity::getPushTime, request.getEndTime());
} }
lambda.orderByDesc(MessagePushRecordEntity::getPushTime); lambda.orderByDesc(MessagePushRecordEntity::getPushTime);
return lambda; return lambda;
} }
/** /**
* 短信推送统计 * 短信推送统计
*/ */
@ -136,8 +136,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
}); });
//按类型分组 //按类型分组
Map<String, List<MessagePushRecordVo>> collect = Map<String, List<MessagePushRecordVo>> collect = messagePushRecordVos.stream().collect(Collectors.groupingBy(MessagePushRecordVo::getType));
messagePushRecordVos.stream().collect(Collectors.groupingBy(MessagePushRecordVo::getType));
List<MessagePushRecordTypeVo> messagePushRecordTypeVos = new ArrayList<>(); List<MessagePushRecordTypeVo> messagePushRecordTypeVos = new ArrayList<>();
//封装数据 //封装数据
@ -195,21 +194,44 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
public List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo) { public List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo) {
List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(vo); List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(vo);
pushStatTypeVos.forEach(item -> { pushStatTypeVos.forEach(item -> {
//查询出状态信息
List<Integer> statusList = baseMapper.selectByStatus();
//业务类型名称 //业务类型名称
String businessClassify = item.getBusinessClassify(); String businessClassify = item.getBusinessClassify();
String businessTypeName = this.getBusinessClassifyByName(businessClassify); String businessTypeName = this.getBusinessClassifyByName(businessClassify);
item.setBusinessClassifyName(businessTypeName); item.setBusinessClassifyName(businessTypeName);
List<PushStatVo> pushStatList = item.getPushStatList(); List<PushStatVo> pushStatList = item.getPushStatList();
pushStatList.forEach(pushStat -> { List<PushStatVo> newPushStatList = new ArrayList<>();
Integer status = pushStat.getStatus(); for (PushStatVo pushStat : pushStatList) {
//状态名称
String name = this.getStatusByName(status);
pushStat.setStatusName(name);
//业务类型名称 //业务类型名称
String businessClassifyPushStat = pushStat.getBusinessClassify(); String businessClassifyPushStat = pushStat.getBusinessClassify();
String businessTypeNamePushStat = this.getBusinessClassifyByName(businessClassifyPushStat); String businessTypeNamePushStat = this.getBusinessClassifyByName(businessClassifyPushStat);
pushStat.setBusinessClassifyName(businessTypeNamePushStat); pushStat.setBusinessClassifyName(businessTypeNamePushStat);
}); Integer status = pushStat.getStatus();
//如果list 包含这条数删除
if (statusList.contains(status)) {
statusList.remove(status);
}
//状态名称
String name = this.getStatusByName(status);
pushStat.setStatusName(name);
newPushStatList.add(pushStat);
}
//如何list不为空补0
if (CollectionUtils.isNotEmpty(statusList)) {
for (int i = 0; i < statusList.size(); i++) {
PushStatVo pushStat = new PushStatVo();
int status = statusList.get(i);
pushStat.setStatus(status);
pushStat.setPower(0L);
pushStat.setBusinessClassify(businessClassify);
pushStat.setBusinessClassifyName(businessTypeName);
pushStat.setStatusName(this.getStatusByName(status));
newPushStatList.add(pushStat);
}
}
item.setPushStatList(newPushStatList);
}); });
return pushStatTypeVos; return pushStatTypeVos;
} }
@ -218,12 +240,12 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
public List<UnreadMessageVO> getPersonalUnreadMessage() { public List<UnreadMessageVO> getPersonalUnreadMessage() {
QueryWrapper<MessagePushRecordEntity> query = Wrappers.query(); QueryWrapper<MessagePushRecordEntity> query = Wrappers.query();
query.select("business_classify businessClassify,count(0) todoNum"); query.select("business_classify businessClassify,count(0) todoNum");
query.eq("account",AuthUtil.getUserId()); query.eq("account", AuthUtil.getUserId());
query.groupBy("business_classify"); query.groupBy("business_classify");
List<Map<String, Object>> list = this.listMaps(query); List<Map<String, Object>> list = this.listMaps(query);
return list.stream().map(map -> { return list.stream().map(map -> {
UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class); UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class);
unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify",unreadMessageVO.getBusinessClassify())); unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify", unreadMessageVO.getBusinessClassify()));
return unreadMessageVO; return unreadMessageVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java

@ -5,6 +5,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity; import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import java.time.YearMonth;
import java.util.List; import java.util.List;
/** /**
@ -25,4 +26,16 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity {
@ApiModelProperty(value = "创建机构集合") @ApiModelProperty(value = "创建机构集合")
private List<Long> deptIds; private List<Long> deptIds;
/**
* 年月
*/
private YearMonth yearMonth;
/**
* 区域Id
*/
private String areaId;
} }

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.java

@ -3,13 +3,13 @@ package com.hnac.hzims.operational.access.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO; import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity; import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List; import java.util.List;
/** /**
*
* Mapper 接口 * Mapper 接口
* *
* @author xiashandong * @author xiashandong
@ -18,7 +18,6 @@ import java.util.List;
public interface OperAccessStatisticsMapper extends UserDataScopeBaseMapper<OperAccessStatisticsEntity> { public interface OperAccessStatisticsMapper extends UserDataScopeBaseMapper<OperAccessStatisticsEntity> {
/** /**
* 自定义分页 * 自定义分页
* *
@ -27,5 +26,5 @@ public interface OperAccessStatisticsMapper extends UserDataScopeBaseMapper<Oper
* @return * @return
*/ */
@UserDataAuth @UserDataAuth
List<OperAccessStatisticsEntity> selectPageList(IPage page, OperAccessStatisticsDTO dto); List<OperAccessStatisticsEntity> selectPageList(IPage page, @Param("dto") OperAccessStatisticsDTO dto);
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml

@ -37,6 +37,12 @@
<if test="dto.planEndTime != null"> <if test="dto.planEndTime != null">
and OS.PLAN_END_TIME &lt;= #{dto.planEndTime} and OS.PLAN_END_TIME &lt;= #{dto.planEndTime}
</if> </if>
<if test="dto.areaId != null and dto.areaId != ''">
and OS.CREATE_DEPT = #{dto.areaId}
</if>
<if test="dto.yearMonth != null">
and date_format(os.CREATE_TIME,'%Y-%m') = #{dto.yearMonth}
</if>
ORDER BY OS.CREATE_TIME DESC ORDER BY OS.CREATE_TIME DESC
</select> </select>

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessStatisticsService.java

@ -5,7 +5,6 @@ import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity; import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO; import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java

@ -85,11 +85,6 @@ public class OperDefectController extends BladeController {
if (defect.getEndTime() != null) { if (defect.getEndTime() != null) {
queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime()); queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime());
} }
queryWrapper.eq(StringUtils.isNotBlank(defect.getAreaId()), BaseEntity::getCreateDept, defect.getCreateDept());
queryWrapper.apply(defect.getYearMonth() != null,"date_format(CREATE_TIME,'%Y-%m')", defect.getYearMonth());
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime); queryWrapper.orderByDesc(OperDefectEntity::getActStartTime);
IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper); IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages); IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages);

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.defect.service; package com.hnac.hzims.operational.defect.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperDefectVO; import com.hnac.hzims.operational.defect.vo.OperDefectVO;
@ -88,4 +90,12 @@ public interface IOperDefectService extends BaseService<OperDefectEntity> {
boolean updateDefectInfo(OperDefectEntity entity); boolean updateDefectInfo(OperDefectEntity entity);
boolean updateDefectHanderState(OperDefectEntity entity); boolean updateDefectHanderState(OperDefectEntity entity);
/**
* 分页查询
* @param operDefectEntityPage
* @param defect
* @return
*/
IPage<OperDefectEntity> selectPage(Page<OperDefectEntity> operDefectEntityPage, OperDefectEntity defect);
} }

335
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java

@ -2,7 +2,10 @@ package com.hnac.hzims.operational.defect.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity; import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
@ -36,6 +39,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
@ -90,24 +94,22 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 开始问题处理流程 * 开始问题处理流程
* 问题处理流程的第一个处理节点人key 必须是 problemUser * 问题处理流程的第一个处理节点人key 必须是 problemUser
*
* @param * @param
*/ */
@Override @Override
public void startFlow(OperPhenomenonEntity phenomenonEntity, OperDefectEntity defectEntity){ public void startFlow(OperPhenomenonEntity phenomenonEntity, OperDefectEntity defectEntity) {
User handler = UserCache.getUser(phenomenonEntity.getHandler()); User handler = UserCache.getUser(phenomenonEntity.getHandler());
String handlerName = handler == null ? "" : handler.getName(); String handlerName = handler == null ? "" : handler.getName();
String sourceName = DictCache.getValue(DefectConstant.SOURCE_CODE_DICT_KEY,phenomenonEntity.getSourceCode()); String sourceName = DictCache.getValue(DefectConstant.SOURCE_CODE_DICT_KEY, phenomenonEntity.getSourceCode());
String processName = "【" + sourceName + "】" + handlerName + " 发起的缺陷【" + phenomenonEntity.getDefectCode() + "】的问题处理流程"; String processName = "【" + sourceName + "】" + handlerName + " 发起的缺陷【" + phenomenonEntity.getDefectCode() + "】的问题处理流程";
defectEntity.setCreateUser(phenomenonEntity.getCreateUser()); defectEntity.setCreateUser(phenomenonEntity.getCreateUser());
defectEntity.setCreateDept(phenomenonEntity.getCreateDept()); defectEntity.setCreateDept(phenomenonEntity.getCreateDept());
defectEntity.setTenantId(phenomenonEntity.getTenantId()); defectEntity.setTenantId(phenomenonEntity.getTenantId());
save(defectEntity); save(defectEntity);
Kv variables = Kv.create() Kv variables = Kv.create().set(ProcessConstant.TASK_VARIABLE_CREATE_USER, "taskUser_" + phenomenonEntity.getCreateUser()).set(DefectConstant.PROCESS_VARIABLE_HANDLE_USER, "taskUser_" + phenomenonEntity.getHandler());
.set(ProcessConstant.TASK_VARIABLE_CREATE_USER, "taskUser_" + phenomenonEntity.getCreateUser()) R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(defectEntity.getProcDefId(), FlowUtil.getBusinessKey("hzims_oper_defect", String.valueOf(defectEntity.getId())), processName, variables);
.set(DefectConstant.PROCESS_VARIABLE_HANDLE_USER, "taskUser_" + phenomenonEntity.getHandler())
;
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(defectEntity.getProcDefId(), FlowUtil.getBusinessKey("hzims_oper_defect",String.valueOf(defectEntity.getId())), processName, variables);
if (result.isSuccess()) { if (result.isSuccess()) {
BladeFlow flow = result.getData(); BladeFlow flow = result.getData();
log.debug("流程已启动,流程ID:" + flow.getProcessInstanceId()); log.debug("流程已启动,流程ID:" + flow.getProcessInstanceId());
@ -116,7 +118,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
defectEntity.setHandleStatus(DefectConstant.DefectHandlerStatusEnum.HANDLING_STATUS.getStatus().toString()); defectEntity.setHandleStatus(DefectConstant.DefectHandlerStatusEnum.HANDLING_STATUS.getStatus().toString());
updateById(defectEntity); updateById(defectEntity);
} else { } else {
throw new ServiceException("开启流程失败,code="+result.getCode()); throw new ServiceException("开启流程失败,code=" + result.getCode());
} }
} }
@ -124,12 +126,13 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 处理问题 * 处理问题
*
* @param flow * @param flow
* @return * @return
*/ */
@Override @Override
public boolean handleProcess(BladeFlow flow) { public boolean handleProcess(BladeFlow flow) {
if(!invalidHandleProcess(flow.getProcessInstanceId())){ if (!invalidHandleProcess(flow.getProcessInstanceId())) {
throw new ServiceException("当前缺陷开具了检修计划,需等任务执行完成才能处理缺陷"); throw new ServiceException("当前缺陷开具了检修计划,需等任务执行完成才能处理缺陷");
} }
ComleteTask task = new ComleteTask(); ComleteTask task = new ComleteTask();
@ -143,42 +146,43 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
flowClient.completeTask(task); flowClient.completeTask(task);
Integer status = ProcessConstant.ProcessInstanceStatusEnum.running.ordinal(); Integer status = ProcessConstant.ProcessInstanceStatusEnum.running.ordinal();
R<String> result = flowClient.queryProcessInstanceStatus(flow.getProcessInstanceId()); R<String> result = flowClient.queryProcessInstanceStatus(flow.getProcessInstanceId());
if(result.isSuccess()){ if (result.isSuccess()) {
status = ProcessConstant.ProcessInstanceStatusEnum.over.name().equals(result.getData())?ProcessConstant.ProcessInstanceStatusEnum.over.ordinal():status; status = ProcessConstant.ProcessInstanceStatusEnum.over.name().equals(result.getData()) ? ProcessConstant.ProcessInstanceStatusEnum.over.ordinal() : status;
} }
LambdaUpdateWrapper<OperDefectEntity> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<OperDefectEntity> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(OperDefectEntity::getHandleStatus,status); updateWrapper.set(OperDefectEntity::getHandleStatus, status);
//第一个流程节点传 //第一个流程节点传
if(Func.isNotEmpty(map.get("actStartTime"))){ if (Func.isNotEmpty(map.get("actStartTime"))) {
updateWrapper.set(OperDefectEntity::getActStartTime, map.get("actStartTime").toString()); updateWrapper.set(OperDefectEntity::getActStartTime, map.get("actStartTime").toString());
} }
//最后一个流程节点传 //最后一个流程节点传
if(Func.isNotEmpty(map.get("actEndTime"))){ if (Func.isNotEmpty(map.get("actEndTime"))) {
updateWrapper.set(OperDefectEntity::getActEndTime, map.get("actEndTime").toString()); updateWrapper.set(OperDefectEntity::getActEndTime, map.get("actEndTime").toString());
} }
//最后一个流程节点传 //最后一个流程节点传
if(Func.isNotEmpty(map.get("disposeDesc"))){ if (Func.isNotEmpty(map.get("disposeDesc"))) {
updateWrapper.set(OperDefectEntity::getDisposeDesc, map.get("disposeDesc").toString()); updateWrapper.set(OperDefectEntity::getDisposeDesc, map.get("disposeDesc").toString());
} }
/** /**
* 每一个流程节点都要传这个数据属于叠加数据例如第一个流程节点是8小时第二个流程节点是2小时 * 每一个流程节点都要传这个数据属于叠加数据例如第一个流程节点是8小时第二个流程节点是2小时
* 第一个节点完成后存储的数据是8 第二个节点完成后存储的数据是 8,2 * 第一个节点完成后存储的数据是8 第二个节点完成后存储的数据是 8,2
*/ */
if(Func.isNotEmpty(map.get("actHours"))){ if (Func.isNotEmpty(map.get("actHours"))) {
updateWrapper.set(OperDefectEntity::getActHours, map.get("actHours").toString()); updateWrapper.set(OperDefectEntity::getActHours, map.get("actHours").toString());
} }
updateWrapper.eq(OperDefectEntity::getProcessInstanceId,flow.getProcessInstanceId()); updateWrapper.eq(OperDefectEntity::getProcessInstanceId, flow.getProcessInstanceId());
update(updateWrapper); update(updateWrapper);
return true; return true;
} }
/** /**
* 获取缺陷的统计月报 * 获取缺陷的统计月报
*
* @param month 格式"2021-01" * @param month 格式"2021-01"
*/ */
@Override @Override
public Map<String, Object> getDefectStatistics(String month){ public Map<String, Object> getDefectStatistics(String month) {
Map<String, Object> re = new HashMap<>(); Map<String, Object> re = new HashMap<>();
re.put("currentMonth", getCurrentMonthStatic(month)); re.put("currentMonth", getCurrentMonthStatic(month));
re.put("severalMonths", getStatisticBySeveralMonth(month)); re.put("severalMonths", getStatisticBySeveralMonth(month));
@ -200,11 +204,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
// 第一步,创建一个webbook,对应一个Excel文件 // 第一步,创建一个webbook,对应一个Excel文件
HSSFWorkbook wb = new HSSFWorkbook(); HSSFWorkbook wb = new HSSFWorkbook();
// 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet
HSSFSheet sheet = wb.createSheet("缺陷月报("+month+")"); HSSFSheet sheet = wb.createSheet("缺陷月报(" + month + ")");
sheet.setDefaultRowHeight((short) (20*20)); sheet.setDefaultRowHeight((short) (20 * 20));
//生成当前行 //生成当前行
int currentRow = 0; int currentRow = 0;
for (int col=0;col<9;col++){ for (int col = 0; col < 9; col++) {
sheet.setColumnWidth(col, 3900); sheet.setColumnWidth(col, 3900);
} }
//创建标题行 //创建标题行
@ -212,13 +216,13 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
sheet.addMergedRegion(region1); sheet.addMergedRegion(region1);
//参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列 //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
HSSFRow headTitle = sheet.createRow(currentRow); HSSFRow headTitle = sheet.createRow(currentRow);
this.setFullHeadCell(wb,headTitle, (short) 9,0); this.setFullHeadCell(wb, headTitle, (short) 9, 0);
HSSFCell headCell = headTitle.getCell(0); HSSFCell headCell = headTitle.getCell(0);
headCell.setCellValue("缺陷月报("+month+")"); headCell.setCellValue("缺陷月报(" + month + ")");
currentRow++; currentRow++;
// 本月与前几月缺陷报表比较表格设置 // 本月与前几月缺陷报表比较表格设置
currentRow = this.setCompareMonthCell(currentMonth, severalMonths,wb, sheet, new Integer(currentRow)); currentRow = this.setCompareMonthCell(currentMonth, severalMonths, wb, sheet, new Integer(currentRow));
currentRow++; currentRow++;
// 管理指标(本月)设置 // 管理指标(本月)设置
@ -226,10 +230,10 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
currentRow++; currentRow++;
// 重复分类缺陷汇总表设置 // 重复分类缺陷汇总表设置
this.setRepeatCell( repeat, wb, sheet, currentRow); this.setRepeatCell(repeat, wb, sheet, currentRow);
// 下载导出 // 下载导出
String filename = "("+month+")缺陷月报表"; String filename = "(" + month + ")缺陷月报表";
// 设置头信息 // 设置头信息
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
@ -246,9 +250,10 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
} }
@Override @Override
public List<OperDefectEntity> getDefectList(String emCode,List<String> list) { public List<OperDefectEntity> getDefectList(String emCode, List<String> list) {
return this.baseMapper.selectDefectList(emCode,list); return this.baseMapper.selectDefectList(emCode, list);
} }
@Override @Override
public List<OperDefectEntity> getDefectByEmCodeList(String emCode) { public List<OperDefectEntity> getDefectByEmCodeList(String emCode) {
return this.baseMapper.selectDefectByEmCodeList(emCode); return this.baseMapper.selectDefectByEmCodeList(emCode);
@ -262,8 +267,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
defectReportsVOList = operDefectVOS.stream().map(operDefectVO -> { defectReportsVOList = operDefectVOS.stream().map(operDefectVO -> {
User finder = UserCache.getUser(operDefectVO.getFinder()); User finder = UserCache.getUser(operDefectVO.getFinder());
String finderAndTime = (ObjectUtil.isNotEmpty(finder) && StringUtil.isNotBlank(finder.getName()) ? finder.getName() : operDefectVO.getFinder().toString()) String finderAndTime = (ObjectUtil.isNotEmpty(finder) && StringUtil.isNotBlank(finder.getName()) ? finder.getName() : operDefectVO.getFinder().toString()) + ":" + DateFormatUtils.format(operDefectVO.getFindTime(), DateUtil.PATTERN_DATETIME);
+ ":" + DateFormatUtils.format(operDefectVO.getFindTime(), DateUtil.PATTERN_DATETIME);
String handlerAndTime = ""; String handlerAndTime = "";
if (Func.isNotEmpty(operDefectVO.getHandler())) { if (Func.isNotEmpty(operDefectVO.getHandler())) {
User handler = UserCache.getUser(operDefectVO.getHandler()); User handler = UserCache.getUser(operDefectVO.getHandler());
@ -272,8 +276,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
handlerAndTime = String.format("%s:%s", handlerName, handleTime); handlerAndTime = String.format("%s:%s", handlerName, handleTime);
} }
String seriousSituation = DictCache.getValue(DefectConstant.LEVEL_CODE_DICT_KEY, operDefectVO.getDefectLevel()); String seriousSituation = DictCache.getValue(DefectConstant.LEVEL_CODE_DICT_KEY, operDefectVO.getDefectLevel());
return DefectReportsVO.builder().faultName(operDefectVO.getFaultName()).seriousSituation(seriousSituation) return DefectReportsVO.builder().faultName(operDefectVO.getFaultName()).seriousSituation(seriousSituation).finderAndTime(finderAndTime).handlerAndTime(handlerAndTime).handleSituation(operDefectVO.getConclusion()).build();
.finderAndTime(finderAndTime).handlerAndTime(handlerAndTime).handleSituation(operDefectVO.getConclusion()).build();
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return defectReportsVOList; return defectReportsVOList;
@ -284,7 +287,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId"); List<Long> deptIdList = (List<Long>) params.get("deptId");
return getFaultByFaultCode(startDate,endDate,deptIdList); return getFaultByFaultCode(startDate, endDate, deptIdList);
} }
@Override @Override
@ -296,19 +299,16 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
public R<OperDefectVO> detail(OperDefectEntity defect) { public R<OperDefectVO> detail(OperDefectEntity defect) {
OperDefectEntity detail = getOne(Condition.getQueryWrapper(defect)); OperDefectEntity detail = getOne(Condition.getQueryWrapper(defect));
OperDefectVO operDefectVO = null; OperDefectVO operDefectVO = null;
if(ObjectUtil.isNotEmpty(detail)) { if (ObjectUtil.isNotEmpty(detail)) {
operDefectVO = OperDefectWrapper.build().entityVO(detail); operDefectVO = OperDefectWrapper.build().entityVO(detail);
//获取检修计划 //获取检修计划
IOperAccessPlanService planService = SpringUtil.getBean(OperAccessPlanServiceImpl.class); IOperAccessPlanService planService = SpringUtil.getBean(OperAccessPlanServiceImpl.class);
OperAccessPlanEntity accessPlanEntity = planService.getOne(Wrappers.<OperAccessPlanEntity>lambdaQuery() OperAccessPlanEntity accessPlanEntity = planService.getOne(Wrappers.<OperAccessPlanEntity>lambdaQuery().eq(OperAccessPlanEntity::getDefectId, detail.getId()));
.eq(OperAccessPlanEntity::getDefectId,detail.getId()) if (ObjectUtil.isNotEmpty(accessPlanEntity)) {
);
if(ObjectUtil.isNotEmpty(accessPlanEntity)){
operDefectVO.setAccessPlanId(accessPlanEntity.getId()); operDefectVO.setAccessPlanId(accessPlanEntity.getId());
if(ObjectUtil.isNotEmpty(accessPlanEntity.getStatus()) && accessPlanEntity.getStatus() > AccessConstants.PLAN_DRAFT){ if (ObjectUtil.isNotEmpty(accessPlanEntity.getStatus()) && accessPlanEntity.getStatus() > AccessConstants.PLAN_DRAFT) {
operDefectVO.setEditStatus(0); operDefectVO.setEditStatus(0);
} } else {
else {
operDefectVO.setEditStatus(1); operDefectVO.setEditStatus(1);
} }
} }
@ -318,6 +318,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 获取安全检查消缺项统计 * 获取安全检查消缺项统计
*
* @param startDate 开始时间 * @param startDate 开始时间
* @param endDate 结束时间 * @param endDate 结束时间
* @param dept 机构ID * @param dept 机构ID
@ -328,66 +329,60 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
public SafeCheckStatisticVO getDefectCheck(String startDate, String endDate, Long dept, String defectType) { public SafeCheckStatisticVO getDefectCheck(String startDate, String endDate, Long dept, String defectType) {
SafeCheckStatisticVO vo = new SafeCheckStatisticVO(); SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
//获取消缺总数 //获取消缺总数
LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.<OperPhenomenonEntity>lambdaQuery() LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.<OperPhenomenonEntity>lambdaQuery().eq(OperPhenomenonEntity::getCreateDept, dept).ge(OperPhenomenonEntity::getPlanStartTime, startDate).le(OperPhenomenonEntity::getPlanStartTime, endDate).eq(OperPhenomenonEntity::getIsDefect, 1);
.eq(OperPhenomenonEntity::getCreateDept,dept)
.ge(OperPhenomenonEntity::getPlanStartTime,startDate)
.le(OperPhenomenonEntity::getPlanStartTime,endDate)
.eq(OperPhenomenonEntity::getIsDefect,1);
//缺陷等级为Ⅰ级缺陷时为重大缺陷 其他为一般缺陷 //缺陷等级为Ⅰ级缺陷时为重大缺陷 其他为一般缺陷
if("1".equals(defectType)){ if ("1".equals(defectType)) {
vo.setProjectType(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getType()); vo.setProjectType(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getName()); vo.setProjectTypeName(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getName());
wrapper.eq(OperPhenomenonEntity::getDefectLevel,DefectConstant.DefectLevelEnum.ONE.getStatus()); wrapper.eq(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus());
} } else if ("2".equals(defectType)) {
else if("2".equals(defectType)){
vo.setProjectType(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getType()); vo.setProjectType(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getName()); vo.setProjectTypeName(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getName());
wrapper.ne(OperPhenomenonEntity::getDefectLevel,DefectConstant.DefectLevelEnum.ONE.getStatus()); wrapper.ne(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus());
} }
List<OperPhenomenonEntity> operPhenomenonEntities = operPhenomenonMapper.selectList(wrapper); List<OperPhenomenonEntity> operPhenomenonEntities = operPhenomenonMapper.selectList(wrapper);
if(CollectionUtil.isNotEmpty(operPhenomenonEntities)){ if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) {
//获取消缺率 //获取消缺率
List<OperPhenomenonEntity> finishDefects = operPhenomenonEntities.stream().filter( List<OperPhenomenonEntity> finishDefects = operPhenomenonEntities.stream().filter(p -> ObjectUtil.isNotEmpty(p.getConclusionStatus()) && "1".equals(p.getConclusionStatus())).collect(Collectors.toList());
p-> ObjectUtil.isNotEmpty(p.getConclusionStatus()) && "1".equals(p.getConclusionStatus())
).collect(Collectors.toList());
vo.setTotal(operPhenomenonEntities.size()); vo.setTotal(operPhenomenonEntities.size());
vo.setQualified(finishDefects.size()); vo.setQualified(finishDefects.size());
vo.setQualifiedRate(new BigDecimal(finishDefects.size()/(double)operPhenomenonEntities.size()*100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); vo.setQualifiedRate(new BigDecimal(finishDefects.size() / (double) operPhenomenonEntities.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
} }
return vo; return vo;
} }
/** /**
* 根据流程ID判断该缺陷是否能执行 * 根据流程ID判断该缺陷是否能执行
*
* @param processInstanceId 流程ID * @param processInstanceId 流程ID
* @return * @return
*/ */
private boolean invalidHandleProcess(String processInstanceId) { private boolean invalidHandleProcess(String processInstanceId) {
boolean result = true; boolean result = true;
OperDefectEntity defectEntity = super.getOne(new LambdaQueryWrapper<OperDefectEntity>(){{ OperDefectEntity defectEntity = super.getOne(new LambdaQueryWrapper<OperDefectEntity>() {{
eq(OperDefectEntity::getProcessInstanceId, processInstanceId); eq(OperDefectEntity::getProcessInstanceId, processInstanceId);
}}); }});
//若类型为检修 //若类型为检修
if(Func.isNotEmpty(defectEntity.getDefectCode()) && DefectConstant.DefectSourceEnum.JX.getStatus().equals(defectEntity.getDefectCode().substring(0,2))){ if (Func.isNotEmpty(defectEntity.getDefectCode()) && DefectConstant.DefectSourceEnum.JX.getStatus().equals(defectEntity.getDefectCode().substring(0, 2))) {
IOperAccessPlanService planService = SpringUtil.getBean(IOperAccessPlanService.class); IOperAccessPlanService planService = SpringUtil.getBean(IOperAccessPlanService.class);
List<OperAccessPlanEntity> planList = planService.list(new LambdaQueryWrapper<OperAccessPlanEntity>(){{ List<OperAccessPlanEntity> planList = planService.list(new LambdaQueryWrapper<OperAccessPlanEntity>() {{
eq(OperAccessPlanEntity::getDefectId, defectEntity.getId()); eq(OperAccessPlanEntity::getDefectId, defectEntity.getId());
}}); }});
if(CollectionUtil.isNotEmpty(planList)){ if (CollectionUtil.isNotEmpty(planList)) {
//获取未审核的计划 //获取未审核的计划
List<OperAccessPlanEntity> pendingReviewList = planList.stream().filter(p->p.getStatus() != AccessConstants.PLAN_FINISH).collect(Collectors.toList()); List<OperAccessPlanEntity> pendingReviewList = planList.stream().filter(p -> p.getStatus() != AccessConstants.PLAN_FINISH).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(pendingReviewList)){ if (CollectionUtil.isNotEmpty(pendingReviewList)) {
result = false; result = false;
} }
//获取检修计划ID集合 //获取检修计划ID集合
List<Long> planIdList = planList.stream().map(OperAccessPlanEntity::getId).collect(Collectors.toList()); List<Long> planIdList = planList.stream().map(OperAccessPlanEntity::getId).collect(Collectors.toList());
IOperAccessTaskService taskService = SpringUtil.getBean(IOperAccessTaskService.class); IOperAccessTaskService taskService = SpringUtil.getBean(IOperAccessTaskService.class);
//未完成检修任务集合 //未完成检修任务集合
List<OperAccessTaskEntity> taskList = taskService.list(new LambdaQueryWrapper<OperAccessTaskEntity>(){{ List<OperAccessTaskEntity> taskList = taskService.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
in(OperAccessTaskEntity::getPlanId, planIdList); in(OperAccessTaskEntity::getPlanId, planIdList);
ne(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_4); ne(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_4);
}}); }});
if(CollectionUtil.isNotEmpty(taskList)){ if (CollectionUtil.isNotEmpty(taskList)) {
result = false; result = false;
} }
} }
@ -397,10 +392,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 创建标题单元格样式 * 创建标题单元格样式
*
* @param wb * @param wb
* @return * @return
*/ */
private HSSFCellStyle setHeadCellStyle(HSSFWorkbook wb){ private HSSFCellStyle setHeadCellStyle(HSSFWorkbook wb) {
HSSFCellStyle headStyle = wb.createCellStyle(); HSSFCellStyle headStyle = wb.createCellStyle();
//设置边框 //设置边框
headStyle.setBorderLeft(BorderStyle.THIN); headStyle.setBorderLeft(BorderStyle.THIN);
@ -425,10 +421,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 创建表格内容单元格样式 * 创建表格内容单元格样式
*
* @param wb * @param wb
* @return * @return
*/ */
private HSSFCellStyle setContentCellStyle(HSSFWorkbook wb){ private HSSFCellStyle setContentCellStyle(HSSFWorkbook wb) {
HSSFCellStyle contentStyle = wb.createCellStyle(); HSSFCellStyle contentStyle = wb.createCellStyle();
//设置边框 //设置边框
contentStyle.setBorderLeft(BorderStyle.THIN); contentStyle.setBorderLeft(BorderStyle.THIN);
@ -449,14 +446,15 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 设置缺陷月报表excel导出-本月与前几月缺陷报表内单元格 * 设置缺陷月报表excel导出-本月与前几月缺陷报表内单元格
*
* @param sheet * @param sheet
* @param currentRow * @param currentRow
*/ */
private int setCompareMonthCell(List<OperDefectRatioDTO> currentMonth, List<OperDefectRatioDTO> severalMonths, HSSFWorkbook wb,HSSFSheet sheet, int currentRow){ private int setCompareMonthCell(List<OperDefectRatioDTO> currentMonth, List<OperDefectRatioDTO> severalMonths, HSSFWorkbook wb, HSSFSheet sheet, int currentRow) {
//创建当月与1-至当月表表头 //创建当月与1-至当月表表头
HSSFRow headRow = sheet.createRow(currentRow); HSSFRow headRow = sheet.createRow(currentRow);
//设置表头信息 //设置表头信息
this.setFullHeadCell(wb,headRow, (short) 9,0); this.setFullHeadCell(wb, headRow, (short) 9, 0);
HSSFCell compare_head1_cell1 = headRow.getCell(0); HSSFCell compare_head1_cell1 = headRow.getCell(0);
compare_head1_cell1.setCellValue("指标名称"); compare_head1_cell1.setCellValue("指标名称");
HSSFCell compare_head1_cell2 = headRow.getCell(1); HSSFCell compare_head1_cell2 = headRow.getCell(1);
@ -464,7 +462,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
HSSFCell compare_head1_cell3 = headRow.getCell(5); HSSFCell compare_head1_cell3 = headRow.getCell(5);
compare_head1_cell3.setCellValue("(1-本月)累计"); compare_head1_cell3.setCellValue("(1-本月)累计");
//合并单元格 //合并单元格
CellRangeAddress head1_region1 = new CellRangeAddress((short) currentRow, (short) currentRow+1, (short) 0, (short) 0); CellRangeAddress head1_region1 = new CellRangeAddress((short) currentRow, (short) currentRow + 1, (short) 0, (short) 0);
CellRangeAddress head1_region2 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 1, (short) 4); CellRangeAddress head1_region2 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 1, (short) 4);
CellRangeAddress head1_region3 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 5, (short) 8); CellRangeAddress head1_region3 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 5, (short) 8);
sheet.addMergedRegion(head1_region1); sheet.addMergedRegion(head1_region1);
@ -473,7 +471,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
currentRow++; currentRow++;
//创建表头 //创建表头
HSSFRow headRow2 = sheet.createRow(currentRow); HSSFRow headRow2 = sheet.createRow(currentRow);
this.setFullHeadCell(wb,headRow2, (short) 9,0); this.setFullHeadCell(wb, headRow2, (short) 9, 0);
//设置表头信息 //设置表头信息
HSSFCell compare_head2_cell1 = headRow2.getCell(1); HSSFCell compare_head2_cell1 = headRow2.getCell(1);
compare_head2_cell1.setCellValue("发生"); compare_head2_cell1.setCellValue("发生");
@ -500,23 +498,20 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
compare_head2_cell8.setCellValue("比率(%)"); compare_head2_cell8.setCellValue("比率(%)");
currentRow++; currentRow++;
for(int i=0;i<currentMonth.size();i++){ for (int i = 0; i < currentMonth.size(); i++) {
HSSFRow row = sheet.createRow(currentRow); HSSFRow row = sheet.createRow(currentRow);
this.setFullHeadCell(wb,row, (short) 9,1); this.setFullHeadCell(wb, row, (short) 9, 1);
OperDefectRatioDTO currentRatioDTO = currentMonth.get(i); OperDefectRatioDTO currentRatioDTO = currentMonth.get(i);
OperDefectRatioDTO severalRatioDTO = severalMonths.get(i); OperDefectRatioDTO severalRatioDTO = severalMonths.get(i);
//创建表格内容第一个单元格 //创建表格内容第一个单元格
HSSFCell compare_content_cell1 = row.getCell(0); HSSFCell compare_content_cell1 = row.getCell(0);
if("1".equals(currentRatioDTO.getDefectLevel())){ if ("1".equals(currentRatioDTO.getDefectLevel())) {
compare_content_cell1.setCellValue("一类缺陷"); compare_content_cell1.setCellValue("一类缺陷");
} } else if ("2".equals(currentRatioDTO.getDefectLevel())) {
else if("2".equals(currentRatioDTO.getDefectLevel())){
compare_content_cell1.setCellValue("二类缺陷"); compare_content_cell1.setCellValue("二类缺陷");
} } else if ("3".equals(currentRatioDTO.getDefectLevel())) {
else if("3".equals(currentRatioDTO.getDefectLevel())){
compare_content_cell1.setCellValue("三类缺陷"); compare_content_cell1.setCellValue("三类缺陷");
} } else if ("合计".equals(currentRatioDTO.getDefectLevel())) {
else if("合计".equals(currentRatioDTO.getDefectLevel())){
compare_content_cell1.setCellValue(currentRatioDTO.getDefectLevel()); compare_content_cell1.setCellValue(currentRatioDTO.getDefectLevel());
} }
HSSFCell compare_content_cell2 = row.getCell(1); HSSFCell compare_content_cell2 = row.getCell(1);
@ -543,14 +538,15 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 设置缺陷月报表excel导出-管理指标本月表内单元格 * 设置缺陷月报表excel导出-管理指标本月表内单元格
*
* @param wb * @param wb
* @param sheet * @param sheet
* @param currentRow 记录表格中叠加后的数据 * @param currentRow 记录表格中叠加后的数据
*/ */
private int setManageIndexCell(OperDefectManageIndexDTO manageIndex,HSSFWorkbook wb, HSSFSheet sheet, int currentRow){ private int setManageIndexCell(OperDefectManageIndexDTO manageIndex, HSSFWorkbook wb, HSSFSheet sheet, int currentRow) {
//管理指标表头 //管理指标表头
HSSFRow headRow3 = sheet.createRow(currentRow); HSSFRow headRow3 = sheet.createRow(currentRow);
this.setFullHeadCell(wb,headRow3, (short) 9,0); this.setFullHeadCell(wb, headRow3, (short) 9, 0);
HSSFCell manage_index_head = headRow3.getCell(0); HSSFCell manage_index_head = headRow3.getCell(0);
manage_index_head.setCellValue("管理指标(本月)"); manage_index_head.setCellValue("管理指标(本月)");
CellRangeAddress head1_region4 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 0, (short) 8); CellRangeAddress head1_region4 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 0, (short) 8);
@ -558,7 +554,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
currentRow++; currentRow++;
HSSFRow headRow4 = sheet.createRow(currentRow); HSSFRow headRow4 = sheet.createRow(currentRow);
this.setFullHeadCell(wb,headRow4, (short) 9,0); this.setFullHeadCell(wb, headRow4, (short) 9, 0);
HSSFCell repeat_head2_cell = headRow4.getCell(0); HSSFCell repeat_head2_cell = headRow4.getCell(0);
repeat_head2_cell.setCellValue("及时消除的缺陷数"); repeat_head2_cell.setCellValue("及时消除的缺陷数");
HSSFCell repeat_head2_cell2 = headRow4.getCell(2); HSSFCell repeat_head2_cell2 = headRow4.getCell(2);
@ -585,7 +581,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
//表格内容行 //表格内容行
HSSFRow manage_index_row = sheet.createRow(currentRow); HSSFRow manage_index_row = sheet.createRow(currentRow);
this.setFullHeadCell(wb,manage_index_row, (short) 9,1); this.setFullHeadCell(wb, manage_index_row, (short) 9, 1);
//表格内容 //表格内容
//第一列 //第一列
CellRangeAddress manage_religon1 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 0, (short) 1); CellRangeAddress manage_religon1 = new CellRangeAddress((short) currentRow, (short) currentRow, (short) 0, (short) 1);
@ -617,15 +613,16 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 设置缺陷月报表excel导出-重复分类缺陷汇总表内单元格 * 设置缺陷月报表excel导出-重复分类缺陷汇总表内单元格
*
* @param wb * @param wb
* @param sheet * @param sheet
* @param currentRow 记录表格中叠加后的数据 * @param currentRow 记录表格中叠加后的数据
*/ */
private int setRepeatCell(List<OperDefectRepeatRatioDTO> repeat, HSSFWorkbook wb, HSSFSheet sheet, int currentRow){ private int setRepeatCell(List<OperDefectRepeatRatioDTO> repeat, HSSFWorkbook wb, HSSFSheet sheet, int currentRow) {
//重复缺陷分类汇总表 //重复缺陷分类汇总表
//表头1 //表头1
HSSFRow repeat_head1 = sheet.createRow(currentRow); HSSFRow repeat_head1 = sheet.createRow(currentRow);
this.setFullHeadCell(wb,repeat_head1, (short) 9,0); this.setFullHeadCell(wb, repeat_head1, (short) 9, 0);
HSSFCell repeat_head1_cell = repeat_head1.getCell(0); HSSFCell repeat_head1_cell = repeat_head1.getCell(0);
repeat_head1_cell.setCellValue("重复缺陷分类汇总表"); repeat_head1_cell.setCellValue("重复缺陷分类汇总表");
CellRangeAddress repeat_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 8); CellRangeAddress repeat_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 8);
@ -637,7 +634,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
sheet.addMergedRegion(repeat_head2_cell_religon); sheet.addMergedRegion(repeat_head2_cell_religon);
HSSFRow repeat_head2 = sheet.createRow(currentRow); HSSFRow repeat_head2 = sheet.createRow(currentRow);
this.setFullHeadCell(wb,repeat_head2, (short) 9,0); this.setFullHeadCell(wb, repeat_head2, (short) 9, 0);
HSSFCell repeat_head2_cell1 = repeat_head2.getCell(3); HSSFCell repeat_head2_cell1 = repeat_head2.getCell(3);
CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4);
sheet.addMergedRegion(repeat_head2_cell1_religon); sheet.addMergedRegion(repeat_head2_cell1_religon);
@ -656,23 +653,20 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
currentRow++; currentRow++;
//内容 //内容
for(int i=0;i<repeat.size();i++){ for (int i = 0; i < repeat.size(); i++) {
HSSFRow repeat_row = sheet.createRow(currentRow); HSSFRow repeat_row = sheet.createRow(currentRow);
this.setFullHeadCell(wb,repeat_row, (short) 9,1); this.setFullHeadCell(wb, repeat_row, (short) 9, 1);
//第一列 //第一列
HSSFCell repeat_cell1 = repeat_row.getCell(0); HSSFCell repeat_cell1 = repeat_row.getCell(0);
CellRangeAddress repeat_content_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2); CellRangeAddress repeat_content_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2);
sheet.addMergedRegion(repeat_content_religon); sheet.addMergedRegion(repeat_content_religon);
if("1".equals(repeat.get(i).getDefectLevel())){ if ("1".equals(repeat.get(i).getDefectLevel())) {
repeat_cell1.setCellValue("一类缺陷"); repeat_cell1.setCellValue("一类缺陷");
} } else if ("2".equals(repeat.get(i).getDefectLevel())) {
else if("2".equals(repeat.get(i).getDefectLevel())){
repeat_cell1.setCellValue("二类缺陷"); repeat_cell1.setCellValue("二类缺陷");
} } else if ("3".equals(repeat.get(i).getDefectLevel())) {
else if("3".equals(repeat.get(i).getDefectLevel())){
repeat_cell1.setCellValue("三类缺陷"); repeat_cell1.setCellValue("三类缺陷");
} } else if ("合计".equals(repeat.get(i).getDefectLevel())) {
else if("合计".equals(repeat.get(i).getDefectLevel())){
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel()); repeat_cell1.setCellValue(repeat.get(i).getDefectLevel());
} }
//第二列 //第二列
@ -699,17 +693,17 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 补全合并单元格时 表格行所有单元格 * 补全合并单元格时 表格行所有单元格
*
* @param headRow * @param headRow
* @param rowLen * @param rowLen
* @param status 0:设置表头样式 1设置内容样式 * @param status 0:设置表头样式 1设置内容样式
*/ */
private void setFullHeadCell(HSSFWorkbook wb,HSSFRow headRow,short rowLen,int status){ private void setFullHeadCell(HSSFWorkbook wb, HSSFRow headRow, short rowLen, int status) {
for (int i=0;i<rowLen;i++){ for (int i = 0; i < rowLen; i++) {
HSSFCell hssfcell = headRow.createCell(i); HSSFCell hssfcell = headRow.createCell(i);
if(status == 0){ if (status == 0) {
hssfcell.setCellStyle(this.setHeadCellStyle(wb)); hssfcell.setCellStyle(this.setHeadCellStyle(wb));
} } else if (status == 1) {
else if(status == 1){
hssfcell.setCellStyle(this.setContentCellStyle(wb)); hssfcell.setCellStyle(this.setContentCellStyle(wb));
} }
} }
@ -717,12 +711,13 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 处理double数据保留两位小数 * 处理double数据保留两位小数
*
* @param num * @param num
* @return * @return
*/ */
private Double dealDouble(Double num){ private Double dealDouble(Double num) {
if(num != null){ if (num != null) {
BigDecimal b = new BigDecimal(num*100); BigDecimal b = new BigDecimal(num * 100);
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
} }
return null; return null;
@ -730,6 +725,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 获取当前月统计数据 * 获取当前月统计数据
*
* @param month * @param month
* @return * @return
*/ */
@ -740,13 +736,14 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 当年1月 - 当前月获取缺陷等级统计数据 * 当年1月 - 当前月获取缺陷等级统计数据
*
* @param month "2021-01" * @param month "2021-01"
* @return * @return
*/ */
private List<OperDefectRatioDTO> getStatisticBySeveralMonth(String month) { private List<OperDefectRatioDTO> getStatisticBySeveralMonth(String month) {
Integer intervalMonth = Integer.valueOf(month.split("-")[1]); Integer intervalMonth = Integer.valueOf(month.split("-")[1]);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date ; Date date;
String firstMonth = month.split("-")[0] + "-01-01"; String firstMonth = month.split("-")[0] + "-01-01";
try { try {
date = dateFormat.parse(firstMonth); date = dateFormat.parse(firstMonth);
@ -757,7 +754,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
} catch (ParseException e) { } catch (ParseException e) {
throw new ServiceException("日期转换失败"); throw new ServiceException("日期转换失败");
} }
log.error("firstMonth:"+firstMonth + "; end=" +dateFormat.format(date)); log.error("firstMonth:" + firstMonth + "; end=" + dateFormat.format(date));
List<OperDefectStatisticsStatusDTO> statisticBySeveralMonth = this.baseMapper.getStatisticBySeveralMonth(firstMonth, dateFormat.format(date), AuthUtil.getDeptId()); List<OperDefectStatisticsStatusDTO> statisticBySeveralMonth = this.baseMapper.getStatisticBySeveralMonth(firstMonth, dateFormat.format(date), AuthUtil.getDeptId());
return getRatioStatic(statisticBySeveralMonth); return getRatioStatic(statisticBySeveralMonth);
@ -765,19 +762,20 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 获取按月管理指标统计数据 * 获取按月管理指标统计数据
*
* @param month * @param month
* @return * @return
*/ */
private OperDefectManageIndexDTO getManageIndexStatistic(String month){ private OperDefectManageIndexDTO getManageIndexStatistic(String month) {
OperDefectManageIndexDTO manageIndex = new OperDefectManageIndexDTO(); OperDefectManageIndexDTO manageIndex = new OperDefectManageIndexDTO();
List<Integer> list = this.baseMapper.getManageIndex(month, AuthUtil.getDeptId()); List<Integer> list = this.baseMapper.getManageIndex(month, AuthUtil.getDeptId());
manageIndex.setInTimeNum(list.get(0)); manageIndex.setInTimeNum(list.get(0));
if(!list.get(1).equals(0)){ if (!list.get(1).equals(0)) {
manageIndex.setInTimeRatio(list.get(0).equals(0)? 0.0 : Double.valueOf(list.get(0))/list.get(1)); manageIndex.setInTimeRatio(list.get(0).equals(0) ? 0.0 : Double.valueOf(list.get(0)) / list.get(1));
} }
manageIndex.setHistoryRemindNum(list.get(3)); manageIndex.setHistoryRemindNum(list.get(3));
manageIndex.setMonthRemindNum(list.get(2)); manageIndex.setMonthRemindNum(list.get(2));
if(!list.get(4).equals(0)) { if (!list.get(4).equals(0)) {
manageIndex.setDealRatio(list.get(1).equals(0) ? 0.0 : Double.valueOf(list.get(1)) / list.get(4)); manageIndex.setDealRatio(list.get(1).equals(0) ? 0.0 : Double.valueOf(list.get(1)) / list.get(4));
} }
return manageIndex; return manageIndex;
@ -785,67 +783,56 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/** /**
* 获取重复缺陷等级统计数据 * 获取重复缺陷等级统计数据
*
* @param month * @param month
* @return * @return
*/ */
private List<OperDefectRepeatRatioDTO> getRepeatStatistic(String month){ private List<OperDefectRepeatRatioDTO> getRepeatStatistic(String month) {
List<OperDefectRepeatRatioDTO> re = new ArrayList<>(); List<OperDefectRepeatRatioDTO> re = new ArrayList<>();
List<OperDefectStatisticsCodeDTO> repetStatistics = this.baseMapper.getRepetStatistics(AuthUtil.getDeptId()); List<OperDefectStatisticsCodeDTO> repetStatistics = this.baseMapper.getRepetStatistics(AuthUtil.getDeptId());
//总缺陷数 //总缺陷数
int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum(); int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum();
//总重复缺陷数 //总重复缺陷数
int totalRepeat = repetStatistics int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum));
.stream()
.filter(s-> s.getDefectNum() > 1 && s.getDefectLevel() != null )
.collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum));
//等级重复统计 //等级重复统计
Map<String, IntSummaryStatistics> repeatList = repetStatistics Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum)));
.stream()
.filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null )
.collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel,
Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum)));
OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO();
one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus()); one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus());
if(repeatList.get(one.getDefectLevel()) != null){ if (repeatList.get(one.getDefectLevel()) != null) {
one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum()); one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum());
one.setHappenRatio(one.getHappenNum()/Double.valueOf(total)); one.setHappenRatio(one.getHappenNum() / Double.valueOf(total));
one.setRepeatRatio(one.getHappenNum()/Double.valueOf(totalRepeat)); one.setRepeatRatio(one.getHappenNum() / Double.valueOf(totalRepeat));
} }
OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO();
two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus()); two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus());
if(repeatList.get(two.getDefectLevel()) != null){ if (repeatList.get(two.getDefectLevel()) != null) {
two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum()); two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum());
two.setHappenRatio(two.getHappenNum()/Double.valueOf(total)); two.setHappenRatio(two.getHappenNum() / Double.valueOf(total));
two.setRepeatRatio(two.getHappenNum()/Double.valueOf(totalRepeat)); two.setRepeatRatio(two.getHappenNum() / Double.valueOf(totalRepeat));
} }
OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO(); OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO();
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus());
if(repeatList.get(three.getDefectLevel()) != null) { if (repeatList.get(three.getDefectLevel()) != null) {
three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum()); three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum());
three.setHappenRatio(three.getHappenNum() / Double.valueOf(total)); three.setHappenRatio(three.getHappenNum() / Double.valueOf(total));
three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat)); three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat));
} }
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder() OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio()).repeatRatio(1.00).build();
.defectLevel("合计") if (addUp.getHappenNum().equals(0L)) {
.happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum())
.happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio())
.repeatRatio(1.00)
.build();
if(addUp.getHappenNum().equals(0L)){
addUp.setRepeatRatio(0.0); addUp.setRepeatRatio(0.0);
} }
re.addAll(Arrays.asList(one,two,three,addUp)); re.addAll(Arrays.asList(one, two, three, addUp));
return re; return re;
} }
private List<OperDefectRatioDTO> getRatioStatic(List<OperDefectStatisticsStatusDTO> dtos){ private List<OperDefectRatioDTO> getRatioStatic(List<OperDefectStatisticsStatusDTO> dtos) {
//本月统计返回 //本月统计返回
List<OperDefectRatioDTO> re = new ArrayList<>(); List<OperDefectRatioDTO> re = new ArrayList<>();
OperDefectRatioDTO one = new OperDefectRatioDTO(); OperDefectRatioDTO one = new OperDefectRatioDTO();
@ -856,16 +843,14 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus());
//等级统计 //等级统计
Map<String, IntSummaryStatistics> collectLevel = dtos.stream().filter(s-> s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getDefectLevel, Map<String, IntSummaryStatistics> collectLevel = dtos.stream().filter(s -> s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
//总缺陷数 //总缺陷数
int total = dtos.stream().mapToInt(OperDefectStatisticsStatusDTO::getDefectNum).sum(); int total = dtos.stream().mapToInt(OperDefectStatisticsStatusDTO::getDefectNum).sum();
//状态统计 //状态统计
Map<String, IntSummaryStatistics> collectStatus = dtos.stream().collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getHandleStatus, Map<String, IntSummaryStatistics> collectStatus = dtos.stream().collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getHandleStatus, Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
for (OperDefectStatisticsStatusDTO dto : dtos) { for (OperDefectStatisticsStatusDTO dto : dtos) {
if(dto.getDefectLevel()!=null){ if (dto.getDefectLevel() != null) {
switch (dto.getDefectLevel()) { switch (dto.getDefectLevel()) {
case "1": case "1":
setReturnRatio(total, one, dto, collectLevel, collectStatus); setReturnRatio(total, one, dto, collectLevel, collectStatus);
@ -881,52 +866,70 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
} }
} }
} }
int solveNum = collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()) == null? 0 : (int)collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum(); int solveNum = collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()) == null ? 0 : (int) collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum();
OperDefectRatioDTO addUp = OperDefectRatioDTO.builder() OperDefectRatioDTO addUp = OperDefectRatioDTO.builder().happenNum(total).happenRatio(total == 0 ? 0 : 1.00).defectLevel("合计").sovleRatio(solveNum == 0 ? 0 : 1.00).sovleNum(solveNum).build();
.happenNum(total) re.addAll(Arrays.asList(one, two, three, addUp));
.happenRatio(total == 0 ? 0 : 1.00)
.defectLevel("合计")
.sovleRatio(solveNum == 0 ? 0 : 1.00)
.sovleNum(solveNum)
.build();
re.addAll(Arrays.asList(one,two,three,addUp));
return re; return re;
} }
private void setReturnRatio(int total, OperDefectRatioDTO ratio, OperDefectStatisticsStatusDTO dto, private void setReturnRatio(int total, OperDefectRatioDTO ratio, OperDefectStatisticsStatusDTO dto, Map<String, IntSummaryStatistics> collectLevel, Map<String, IntSummaryStatistics> collectStatus) {
Map<String, IntSummaryStatistics> collectLevel, Map<String, IntSummaryStatistics> collectStatus){ if (dto.getHandleStatus().equals(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus())) {
if(dto.getHandleStatus().equals(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus())) {
ratio.setSovleNum(dto.getDefectNum()); ratio.setSovleNum(dto.getDefectNum());
ratio.setSovleRatio(Double.valueOf(dto.getDefectNum())/collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum()); ratio.setSovleRatio(Double.valueOf(dto.getDefectNum()) / collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum());
ratio.setHappenNum((int)collectLevel.get(dto.getDefectLevel()).getSum()); ratio.setHappenNum((int) collectLevel.get(dto.getDefectLevel()).getSum());
ratio.setHappenRatio(ratio.getHappenNum()/Double.valueOf(total)); ratio.setHappenRatio(ratio.getHappenNum() / Double.valueOf(total));
} else { } else {
ratio.setHappenNum((int)collectLevel.get(dto.getDefectLevel()).getSum()); ratio.setHappenNum((int) collectLevel.get(dto.getDefectLevel()).getSum());
ratio.setHappenRatio(ratio.getHappenNum()/Double.valueOf(total)); ratio.setHappenRatio(ratio.getHappenNum() / Double.valueOf(total));
} }
} }
/** /**
* 更新缺陷信息 * 更新缺陷信息
*
* @param entity * @param entity
* @return * @return
*/ */
@Override @Override
public boolean updateDefectInfo(OperDefectEntity entity) { public boolean updateDefectInfo(OperDefectEntity entity) {
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate() return this.update(Wrappers.<OperDefectEntity>lambdaUpdate().set(OperDefectEntity::getActHours, entity.getActHours()).set(OperDefectEntity::getActStartTime, entity.getActStartTime()).set(OperDefectEntity::getActEndTime, entity.getActEndTime()).set(OperDefectEntity::getDisposeDesc, entity.getDisposeDesc()).eq(OperDefectEntity::getDefectCode, entity.getDefectCode()));
.set(OperDefectEntity::getActHours, entity.getActHours())
.set(OperDefectEntity::getActStartTime,entity.getActStartTime())
.set(OperDefectEntity::getActEndTime,entity.getActEndTime())
.set(OperDefectEntity::getDisposeDesc,entity.getDisposeDesc())
.eq(OperDefectEntity::getDefectCode,entity.getDefectCode()));
} }
@Override @Override
public boolean updateDefectHanderState(OperDefectEntity entity) { public boolean updateDefectHanderState(OperDefectEntity entity) {
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate() return this.update(Wrappers.<OperDefectEntity>lambdaUpdate().set(OperDefectEntity::getHandleStatus, entity.getHandleStatus()).eq(OperDefectEntity::getDefectCode, entity.getDefectCode()));
.set(OperDefectEntity::getHandleStatus, entity.getHandleStatus()) }
.eq(OperDefectEntity::getDefectCode,entity.getDefectCode()));
/**
* 分页查询
*
* @param operDefectEntityPage
* @param defect
* @return
*/
@Override
public IPage<OperDefectEntity> selectPage(Page<OperDefectEntity> operDefectEntityPage, OperDefectEntity defect) {
LambdaQueryWrapper<OperDefectEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtils.isNotBlank(defect.getDefectCode()), OperDefectEntity::getDefectCode, defect.getDefectCode());
//缺陷编号
queryWrapper.ge(defect.getActStartTime() != null, OperDefectEntity::getActStartTime, defect.getActStartTime());
queryWrapper.le(defect.getActEndTime() != null, OperDefectEntity::getActEndTime, defect.getActEndTime());
queryWrapper.ge(defect.getStartTime() != null, OperDefectEntity::getCreateTime, defect.getStartTime());
queryWrapper.le(defect.getEndTime() != null, OperDefectEntity::getCreateTime, defect.getEndTime());
//区域Id
queryWrapper.eq(BaseEntity::getCreateDept, defect.getCreateDept());
//年月查询
queryWrapper.apply(defect.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m') = '" +
defect.getYearMonth() + "'");
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime);
return baseMapper.selectPage(operDefectEntityPage, queryWrapper);
} }

175
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java

@ -1,11 +1,26 @@
package com.hnac.hzims.operational.main.controller.web; package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.service.IOperAccessStatisticsService;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.vo.OperDefectVO;
import com.hnac.hzims.operational.defect.wrapper.OperDefectWrapper;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService; import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -16,7 +31,9 @@ import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.SpringQueryMap; import org.springframework.cloud.openfeign.SpringQueryMap;
@ -43,6 +60,10 @@ public class AreaMonthlyDetailsController {
private final IOperMaintenanceTaskService taskService; private final IOperMaintenanceTaskService taskService;
private final IOperDefectService defectService;
private final IOperAccessStatisticsService accessStatisticsService;
/** /**
* 操作票 根据月份区域 获取操作详情数据 * 操作票 根据月份区域 获取操作详情数据
@ -143,4 +164,158 @@ public class AreaMonthlyDetailsController {
return R.data(task); return R.data(task);
} }
/**
* 根据区域和月份分页查询缺陷库
*/
@ApiOperationSupport(order = 70)
@ApiOperation(value = "分页查询")
@GetMapping("/queryDefectPageList/{page}/{size}")
public R<IPage<OperDefectVO>> queryDefectPageList(
@PathVariable Long page,
@PathVariable Long size,
OperDefectEntity defect) {
Page<OperDefectEntity> operDefectEntityPage = new Page<>(page, size);
IPage<OperDefectEntity> pages = defectService.selectPage(operDefectEntityPage, defect);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages);
return R.data(vos);
}
/**
* 根据区域和月份分页查询缺陷库 详情
*/
@GetMapping("queryDefectPageDetail/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入defect")
public R<OperDefectVO> queryDefectPageDetail(OperDefectEntity defect) {
return defectService.detail(defect);
}
/**
* 根据区域和月份分页查询检修任务
*/
@ApiOperationSupport(order = 80)
@ApiOperation(value = "根据区域和月份分页查询检修任务")
@GetMapping("/queryReconditionPageList/{page}/{size}")
public R<IPage<OperAccessStatisticsVO>> queryReconditionPageList(
@PathVariable Long page, @PathVariable Long size,
OperAccessStatisticsDTO result) {
Page<OperAccessStatisticsVO> dbPage = new Page<>(page, size);
R<IPage<OperAccessStatisticsVO>> r = accessStatisticsService.list(result, dbPage);
return r;
}
/**
* 根据区域 编号查询检修任务详情
*/
@GetMapping("/queryReconditionPageDetail/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "根据区域 编号查询检修任务详情")
public R<OperAccessStatisticsVO> queryReconditionPageDetail(@RequestParam Long id) {
R<OperAccessStatisticsVO> detail = accessStatisticsService.detail(id);
return detail;
}
/**
* 根据区域编号查询安全生产会议次数
*/
@GetMapping("/queryProduceNumByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 90)
@ApiOperation(value = "根据区域编号查询安全生产会议次数")
public R<BladePage<CheckMonthVo>> queryProduceNumByAreaCode(@PathVariable Long page, @PathVariable Long size,
CheckMonthEntity req) {
req.setItemName("现场每月1次安全生产会议");
BladePage<CheckMonthVo> checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询技能培训
*/
@GetMapping("/querySkillByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询技能培训")
public R<BladePage<CheckMonthVo>> querySkillByAreaCode(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req) {
req.setItemName("每月开展1次技能培训");
BladePage<CheckMonthVo> checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询月度自查
*/
@GetMapping("/queryProduceByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询技能培训")
public R<BladePage<CheckMonthVo>> queryProduceByAreaCode(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req) {
BladePage<CheckMonthVo> checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询 月度自查 技能培训 安全生产会议次数
*/
@GetMapping("/queryProduceByAreaCodeDetail/detail/{id}")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入id")
public R<CheckMonthVo> queryProduceByAreaCodeDetail(@PathVariable Long id){
CheckMonthVo checkMonthVo = areaMonthlyDetailsService.queryProduceByAreaCodeDetail(id);
return R.data(checkMonthVo);
}
/**
* 根据区域编号查询安全检查
*/
@GetMapping("/querySecurityAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询安全检查")
public R<BladePage<CheckCompanyVo>> querySecurityAreaCode(@PathVariable Long page,
@PathVariable Long size,
CheckCompanyEntity req) {
BladePage<CheckCompanyVo> checkMonthVoBladePage = areaMonthlyDetailsService.querySecurityAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询安全检查 详情
*/
@GetMapping("/querySecurityAreaCode/detail/{id}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询安全检查 详情")
public R<CheckCompanyVo> querySecurityAreaCodeDetail(@PathVariable Long id) {
CheckCompanyVo checkMonthVoBladePage = areaMonthlyDetailsService.querySecurityAreaCodeDetail(id);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询设备试验
*/
@GetMapping("/queryEquipmentAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询设备试验")
public R<BladePage<SafeEquipmentTrialVO>> queryEquipmentAreaCode(
@PathVariable Long page,
@PathVariable Long size,
SafeEquipmentTrialDTO safeEquipmentTrialDTO) {
BladePage<SafeEquipmentTrialVO> checkMonthVoBladePage = areaMonthlyDetailsService.queryEquipmentAreaCode(page
,size,safeEquipmentTrialDTO);
return R.data(checkMonthVoBladePage);
}
} }

47
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java

@ -1,6 +1,12 @@
package com.hnac.hzims.operational.main.service; package com.hnac.hzims.operational.main.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -75,4 +81,45 @@ public interface AreaMonthlyDetailsService {
* @return * @return
*/ */
TaskEntity queryCheckTaskById(Long id); TaskEntity queryCheckTaskById(Long id);
/**
* 根据区域编号查询安全生产会议次数 技能培训
* @param page
* @param size
* @param req
* @return
*/
BladePage<CheckMonthVo> queryProduceByAreaCode(Long page, Long size, CheckMonthEntity req);
/**
* 根据区域编号查询 月度自查 技能培训 安全生产会议次数
*/
CheckMonthVo queryProduceByAreaCodeDetail(Long id);
/**
* 根据区域编号查询安全检查
* @param page
* @param size
* @param req
* @return
*/
BladePage<CheckCompanyVo> querySecurityAreaCode(Long page, Long size, CheckCompanyEntity req);
/**
* 根据区域编号查询安全检查 详情
* @param id
* @return
*/
CheckCompanyVo querySecurityAreaCodeDetail(Long id);
/**
* 根据区域编号查询设备试验
* @param page
* @param size
* @param safeEquipmentTrialDTO
* @return
*/
BladePage<SafeEquipmentTrialVO> queryEquipmentAreaCode(Long page, Long size, SafeEquipmentTrialDTO safeEquipmentTrialDTO);
} }

122
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java

@ -1,6 +1,15 @@
package com.hnac.hzims.operational.main.service.impl; package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.areamonthly.feign.CheckCompanyFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeEquipmentTrialFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeproductFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -38,6 +47,13 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
private final TaskFeignClient taskFeignClient; private final TaskFeignClient taskFeignClient;
private final SafeproductFeignClient safeproductFeignClient;
private final CheckCompanyFeignClient checkCompanyFeignClient;
private final SafeEquipmentTrialFeignClient safeEquipmentTrialFeignClient;
/** /**
* 根据月份区域 获取操作详情数据 * 根据月份区域 获取操作详情数据
@ -49,8 +65,7 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
*/ */
@Override @Override
public BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) { public BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) {
R<BladePage<StandardTicketVo>> pageR = R<BladePage<StandardTicketVo>> pageR = ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly);
ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly);
if (pageR.isSuccess()) { if (pageR.isSuccess()) {
log.info("获取操作详情数据成功"); log.info("获取操作详情数据成功");
return pageR.getData(); return pageR.getData();
@ -68,9 +83,8 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
* @return * @return
*/ */
@Override @Override
public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Long page, Long size,StandardTicketWithAreaVo areaMonthlyVo) { public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Long page, Long size, StandardTicketWithAreaVo areaMonthlyVo) {
R<BladePage<StandardWorkVo>> pageR = R<BladePage<StandardWorkVo>> pageR = ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
if (pageR.isSuccess()) { if (pageR.isSuccess()) {
log.info("获取操作详情数据成功"); log.info("获取操作详情数据成功");
return pageR.getData(); return pageR.getData();
@ -149,6 +163,7 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
/** /**
* 根据id查询巡检任务 * 根据id查询巡检任务
*
* @param id * @param id
* @return * @return
*/ */
@ -162,4 +177,101 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
log.error("获取检查巡检任务详情失败", detail.getMsg()); log.error("获取检查巡检任务详情失败", detail.getMsg());
return null; return null;
} }
/**
* 根据区域编号查询安全生产会议次数 技能培训
*
* @param page
* @param size
* @param req
* @return
*/
@Override
public BladePage<CheckMonthVo> queryProduceByAreaCode(Long page, Long size, CheckMonthEntity req) {
R<BladePage<CheckMonthVo>> detail = safeproductFeignClient.listconferenceScope(page, size, req);
if (detail.isSuccess()) {
log.info("获取安全生产会议次数 技能培训成功");
return detail.getData();
}
log.error("获取安全生产会议次数 技能培训失败", detail.getMsg());
return null;
}
/**
* 根据区域编号查询 月度自查 技能培训 安全生产会议次数
*
* @param id
*/
@Override
public CheckMonthVo queryProduceByAreaCodeDetail(Long id) {
R<CheckMonthVo> detail = safeproductFeignClient.detail(id);
if (detail.isSuccess()) {
log.info("根据区域编号查询 月度自查 技能培训 安全生产会议次数成功");
return detail.getData();
}
log.error("根据区域编号查询 月度自查 技能培训 安全生产会议次数失败", detail.getMsg());
return null;
}
/**
* 根据区域编号查询安全检查
*
* @param page
* @param size
* @param req
* @return
*/
@Override
public BladePage<CheckCompanyVo> querySecurityAreaCode(Long page, Long size, CheckCompanyEntity req) {
Query query = new Query();
query.setCurrent(page.intValue());
query.setSize(size.intValue());
R<BladePage<CheckCompanyVo>> list = checkCompanyFeignClient.list(req, query);
if (list.isSuccess()) {
log.info("根据区域编号查询安全检查成功");
return list.getData();
}
log.error("根据区域编号查询安全检查失败", list.getMsg());
return null;
}
/**
* 根据区域编号查询安全检查详情
*
* @param id
* @return
*/
@Override
public CheckCompanyVo querySecurityAreaCodeDetail(Long id) {
R<CheckCompanyVo> detailed = checkCompanyFeignClient.detail(id);
if (detailed.isSuccess()) {
log.info(" 根据区域编号查询安全检查详情成功");
return detailed.getData();
}
log.error(" 根据区域编号查询安全检查详情失败", detailed.getMsg());
return null;
}
/**
* 根据区域编号查询设备试验
*
* @param page
* @param size
* @param safeEquipmentTrialDTO
* @return
*/
@Override
public BladePage<SafeEquipmentTrialVO> queryEquipmentAreaCode(Long page, Long size, SafeEquipmentTrialDTO safeEquipmentTrialDTO) {
Query query = new Query();
query.setCurrent(page.intValue());
query.setSize(size.intValue());
R<BladePage<SafeEquipmentTrialVO>> list = safeEquipmentTrialFeignClient.list(safeEquipmentTrialDTO, query);
if (list.isSuccess()) {
log.info("根据区域编号查询设备试验成功");
return list.getData();
}
log.error("根据区域编号查询设备试验失败", list.getMsg());
return null;
}
} }

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckCompanyController.java

@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
@ -76,7 +77,7 @@ public class CheckCompanyController extends BladeController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status") @ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status")
public R<IPage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query) { public R<BladePage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query) {
return CheckCompanyService.pageCondition(req, query); return CheckCompanyService.pageCondition(req, query);
} }

27
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckMonthController.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.controller; package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.dto.CheckMonthDTO; import com.hnac.hzims.safeproduct.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
@ -11,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
@ -108,4 +110,29 @@ public class CheckMonthController extends BladeController {
return R.data(page); return R.data(page);
} }
/**
* 分页查询安全生产会议次数
*/
@GetMapping("/listconferenceScope/{page}/{size}")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:month,status,createDept")
public R<BladePage<CheckMonthVo>> listconferenceScope(
@PathVariable Long page, @PathVariable Long size,
CheckMonthEntity req) {
Page<CheckMonthEntity> objectPage = new Page<>(page, size);
R<IPage<CheckMonthVo>> pageR = checkMonthlyService.listconferenceScope(req,objectPage);
IPage<CheckMonthVo> pages = pageR.getData();
pages.getRecords().forEach(monthlyVo -> {
R<Dept> deptR = sysClient.getDept(monthlyVo.getCreateDept());
if (deptR.isSuccess()) {
monthlyVo.setDeptName(Optional.ofNullable(deptR.getData()).map(Dept::getDeptName).orElse(null));
}
});
BladePage<CheckMonthVo> bladePage = BladePage.of(pages);
return R.data(bladePage);
}
} }

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeEquipmentTrialController.java

@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -58,7 +59,7 @@ public class SafeEquipmentTrialController extends BladeController {
@ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime") @ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime")
@OperationAnnotation(title = "设备试验",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, @OperationAnnotation(title = "设备试验",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页条件") action = "分页条件")
public R<IPage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) { public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) {
return service.pageCondition(safeEquipmentTrialDTO, query); return service.pageCondition(safeEquipmentTrialDTO, query);
} }

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.java

@ -2,7 +2,9 @@ package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -21,4 +23,11 @@ public interface CheckMonthMapper extends UserDataScopeBaseMapper<CheckMonthEnti
*/ */
IPage<CheckMonthEntity> pageNotDataScope(IPage page, @Param("req") CheckMonthEntity req); IPage<CheckMonthEntity> pageNotDataScope(IPage page, @Param("req") CheckMonthEntity req);
/**
* 分页查询安全生产会议次数
* @param objectPage
* @param req
* @return
*/
IPage<CheckMonthEntity> listconferenceScope(IPage<CheckMonthEntity> objectPage, @Param("req") CheckMonthEntity req);
} }

27
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.xml

@ -15,5 +15,32 @@
</if> </if>
order by CREATE_TIME desc order by CREATE_TIME desc
</select> </select>
<!-- 分页查询安全生产会议次数-->
<select id="listconferenceScope" resultType="com.hnac.hzims.safeproduct.entity.CheckMonthEntity">
select p.* from hzims_safe_check_month p LEFT JOIN
hzims_safe_check_item_instance c
on p.id = c.CHECK_ID
<where>
<if test="req.itemName!=null and req.itemName!=''">
c.item = #{req.itemName}
</if>
<if test="req.month!=null and req.month!=''">
AND p.MONTH = #{req.month}
</if>
<if test="req.status!=null">
AND p.STATUS = #{req.status}
</if>
<if test="req.createDept!=null">
AND p.CREATE_DEPT = #{req.createDept}
</if>
<if test="req.areaId !=null">
AND p.CREATE_DEPT = #{req.areaId}
</if>
<if test="req.yearMonth !=null">
AND p.month = #{req.yearMonth}
</if>
</where>
</select>
</mapper> </mapper>

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckCompanyService.java

@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.entity.CheckQuarterEntity;
import com.hnac.hzims.safeproduct.vo.CheckCompanyVo; import com.hnac.hzims.safeproduct.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.vo.CheckQuarterVo; import com.hnac.hzims.safeproduct.vo.CheckQuarterVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -24,6 +25,6 @@ public interface ICheckCompanyService extends BaseService<CheckCompanyEntity> {
R<CheckCompanyVo> detail(Long id); R<CheckCompanyVo> detail(Long id);
R<IPage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query); R<BladePage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query);
} }

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckMonthService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.service; package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.dto.CheckMonthDTO; import com.hnac.hzims.safeproduct.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo; import com.hnac.hzims.safeproduct.vo.CheckMonthVo;
@ -25,4 +26,12 @@ public interface ICheckMonthService extends BaseService<CheckMonthEntity> {
R<IPage<CheckMonthVo>> pageNotDataScope(CheckMonthEntity req, Query query); R<IPage<CheckMonthVo>> pageNotDataScope(CheckMonthEntity req, Query query);
/**
* 分页查询安全生产会议次数
* @param req
* @param objectPage
* @return
*/
R<IPage<CheckMonthVo>> listconferenceScope(CheckMonthEntity req, Page<CheckMonthEntity> objectPage);
} }

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/SafeEquipmentTrialService.java

@ -6,6 +6,7 @@ import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity; import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity;
import com.hnac.hzims.safeproduct.vo.SafeEquipmentTrialVO; import com.hnac.hzims.safeproduct.vo.SafeEquipmentTrialVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -16,7 +17,7 @@ import java.util.List;
*/ */
public interface SafeEquipmentTrialService extends BaseService<SafeEquipmentTrialEntity> { public interface SafeEquipmentTrialService extends BaseService<SafeEquipmentTrialEntity> {
R<IPage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query); R<BladePage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query);
int getSafeEquipmentCount(SafeEquipmentTrialDTO dto); int getSafeEquipmentCount(SafeEquipmentTrialDTO dto);

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckCompanyServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.hnac.hzims.safeproduct.dto.CheckCompanyDTO; import com.hnac.hzims.safeproduct.dto.CheckCompanyDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity; import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckItemEntity; import com.hnac.hzims.safeproduct.entity.CheckItemEntity;
@ -15,7 +16,9 @@ import com.hnac.hzims.safeproduct.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.wrapper.CheckCompanyWrapper; import com.hnac.hzims.safeproduct.wrapper.CheckCompanyWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -128,7 +131,7 @@ public class CheckCompanyServiceImpl extends BaseServiceImpl<CheckCompanyMapper,
} }
@Override @Override
public R<IPage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query) { public R<BladePage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query) {
Wrapper<CheckCompanyEntity> queryWrapper = new LambdaQueryWrapper<CheckCompanyEntity>() {{ Wrapper<CheckCompanyEntity> queryWrapper = new LambdaQueryWrapper<CheckCompanyEntity>() {{
orderByDesc(CheckCompanyEntity::getCreateTime); orderByDesc(CheckCompanyEntity::getCreateTime);
if (ObjectUtil.isNotEmpty(req.getStartTime())) { if (ObjectUtil.isNotEmpty(req.getStartTime())) {
@ -140,9 +143,14 @@ public class CheckCompanyServiceImpl extends BaseServiceImpl<CheckCompanyMapper,
if (ObjectUtil.isNotEmpty(req.getStatus())) { if (ObjectUtil.isNotEmpty(req.getStatus())) {
eq(CheckCompanyEntity::getStatus, req.getStatus()); eq(CheckCompanyEntity::getStatus, req.getStatus());
} }
eq(StringUtils.isNotBlank(req.getAreaId()), BaseEntity::getCreateDept, req.getAreaId());
apply(req.getYearMonth() != null, "date_format(start_time ,'%Y-%m') = '"
+ req.getYearMonth() + "'" + "and date_format(end_time,'%Y-%m') = '" + req.getYearMonth() + "'");
}}; }};
IPage page = page(Condition.getPage(query), queryWrapper); IPage page = page(Condition.getPage(query), queryWrapper);
page.setRecords(CheckCompanyWrapper.build().listVO(page.getRecords())); page.setRecords(CheckCompanyWrapper.build().listVO(page.getRecords()));
return R.data(page); BladePage bladePage = BladePage.of(page);
return R.data(bladePage);
} }
} }

14
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckMonthServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.dto.CheckMonthDTO; import com.hnac.hzims.safeproduct.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckItemEntity; import com.hnac.hzims.safeproduct.entity.CheckItemEntity;
import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity; import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity;
@ -140,4 +141,17 @@ public class CheckMonthServiceImpl extends BaseServiceImpl<CheckMonthMapper, Che
page.setRecords(CheckMonthWrapper.build().listVO(page.getRecords())); page.setRecords(CheckMonthWrapper.build().listVO(page.getRecords()));
return R.data(page); return R.data(page);
} }
/**
* 分页查询安全生产会议次数
* @param req
* @param objectPage
* @return
*/
@Override
public R<IPage<CheckMonthVo>> listconferenceScope(CheckMonthEntity req, Page<CheckMonthEntity> objectPage) {
IPage page = checkMonthMapper.listconferenceScope(objectPage, req);
page.setRecords(CheckMonthWrapper.build().listVO(page.getRecords()));
return R.data(page);
}
} }

50
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafeEquipmentTrialServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.safeproduct.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentDTO; import com.hnac.hzims.safeproduct.dto.SafeEquipmentDTO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO; import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity; import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity;
@ -11,6 +12,7 @@ import com.hnac.hzims.safeproduct.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.wrapper.SafeEquipmentTrialWrapper; import com.hnac.hzims.safeproduct.wrapper.SafeEquipmentTrialWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -28,55 +30,62 @@ public class SafeEquipmentTrialServiceImpl extends BaseServiceImpl<SafeEquipment
/** /**
* 分页查询 * 分页查询
*
* @param param * @param param
* @param query * @param query
* @return * @return
*/ */
@Override @Override
public R<IPage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO param, Query query) { public R<BladePage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO param, Query query) {
QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{ QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{
if(Optional.ofNullable(param.getCreateDept()).isPresent()){ if (Optional.ofNullable(param.getCreateDept()).isPresent()) {
eq("create_dept",param.getCreateDept()); eq("create_dept", param.getCreateDept());
} }
if(Optional.ofNullable(param.getFileName()).isPresent()){ if (Optional.ofNullable(param.getFileName()).isPresent()) {
like("file_name","%".concat(param.getFileName()).concat("%")); like("file_name", "%".concat(param.getFileName()).concat("%"));
} }
if(Optional.ofNullable(param.getStartTime()).isPresent()){ if (Optional.ofNullable(param.getStartTime()).isPresent()) {
gt("create_time", param.getStartTime()); gt("create_time", param.getStartTime());
} }
if(Optional.ofNullable(param.getEndTime()).isPresent()){ if (Optional.ofNullable(param.getEndTime()).isPresent()) {
lt("create_time", param.getEndTime()); lt("create_time", param.getEndTime());
} }
lambda().eq(StringUtils.isNotBlank(param.getAreaId()), SafeEquipmentTrialEntity::getCreateDept,
param.getAreaId());
eq(param.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m)", param.getYearMonth());
orderByDesc("create_time"); orderByDesc("create_time");
}}; }};
IPage pages = super.page(Condition.getPage(query), queryWrapper); IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = SafeEquipmentTrialWrapper.build().listVO(pages.getRecords()); List list = SafeEquipmentTrialWrapper.build().listVO(pages.getRecords());
return R.data(pages.setRecords(list)); pages.setRecords(list);
BladePage bladePage = BladePage.of(pages);
return R.data(bladePage);
} }
/** /**
* 获取设备试验次数 * 获取设备试验次数
*
* @param param * @param param
* @return * @return
*/ */
@Override @Override
public int getSafeEquipmentCount(SafeEquipmentTrialDTO param) { public int getSafeEquipmentCount(SafeEquipmentTrialDTO param) {
if(ObjectUtil.isEmpty(param)){ if (ObjectUtil.isEmpty(param)) {
return 0; return 0;
} }
QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{ QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{
if(CollectionUtil.isEmpty(param.getDeptList())){ if (CollectionUtil.isEmpty(param.getDeptList())) {
if(Optional.ofNullable(param.getCreateDept()).isPresent()){ if (Optional.ofNullable(param.getCreateDept()).isPresent()) {
eq("create_dept",param.getCreateDept()); eq("create_dept", param.getCreateDept());
} }
} else { } else {
in("create_dept",param.getDeptList()); in("create_dept", param.getDeptList());
} }
if(Optional.ofNullable(param.getStartTime()).isPresent()){ if (Optional.ofNullable(param.getStartTime()).isPresent()) {
gt("create_time", param.getStartTime()); gt("create_time", param.getStartTime());
} }
if(Optional.ofNullable(param.getEndTime()).isPresent()){ if (Optional.ofNullable(param.getEndTime()).isPresent()) {
lt("create_time", param.getEndTime()); lt("create_time", param.getEndTime());
} }
}}; }};
@ -85,20 +94,21 @@ public class SafeEquipmentTrialServiceImpl extends BaseServiceImpl<SafeEquipment
/** /**
* 查询设备列表 * 查询设备列表
*
* @param entity * @param entity
* @return * @return
*/ */
@Override @Override
public List<SafeEquipmentTrialEntity> getList(SafeEquipmentDTO entity) { public List<SafeEquipmentTrialEntity> getList(SafeEquipmentDTO entity) {
QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{ QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{
if(CollectionUtil.isEmpty(entity.getDeptList())){ if (CollectionUtil.isEmpty(entity.getDeptList())) {
if(Optional.ofNullable(entity.getCreateDept()).isPresent()){ if (Optional.ofNullable(entity.getCreateDept()).isPresent()) {
eq("create_dept",entity.getCreateDept()); eq("create_dept", entity.getCreateDept());
} }
} else { } else {
in("create_dept",entity.getDeptList()); in("create_dept", entity.getDeptList());
} }
if(Optional.ofNullable(entity.getTime()).isPresent()){ if (Optional.ofNullable(entity.getTime()).isPresent()) {
gt("create_time", entity.getTime()); gt("create_time", entity.getTime());
lt("create_time", entity.getTime()); lt("create_time", entity.getTime());
} }

Loading…
Cancel
Save