Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
ty 11 months ago
parent
commit
0134f3fbcf
  1. 6
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java
  2. 6
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java
  3. 6
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SparePartVO.java
  4. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  5. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  6. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClientFallback.java
  7. 28
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessMaterialClient.java
  8. 17
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/MaterialConsumeVO.java
  9. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneExportDTO.java
  10. 42
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java
  11. 58
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneRecordDTO.java
  12. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java
  13. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferencePlanEntity.java
  14. 1
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java
  15. 18
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java
  16. 12
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java
  17. 34
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneZoneEntity.java
  18. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalPlanEntity.java
  19. 7
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java
  20. 1
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java
  21. 8
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneMonthVO.java
  22. 39
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java
  23. 31
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java
  24. 34
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordPageVO.java
  25. 41
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneZoneDetailVO.java
  26. 3
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java
  27. 11
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java
  28. 3
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java
  29. 16
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml
  30. 3
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/IWtSpBasicService.java
  31. 6
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  32. 4
      hzims-service/equipment/pom.xml
  33. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  34. 16
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  35. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java
  36. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml
  37. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java
  38. 85
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  39. 34
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClient.java
  40. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.java
  41. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml
  42. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java
  43. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  44. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessMaterialService.java
  45. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessMaterialServiceImpl.java
  46. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  47. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/RepairBillVO.java
  48. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  49. 55
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java
  50. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  51. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  52. 17
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java
  53. 26
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml
  54. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java
  55. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml
  56. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java
  57. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.xml
  58. 33
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java
  59. 32
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java
  60. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneZoneService.java
  61. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java
  62. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java
  63. 207
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java
  64. 144
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java
  65. 42
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneZoneServiceImpl.java
  66. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java
  67. 17
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java
  68. 45
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  69. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java
  70. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  71. 39
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java
  72. 31
      hzims-service/safeproduct/src/main/resources/db/1.0.1.sql
  73. 9
      hzims-service/ticket/pom.xml
  74. 19
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/CensController.java
  75. 15
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java
  76. 6
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/CensService.java
  77. 449
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java
  78. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java
  79. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  80. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java
  81. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml
  82. 25
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
  83. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketBillVO.java
  84. 5
      hzims-service/ticket/src/main/resources/db/2.0.1.sql
  85. 9
      hzims-service/ticket/src/main/resources/file/线下工作票审批流程.bpmn20.xml

6
hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java

@ -3,6 +3,7 @@ package com.hnac.hzims.spare.feign;
import com.hnac.hzims.operational.census.vo.AreaTimelyVo; import com.hnac.hzims.operational.census.vo.AreaTimelyVo;
import com.hnac.hzims.spare.entity.*; import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.vo.ExceedVo; import com.hnac.hzims.spare.vo.ExceedVo;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
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;
@ -23,6 +24,8 @@ public interface ISpareClient {
String EXCEED_LIMIT = API_PREFIX + "/exceedLimit" ; String EXCEED_LIMIT = API_PREFIX + "/exceedLimit" ;
String SPARE_PART = API_PREFIX + "/sparePart" ;
/** /**
* 保存工单与出库单关联信息 * 保存工单与出库单关联信息
* @param recordEntity * @param recordEntity
@ -33,4 +36,7 @@ public interface ISpareClient {
@PostMapping(EXCEED_LIMIT) @PostMapping(EXCEED_LIMIT)
List<AreaTimelyVo> exceedLimit(@RequestParam("deptId") Long deptId); List<AreaTimelyVo> exceedLimit(@RequestParam("deptId") Long deptId);
@GetMapping(EXCEED_LIMIT)
List<SparePartVO> sparePart(@RequestParam("basics") List<Long> basics);
} }

6
hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java

@ -2,6 +2,7 @@ package com.hnac.hzims.spare.feign;
import com.hnac.hzims.operational.census.vo.AreaTimelyVo; import com.hnac.hzims.operational.census.vo.AreaTimelyVo;
import com.hnac.hzims.spare.entity.*; import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -24,4 +25,9 @@ public class ISpareClientFallback implements ISpareClient {
public List<AreaTimelyVo> exceedLimit(Long deptId) { public List<AreaTimelyVo> exceedLimit(Long deptId) {
return new ArrayList<>(); return new ArrayList<>();
} }
@Override
public List<SparePartVO> sparePart(List<Long> basics) {
return new ArrayList<>();
}
} }

6
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/SparePartVO.java → hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SparePartVO.java

@ -1,4 +1,4 @@
package com.hnac.hzims.equipment.vo; package com.hnac.hzims.spare.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -9,6 +9,10 @@ import lombok.Data;
*/ */
@Data @Data
public class SparePartVO { public class SparePartVO {
@ApiModelProperty(value = "物资类别编号")
private Long basicId;
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
private String emName; private String emName;

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -82,6 +82,8 @@ public interface IEmInfoClient {
String GET_EM_CREATE_TABLE = API_PREFIX + "/getEmCreateTable"; String GET_EM_CREATE_TABLE = API_PREFIX + "/getEmCreateTable";
String GET_VIDEO_DEVICE_BY_EM_CODE = API_PREFIX + "/getVideoDeviceByEmCode"; String GET_VIDEO_DEVICE_BY_EM_CODE = API_PREFIX + "/getVideoDeviceByEmCode";
String DEVICE_BY_PATH = API_PREFIX + "/deviceByPath";
@PostMapping(DETAIL) @PostMapping(DETAIL)
EmInfoEntity getByCode(@RequestParam("code") String id); EmInfoEntity getByCode(@RequestParam("code") String id);
@ -161,4 +163,7 @@ public interface IEmInfoClient {
@GetMapping(value = GET_VIDEO_DEVICE_BY_EM_CODE) @GetMapping(value = GET_VIDEO_DEVICE_BY_EM_CODE)
List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo); List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo);
@GetMapping(DEVICE_BY_PATH)
List<EmInfoEntity> deviceByPath(@RequestParam("emCode") String emCode);
} }

5
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -104,4 +104,9 @@ public class IEmInfoClientBack implements IEmInfoClient {
public List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo) { public List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo) {
return new ArrayList<>(); return new ArrayList<>();
} }
@Override
public List<EmInfoEntity> deviceByPath(String emCode) {
return new ArrayList<>();
}
} }

20
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClientFallback.java

@ -0,0 +1,20 @@
package com.hnac.hzims.operational.access.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* @author ysj
*/
@Component
public class AccessMaterialClientFallback implements IAccessMaterialClient {
@Override
public List<MaterialConsumeVO> materialConsume(List<Long> basics) {
return new ArrayList<>();
}
}

28
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessMaterialClient.java

@ -0,0 +1,28 @@
package com.hnac.hzims.operational.access.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author ysj
*/
@FeignClient(
value = OperationalConstants.APP_NAME,
fallback = AccessMaterialClientFallback.class
)
public interface IAccessMaterialClient {
String API_PREFIX = "/feign/accessMaterial";
String MATERIAL_CONSUME = API_PREFIX + "/materialConsume";
@GetMapping(MATERIAL_CONSUME)
List<MaterialConsumeVO> materialConsume(@RequestParam("basics") List<Long> basics);
}

17
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/MaterialConsumeVO.java

@ -0,0 +1,17 @@
package com.hnac.hzims.operational.access.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class MaterialConsumeVO {
@ApiModelProperty(value = "物资编号")
private Long basicId;
@ApiModelProperty(value = "消耗数量")
private Integer expend;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneExportDTO.java

@ -1,21 +0,0 @@
package com.hnac.hzims.safeproduct.dto;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2023-12-27
*/
@Data
@ExcelIgnoreUnannotated
@ApiModel(value = "卫生自查数据导出DTO类")
public class HygieneExportDTO {
@ApiModelProperty("卫生自查状态")
@ExcelProperty(value = "卫生自查状态", index = 8)
private String hygieneStatus;
}

42
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java

@ -0,0 +1,42 @@
package com.hnac.hzims.safeproduct.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "卫生自查计划DTO类")
public class HygienePlanDTO extends BaseEntity {
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("标准总分值")
private Integer standardScore;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划开始时间")
private Date scheduledStartTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划结束时间")
private Date scheduledEndTime;
@ApiModelProperty("责任区数据列表")
private List<HygieneZoneEntity> zoneList;
}

58
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneRecordDTO.java

@ -0,0 +1,58 @@
package com.hnac.hzims.safeproduct.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "卫生自查记录DTO类")
public class HygieneRecordDTO extends BaseEntity {
@ApiModelProperty("卫生自查计划id")
private Long hygienePlanId;
@NotNull
@Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位")
private String unit;
@Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("实际开始时间")
private Date actualStartTime;
@ApiModelProperty("实际结束时间")
private Date actualEndTime;
@ApiModelProperty("检查人")
private String checkUser;
@ApiModelProperty("责任区id")
private String hygieneZoneIds;
@ApiModelProperty("检查结果")
private String checkResult;
@ApiModelProperty("综合评分")
private String comprehensiveScore;
@ApiModelProperty("周数")
private Integer weekNum;
@Size(max = 1000, message = "检查图片字段长度不能超过1000")
@ApiModelProperty("检查图片")
private String imgPath;
}

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java

@ -26,11 +26,11 @@ public class RehearsalExportDTO {
private String subject; private String subject;
@ApiModelProperty("演练计划开始时间") @ApiModelProperty("演练计划开始时间")
@ExcelProperty(value = "演练计划开始时间", index = 2) @ExcelProperty(value = "计划开始时间", index = 2)
private Date scheduledStartTime; private Date scheduledStartTime;
@ApiModelProperty("演练计划结束时间") @ApiModelProperty("演练计划结束时间")
@ExcelProperty(value = "演练计划结束时间", index = 3) @ExcelProperty(value = "计划结束时间", index = 3)
private Date scheduledEndTime; private Date scheduledEndTime;
@ApiModelProperty("演练地点") @ApiModelProperty("演练地点")

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferencePlanEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.entity; package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -32,10 +33,12 @@ public class ConferencePlanEntity extends BaseEntity {
private String theme; private String theme;
@NotNull @NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("会议计划开始时间") @ApiModelProperty("会议计划开始时间")
private Date scheduledStartTime; private Date scheduledStartTime;
@NotNull @NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("会议计划结束时间") @ApiModelProperty("会议计划结束时间")
private Date scheduledEndTime; private Date scheduledEndTime;

1
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java

@ -41,7 +41,6 @@ public class ConferenceRecordEntity extends BaseEntity {
@ApiModelProperty("记录人") @ApiModelProperty("记录人")
private String recorder; private String recorder;
@Size(max = 250, message = "会议内容字段长度不能超过250")
@ApiModelProperty("会议内容") @ApiModelProperty("会议内容")
private String content; private String content;

18
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java

@ -22,22 +22,8 @@ import java.util.Date;
@ApiModel(value = "卫生自查计划实体类") @ApiModel(value = "卫生自查计划实体类")
public class HygienePlanEntity extends BaseEntity { public class HygienePlanEntity extends BaseEntity {
@NotNull @ApiModelProperty("编码")
@Size(max = 50, message = "单位字段长度不能超过50") private String code;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("责任区")
private String zone;
@ApiModelProperty("责任人")
private String principal;
@ApiModelProperty("检查项")
private String checkItem;
@ApiModelProperty("检查项分值")
private String checkItemScore;
@ApiModelProperty("标准总分值") @ApiModelProperty("标准总分值")
private Integer standardScore; private Integer standardScore;

12
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java

@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Date; import java.util.Date;
@ -23,6 +24,11 @@ public class HygieneRecordEntity extends BaseEntity {
@ApiModelProperty("卫生自查计划id") @ApiModelProperty("卫生自查计划id")
private Long hygienePlanId; private Long hygienePlanId;
@NotNull
@Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位")
private String unit;
@Size(max = 50, message = "编码字段长度不能超过50") @Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码") @ApiModelProperty("编码")
private String code; private String code;
@ -36,11 +42,15 @@ public class HygieneRecordEntity extends BaseEntity {
@ApiModelProperty("检查人") @ApiModelProperty("检查人")
private String checkUser; private String checkUser;
@ApiModelProperty("责任区id")
private String hygieneZoneIds;
@ApiModelProperty("检查结果") @ApiModelProperty("检查结果")
private String checkResult; private String checkResult;
@NotNull
@ApiModelProperty("综合评分") @ApiModelProperty("综合评分")
private Integer comprehensiveScore; private String comprehensiveScore;
@ApiModelProperty("周数") @ApiModelProperty("周数")
private Integer weekNum; private Integer weekNum;

34
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneZoneEntity.java

@ -0,0 +1,34 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_hygiene_zone")
@ApiModel(value = "卫生自查区域实体类")
public class HygieneZoneEntity extends BaseEntity {
@ApiModelProperty("卫生自查计划id")
private Long hygienePlanId;
@ApiModelProperty("责任区")
private String zone;
@ApiModelProperty("责任人")
private String principal;
@ApiModelProperty("检查项")
private String checkItem;
@ApiModelProperty("检查项分值")
private String checkItemScore;
}

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalPlanEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.entity; package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -32,10 +33,12 @@ public class RehearsalPlanEntity extends BaseEntity {
private String subject; private String subject;
@NotNull @NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("演练计划开始时间") @ApiModelProperty("演练计划开始时间")
private Date scheduledStartTime; private Date scheduledStartTime;
@NotNull @NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("演练计划结束时间") @ApiModelProperty("演练计划结束时间")
private Date scheduledEndTime; private Date scheduledEndTime;

7
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java

@ -4,6 +4,7 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField; 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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -32,12 +33,14 @@ public class TrainPlanEntity extends BaseEntity {
private String unit; private String unit;
@NotNull @NotNull
@ApiModelProperty("计划培训开始时间") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划开始时间")
@ExcelProperty(value = "计划开始时间", index = 6) @ExcelProperty(value = "计划开始时间", index = 6)
private Date scheduledStartTime; private Date scheduledStartTime;
@NotNull @NotNull
@ApiModelProperty("计划培训结束时间") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划结束时间")
@ExcelProperty(value = "计划结束时间", index = 7) @ExcelProperty(value = "计划结束时间", index = 7)
private Date scheduledEndTime; private Date scheduledEndTime;

1
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java

@ -41,7 +41,6 @@ public class TrainRecordEntity extends BaseEntity {
@ExcelProperty(value = "培训学员", index = 3) @ExcelProperty(value = "培训学员", index = 3)
private String peopleName; private String peopleName;
@Size(max = 5000, message = "培训内容字段长度超出限制范围")
@ApiModelProperty("培训内容") @ApiModelProperty("培训内容")
@ExcelProperty(value = "培训内容", index = 2) @ExcelProperty(value = "培训内容", index = 2)
private String content; private String content;

8
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneMonthVO.java

@ -1,5 +1,7 @@
package com.hnac.hzims.safeproduct.vo; package com.hnac.hzims.safeproduct.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -11,21 +13,27 @@ import java.math.BigDecimal;
* @date 2023-12-27 * @date 2023-12-27
*/ */
@Data @Data
@ExcelIgnoreUnannotated
@ApiModel(value = "卫生自查月度统计VO类") @ApiModel(value = "卫生自查月度统计VO类")
public class HygieneMonthVO { public class HygieneMonthVO {
@ApiModelProperty("单位") @ApiModelProperty("单位")
@ExcelProperty(value = "单位", index = 0)
private String unit; private String unit;
@ApiModelProperty("应检查次数") @ApiModelProperty("应检查次数")
@ExcelProperty(value = "应检查次数", index = 1)
private Long scheduledCheckNum; private Long scheduledCheckNum;
@ApiModelProperty("已检查次数") @ApiModelProperty("已检查次数")
@ExcelProperty(value = "已检查次数", index = 2)
private Long finishedCheckNum; private Long finishedCheckNum;
@ApiModelProperty("未检查次数") @ApiModelProperty("未检查次数")
@ExcelProperty(value = "未检查次数", index = 3)
private Long unfinishedCheckNum; private Long unfinishedCheckNum;
@ApiModelProperty("完成率") @ApiModelProperty("完成率")
@ExcelProperty(value = "完成率/%", index = 4)
private BigDecimal completionRate; private BigDecimal completionRate;
} }

39
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java

@ -0,0 +1,39 @@
package com.hnac.hzims.safeproduct.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "卫生自查计划详情VO类")
public class HygienePlanDetailVO extends BaseEntity {
@ApiModelProperty("标准总分值")
private Integer standardScore;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划开始时间")
private Date scheduledStartTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划结束时间")
private Date scheduledEndTime;
@ApiModelProperty("责任区数据列表")
private List<HygieneZoneEntity> zoneList;
}

31
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author liwen * @author liwen
@ -14,33 +15,33 @@ import java.util.Date;
@ApiModel(value = "卫生自查记录详情VO类") @ApiModel(value = "卫生自查记录详情VO类")
public class HygieneRecordDetailVO { public class HygieneRecordDetailVO {
@ApiModelProperty("责任区")
private String zone;
@ApiModelProperty("责任人")
private String principal;
@ApiModelProperty("检查项")
private String checkItem;
@ApiModelProperty("检查项分值")
private String checkItemScore;
@ApiModelProperty("编码") @ApiModelProperty("编码")
private String code; private String code;
@ApiModelProperty("检查时间") @ApiModelProperty("实际结束时间")
private Date checkTime; private Date actualEndTime;
@ApiModelProperty("检查人") @ApiModelProperty("检查人")
private String checkUser; private String checkUser;
@ApiModelProperty("责任区id")
private String hygieneZoneIds;
@ApiModelProperty("检查结果") @ApiModelProperty("检查结果")
private String checkResult; private String checkResult;
@ApiModelProperty("综合评分") @ApiModelProperty("综合评分")
private Integer comprehensiveScore; private String comprehensiveScore;
@ApiModelProperty("周数") @ApiModelProperty("周数")
private Integer weekNum; private Integer weekNum;
@ApiModelProperty("检查图片")
private String imgPath;
@ApiModelProperty("卫生自查计划id")
private Long hygienePlanId;
@ApiModelProperty("检查信息列表")
private List<HygieneZoneDetailVO> checkList;
} }

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

@ -0,0 +1,34 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-03
*/
@Data
@ApiModel(value = "卫生自查记录页面VO类")
public class HygieneRecordPageVO {
@ApiModelProperty("卫生自查记录id")
private Long id;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("实际开始时间")
private Date actualStartTime;
@ApiModelProperty("实际结束时间")
private Date actualEndTime;
@ApiModelProperty("检查人")
private String checkUser;
@ApiModelProperty("周数")
private Integer weekNum;
}

41
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneZoneDetailVO.java

@ -0,0 +1,41 @@
package com.hnac.hzims.safeproduct.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@ExcelIgnoreUnannotated
@ApiModel(value = "卫生自查详情VO类")
public class HygieneZoneDetailVO {
@ApiModelProperty("责任区")
@ExcelProperty(value = "责任区", index = 0)
private String zone;
@ApiModelProperty("责任人")
@ExcelProperty(value = "责任人", index = 1)
private String principal;
@ApiModelProperty("检查项")
@ExcelProperty(value = "检查项", index = 2)
private String checkItem;
@ApiModelProperty("检查项分值")
@ExcelProperty(value = "检查项分值", index = 3)
private String checkItemScore;
@ApiModelProperty("检查结果")
@ExcelProperty(value = "检查结果", index = 4)
private String result;
@ApiModelProperty("综合评分")
@ExcelProperty(value = "综合评分", index = 5)
private Integer score;
}

3
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/workTicket/entity/WorkTicketInfoEntity.java

@ -497,4 +497,7 @@ public class WorkTicketInfoEntity extends TenantEntity implements Serializable {
@TableField(exist=false) @TableField(exist=false)
private Integer isQualified; private Integer isQualified;
@ApiModelProperty("是否线下 : 1-线下,0-线上")
private Boolean isOffline;
} }

11
hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java

@ -6,6 +6,7 @@ import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.mapper.SpRecordMapper; import com.hnac.hzims.spare.mapper.SpRecordMapper;
import com.hnac.hzims.spare.mapper.SpWarehouseOutMapper; import com.hnac.hzims.spare.mapper.SpWarehouseOutMapper;
import com.hnac.hzims.spare.service.*; import com.hnac.hzims.spare.service.*;
import com.hnac.hzims.spare.vo.SparePartVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -129,4 +130,14 @@ public class SpareClient implements ISpareClient{
} }
return exceeds; return exceeds;
} }
/**
* 备品备件台账
* @param basics
* @return
*/
@Override
public List<SparePartVO> sparePart(List<Long> basics) {
return wtSpBasicService.sparePart(basics);
}
} }

3
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java

@ -2,9 +2,11 @@ package com.hnac.hzims.spare.mapper;
import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity; import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity;
import com.hnac.hzims.spare.entity.WtSpBasicEntity; import com.hnac.hzims.spare.entity.WtSpBasicEntity;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
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 org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -46,4 +48,5 @@ public interface WtSpBasicMapper extends UserDataScopeBaseMapper<WtSpBasicEntity
@UserDataAuth @UserDataAuth
List<SpTemporaryStockDetailEntity> getInList(Long spBasicId); List<SpTemporaryStockDetailEntity> getInList(Long spBasicId);
List<SparePartVO> sparePart(@RequestParam("basics") List<Long> basics);
} }

16
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml

@ -94,4 +94,20 @@
AND b.type = 5 AND b.type = 5
</select> </select>
<select id="sparePart" resultType="com.hnac.hzims.spare.vo.SparePartVO">
SELECT basic.ID as basicId,house.`NAME` as houseName,basic.`NAME` as basicName,basic.UPPER_LIMIT,basic.LOWER_LIMIT,total.stock
FROM WT_SP_BASIC basic
LEFT JOIN WT_SP_TOTAL total ON basic.id = total.SP_BASIC_ID
LEFT JOIN WT_SP_WAREHOUSE house ON total.WAREHOUSE_ID = house.id
<where>
1 = 2 OR
<if test="basics != null">
and basic.ID in
<foreach collection="basics" item="basic" index="index" open="(" close=")" separator=",">
#{basic}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>

3
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/IWtSpBasicService.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity; import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity;
import com.hnac.hzims.spare.entity.SpTemporaryStockEntity; import com.hnac.hzims.spare.entity.SpTemporaryStockEntity;
import com.hnac.hzims.spare.entity.WtSpBasicEntity; import com.hnac.hzims.spare.entity.WtSpBasicEntity;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
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.mp.support.Query;
@ -73,6 +74,8 @@ public interface IWtSpBasicService extends BaseService<WtSpBasicEntity> {
R importExcel(MultipartFile file) throws Exception; R importExcel(MultipartFile file) throws Exception;
List<SparePartVO> sparePart(List<Long> basics);
/** /**
* 获取流程中的用户 * 获取流程中的用户
* @param deptId * @param deptId

6
hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java

@ -29,6 +29,7 @@ import com.hnac.hzims.spare.service.IWtSpTotalService;
import com.hnac.hzims.spare.service.IWtSpWarehouseService; import com.hnac.hzims.spare.service.IWtSpWarehouseService;
import com.hnac.hzims.spare.utils.ExcelToolListener; import com.hnac.hzims.spare.utils.ExcelToolListener;
import com.hnac.hzims.spare.utils.SheetWriteStyleHandler; import com.hnac.hzims.spare.utils.SheetWriteStyleHandler;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.spare.vo.WtSpBasicVO;
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient; import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
@ -580,6 +581,11 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl<WtSpBasicMapper, WtSpB
} }
@Override
public List<SparePartVO> sparePart(List<Long> basics) {
return this.basicMapper.sparePart(basics);
}
private InputStream copyStream(InputStream source) throws IOException { private InputStream copyStream(InputStream source) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];

4
hzims-service/equipment/pom.xml

@ -98,6 +98,10 @@
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>inspect-api</artifactId> <artifactId>inspect-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>assets-api</artifactId>
</dependency>
</dependencies> </dependencies>

3
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java

@ -10,14 +10,13 @@ import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.equipment.dto.DeviceTreeDTO; import com.hnac.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.EmInfoAddVo; import com.hnac.hzims.equipment.vo.EmInfoAddVo;
import com.hnac.hzims.equipment.vo.EmInfoContentVO; import com.hnac.hzims.equipment.vo.EmInfoContentVO;
import com.hnac.hzims.equipment.vo.EmInfoVO; import com.hnac.hzims.equipment.vo.EmInfoVO;
import com.hnac.hzims.equipment.vo.SparePartVO;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.util.MemoryPagination; import com.hnac.hzims.util.MemoryPagination;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;

16
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -9,11 +9,16 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.DeviceVO; import com.hnac.hzims.equipment.vo.DeviceVO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.vo.CreateTableVO; import org.springblade.system.vo.CreateTableVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -131,6 +136,17 @@ public class EmInfoClient implements IEmInfoClient {
public List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo) { public List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo) {
return service.getVideoDeviceByEmCode(emInfo); return service.getVideoDeviceByEmCode(emInfo);
} }
/**
* 获取设备路径下的设备
* @param emCode
* @return
*/
@Override
public List<EmInfoEntity> deviceByPath(String emCode) {
return service.deviceByPath(emCode);
}
@PostMapping(GET_EM_CREATE_TABLE) @PostMapping(GET_EM_CREATE_TABLE)
@Override @Override
public List<CreateTableVO> getEmCreateTable(List<String> tableNames) { public List<CreateTableVO> getEmCreateTable(List<String> tableNames) {

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java

@ -4,7 +4,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.EmInfoExtendVo; import com.hnac.hzims.equipment.vo.EmInfoExtendVo;
import com.hnac.hzims.equipment.vo.DeviceVO; import com.hnac.hzims.equipment.vo.DeviceVO;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.SparePartVO; import com.hnac.hzims.spare.vo.SparePartVO;
import org.apache.ibatis.annotations.Param; 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;

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml

@ -120,7 +120,7 @@
select max(em_index) from hzims_em_info where DEPARTMENT = #{department} and em_grade = #{emGrade} and is_deleted = 0 select max(em_index) from hzims_em_info where DEPARTMENT = #{department} and em_grade = #{emGrade} and is_deleted = 0
</select> </select>
<select id="getSparePart" resultType="com.hnac.hzims.equipment.vo.SparePartVO"> <select id="getSparePart" resultType="com.hnac.hzims.spare.vo.SparePartVO">
select info.`NAME` as emName,house.`NAME` as houseName,basic.`NAME` as basicName, select info.`NAME` as emName,house.`NAME` as houseName,basic.`NAME` as basicName,
mat.number as expend,basic.UPPER_LIMIT,basic.LOWER_LIMIT,total.stock mat.number as expend,basic.UPPER_LIMIT,basic.LOWER_LIMIT,total.stock
from hzims_em_info info from hzims_em_info info

3
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.equipment.dto.DeviceTreeDTO; import com.hnac.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.*; import com.hnac.hzims.equipment.vo.*;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -91,4 +92,6 @@ public interface IEmInfoService extends BaseService<EmInfoEntity> {
List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo); List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo);
List<EmInfoEntity> hkVideoDevices(); List<EmInfoEntity> hkVideoDevices();
List<EmInfoEntity> deviceByPath(String emCode);
} }

85
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -17,9 +17,13 @@ import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper;
import com.hnac.hzims.equipment.service.*; import com.hnac.hzims.equipment.service.*;
import com.hnac.hzims.equipment.vo.*; import com.hnac.hzims.equipment.vo.*;
import com.hnac.hzims.fdp.service.IFdpQuestionService; import com.hnac.hzims.fdp.service.IFdpQuestionService;
import com.hnac.hzims.operational.access.feign.IAccessMaterialClient;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.spare.feign.ISpareClient;
import com.hnac.hzims.spare.vo.SparePartVO;
import com.hnac.hzims.util.TableJsonUtils; import com.hnac.hzims.util.TableJsonUtils;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
@ -87,12 +91,17 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Autowired @Autowired
private IEmTreeInspectService emTreeInspectService; private IEmTreeInspectService emTreeInspectService;
@Autowired @Autowired
private IEmTreeBasicService emTreeBasicService;
@Autowired
private IEmDefinitionService emDefinitionService; private IEmDefinitionService emDefinitionService;
@Autowired @Autowired
private IAccessMaterialClient accessMaterialClient;
@Autowired
private IStationClient stationClient; private IStationClient stationClient;
@Autowired @Autowired
private IAnalyseDataSearchClient searchClient; private IAnalyseDataSearchClient searchClient;
@Autowired
private ISpareClient spareClient;
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@ -563,10 +572,61 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return emInfoContentList; return emInfoContentList;
} }
/**
* 备品备件台账
* @param emCode
* @param startTime
* @param endTime
* @return
*/
@Override @Override
public List<SparePartVO> getSparePart(String emCode, String startTime, String endTime) { public List<SparePartVO> getSparePart(String emCode, String startTime, String endTime) {
EmInfoEntity emInfo = this.getEmInfoByEmCode(emCode); // 查询路径设备
return baseMapper.getSparePart(emInfo.getPath(), startTime, endTime); List<EmInfoEntity> devices = deviceByPath(emCode);
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
// 物资台账记录
List<Long> trees = devices.stream().map(EmInfoEntity::getTreeId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
if(CollectionUtil.isEmpty(trees)){
return new ArrayList<>();
}
List<EmTreeBasicEntity> treeBasics = emTreeBasicService.list(Wrappers.<EmTreeBasicEntity>lambdaQuery()
.in(EmTreeBasicEntity::getTreeId,trees));
if(CollectionUtil.isEmpty(treeBasics)){
return new ArrayList<>();
}
List<Long> basics = treeBasics.stream().map(EmTreeBasicEntity::getBasicId).filter(ObjectUtil::isNotEmpty).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
if(CollectionUtil.isEmpty(basics)){
return new ArrayList<>();
}
// 仓库、物资种类、库存上限、库存下限、物资库存
List<SparePartVO> spares = spareClient.sparePart(basics);
if(CollectionUtil.isEmpty(spares)){
return new ArrayList<>();
}
// 物资消耗
List<MaterialConsumeVO> consumes = accessMaterialClient.materialConsume(basics);
return spares.stream().peek(spare -> {
List<MaterialConsumeVO> spareConsumes = consumes.stream().filter(consume->consume.getBasicId().equals(spare.getBasicId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(spareConsumes)){
spare.setExpend(0);
}else{
spare.setExpend(spareConsumes.get(0).getExpend());
}
// 设备名称
List<EmTreeBasicEntity> deviceBasics = treeBasics.stream().filter(tree->tree.getBasicId().equals(spare.getBasicId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deviceBasics)){
spare.setEmName("未知设备");
}else{
List<EmInfoEntity> deivceEntitys = devices.stream().filter(device->device.getTreeId().equals(deviceBasics.get(0).getTreeId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deivceEntitys)){
spare.setEmName("未知设备");
}else{
spare.setEmName(deivceEntitys.get(0).getName());
}
}
}).collect(Collectors.toList());
} }
@Override @Override
@ -911,4 +971,23 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
.eq(EmInfoEntity::getEmType,4)); .eq(EmInfoEntity::getEmType,4));
} }
/**
* 符合设备路径的设备
* @param emCode
* @return
*/
@Override
public List<EmInfoEntity> deviceByPath(String emCode) {
EmInfoEntity device = this.getOne(Wrappers.<EmInfoEntity>lambdaQuery().
eq(EmInfoEntity::getNumber,emCode));
if(ObjectUtil.isEmpty(device)){
return new ArrayList<>();
}
if(StringUtil.isEmpty(device.getPath())){
return Collections.singletonList(device);
}
String[] deviceCodes = device.getPath().split("/");
return this.list(Wrappers.<EmInfoEntity>lambdaQuery().in(EmInfoEntity::getNumber, Arrays.asList(deviceCodes)));
}
} }

34
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClient.java

@ -0,0 +1,34 @@
package com.hnac.hzims.operational.access.feign;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.service.AccessPlanV4Service;
import com.hnac.hzims.operational.access.service.IOperAccessMaterialService;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author ysj
*/
@RestController
@RequestMapping("/feign/accessMaterial")
@Slf4j
@RequiredArgsConstructor
public class AccessMaterialClient implements IAccessMaterialClient {
private final IOperAccessMaterialService accessMaterialService;
/**
* 备品备件台账-物资消耗
* @param basics
* @return
*/
@Override
public List<MaterialConsumeVO> materialConsume(@RequestParam("basics") List<Long> basics) {
return accessMaterialService.materialConsume(basics);
}
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.access.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
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;
@ -17,4 +18,6 @@ import java.util.List;
public interface OperAccessMaterialMapper extends BaseMapper<OperAccessMaterialEntity> { public interface OperAccessMaterialMapper extends BaseMapper<OperAccessMaterialEntity> {
List<OperAccessMaterialEntity> getList(@Param(value = "planId") String planId,@Param(value = "taskId") String taskId); List<OperAccessMaterialEntity> getList(@Param(value = "planId") String planId,@Param(value = "taskId") String taskId);
List<MaterialConsumeVO> materialConsume(@Param(value = "basics") List<Long> basics);
} }

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml

@ -39,4 +39,19 @@
</if> </if>
</select> </select>
<select id="materialConsume" resultType="com.hnac.hzims.operational.access.vo.MaterialConsumeVO">
SELECT SP_BASIC_ID AS basicId,sum(NUMBER) FROM HZIMS_OPER_ACCESS_MATERIAL
<where>
NOT SP_BASIC_ID IS NULL AND
1 = 2 OR
<if test="basics != null">
and basic.ID in
<foreach collection="basics" item="basic" index="index" open="(" close=")" separator=",">
#{basic}
</foreach>
</if>
</where>
GROUP BY SP_BASIC_ID
</select>
</mapper> </mapper>

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java

@ -41,5 +41,5 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper<OperAccess
List<OperAccessTaskEntity> selectAccessTask(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("list")List<Long> list); List<OperAccessTaskEntity> selectAccessTask(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("list")List<Long> list);
List<RepairBillVO> getRepairBill(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime); List<RepairBillVO> getRepairBill(@Param("deviceCodes") List<String> deviceCodes,@Param("startTime") String startTime, @Param("endTime") String endTime);
} }

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml

@ -207,15 +207,17 @@
</select> </select>
<select id="getRepairBill" resultType="com.hnac.hzims.operational.access.vo.RepairBillVO"> <select id="getRepairBill" resultType="com.hnac.hzims.operational.access.vo.RepairBillVO">
SELECT e.`NAME` AS emName,p.`GRADE_CODE`,count(t.ID) AS frequency, SELECT t.EM_CODE AS emCode,p.`GRADE_CODE`,count(t.ID) AS frequency,
sum(m.NUMBER) AS amount,t.ACT_HOURS,max(t.PLAN_START_TIME) AS recently sum(m.NUMBER) AS amount,t.ACT_HOURS,max(t.PLAN_START_TIME) AS recently
FROM hzims_oper_access_task t FROM hzims_oper_access_task t
LEFT JOIN hzims_oper_access_plan p ON t.PLAN_ID = p.ID LEFT JOIN hzims_oper_access_plan p ON t.PLAN_ID = p.ID
LEFT JOIN hzims_oper_access_material m ON t.ID = m.TASK_ID LEFT JOIN hzims_oper_access_material m ON t.ID = m.TASK_ID
LEFT JOIN equipment.hzims_em_info e ON t.EM_CODE = e.NUMBER
<where> <where>
<if test="path != null"> <if test="deviceCodes != null">
e.path like CONCAT(#{path},'%') and t.EM_CODE in
<foreach collection="deviceCodes" item="code" index="index" open="(" close=")" separator=",">
#{code}
</foreach>
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
and t.PLAN_START_TIME &gt;= #{startTime} and t.PLAN_START_TIME &gt;= #{startTime}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessMaterialService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.access.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessMaterialDTO; import com.hnac.hzims.operational.access.dto.OperAccessMaterialDTO;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import com.hnac.hzims.operational.access.vo.OperAccessMaterialVO; import com.hnac.hzims.operational.access.vo.OperAccessMaterialVO;
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.mp.support.Query;
@ -25,4 +26,6 @@ public interface IOperAccessMaterialService extends BaseService<OperAccessMateri
R<IPage<OperAccessMaterialVO>> list(OperAccessMaterialDTO req, Query query); R<IPage<OperAccessMaterialVO>> list(OperAccessMaterialDTO req, Query query);
List<OperAccessMaterialVO> getList(String planId,String taskId); List<OperAccessMaterialVO> getList(String planId,String taskId);
List<MaterialConsumeVO> materialConsume(List<Long> basics);
} }

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessMaterialServiceImpl.java

@ -7,6 +7,7 @@ import com.hnac.hzims.operational.access.dto.OperAccessMaterialDTO;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.mapper.OperAccessMaterialMapper; import com.hnac.hzims.operational.access.mapper.OperAccessMaterialMapper;
import com.hnac.hzims.operational.access.service.IOperAccessMaterialService; import com.hnac.hzims.operational.access.service.IOperAccessMaterialService;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import com.hnac.hzims.operational.access.vo.OperAccessMaterialVO; import com.hnac.hzims.operational.access.vo.OperAccessMaterialVO;
import com.hnac.hzims.operational.access.wrapper.OperAccessMaterialWrapper; import com.hnac.hzims.operational.access.wrapper.OperAccessMaterialWrapper;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
@ -66,4 +67,14 @@ public class OperAccessMaterialServiceImpl extends BaseServiceImpl<OperAccessMat
} }
return OperAccessMaterialWrapper.build().listVO(list); return OperAccessMaterialWrapper.build().listVO(list);
} }
/**
* 备品备件台账
* @param basics
* @return
*/
@Override
public List<MaterialConsumeVO> materialConsume(List<Long> basics) {
return this.baseMapper.materialConsume(basics);
}
} }

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -426,11 +426,32 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
return baseMapper.selectPage(dbPage, queryWrapper); return baseMapper.selectPage(dbPage, queryWrapper);
} }
/**
* 获取设备检修台账
* @param emCode
* @param startTime
* @param endTime
* @return
*/
@Override @Override
public List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime) { public List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime) {
EmInfoEntity emInfo = emInfoClient.getEmInfoByEmCode(emCode).getData(); // 查询路径设备
List<RepairBillVO> repairBillList = baseMapper.getRepairBill(emInfo.getPath(), startTime, endTime); List<EmInfoEntity> devices = emInfoClient.deviceByPath(emCode);
return repairBillList; if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
List<RepairBillVO> repairs = baseMapper.getRepairBill(devices.stream().map(EmInfoEntity::getNumber).collect(Collectors.toList()),startTime, endTime);
if(CollectionUtil.isEmpty(repairs)){
return new ArrayList<>();
}
return repairs.stream().map(repair->{
List<EmInfoEntity> repairDevice = devices.stream().filter(device->device.getNumber().equals(repair.getEmCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(repairDevice)){
return repair;
}
repair.setEmName(repairDevice.get(0).getName());
return repair;
}).collect(Collectors.toList());
} }
@Override @Override

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/RepairBillVO.java

@ -12,6 +12,9 @@ import lombok.EqualsAndHashCode;
@Data @Data
public class RepairBillVO { public class RepairBillVO {
@ApiModelProperty("设备编码")
private String emCode;
@ApiModelProperty("设备名称") @ApiModelProperty("设备名称")
private String emName; private String emName;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -244,7 +244,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ServletOutputStream outputStream; ServletOutputStream outputStream;
try { try {
//设置xlsx格式 //设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xlsx", "UTF-8")); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xls", "UTF-8"));
//创建一个输出流 //创建一个输出流
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
//写入数据 //写入数据

55
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java

@ -3,12 +3,16 @@ package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygienePlanService;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -43,15 +47,15 @@ public class HygieneController extends BladeController {
@PostMapping("/savePlan") @PostMapping("/savePlan")
@ApiOperation(value = "新增卫生自查计划") @ApiOperation(value = "新增卫生自查计划")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R savePlan(@Valid @RequestBody HygienePlanEntity hygienePlanEntity) { public R savePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) {
return hygienePlanService.savePlan(hygienePlanEntity); return hygienePlanService.savePlan(hygienePlanDTO);
} }
@PostMapping("/updatePlan") @PostMapping("/updatePlan")
@ApiOperation(value = "修改卫生自查计划") @ApiOperation(value = "修改卫生自查计划")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R updatePlan(@Valid @RequestBody HygienePlanEntity hygienePlanEntity) { public R updatePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) {
return hygienePlanService.updatePlan(hygienePlanEntity); return hygienePlanService.updatePlan(hygienePlanDTO);
} }
@PostMapping("/removePlan") @PostMapping("/removePlan")
@ -64,14 +68,14 @@ public class HygieneController extends BladeController {
@GetMapping("/planDetail") @GetMapping("/planDetail")
@ApiOperation(value = "卫生自查计划详情") @ApiOperation(value = "卫生自查计划详情")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
public R<HygienePlanEntity> planDetail(@RequestParam Long id) { public R<HygienePlanDetailVO> planDetail(@RequestParam Long id) {
return R.data(hygienePlanService.getById(id)); return R.data(hygienePlanService.getPlan(id));
} }
@GetMapping("/planPage") @GetMapping("/planPage")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "zone", value = "责任区", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "principal", value = "责任人", dataType = "query", paramType = "string") @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "卫生自查计划分页") @ApiOperation(value = "卫生自查计划分页")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ -83,15 +87,15 @@ public class HygieneController extends BladeController {
@PostMapping("/saveRecord") @PostMapping("/saveRecord")
@ApiOperation(value = "新增卫生自查记录") @ApiOperation(value = "新增卫生自查记录")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
public R saveRecord(@Valid @RequestBody HygieneRecordEntity hygieneRecordEntity) { public R saveRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) {
return hygieneRecordService.saveRecord(hygieneRecordEntity); return hygieneRecordService.saveRecord(hygieneRecordDTO);
} }
@PostMapping("/updateRecord") @PostMapping("/updateRecord")
@ApiOperation(value = "修改卫生自查记录") @ApiOperation(value = "修改卫生自查记录")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
public R updateRecord(@Valid @RequestBody HygieneRecordEntity hygieneRecordEntity) { public R updateRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) {
return hygieneRecordService.updateRecord(hygieneRecordEntity); return hygieneRecordService.updateRecord(hygieneRecordDTO);
} }
@PostMapping("/removeRecord") @PostMapping("/removeRecord")
@ -114,29 +118,34 @@ public class HygieneController extends BladeController {
}) })
@ApiOperation(value = "卫生自查记录分页") @ApiOperation(value = "卫生自查记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<HygieneRecordEntity>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<HygieneRecordPageVO>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<HygieneRecordEntity> page = hygieneRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(param, IPage<HygieneRecordPageVO> page = hygieneRecordService.recordPage(param, query);
HygieneRecordEntity.class));
return R.data(page); return R.data(page);
} }
@GetMapping("/dataByMonth") @GetMapping("/dataByMonth")
@ApiOperation(value = "月度统计表") @ApiOperation(value = "月度统计表")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
public R<IPage<HygieneMonthVO>> dataByMonth(@RequestParam String month, Query query) { public R<IPage<HygieneMonthVO>> dataByMonth(@RequestParam String month, String unit, Query query) {
IPage<HygieneMonthVO> page = hygienePlanService.dataByMonth(month, query); IPage<HygieneMonthVO> page = hygienePlanService.dataByMonth(month, unit, query);
return R.data(page); return R.data(page);
} }
@GetMapping("/exportHygieneData") @GetMapping("/exportHygieneData")
@ApiOperation(value = "卫生自查数据导出")
@ApiOperationSupport(order = 12)
public void exportHygieneData(@RequestParam Long hygieneRecordId, HttpServletResponse response) {
hygieneRecordService.exportHygieneData(hygieneRecordId, response);
}
@GetMapping("/exportMonthData")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "month", value = "月份", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "卫生自查数据导出") @ApiOperation(value = "月度数据导出")
@ApiOperationSupport(order = 13) @ApiOperationSupport(order = 13)
public void exportHygieneData(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletResponse response) { public void exportMonthData(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletResponse response) {
hygienePlanService.exportHygieneData(param, response); hygienePlanService.exportMonthData(param, query, response);
} }
} }

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalRecordController.java → hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java

@ -25,7 +25,7 @@ import javax.validation.Valid;
import java.util.Map; import java.util.Map;
/** /**
* 演练记录接口类 * 演练管理接口类
* *
* @author liwen * @author liwen
* @date 2023-12-13 * @date 2023-12-13
@ -33,8 +33,8 @@ import java.util.Map;
@RestController @RestController
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/rehearsal") @RequestMapping("/rehearsal")
@Api(value = "演练记录", tags = "演练记录接口") @Api(value = "演练管理", tags = "演练管理接口")
public class RehearsalRecordController extends BladeController { public class RehearsalController extends BladeController {
private final IRehearsalRecordService rehearsalRecordService; private final IRehearsalRecordService rehearsalRecordService;

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java

@ -83,8 +83,8 @@ public class TrainController extends BladeController {
@GetMapping("/trainPlanPage") @GetMapping("/trainPlanPage")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "scheduledStartTime", value = "计划培训开始时间", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "scheduledEndTime", value = "计划培训结束时间", dataType = "query", paramType = "string") @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "培训计划分页") @ApiOperation(value = "培训计划分页")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)

17
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java

@ -2,12 +2,10 @@ package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.HygieneExportDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 卫生自查计划Mapper类 * 卫生自查计划Mapper类
@ -21,25 +19,18 @@ public interface HygienePlanMapper extends BaseMapper<HygienePlanEntity> {
/** /**
* 查询当月各单位的卫生自查总数 * 查询当月各单位的卫生自查总数
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月的卫生自查总数据 * @return 当月的卫生自查总数据
*/ */
IPage<HygieneMonthVO> selectByMonth(IPage<HygieneMonthVO> page, String month); IPage<HygieneMonthVO> selectByMonth(IPage<HygieneMonthVO> page, String unit, String month);
/** /**
* 查询当月各单位已完成的卫生自查数据 * 查询当月各单位已完成的卫生自查数据
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月的已完成数据 * @return 当月的已完成数据
*/ */
IPage<HygieneMonthVO> selectFinishedDataByMonth(IPage<HygieneMonthVO> page, String month); IPage<HygieneMonthVO> selectFinishedDataByMonth(IPage<HygieneMonthVO> page, String unit, String month);
/**
* 根据单位和计划时间查询卫生自查记录
* @param unit 单位
* @param startTime 计划开始时间
* @param endTime 计划结束时间
* @return 卫生自查记录
*/
List<HygieneExportDTO> getHygieneByUnitAndDate(String unit, String startTime, String endTime);
} }

26
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml

@ -9,6 +9,9 @@
WHERE WHERE
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
@ -24,29 +27,12 @@
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
AND hygiene_status = 'FINISHED' AND hygiene_status = 'FINISHED'
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
unit unit
</select> </select>
<select id="getHygieneByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.HygieneExportDTO">
SELECT
t1.unit, t1.zone, t1.principal, t1.check_item, t1.check_item_score, t2.code, t2.check_result, t2.comprehensive_score,
t2.check_user, t2.actual_start_time, t2.actual_end_time, t1.hygiene_status
FROM
hzims_hygiene_plan t1
LEFT JOIN hzims_hygiene_record t2 ON t1.id = t2.hygiene_plan_id
WHERE
t1.is_deleted = 0
<if test="unit != 'null' and unit != ''">
AND t1.unit like concat('%', #{unit}, '%')
</if>
<if test="startTime != 'null' and startTime != ''">
AND t1.scheduled_start_time >= #{startTime}
</if>
<if test="endTime != 'null' and endTime != ''">
AND t1.scheduled_end_time &lt; #{endTime}
</if>
</select>
</mapper> </mapper>

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java

@ -1,10 +1,14 @@
package com.hnac.hzims.safeproduct.mapper; package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
/** /**
* 卫生自查记录Mapper类 * 卫生自查记录Mapper类
* *
@ -20,4 +24,12 @@ public interface HygieneRecordMapper extends BaseMapper<HygieneRecordEntity> {
* @return 卫生自查记录详情VO类 * @return 卫生自查记录详情VO类
*/ */
HygieneRecordDetailVO getRecordDetail(Long id); HygieneRecordDetailVO getRecordDetail(Long id);
/**
* 卫生自查记录页面
* @param param 入参
* @param page 分页类
* @return 记录数据页
*/
IPage<HygieneRecordPageVO> recordPage(IPage<HygieneRecordPageVO> page, Map<String, Object> param);
} }

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml

@ -3,13 +3,24 @@
<select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO"> <select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO">
SELECT SELECT
t2.zone, t2.principal, t2.check_item, t2.check_item_score, t1.code, t1.check_time, t1.check_user, code, actual_end_time, check_user, hygiene_zone_ids, check_result,comprehensive_score, week_num,
t1.check_result, t1.comprehensive_score, t1.week_num img_path, hygiene_plan_id
FROM FROM
hzims_hygiene_record t1 hzims_hygiene_record
LEFT JOIN hzims_hygiene_plan t2 ON t1.hygiene_plan_id = h2.id
WHERE WHERE
t1.is_deleted = 0 is_deleted = 0
AND t1.id = #{id} AND id = #{id}
</select>
<select id="recordPage" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO">
SELECT
id, unit, actual_start_time, actual_end_time, check_user, week_num
FROM
hzims_hygiene_record
WHERE
is_deleted = 0
<if test="param.hygienePlanId != null and param.hygienePlanId != ''">
AND hygiene_plan_id = #{hygienePlanId}
</if>
</select> </select>
</mapper> </mapper>

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java

@ -0,0 +1,10 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface HygieneZoneMapper extends BaseMapper<HygieneZoneEntity> {
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.xml

@ -0,0 +1,4 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.HygieneZoneMapper">
</mapper>

33
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java

@ -2,7 +2,9 @@ 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.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
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;
@ -35,30 +37,43 @@ public interface IHygienePlanService extends IService<HygienePlanEntity> {
/** /**
* 新增卫生自查计划 * 新增卫生自查计划
* @param hygienePlanEntity 卫生自查计划实体 * @param hygienePlanDTO 卫生自查DTO
* @return 结果封装类 * @return 结果封装类
*/ */
R savePlan(HygienePlanEntity hygienePlanEntity); R savePlan(HygienePlanDTO hygienePlanDTO);
/** /**
* 修改卫生自查计划 * 修改卫生自查计划
* @param hygienePlanEntity 卫生自查计划实体 * @param hygienePlanDTO 卫生自查DTO
* @return 结果封装类 * @return 结果封装类
*/ */
R updatePlan(HygienePlanEntity hygienePlanEntity); R updatePlan(HygienePlanDTO hygienePlanDTO);
/** /**
* 卫生自查月度数据 * 卫生自查月度数据
* @param month 月份 * @param month 月份
* @param unit 单位
* @param query 分页类 * @param query 分页类
* @return 月度统计分页 * @return 月度统计分页
*/ */
IPage<HygieneMonthVO> dataByMonth(String month, Query query); IPage<HygieneMonthVO> dataByMonth(String month, String unit, Query query);
/** /**
* 卫生自查数据导出 * 卫生自查计划数据详情
* @param param 入参 * @param id 卫生自查计划id
* @param response 响应类 * @return 卫生自查计划详情VO类
*/
HygienePlanDetailVO getPlan(Long id);
/**
* 根据编码查询卫生自查计划
* @param code 编码
* @return 卫生自查计划实体类
*/
HygienePlanEntity getPlanByCode(String code);
/**
* 月度数据导出
*/ */
void exportHygieneData(Map<String, Object> param, HttpServletResponse response); void exportMonthData(Map<String, Object> param, Query query, HttpServletResponse response);
} }

32
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java

@ -1,10 +1,17 @@
package com.hnac.hzims.safeproduct.service; package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
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 java.util.Map;
/** /**
* 卫生自查记录服务类 * 卫生自查记录服务类
* *
@ -22,17 +29,17 @@ public interface IHygieneRecordService extends IService<HygieneRecordEntity> {
/** /**
* 新增卫生自查记录 * 新增卫生自查记录
* @param hygieneRecordEntity 卫生自查记录实体 * @param hygieneRecordDTO 卫生自查记录DTO
* @return 封装结果类 * @return 封装结果类
*/ */
R saveRecord(HygieneRecordEntity hygieneRecordEntity); R saveRecord(HygieneRecordDTO hygieneRecordDTO);
/** /**
* 修改卫生自查记录 * 修改卫生自查记录
* @param hygieneRecordEntity 卫生自查记录实体 * @param hygieneRecordDTO 卫生自查记录DTO
* @return true-成功false-失败 * @return 封装结果类
*/ */
R updateRecord(HygieneRecordEntity hygieneRecordEntity); R updateRecord(HygieneRecordDTO hygieneRecordDTO);
/** /**
* 查询卫生自查记录详情 * 查询卫生自查记录详情
@ -40,4 +47,19 @@ public interface IHygieneRecordService extends IService<HygieneRecordEntity> {
* @return 卫生自查记录详情VO类 * @return 卫生自查记录详情VO类
*/ */
HygieneRecordDetailVO getRecordDetail(Long id); HygieneRecordDetailVO getRecordDetail(Long id);
/**
* 卫生自查记录页面
* @param param 入参
* @param query 分页类
* @return 记录数据页
*/
IPage<HygieneRecordPageVO> recordPage(Map<String, Object> param, Query query);
/**
* 卫生自查记录数据导出
* @param hygieneRecordId 卫生自查记录id
* @param response 响应类
*/
void exportHygieneData(Long hygieneRecordId, HttpServletResponse response);
} }

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneZoneService.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import java.util.List;
public interface IHygieneZoneService extends IService<HygieneZoneEntity> {
/**
* 删除关联责任区数据
* @param hygienePlanId 卫生自查计划id
* @return true-成功false-失败
*/
boolean removeReferenceZone(Long hygienePlanId);
/**
* 查询关联责任区数据
* @param hygienePlanId 卫生自查计划id
* @return 关联责任区数据
*/
List<HygieneZoneEntity> getReferenceZone(Long hygienePlanId);
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java

@ -62,8 +62,8 @@ public class ConferencePlanServiceImpl extends ServiceImpl<ConferencePlanMapper,
public IPage<ConferencePlanEntity> planPage(Map<String, Object> param, Query query) { public IPage<ConferencePlanEntity> planPage(Map<String, Object> param, Query query) {
QueryWrapper<ConferencePlanEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ConferencePlanEntity> queryWrapper = new QueryWrapper<>();
String unit = String.valueOf(param.get("unit")); String unit = String.valueOf(param.get("unit"));
String startTime = String.valueOf(param.get("startTime")); String startTime = String.valueOf(param.get("scheduledStartTime"));
String endTime = String.valueOf((param.get("endTime"))); String endTime = String.valueOf((param.get("scheduledEndTime")));
if (!unit.equals("null") && !unit.equals("")) { if (!unit.equals("null") && !unit.equals("")) {
queryWrapper.lambda().like(ConferencePlanEntity::getUnit, unit); queryWrapper.lambda().like(ConferencePlanEntity::getUnit, unit);
} }

18
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java

@ -4,7 +4,6 @@ import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity;
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity;
@ -12,6 +11,7 @@ import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum;
import com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper; import com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper;
import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper; import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper;
import com.hnac.hzims.safeproduct.service.IConferenceRecordService; import com.hnac.hzims.safeproduct.service.IConferenceRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -59,21 +59,7 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap
// 查询是否存在同月编号 // 查询是否存在同月编号
String lastCode = getLastCode(currentMonth); String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号 // 若不存在,新增编号
String code; String code = BaseUtil.getUniqueCode("HYJL", lastCode, currentMonth);
if (StringUtils.isNull(lastCode)) {
code = "HYJL" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "HYJL" + currentMonth + "00" + value;
} else if (value < 100) {
code = "HYJL" + currentMonth + "0" + value;
} else {
code = "HYJL" + currentMonth + value;
}
}
conferenceRecord.setCode(code); conferenceRecord.setCode(code);
boolean save = this.save(conferenceRecord); boolean save = this.save(conferenceRecord);
// 若会议记录新增成功,修改会议计划状态为已完成 // 若会议记录新增成功,修改会议计划状态为已完成

207
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java

@ -10,18 +10,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.HygieneExportDTO; import com.hnac.hzims.safeproduct.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.enums.HygieneStatusEnum; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper;
import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygienePlanService;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
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.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -45,14 +49,24 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
@Autowired @Autowired
IHygieneRecordService hygieneRecordService; IHygieneRecordService hygieneRecordService;
@Autowired
IHygieneZoneService hygieneZoneService;
/** /**
* 删除卫生自查计划 * 删除卫生自查计划
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean removePlan(Long id) { public boolean removePlan(Long id) {
// 删除计划数据
boolean remove = this.removeById(id); boolean remove = this.removeById(id);
if (remove) { if (remove) {
return hygieneRecordService.removeReferenceRecord(id); // 删除记录数据
boolean removeRecord = hygieneRecordService.removeReferenceRecord(id);
if (removeRecord) {
// 删除责任区数据
return hygieneZoneService.removeReferenceZone(id);
}
} }
return false; return false;
} }
@ -63,13 +77,13 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
@Override @Override
public IPage<HygienePlanEntity> planPage(Map<String, Object> param, Query query) { public IPage<HygienePlanEntity> planPage(Map<String, Object> param, Query query) {
QueryWrapper<HygienePlanEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<HygienePlanEntity> queryWrapper = new QueryWrapper<>();
String zone = String.valueOf(param.get("zone")); String startTime = String.valueOf(param.get("scheduledStartTime"));
String principal = String.valueOf(param.get("principal")); String endTime = String.valueOf(param.get("scheduledEndTime"));
if (!zone.equals("null") && !zone.equals("")) { if (!startTime.equals("null") && !startTime.equals("")) {
queryWrapper.lambda().like(HygienePlanEntity::getZone, zone); queryWrapper.lambda().ge(HygienePlanEntity::getScheduledStartTime, startTime);
} }
if (!principal.equals("null") && !principal.equals("")) { if (!endTime.equals("null") && !endTime.equals("")) {
queryWrapper.lambda().ge(HygienePlanEntity::getPrincipal, principal); queryWrapper.lambda().le(HygienePlanEntity::getScheduledEndTime, endTime);
} }
return this.page(Condition.getPage(query), queryWrapper); return this.page(Condition.getPage(query), queryWrapper);
} }
@ -77,48 +91,84 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
/** /**
* 新增卫生自查计划 * 新增卫生自查计划
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public R savePlan(HygienePlanEntity hygienePlanEntity) { public R savePlan(HygienePlanDTO hygienePlanDTO) {
String[] scores = hygienePlanEntity.getCheckItemScore().split(",|,"); // 新增卫生自查计划
Integer standardScore = hygienePlanEntity.getStandardScore(); HygienePlanEntity hygienePlanEntity = new HygienePlanEntity();
R res = getSumScore(scores, standardScore); BeanUtils.copyProperties(hygienePlanDTO, hygienePlanEntity);
return res.isSuccess() ? R.status(this.save(hygienePlanEntity)) : res; boolean savePlan = this.save(hygienePlanEntity);
List<HygieneZoneEntity> zoneList = hygienePlanDTO.getZoneList();
// 若计划新增成功,新增关联责任区数据
if (savePlan) {
HygienePlanEntity hygienePlan = getPlanByCode(hygienePlanDTO.getCode());
for (HygieneZoneEntity zone : zoneList) {
// 传计划id
if (hygienePlan != null) {
zone.setHygienePlanId(hygienePlan.getId());
}
String[] scores = zone.getCheckItemScore().split(",|,");
// 校验检查项总成绩是否为标准总成绩
R res = getSumScore(scores, hygienePlanDTO.getStandardScore());
if (!res.isSuccess()) {
return res;
}
}
// 校验通过则批量新增责任区数据
return R.status(hygieneZoneService.saveBatch(zoneList));
}
return R.status(Boolean.FALSE);
} }
/** /**
* 修改卫生自查计划 * 修改卫生自查计划
*/ */
@Override @Override
public R updatePlan(HygienePlanEntity hygienePlanEntity) { public R updatePlan(HygienePlanDTO hygienePlanDTO) {
String[] scores = hygienePlanEntity.getCheckItemScore().split(",|,"); // 修改卫生自查计划
Integer standardScore = hygienePlanEntity.getStandardScore(); HygienePlanEntity hygienePlanEntity = new HygienePlanEntity();
R res = getSumScore(scores, standardScore); BeanUtils.copyProperties(hygienePlanDTO, hygienePlanEntity);
return res.isSuccess() ? R.status(this.updateById(hygienePlanEntity)) : res; boolean updatePlan = this.updateById(hygienePlanEntity);
List<HygieneZoneEntity> zoneList = hygienePlanDTO.getZoneList();
// 若计划修改成功,修改关联责任区数据
if (updatePlan) {
for (HygieneZoneEntity zone : zoneList) {
String[] scores = zone.getCheckItemScore().split(",|,");
// 校验检查项总成绩是否为标准总成绩
R res = getSumScore(scores, hygienePlanDTO.getStandardScore());
if (!res.isSuccess()) {
return res;
}
}
// 校验通过则批量修改责任区数据
return R.status(hygieneZoneService.updateBatchById(zoneList));
}
return R.status(Boolean.FALSE);
} }
/** /**
* 卫生自查月度数据 * 卫生自查月度数据
*/ */
@Override @Override
public IPage<HygieneMonthVO> dataByMonth(String month, Query query) { public IPage<HygieneMonthVO> dataByMonth(String month, String unit, Query query) {
// 查询当月各单位的卫生自查总数 // 查询当月各单位的卫生自查总数
IPage<HygieneMonthVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<HygieneMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<HygieneMonthVO> unitPage = baseMapper.selectByMonth(page, month); IPage<HygieneMonthVO> unitPage = baseMapper.selectByMonth(page, unit, month);
List<HygieneMonthVO> unitList = unitPage.getRecords(); List<HygieneMonthVO> unitList = unitPage.getRecords();
// 查询当月各单位已完成的卫生自查数据 // 查询当月各单位已完成的卫生自查数据
IPage<HygieneMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize()); IPage<HygieneMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<HygieneMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); IPage<HygieneMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, unit, month);
List<HygieneMonthVO> finishedList = finishedPage.getRecords(); List<HygieneMonthVO> finishedList = finishedPage.getRecords();
// 处理统计数据 // 处理统计数据
for (HygieneMonthVO unit : unitList) { for (HygieneMonthVO u : unitList) {
Long taskNum = unit.getScheduledCheckNum(); Long taskNum = u.getScheduledCheckNum();
Optional<HygieneMonthVO> finishedHygiene = finishedList.stream().filter(x -> x.getUnit().equals(unit.getUnit())).findFirst(); Optional<HygieneMonthVO> finishedHygiene = finishedList.stream().filter(x -> x.getUnit().equals(u.getUnit())).findFirst();
Long finishedTaskNum = finishedHygiene.isPresent() ? finishedHygiene.get().getFinishedCheckNum() : 0L; Long finishedTaskNum = finishedHygiene.isPresent() ? finishedHygiene.get().getFinishedCheckNum() : 0L;
unit.setFinishedCheckNum(finishedTaskNum); u.setFinishedCheckNum(finishedTaskNum);
unit.setUnfinishedCheckNum(taskNum - finishedTaskNum); u.setUnfinishedCheckNum(taskNum - finishedTaskNum);
BigDecimal taskDecimal = new BigDecimal(taskNum); BigDecimal taskDecimal = new BigDecimal(taskNum);
BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum); BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum);
unit.setCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")) u.setCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP)); .setScale(2, RoundingMode.HALF_UP));
} }
unitPage.setRecords(unitList); unitPage.setRecords(unitList);
@ -126,32 +176,61 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
} }
/** /**
* 卫生自查数据导出 * 卫生自查计划数据详情
*/ */
@Override @Override
public void exportHygieneData(Map<String, Object> param, HttpServletResponse response) { public HygienePlanDetailVO getPlan(Long id) {
HygienePlanEntity hygienePlanEntity = this.getById(id);
HygienePlanDetailVO hygienePlanDetailVO = new HygienePlanDetailVO();
BeanUtils.copyProperties(hygienePlanEntity, hygienePlanDetailVO);
// 查询关联责任区数据
List<HygieneZoneEntity> zoneList = hygieneZoneService.getReferenceZone(id);
hygienePlanDetailVO.setZoneList(zoneList);
return hygienePlanDetailVO;
}
/**
* 计算累计分值
* @param scores 各项分值
* @param standardScore 标准总分值
* @return 累计分值等于标准总分值时返回数据否则返回错误信息
*/
private R getSumScore(String[] scores, Integer standardScore) {
int sum = 0;
for (String score : scores) {
sum += Integer.parseInt(score);
if (sum > standardScore) {
return R.fail("累计分值已超过标准总分值");
}
}
return sum < standardScore ? R.fail("标准总分值未全部分配") : R.data(sum);
}
/**
* 根据编码查询卫生自查计划
*/
@Override
public HygienePlanEntity getPlanByCode(String code) {
QueryWrapper<HygienePlanEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HygienePlanEntity::getCode, code);
return this.getOne(queryWrapper);
}
/**
* 月度数据导出
*/
@Override
public void exportMonthData(Map<String, Object> param, Query query, HttpServletResponse response) {
ServletOutputStream outputStream = null; ServletOutputStream outputStream = null;
try { try {
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
String unit = String.valueOf(param.get("unit")); String unit = String.valueOf(param.get("unit"));
String startTime = String.valueOf(param.get("scheduledStartTime")); String month = String.valueOf(param.get("month"));
String endTime = String.valueOf(param.get("scheduledEndTime")); IPage<HygieneMonthVO> monthPage = dataByMonth(month, unit, query);
List<HygieneExportDTO> rehearsalList = getHygieneByUnitAndDate(unit, startTime, endTime); List<HygieneMonthVO> records = monthPage.getRecords();
// 处理卫生自查状态信息
rehearsalList.forEach(record -> {
String status;
if (record.getHygieneStatus().equals(HygieneStatusEnum.WAITING.getValue())) {
status = HygieneStatusEnum.WAITING.getDesc();
} else if (record.getHygieneStatus().equals(HygieneStatusEnum.UNFINISHED.getValue())) {
status = HygieneStatusEnum.UNFINISHED.getDesc();
} else {
status = HygieneStatusEnum.FINISHED.getDesc();
}
record.setHygieneStatus(status);
});
// 设置响应头 // 设置响应头
// URLEncoder.encode防止中文乱码 // URLEncoder.encode防止中文乱码
String fileName = URLEncoder.encode("卫生自查数据表", "UTF-8"); String fileName = URLEncoder.encode("卫生自查月度统计表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
@ -162,52 +241,24 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
.registerConverter(new LongStringConverter()) .registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
.build(); .build();
WriteSheet writeSheet = EasyExcel.writerSheet(1, "卫生自查数据表").head(HygieneExportDTO.class) WriteSheet writeSheet = EasyExcel.writerSheet(1, "卫生自查月度统计表").head(HygieneMonthVO.class)
.build(); .build();
excelWriter.write(rehearsalList, writeSheet); excelWriter.write(records, writeSheet);
excelWriter.finish(); excelWriter.finish();
} catch (Exception e) { } catch (Exception e) {
// 重置response // 重置response
response.reset(); response.reset();
response.setContentType("application/json"); response.setContentType("application/json");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
throw new ServiceException("卫生自查数据导出异常: " + e.getMessage()); throw new ServiceException("卫生自查月度数据导出异常: " + e.getMessage());
} finally { } finally {
if (outputStream != null) { if (outputStream != null) {
try { try {
outputStream.close(); outputStream.close();
} catch (IOException e) { } catch (IOException e) {
log.error("卫生自查导出响应头输出流关闭异常: " + e.getMessage()); log.error("卫生自查月度数据导出输出流关闭异常: " + e.getMessage());
} }
} }
} }
} }
/**
* 计算累计分值
* @param scores 各项分值
* @param standardScore 标准总分值
* @return 累计分值等于标准总分值时返回数据否则返回错误信息
*/
private R getSumScore(String[] scores, Integer standardScore) {
int sum = 0;
for (String score : scores) {
sum += Integer.parseInt(score);
if (sum > standardScore) {
return R.fail("累计分值已超过标准总分值");
}
}
return sum < standardScore ? R.fail("标准总分值未全部分配") : R.data(sum);
}
/**
* 根据单位和计划时间查询卫生自查记录
* @param unit 单位
* @param startTime 计划开始时间
* @param endTime 计划结束时间
* @return 卫生自查记录
*/
public List<HygieneExportDTO> getHygieneByUnitAndDate(String unit, String startTime, String endTime) {
return baseMapper.getHygieneByUnitAndDate(unit, startTime, endTime);
}
} }

144
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java

@ -1,26 +1,48 @@
package com.hnac.hzims.safeproduct.service.impl; package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.excel.write.merge.LoopMergeStrategy;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper;
import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper; import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import com.hnac.hzims.safeproduct.vo.HygieneZoneDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.temporal.WeekFields; import java.time.temporal.WeekFields;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -35,6 +57,9 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
@Resource @Resource
HygienePlanMapper hygienePlanMapper; HygienePlanMapper hygienePlanMapper;
@Autowired
IHygieneZoneService hygieneZoneService;
/** /**
* 删除关联卫生自查记录 * 删除关联卫生自查记录
*/ */
@ -56,37 +81,29 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
* 新增卫生自查记录 * 新增卫生自查记录
*/ */
@Override @Override
public R saveRecord(HygieneRecordEntity hygieneRecordEntity) { public R saveRecord(HygieneRecordDTO hygieneRecordDTO) {
HygieneRecordEntity hygieneRecordEntity = new HygieneRecordEntity();
BeanUtils.copyProperties(hygieneRecordDTO, hygieneRecordEntity);
// 编码生成 // 编码生成
// 获取当月时间(yyyymm) // 获取当月时间(yyyymm)
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号 // 查询是否存在同月编号
String lastCode = getLastCode(currentMonth); String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号 // 若不存在,新增编号
String code; String code = BaseUtil.getUniqueCode("WSZC", lastCode, currentMonth);
if (StringUtils.isNull(lastCode)) {
code = "WSZC" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "WSZC" + currentMonth + "00" + value;
} else if (value < 100) {
code = "WSZC" + currentMonth + "0" + value;
} else {
code = "WSZC" + currentMonth + value;
}
}
hygieneRecordEntity.setCode(code); hygieneRecordEntity.setCode(code);
// 周数计算 // 周数计算
int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime()); int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime());
hygieneRecordEntity.setWeekNum(weekNum); hygieneRecordEntity.setWeekNum(weekNum);
// 综合评分判断 // 综合评分判断
HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId()); HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId());
if (hygieneRecordEntity.getComprehensiveScore().compareTo(hygienePlanEntity.getStandardScore()) > 0) { String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",|,");
for (String score : scores) {
int sc = Integer.parseInt(score);
if (sc > hygienePlanEntity.getStandardScore()) {
return R.fail("评分不能大于标准总分值"); return R.fail("评分不能大于标准总分值");
} }
}
return R.status(this.save(hygieneRecordEntity)); return R.status(this.save(hygieneRecordEntity));
} }
@ -94,15 +111,21 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
* 修改卫生自查记录 * 修改卫生自查记录
*/ */
@Override @Override
public R updateRecord(HygieneRecordEntity hygieneRecordEntity) { public R updateRecord(HygieneRecordDTO hygieneRecordDTO) {
HygieneRecordEntity hygieneRecordEntity = new HygieneRecordEntity();
BeanUtils.copyProperties(hygieneRecordDTO, hygieneRecordEntity);
// 周数计算 // 周数计算
int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime()); int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime());
hygieneRecordEntity.setWeekNum(weekNum); hygieneRecordEntity.setWeekNum(weekNum);
// 综合评分判断 // 综合评分判断
HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId()); HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId());
if (hygieneRecordEntity.getComprehensiveScore().compareTo(hygienePlanEntity.getStandardScore()) > 0) { String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",|,");
for (String score : scores) {
int sc = Integer.parseInt(score);
if (sc > hygienePlanEntity.getStandardScore()) {
return R.fail("评分不能大于标准总分值"); return R.fail("评分不能大于标准总分值");
} }
}
return R.status(this.updateById(hygieneRecordEntity)); return R.status(this.updateById(hygieneRecordEntity));
} }
@ -111,7 +134,80 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
*/ */
@Override @Override
public HygieneRecordDetailVO getRecordDetail(Long id) { public HygieneRecordDetailVO getRecordDetail(Long id) {
return baseMapper.getRecordDetail(id); HygieneRecordDetailVO recordDetailVO = baseMapper.getRecordDetail(id);
String[] zoneIds = recordDetailVO.getHygieneZoneIds().split(",|,");
String[] results = recordDetailVO.getCheckResult().split(",|,");
String[] scores = recordDetailVO.getComprehensiveScore().split(",|,");
List<HygieneZoneDetailVO> checkDetailVOList = new ArrayList<>();
for (int i = 0; i < zoneIds.length ; i++) {
HygieneZoneDetailVO zoneDetailVO = new HygieneZoneDetailVO();
HygieneZoneEntity hygieneZoneEntity = hygieneZoneService.getById(zoneIds[i]);
BeanUtils.copyProperties(hygieneZoneEntity, zoneDetailVO);
zoneDetailVO.setResult(results[i]);
zoneDetailVO.setScore(Integer.parseInt(scores[i]));
checkDetailVOList.add(zoneDetailVO);
}
recordDetailVO.setCheckList(checkDetailVOList);
return recordDetailVO;
}
/**
* 卫生自查记录页面
*/
@Override
public IPage<HygieneRecordPageVO> recordPage(Map<String, Object> param, Query query) {
IPage<HygieneRecordPageVO> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.recordPage(page, param);
}
/**
* 卫生自查数据导出
*/
@Override
public void exportHygieneData(Long hygieneRecordId, HttpServletResponse response) {
ServletOutputStream outputStream = null;
try {
outputStream = response.getOutputStream();
HygieneRecordDetailVO recordDetailVO = getRecordDetail(hygieneRecordId);
List<HygieneZoneDetailVO> records = recordDetailVO.getCheckList();
// 设置响应头
// URLEncoder.encode防止中文乱码
String fileName = URLEncoder.encode("卫生自查记录数据表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// ExcelWriter初始化
ExcelWriter excelWriter = EasyExcel
.write(response.getOutputStream())
.autoCloseStream(Boolean.TRUE)
.registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
.build();
Date endTime = recordDetailVO.getActualEndTime();
String name = DateUtil.format(endTime, "yyyy年mm月") + "第" + recordDetailVO.getWeekNum() + "周卫生自查表";
List<String> head = new ArrayList<>();
head.add(name);
WriteSheet writeSheet = EasyExcel.writerSheet(1, "卫生自查记录数据表")
.head(Collections.singletonList(head))
.head(HygieneZoneDetailVO.class)
.build();
excelWriter.write(records, writeSheet);
excelWriter.finish();
} catch (Exception e) {
// 重置response
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
throw new ServiceException("卫生自查记录数据导出异常: " + e.getMessage());
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
log.error("卫生自查记录数据导出输出流关闭异常: " + e.getMessage());
}
}
}
} }
/** /**

42
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneZoneServiceImpl.java

@ -0,0 +1,42 @@
package com.hnac.hzims.safeproduct.service.impl;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.mapper.HygieneZoneMapper;
import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class HygieneZoneServiceImpl extends ServiceImpl<HygieneZoneMapper, HygieneZoneEntity> implements IHygieneZoneService {
/**
* 删除关联责任区数据
*/
@Override
public boolean removeReferenceZone(Long hygienePlanId) {
QueryWrapper<HygieneZoneEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HygieneZoneEntity::getHygienePlanId, hygienePlanId);
List<HygieneZoneEntity> zoneList = this.list(queryWrapper);
// 若无关联卫生自查责任区,直接返回true
if (CollectionUtils.isEmpty(zoneList)) {
return true;
}
List<Long> ids = zoneList.stream().map(HygieneZoneEntity::getId).collect(Collectors.toList());
return this.removeByIds(ids);
}
/**
* 查询关联责任区数据
*/
@Override
public List<HygieneZoneEntity> getReferenceZone(Long hygienePlanId) {
QueryWrapper<HygieneZoneEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HygieneZoneEntity::getHygienePlanId, hygienePlanId);
return this.list(queryWrapper);
}
}

7
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java

@ -24,6 +24,7 @@ import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -72,6 +73,10 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
IPage<RehearsalMonthVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<RehearsalMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<RehearsalMonthVO> unitPage = baseMapper.selectByMonth(page, month); IPage<RehearsalMonthVO> unitPage = baseMapper.selectByMonth(page, month);
List<RehearsalMonthVO> unitList = unitPage.getRecords(); List<RehearsalMonthVO> unitList = unitPage.getRecords();
// 若无数据,返回空页面
if (CollectionUtils.isEmpty(unitList)) {
return unitPage;
}
// 查询当月各单位已完成的演练数据 // 查询当月各单位已完成的演练数据
IPage<RehearsalMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize()); IPage<RehearsalMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<RehearsalMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); IPage<RehearsalMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month);
@ -102,7 +107,7 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
IPage<RehearsalYearVO> unitPage = baseMapper.selectUnitByYear(page, year); IPage<RehearsalYearVO> unitPage = baseMapper.selectUnitByYear(page, year);
List<RehearsalYearVO> records = unitPage.getRecords(); List<RehearsalYearVO> records = unitPage.getRecords();
// 若无数据,返回空页面 // 若无数据,返回空页面
if (org.springframework.util.CollectionUtils.isEmpty(records)) { if (CollectionUtils.isEmpty(records)) {
return unitPage; return unitPage;
} }
List<String> unitList = records.stream().map(RehearsalYearVO::getUnit).collect(Collectors.toList()); List<String> unitList = records.stream().map(RehearsalYearVO::getUnit).collect(Collectors.toList());

17
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java

@ -12,6 +12,7 @@ import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum;
import com.hnac.hzims.safeproduct.mapper.RehearsalPlanMapper; import com.hnac.hzims.safeproduct.mapper.RehearsalPlanMapper;
import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper; import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper;
import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -42,21 +43,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMappe
// 查询是否存在同月编号 // 查询是否存在同月编号
String lastCode = getLastCode(currentMonth); String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号 // 若不存在,新增编号
String code; String code = BaseUtil.getUniqueCode("YLJL", lastCode, currentMonth);
if (StringUtils.isNull(lastCode)) {
code = "YLJL" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "YLJL" + currentMonth + "00" + value;
} else if (value < 100) {
code = "YLJL" + currentMonth + "0" + value;
} else {
code = "YLJL" + currentMonth + value;
}
}
rehearsalRecord.setCode(code); rehearsalRecord.setCode(code);
// 参演人数 // 参演人数
String peopleName = rehearsalRecord.getPeopleName(); String peopleName = rehearsalRecord.getPeopleName();

45
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java

@ -4,7 +4,6 @@ import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity; import com.hnac.hzims.safeproduct.entity.TestEntity;
@ -14,6 +13,7 @@ import com.hnac.hzims.safeproduct.mapper.TestMapper;
import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper; import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper;
import com.hnac.hzims.safeproduct.service.ITestScoreService; import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -56,21 +56,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
// 查询是否存在同月编号 // 查询是否存在同月编号
String lastCode = getLastCode(currentMonth); String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号 // 若不存在,新增编号
String code; String code = BaseUtil.getUniqueCode("KSJL", lastCode, currentMonth);
if (StringUtils.isNull(lastCode)) {
code = "KSJL" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "KSJL" + currentMonth + "00" + value;
} else if (value < 100) {
code = "KSJL" + currentMonth + "0" + value;
} else {
code = "KSJL" + currentMonth + value;
}
}
testEntity.setCode(code); testEntity.setCode(code);
boolean saveTest = this.save(testEntity); boolean saveTest = this.save(testEntity);
// 若新增考试记录成功,添加相关的参考人员数据 // 若新增考试记录成功,添加相关的参考人员数据
@ -81,13 +67,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
String people = test.getPeopleName(); String people = test.getPeopleName();
String[] person = people.split(",|,"); String[] person = people.split(",|,");
// 新增参考人员成绩数据 // 新增参考人员成绩数据
List<TestScoreEntity> scoreList = new ArrayList<>(); List<TestScoreEntity> scoreList = getReferenceTestScore(test, person);
for(String name : person) {
TestScoreEntity testScoreEntity = new TestScoreEntity();
testScoreEntity.setTestId(test.getId());
testScoreEntity.setName(name);
scoreList.add(testScoreEntity);
}
return R.status(testScoreService.saveBatch(scoreList)); return R.status(testScoreService.saveBatch(scoreList));
} }
return R.fail("新增考试记录失败"); return R.fail("新增考试记录失败");
@ -185,6 +165,20 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
if (removeByIds) { if (removeByIds) {
String[] person = testEntity.getPeopleName().split(",|,"); String[] person = testEntity.getPeopleName().split(",|,");
// 新增参考人员成绩数据 // 新增参考人员成绩数据
List<TestScoreEntity> scoreList = getReferenceTestScore(testEntity, person);
return testScoreService.saveBatch(scoreList);
}
}
return false;
}
/**
* 获取成绩列表
* @param testEntity 考试记录实体类
* @param person 参考人员
* @return 成绩列表
*/
private List<TestScoreEntity> getReferenceTestScore(TestEntity testEntity, String[] person) {
List<TestScoreEntity> res = new ArrayList<>(); List<TestScoreEntity> res = new ArrayList<>();
for (String name : person) { for (String name : person) {
TestScoreEntity testScoreEntity = new TestScoreEntity(); TestScoreEntity testScoreEntity = new TestScoreEntity();
@ -192,10 +186,7 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
testScoreEntity.setName(name); testScoreEntity.setName(name);
res.add(testScoreEntity); res.add(testScoreEntity);
} }
return testScoreService.saveBatch(res); return res;
}
}
return false;
} }
/** /**

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java

@ -63,6 +63,10 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
IPage<TrainMonthVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<TrainMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> unitPage = baseMapper.selectByMonth(page, month); IPage<TrainMonthVO> unitPage = baseMapper.selectByMonth(page, month);
List<TrainMonthVO> unitList = unitPage.getRecords(); List<TrainMonthVO> unitList = unitPage.getRecords();
// 若无数据,返回空页面
if (CollectionUtils.isEmpty(unitList)) {
return unitPage;
}
// 查询当月各单位已完成的培训数据 // 查询当月各单位已完成的培训数据
IPage<TrainMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize()); IPage<TrainMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); IPage<TrainMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month);

18
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -10,7 +10,6 @@ import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
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.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; import com.hnac.hzims.safeproduct.entity.TrainPlanEntity;
@ -20,6 +19,7 @@ import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper;
import com.hnac.hzims.safeproduct.mapper.TrainRecordMapper; import com.hnac.hzims.safeproduct.mapper.TrainRecordMapper;
import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService; import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -61,21 +61,7 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
// 查询是否存在同月编号 // 查询是否存在同月编号
String lastCode = getLastCode(currentMonth); String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号 // 若不存在,新增编号
String code; String code = BaseUtil.getUniqueCode("PXJL", lastCode, currentMonth);
if (StringUtils.isNull(lastCode)) {
code = "PXJL" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "PXJL" + currentMonth + "00" + value;
} else if (value < 100) {
code = "PXJL" + currentMonth + "0" + value;
} else {
code = "PXJL" + currentMonth + value;
}
}
trainRecordEntity.setCode(code); trainRecordEntity.setCode(code);
boolean save = this.save(trainRecordEntity); boolean save = this.save(trainRecordEntity);
// 若培训记录新增成功,修改培训计划状态为已完成 // 若培训记录新增成功,修改培训计划状态为已完成

39
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

@ -0,0 +1,39 @@
package com.hnac.hzims.safeproduct.utils;
import com.hnac.hzims.common.logs.utils.StringUtils;
/**
* 公用工具类
*
* @author liwen
* @date 2024-01-02
*/
public class BaseUtil {
/**
* 生成编码规则模块首字母 + 日期yyyymm + 编号三位
* @param module 模块首字母
* @param lastCode 已存在的最新编号
* @param currentMonth 日期
* @return 编码
*/
public static String getUniqueCode(String module, String lastCode, String currentMonth) {
// 若不存在,新增编号
String code;
if (StringUtils.isNull(lastCode)) {
code = module + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = module + currentMonth + "00" + value;
} else if (value < 100) {
code = module + currentMonth + "0" + value;
} else {
code = module + currentMonth + value;
}
}
return code;
}
}

31
hzims-service/safeproduct/src/main/resources/db/1.0.1.sql

@ -80,7 +80,7 @@ CREATE TABLE `hzims_train_record` (
`train_record_name` varchar(50) NOT NULL DEFAULT '' COMMENT '培训记录名称', `train_record_name` varchar(50) NOT NULL DEFAULT '' COMMENT '培训记录名称',
`code` varchar(50) NOT NULL COMMENT '编号', `code` varchar(50) NOT NULL COMMENT '编号',
`people_name` varchar(5000) DEFAULT '' COMMENT '培训学员', `people_name` varchar(5000) DEFAULT '' COMMENT '培训学员',
`content` varchar(5000) DEFAULT '' COMMENT '培训内容', `content` mediumtext DEFAULT '' COMMENT '培训内容',
`actual_start_time` datetime DEFAULT NULL COMMENT '实际培训开始时间', `actual_start_time` datetime DEFAULT NULL COMMENT '实际培训开始时间',
`actual_end_time` datetime DEFAULT NULL COMMENT '实际培训结束时间', `actual_end_time` datetime DEFAULT NULL COMMENT '实际培训结束时间',
`command` varchar(250) DEFAULT NULL COMMENT '培训评价', `command` varchar(250) DEFAULT NULL COMMENT '培训评价',
@ -164,7 +164,7 @@ CREATE TABLE `hzims_conference_record` (
`actual_start_time` datetime DEFAULT NULL COMMENT '会议实际开始时间', `actual_start_time` datetime DEFAULT NULL COMMENT '会议实际开始时间',
`actual_end_time` datetime DEFAULT NULL COMMENT '会议实际结束时间', `actual_end_time` datetime DEFAULT NULL COMMENT '会议实际结束时间',
`recorder` varchar(20) DEFAULT '' COMMENT '记录人', `recorder` varchar(20) DEFAULT '' COMMENT '记录人',
`content` varchar(250) DEFAULT '' DEFAULT '' COMMENT '会议内容', `content` mediumtext DEFAULT '' DEFAULT '' COMMENT '会议内容',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议图片', `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议图片',
`file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议附件', `file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议附件',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
@ -179,15 +179,27 @@ CREATE TABLE `hzims_conference_record` (
CREATE TABLE `hzims_hygiene_plan` ( CREATE TABLE `hzims_hygiene_plan` (
`id` bigint(20) NOT NULL COMMENT '主键id', `id` bigint(20) NOT NULL COMMENT '主键id',
`unit` varchar(50) NOT NULL COMMENT '单位', `code` varchar(50) NOT NULL COMMENT '编码',
`standard_score` int(10) NOT NULL DEFAULT '100' COMMENT '标准总分值',
`scheduled_start_time` date NOT NULL COMMENT '计划开始时间',
`scheduled_end_time` date NOT NULL COMMENT '计划结束时间',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查计划表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_hygiene_zone` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`hygiene_plan_id` bigint(20) NOT NULL COMMENT '卫生自查计划id',
`zone` varchar(50) NOT NULL COMMENT '责任区', `zone` varchar(50) NOT NULL COMMENT '责任区',
`principal` varchar(20) NOT NULL COMMENT '责任人', `principal` varchar(20) NOT NULL COMMENT '责任人',
`check_item` mediumtext NOT NULL COMMENT '检查项', `check_item` mediumtext NOT NULL COMMENT '检查项',
`check_item_score` varchar(255) NOT NULL COMMENT '检查项分值', `check_item_score` varchar(255) NOT NULL COMMENT '检查项分值',
`standard_score` int(10) NOT NULL DEFAULT '100' COMMENT '标准总分值',
`scheduled_start_time` date NOT NULL COMMENT '计划开始时间',
`scheduled_end_time` date NOT NULL COMMENT '计划结束时间',
`hygiene_status` varchar(20) NOT NULL DEFAULT 'WAITING' COMMENT '卫生自查状态',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@ -196,14 +208,17 @@ CREATE TABLE `hzims_hygiene_plan` (
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查表' ROW_FORMAT=Dynamic; ) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查区域' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_hygiene_record` ( CREATE TABLE `hzims_hygiene_record` (
`id` bigint(20) NOT NULL COMMENT '主键id', `id` bigint(20) NOT NULL COMMENT '主键id',
`hygiene_plan_id` bigint(20) NOT NULL COMMENT '卫生自查计划id',
`unit` varchar(50) NOT NULL COMMENT '单位',
`code` varchar(50) NOT NULL COMMENT '编号', `code` varchar(50) NOT NULL COMMENT '编号',
`actual_start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际开始时间', `actual_start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际开始时间',
`actual_end_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际结束时间', `actual_end_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际结束时间',
`check_user` varchar(20) NOT NULL DEFAULT '' COMMENT '检查人', `check_user` varchar(20) NOT NULL DEFAULT '' COMMENT '检查人',
`hygiene_zone_ids` varchar(1000) NOT NULL COMMENT '卫生自查区域id',
`check_result` mediumtext NOT NULL COMMENT '检查结果', `check_result` mediumtext NOT NULL COMMENT '检查结果',
`comprehensive_score` int(10) NOT NULL COMMENT '综合评分', `comprehensive_score` int(10) NOT NULL COMMENT '综合评分',
`week_num` int(10) NOT NULL COMMENT '周数', `week_num` int(10) NOT NULL COMMENT '周数',

9
hzims-service/ticket/pom.xml

@ -298,7 +298,14 @@
<skip>false</skip> <skip>false</skip>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--设置为true,以便把本地的system的jar也包括进来-->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

19
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/CensController.java

@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
@ -32,10 +33,24 @@ public class CensController {
return R.data(censService.cens(param)); return R.data(censService.cens(param));
} }
@GetMapping ("/censExport")
@ApiOperation("两票统计导出")
@ApiOperationSupport(order = 2)
public void censExport(HttpServletResponse response,CensParamVo param) {
censService.censExport(response,param);
}
@PostMapping("/censYear") @PostMapping("/censYear")
@ApiOperation("两票统计") @ApiOperation("两票年度统计")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 3)
public R<List<CensYearVo>> censYear(@RequestBody CensYearParamVo param) { public R<List<CensYearVo>> censYear(@RequestBody CensYearParamVo param) {
return R.data(censService.censYear(param)); return R.data(censService.censYear(param));
} }
@GetMapping ("/censYearExport")
@ApiOperation("两票年度统计导出")
@ApiOperationSupport(order = 4)
public void censYearExport(HttpServletResponse response,CensYearParamVo param) {
censService.censYearExport(response,param);
}
} }

15
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/WorkTicketFinish.java

@ -166,6 +166,21 @@ public class WorkTicketFinish implements Serializable {
*/ */
private String otherItems; private String otherItems;
/**
* 工作终结负责人
*/
private String endPrincipalName;
/**
* 工作终结许可人
*/
private String endLicensorName;
/**
* 工作票终结许可人
*/
private String finishLicensorName;
} }

6
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/CensService.java

@ -4,7 +4,9 @@ import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensVo; import com.hnac.hzims.ticket.standardTicket.vo.CensVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo; import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo; import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo;
import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@ -15,4 +17,8 @@ public interface CensService {
List<CensVo> cens(CensParamVo param); List<CensVo> cens(CensParamVo param);
List<CensYearVo> censYear(CensYearParamVo param); List<CensYearVo> censYear(CensYearParamVo param);
void censExport(HttpServletResponse response, CensParamVo param);
void censYearExport(HttpServletResponse response, CensYearParamVo param);
} }

449
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java

@ -1,8 +1,6 @@
package com.hnac.hzims.ticket.twoTicket.service.impl; package com.hnac.hzims.ticket.twoTicket.service.impl;
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.toolkit.Wrappers;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService; import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
@ -15,14 +13,26 @@ import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -60,10 +70,21 @@ public class CensServiceImpl implements CensService {
} }
// 获取权限区域机构 // 获取权限区域机构
List<Dept> depts = this.authArea(); List<Dept> depts;
if(ObjectUtil.isEmpty(param.getDeptId())){
// 获取权限区域机构
depts = this.authArea();
if(CollectionUtil.isEmpty(depts)){ if(CollectionUtil.isEmpty(depts)){
return new ArrayList<>(); return new ArrayList<>();
} }
}else{
R<Dept> result = sysClient.getDept(param.getDeptId());
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
depts = Collections.singletonList(result.getData());
}
// 操作票查询 // 操作票查询
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
if(!StringUtil.isEmpty(param.getFlowTaskName())){ if(!StringUtil.isEmpty(param.getFlowTaskName())){
@ -135,12 +156,20 @@ public class CensServiceImpl implements CensService {
if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){ if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){
param.setFlowTaskName("结束"); param.setFlowTaskName("结束");
} }
List<Dept> depts;
if(ObjectUtil.isEmpty(param.getDeptId())){
// 获取权限区域机构 // 获取权限区域机构
List<Dept> depts = this.authArea(); depts = this.authArea();
if(CollectionUtil.isEmpty(depts)){ if(CollectionUtil.isEmpty(depts)){
return new ArrayList<>(); return new ArrayList<>();
} }
}else{
R<Dept> result = sysClient.getDept(param.getDeptId());
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
depts = Collections.singletonList(result.getData());
}
// 操作票查询 // 操作票查询
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
@ -180,11 +209,417 @@ public class CensServiceImpl implements CensService {
}else{ }else{
cens.setWorkCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId()) && DateUtil.format(work.getCreateTime(),"yyyy-MM").equals(strMon)).count()); cens.setWorkCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId()) && DateUtil.format(work.getCreateTime(),"yyyy-MM").equals(strMon)).count());
} }
cens.setWorkTaskCount((long)new Random().nextInt(10));
censs.add(cens); censs.add(cens);
} }
censYear.setCenss(censs); censYear.setCenss(censs.stream().sorted(Comparator.comparing(CensVo::getMon)).collect(Collectors.toList()));
return censYear; return censYear;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/**
* 两票统计导出
* @param response
* @param param
*/
@Override
public void censExport(HttpServletResponse response, CensParamVo param) {
// 创建Excel文件
HSSFWorkbook hssWB = new HSSFWorkbook();
// 添加sheet页
HSSFSheet sheet = hssWB.createSheet("两票统计报表");
// 行高
sheet.setDefaultRowHeight((short) (20 * 25));
// 列宽
sheet.setDefaultColumnWidth(20);
this.setFirstHeader(hssWB, sheet);
// 第二行/三行 表头格式设置
this.setWorkHeader(hssWB, sheet);
List<CensVo> censs = this.cens(param);
if (!CollectionUtil.isEmpty(censs)) {
// 数据填充
this.setWorkData(hssWB, sheet, censs);
}
// 下载导出
String filename = "两票统计报表";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
ServletOutputStream outputStream;
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xls", "UTF-8"));
//创建一个输出流
outputStream = response.getOutputStream();
//写入数据
hssWB.write(outputStream);
// 关闭
outputStream.close();
hssWB.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 首行表头样式
* @param hssWB
* @param sheet
*/
private void setFirstHeader(HSSFWorkbook hssWB, HSSFSheet sheet) {
// 第一行
HSSFRow fisrtRow = sheet.createRow(0);
this.setTitileStyle(hssWB, fisrtRow, 4, true);
// 第一个单元格
HSSFCell headCell = fisrtRow.getCell(0);
headCell.setCellValue("两票统计报表");
// 首行合并情况
CellRangeAddress region1 = new CellRangeAddress(0, 0, (short) 0, (short) 4);
sheet.addMergedRegion(region1);
}
/**
* 年度统计首行表头样式
* @param hssWB
* @param sheet
*/
private void setYearFirstHeader(HSSFWorkbook hssWB, HSSFSheet sheet) {
// 第一行
HSSFRow fisrtRow = sheet.createRow(0);
this.setTitileStyle(hssWB, fisrtRow, 27, true);
// 第一个单元格
HSSFCell headCell = fisrtRow.getCell(0);
headCell.setCellValue("两票年度统计报表");
// 首行合并情况
CellRangeAddress region1 = new CellRangeAddress(0, 0, (short) 0, (short) 27);
sheet.addMergedRegion(region1);
}
/**
* 表头格式设置
*
* @param hssWB
* @param sheet
*/
private void setWorkHeader(HSSFWorkbook hssWB, HSSFSheet sheet) {
// 创建行
HSSFRow row_1 = sheet.createRow(1);
this.setTitileStyle(hssWB, row_1, 4, true);
// 第一行
HSSFCell header_row_1_cell_1 = row_1.getCell(0);
header_row_1_cell_1.setCellValue("序号");
HSSFCell header_row_1_cell_2 = row_1.getCell(1);
header_row_1_cell_2.setCellValue("单位");
HSSFCell header_row_1_cell_3 = row_1.getCell(2);
header_row_1_cell_3.setCellValue("工作票数量");
HSSFCell header_row_1_cell_4 = row_1.getCell(3);
header_row_1_cell_4.setCellValue("操作票数量");
HSSFCell header_row_1_cell_5 = row_1.getCell(4);
header_row_1_cell_5.setCellValue("工作任务数量");
}
/**
* 设置Titile单元格样式
*
* @param hssWB
* @param row
* @param len
*/
private void setTitileStyle(HSSFWorkbook hssWB, HSSFRow row, int len, boolean isHead) {
HSSFCellStyle cellStyle = getHeadStyle(hssWB, isHead);
for (int i = 0; i <= len; i++) {
HSSFCell hssfcell = row.createCell(i);
hssfcell.setCellStyle(cellStyle);
}
}
/**
* 获取表头样式
*
* @param hssWB
* @return
*/
private HSSFCellStyle getHeadStyle(HSSFWorkbook hssWB, boolean isHead) {
HSSFCellStyle headStyle = hssWB.createCellStyle();
//边框
headStyle.setBorderLeft(BorderStyle.THIN);
headStyle.setBorderRight(BorderStyle.THIN);
headStyle.setBorderTop(BorderStyle.THIN);
headStyle.setBorderBottom(BorderStyle.THIN);
//居中:
headStyle.setAlignment(HorizontalAlignment.CENTER); // 居中
headStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
//字体:
HSSFFont font = hssWB.createFont();
font.setFontName("黑体");
if (isHead) {
//设置字体大小
font.setFontHeightInPoints((short) 12);
//背景颜色
headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headStyle.setFillForegroundColor(HSSFColor.HSSFColorPredefined.SKY_BLUE.getIndex());
} else {
//设置字体大小
font.setFontHeightInPoints((short) 8);
//背景颜色
headStyle.setFillPattern(FillPatternType.NO_FILL);
headStyle.setFillForegroundColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex());
}
//字体格式
headStyle.setFont(font);
return headStyle;
}
/**
* 表格数据填充
*
* @param hssWB
* @param sheet
* @param censs
*/
private void setWorkData(HSSFWorkbook hssWB, HSSFSheet sheet, List<CensVo> censs) {
int size = censs.size();
for (int i = 0; i < size; i++) {
HSSFRow row = sheet.createRow(i + 2);
this.setTitileStyle(hssWB, row, 19, false);
CensVo cens = censs.get(i);
// 序号
HSSFCell header_row_cell_0 = row.getCell(0);
header_row_cell_0.setCellValue(i + 1);
// 单位
HSSFCell header_row_cell_1 = row.getCell(1);
header_row_cell_1.setCellValue(cens.getDeptName());
// 工作票数量
HSSFCell header_row_cell_2 = row.getCell(2);
header_row_cell_2.setCellValue(cens.getWorkCount());
// 操作票数量
HSSFCell header_row_cell_3 = row.getCell(3);
header_row_cell_3.setCellValue(cens.getOperateCount());
// 工作任务数量
HSSFCell header_row_cell_4 = row.getCell(4);
header_row_cell_4.setCellValue(cens.getWorkTaskCount());
}
}
/**
* 两票年度统计导出
* @param response
* @param param
*/
@Override
public void censYearExport(HttpServletResponse response, CensYearParamVo param) {
if(StringUtil.isEmpty(param.getYear())){
param.setYear(DateUtil.format(new Date(),"yyyy"));
}
// 创建Excel文件
HSSFWorkbook hssWB = new HSSFWorkbook();
// 添加sheet页
HSSFSheet sheet = hssWB.createSheet(param.getYear() +"两票年度统计报表");
// 行高
sheet.setDefaultRowHeight((short) (20 * 25));
// 列宽
sheet.setDefaultColumnWidth(20);
this.setYearFirstHeader(hssWB, sheet);
// 第二行/三行 表头格式设置
this.setYearWorkHeader(hssWB, sheet);
List<CensYearVo> censYears = this.censYear(param);
if (!CollectionUtil.isEmpty(censYears)) {
// 数据填充
this.setYearWorkData(hssWB, sheet, censYears);
}
// 下载导出
String filename = param.getYear() + "年度两票统计报表";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
ServletOutputStream outputStream;
try {
//设置xlsx格式
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".xls", "UTF-8"));
//创建一个输出流
outputStream = response.getOutputStream();
//写入数据
hssWB.write(outputStream);
// 关闭
outputStream.close();
hssWB.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 两票年首行表头设置
* @param hssWB
* @param sheet
*/
private void setYearWorkHeader(HSSFWorkbook hssWB, HSSFSheet sheet) {
// 创建行
HSSFRow row_1 = sheet.createRow(1);
this.setTitileStyle(hssWB, row_1, 27, true);
// 第一行
HSSFCell header_row_1_cell_1 = row_1.getCell(0);
header_row_1_cell_1.setCellValue("序号");
HSSFCell header_row_1_cell_2 = row_1.getCell(1);
header_row_1_cell_2.setCellValue("单位");
HSSFCell header_row_1_cell_3 = row_1.getCell(2);
header_row_1_cell_3.setCellValue("1月");
HSSFCell header_row_1_cell_4 = row_1.getCell(4);
header_row_1_cell_4.setCellValue("2月");
HSSFCell header_row_1_cell_5 = row_1.getCell(6);
header_row_1_cell_5.setCellValue("3月");
HSSFCell header_row_1_cell_6 = row_1.getCell(8);
header_row_1_cell_6.setCellValue("4月");
HSSFCell header_row_1_cell_7 = row_1.getCell(10);
header_row_1_cell_7.setCellValue("5月");
HSSFCell header_row_1_cell_8 = row_1.getCell(12);
header_row_1_cell_8.setCellValue("6月");
HSSFCell header_row_1_cell_9 = row_1.getCell(14);
header_row_1_cell_9.setCellValue("7月");
HSSFCell header_row_1_cell_10 = row_1.getCell(16);
header_row_1_cell_10.setCellValue("8月");
HSSFCell header_row_1_cell_11 = row_1.getCell(18);
header_row_1_cell_11.setCellValue("9月");
HSSFCell header_row_1_cell_12 = row_1.getCell(20);
header_row_1_cell_12.setCellValue("10月");
HSSFCell header_row_1_cell_13 = row_1.getCell(22);
header_row_1_cell_13.setCellValue("11月");
HSSFCell header_row_1_cell_14 = row_1.getCell(24);
header_row_1_cell_14.setCellValue("12月");
HSSFCell header_row_1_cell_15 = row_1.getCell(26);
header_row_1_cell_15.setCellValue("总计");
// 第二行
HSSFRow row_2 = sheet.createRow(2);
this.setTitileStyle(hssWB, row_2, 27, true);
HSSFCell header_row_2_cell_1 = row_2.getCell(2);
header_row_2_cell_1.setCellValue("工作票");
HSSFCell header_row_2_cell_2 = row_2.getCell(3);
header_row_2_cell_2.setCellValue("操作票");
HSSFCell header_row_2_cell_3 = row_2.getCell(4);
header_row_2_cell_3.setCellValue("工作票");
HSSFCell header_row_2_cell_4 = row_2.getCell(5);
header_row_2_cell_4.setCellValue("操作票");
HSSFCell header_row_2_cell_5 = row_2.getCell(6);
header_row_2_cell_5.setCellValue("工作票");
HSSFCell header_row_2_cell_6 = row_2.getCell(7);
header_row_2_cell_6.setCellValue("操作票");
HSSFCell header_row_2_cell_7 = row_2.getCell(8);
header_row_2_cell_7.setCellValue("工作票");
HSSFCell header_row_2_cell_8 = row_2.getCell(9);
header_row_2_cell_8.setCellValue("操作票");
HSSFCell header_row_2_cell_9 = row_2.getCell(10);
header_row_2_cell_9.setCellValue("工作票");
HSSFCell header_row_2_cell_10 = row_2.getCell(11);
header_row_2_cell_10.setCellValue("操作票");
HSSFCell header_row_2_cell_11 = row_2.getCell(12);
header_row_2_cell_11.setCellValue("工作票");
HSSFCell header_row_2_cell_12 = row_2.getCell(13);
header_row_2_cell_12.setCellValue("操作票");
HSSFCell header_row_2_cell_13 = row_2.getCell(14);
header_row_2_cell_13.setCellValue("工作票");
HSSFCell header_row_2_cell_14 = row_2.getCell(15);
header_row_2_cell_14.setCellValue("操作票");
HSSFCell header_row_2_cell_15 = row_2.getCell(16);
header_row_2_cell_15.setCellValue("工作票");
HSSFCell header_row_2_cell_16 = row_2.getCell(17);
header_row_2_cell_16.setCellValue("操作票");
HSSFCell header_row_2_cell_17 = row_2.getCell(18);
header_row_2_cell_17.setCellValue("工作票");
HSSFCell header_row_2_cell_18 = row_2.getCell(19);
header_row_2_cell_18.setCellValue("操作票");
HSSFCell header_row_2_cell_19 = row_2.getCell(20);
header_row_2_cell_19.setCellValue("工作票");
HSSFCell header_row_2_cell_20 = row_2.getCell(21);
header_row_2_cell_20.setCellValue("操作票");
HSSFCell header_row_2_cell_21 = row_2.getCell(22);
header_row_2_cell_21.setCellValue("工作票");
HSSFCell header_row_2_cell_22 = row_2.getCell(23);
header_row_2_cell_22.setCellValue("操作票");
HSSFCell header_row_2_cell_23 = row_2.getCell(24);
header_row_2_cell_23.setCellValue("工作票");
HSSFCell header_row_2_cell_24 = row_2.getCell(25);
header_row_2_cell_24.setCellValue("操作票");
HSSFCell header_row_2_cell_25 = row_2.getCell(26);
header_row_2_cell_25.setCellValue("工作票");
HSSFCell header_row_2_cell_26 = row_2.getCell(27);
header_row_2_cell_26.setCellValue("操作票");
// 表头一:合并情况
CellRangeAddress header_region_1 = new CellRangeAddress((short) 1, (short) 2, (short) 0, (short) 0);
CellRangeAddress header_region_2 = new CellRangeAddress((short) 1, (short) 2, (short) 1, (short) 1);
CellRangeAddress header_region_3 = new CellRangeAddress((short) 1, (short) 1, (short) 2, (short) 3);
CellRangeAddress header_region_4 = new CellRangeAddress((short) 1, (short) 1, (short) 4, (short) 5);
CellRangeAddress header_region_5 = new CellRangeAddress((short) 1, (short) 1, (short) 6, (short) 7);
CellRangeAddress header_region_6 = new CellRangeAddress((short) 1, (short) 1, (short) 8, (short) 9);
CellRangeAddress header_region_7 = new CellRangeAddress((short) 1, (short) 1, (short) 10, (short) 11);
CellRangeAddress header_region_8 = new CellRangeAddress((short) 1, (short) 1, (short) 12, (short) 13);
CellRangeAddress header_region_9 = new CellRangeAddress((short) 1, (short) 1, (short) 14, (short) 15);
CellRangeAddress header_region_10 = new CellRangeAddress((short) 1, (short) 1, (short) 16, (short) 17);
CellRangeAddress header_region_11 = new CellRangeAddress((short) 1, (short) 1, (short) 18, (short) 19);
CellRangeAddress header_region_12 = new CellRangeAddress((short) 1, (short) 1, (short) 20, (short) 21);
CellRangeAddress header_region_13 = new CellRangeAddress((short) 1, (short) 1, (short) 22, (short) 23);
CellRangeAddress header_region_14 = new CellRangeAddress((short) 1, (short) 1, (short) 24, (short) 25);
CellRangeAddress header_region_15 = new CellRangeAddress((short) 1, (short) 1, (short) 26, (short) 27);
sheet.addMergedRegion(header_region_1);
sheet.addMergedRegion(header_region_2);
sheet.addMergedRegion(header_region_3);
sheet.addMergedRegion(header_region_4);
sheet.addMergedRegion(header_region_5);
sheet.addMergedRegion(header_region_6);
sheet.addMergedRegion(header_region_7);
sheet.addMergedRegion(header_region_8);
sheet.addMergedRegion(header_region_9);
sheet.addMergedRegion(header_region_10);
sheet.addMergedRegion(header_region_11);
sheet.addMergedRegion(header_region_12);
sheet.addMergedRegion(header_region_13);
sheet.addMergedRegion(header_region_14);
sheet.addMergedRegion(header_region_15);
}
/**
* 年度数据设置
* @param hssWB
* @param sheet
* @param censYears
*/
private void setYearWorkData(HSSFWorkbook hssWB, HSSFSheet sheet, List<CensYearVo> censYears) {
int size = censYears.size();
for (int i = 0; i < size; i++) {
HSSFRow row = sheet.createRow(i + 3);
this.setTitileStyle(hssWB, row, 27, false);
CensYearVo censYear = censYears.get(i);
// 序号
HSSFCell header_row_cell_0 = row.getCell(0);
header_row_cell_0.setCellValue(i + 1);
// 单位
HSSFCell header_row_cell_1 = row.getCell(1);
header_row_cell_1.setCellValue(censYear.getDeptName());
List<CensVo> censs = censYear.getCenss();
if(CollectionUtil.isEmpty(censs)){
return;
}
int workSum = 0,operateSum = 0;
for(int mon = 0; mon < 12; mon ++){
CensVo cens = censs.get(mon);
// 工作票数量
HSSFCell work_cell = row.getCell(2 * (mon + 1));
work_cell.setCellValue(cens.getWorkCount());
workSum += cens.getWorkCount();
// 操作票数量
HSSFCell operate_cell = row.getCell(2 * (mon + 1) + 1);
operate_cell.setCellValue(cens.getOperateCount());
operateSum += cens.getOperateCount();
}
// 总计
HSSFCell work_sum_cell = row.getCell(26);
work_sum_cell.setCellValue(workSum);
HSSFCell operate_sum_cell = row.getCell(27);
operate_sum_cell.setCellValue(operateSum);
}
}
} }

17
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java

@ -395,27 +395,27 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
//安全隔离措施附页 (true,展示附件,false,不展示附件) //安全隔离措施附页 (true,展示附件,false,不展示附件)
if (workTicketInfo.getIsSafety()) { if (workTicketInfo.getIsSafety()) {
XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SECURE_PAGE, params); XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SECURE_PAGE, params);
result.add(xwpfDocument); //result.add(xwpfDocument);
} }
//危险点分析与预控措施票 (true,展示附件,false,不展示附件) //危险点分析与预控措施票 (true,展示附件,false,不展示附件)
if (workTicketInfo.getIsHazard()) { if (workTicketInfo.getIsHazard()) {
XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SAFETY_PAGE, params); XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SAFETY_PAGE, params);
result.add(xwpfDocument); //result.add(xwpfDocument);
} }
//动火工作票 (true,展示附件,false,不展示附件) //动火工作票 (true,展示附件,false,不展示附件)
if (workTicketInfo.getIsRailway()) { if (workTicketInfo.getIsRailway()) {
XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.FLIGHT_PAGE, params); XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.FLIGHT_PAGE, params);
result.add(xwpfDocument); //result.add(xwpfDocument);
} }
//有限空间监测记录单(true,展示附件,false,不展示附件) //有限空间监测记录单(true,展示附件,false,不展示附件)
if (workTicketInfo.getIsLimited()) { if (workTicketInfo.getIsLimited()) {
XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SPACE_PAGE, params); XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.SPACE_PAGE, params);
result.add(xwpfDocument); //result.add(xwpfDocument);
} }
//每日开工和收工时间附页 //每日开工和收工时间附页
if (workTicketInfo.getIsStart()) { if (workTicketInfo.getIsStart()) {
XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.START_PAGE, params); XWPFDocument xwpfDocument = this.fillDocument("template/" + TicketConstant.START_PAGE, params);
result.add(xwpfDocument); //result.add(xwpfDocument);
} }
return result; return result;
} }
@ -431,12 +431,7 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
} }
private void exportTicketWord(List<XWPFDocument> documents, String savePath) throws IOException { private void exportTicketWord(List<XWPFDocument> documents, String savePath) throws IOException {
FileOutputStream out = new FileOutputStream(savePath, true); FileOutputStream out = new FileOutputStream(savePath);
Path file = Paths.get(path);
if(Files.exists(file)) {
Files.delete(file);
}
new File(savePath).createNewFile();
for (XWPFDocument document : documents) { for (XWPFDocument document : documents) {
document.write(out); document.write(out);
} }

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -506,6 +506,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
} }
workTicket.setProcessInstanceId(response.getProcessInstanceId()); workTicket.setProcessInstanceId(response.getProcessInstanceId());
this.saveWorkTicket(workTicket,response); this.saveWorkTicket(workTicket,response);
firstWorkTicketService.updateById(workTicket);
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList();
if(CollectionUtil.isNotEmpty(safetyMeasuresList)) { if(CollectionUtil.isNotEmpty(safetyMeasuresList)) {
workTicketSafetyMeasureService.saveOrUpdateBatch(safetyMeasuresList); workTicketSafetyMeasureService.saveOrUpdateBatch(safetyMeasuresList);
@ -1366,7 +1367,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket()); this.saveSafetyMeasures(workTicketVo.getSafetyMeasuresList(), workTicketVo.getWorkTicket());
this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket()); this.saveWorkTicketContentDto(workTicketVo.getWorkTicketContentDtoList(), workTicketVo.getWorkTicket());
// 开启工作流 // 开启工作流
String processInstanceId = this.startOfflineTicketProcess(workTicketVo); this.startOfflineTicketProcess(workTicketVo);
return workTicket.getId(); return workTicket.getId();
} }

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java

@ -67,7 +67,7 @@ public interface WorkTicketInfoMapper extends UserDataScopeBaseMapper<WorkTicket
Page<WorkTicketInfoEntity> selectPages(Page<WorkTicketInfoEntity> pageEntity, Page<WorkTicketInfoEntity> selectPages(Page<WorkTicketInfoEntity> pageEntity,
@Param(Constants.WRAPPER) QueryWrapper<WorkTicketInfoEntity> queryWrapper); @Param(Constants.WRAPPER) QueryWrapper<WorkTicketInfoEntity> queryWrapper);
List<WorkTicketBillVO> getWorkTicketBill(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime); List<WorkTicketBillVO> getWorkTicketBill(@Param("deviceCodes") List<String> deviceCodes, @Param("startTime") String startTime, @Param("endTime") String endTime);
@UserDataAuth @UserDataAuth
List<Map> selectTicketList(@Param(Constants.WRAPPER) QueryWrapper<WorkTicketInfoEntity> queryWrapper); List<Map> selectTicketList(@Param(Constants.WRAPPER) QueryWrapper<WorkTicketInfoEntity> queryWrapper);

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml

@ -86,16 +86,18 @@
</select> </select>
<select id="getWorkTicketBill" resultType="com.hnac.hzims.ticket.workTicket.vo.WorkTicketBillVO"> <select id="getWorkTicketBill" resultType="com.hnac.hzims.ticket.workTicket.vo.WorkTicketBillVO">
select em.`NAME` as emName,info.`type`,count(*) as payment, select info.em_code as emCode,info.`type`,count(*) as payment,
(select count(*) from hzims_work_ticket_info i where flow_description = '结束' and i.id = info.id) as finish, (select count(*) from hzims_work_ticket_info i where flow_description = '结束' and i.id = info.id) as finish,
(select count(*) from hzims_work_ticket_info i where flow_description = '作废' and i.id = info.id) as invalid, (select count(*) from hzims_work_ticket_info i where flow_description = '作废' and i.id = info.id) as invalid,
(select count(*) from hzims_ticket_info_evaluate e where evaluate = '合格!' and e.id = eval.id) as qualified (select count(*) from hzims_ticket_info_evaluate e where evaluate = '合格!' and e.id = eval.id) as qualified
from hzims_work_ticket_info info from hzims_work_ticket_info info
LEFT JOIN hzims_ticket_info_evaluate eval ON info.id = eval.ticket_id LEFT JOIN hzims_ticket_info_evaluate eval ON info.id = eval.ticket_i
LEFT JOIN `equipment`.hzims_em_info em ON info.em_code = em.NUMBER
<where> <where>
<if test="path != null"> <if test="deviceCodes != null">
em.path like CONCAT(#{path},'%') and info.em_code in
<foreach collection="deviceCodes" item="deviceCode" separator="," open="(" close=")" index="index">
#{deviceCode}
</foreach>
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
and info.make_date_time &gt;= #{startTime} and info.make_date_time &gt;= #{startTime}

25
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -1127,14 +1127,23 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
@Override @Override
public List<WorkTicketBillVO> getWorkTicketBill(String emCode, String startTime, String endTime) { public List<WorkTicketBillVO> getWorkTicketBill(String emCode, String startTime, String endTime) {
R<EmInfoEntity> emInfoEntityR = emInfoClient.getEmInfoByEmCode(emCode); // 查询路径设备
if (emInfoEntityR.getCode() != 200 || Func.isEmpty(emInfoEntityR.getData())) { List<EmInfoEntity> devices = emInfoClient.deviceByPath(emCode);
throw new ServiceException("设备信息查询异常"); if(CollectionUtil.isEmpty(devices)){
} return new ArrayList<>();
EmInfoEntity emInfo = emInfoEntityR.getData(); }
List<WorkTicketBillVO> tickets = baseMapper.getWorkTicketBill(devices.stream().map(EmInfoEntity::getNumber).collect(Collectors.toList()), startTime, endTime);
List<WorkTicketBillVO> workTicketBillList = baseMapper.getWorkTicketBill(emInfo.getPath(), startTime, endTime); if(CollectionUtil.isEmpty(tickets)){
return workTicketBillList; return new ArrayList<>();
}
return tickets.stream().map(ticket->{
List<EmInfoEntity> repairDevice = devices.stream().filter(device->device.getNumber().equals(ticket.getEmCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(repairDevice)){
return ticket;
}
ticket.setEmName(repairDevice.get(0).getName());
return ticket;
}).collect(Collectors.toList());
} }

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketBillVO.java

@ -10,6 +10,10 @@ import lombok.Data;
*/ */
@Data @Data
public class WorkTicketBillVO { public class WorkTicketBillVO {
@ApiModelProperty("设备编码")
private String emCode;
@ApiModelProperty("设备名称") @ApiModelProperty("设备名称")
private String emName; private String emName;

5
hzims-service/ticket/src/main/resources/db/2.0.1.sql

@ -0,0 +1,5 @@
alter table `hzims_work_ticket_finish` add column `end_principal_name` varchar(50) comment '工作终结负责人';
alter table `hzims_work_ticket_finish` add column `end_licensor_name` varchar(50) comment '工作终结许可人';
alter table `hzims_work_ticket_finish` add column `finish_licensor_name` varchar(50) comment '工作票终结许可人';
alter table `hzims_work_ticket_info` add column `is_offline` tinyint(2) default 0 comment '是否线下 : 1-线下,0-线上';

9
hzims-service/ticket/src/main/resources/file/线下工作票审批流程.bpmn20.xml

@ -4,6 +4,7 @@
<startEvent id="startEvent1"></startEvent> <startEvent id="startEvent1"></startEvent>
<userTask id="sid-194BD702-29AE-4DA6-A343-05464D12BB83" name="签发人签发" flowable:candidateGroups="signer"> <userTask id="sid-194BD702-29AE-4DA6-A343-05464D12BB83" name="签发人签发" flowable:candidateGroups="signer">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="1"></flowable:formProperty>
<flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener> <flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener>
</extensionElements> </extensionElements>
</userTask> </userTask>
@ -11,6 +12,7 @@
<exclusiveGateway id="sid-C055B0CF-183B-4BFF-B9CA-D5C420311421"></exclusiveGateway> <exclusiveGateway id="sid-C055B0CF-183B-4BFF-B9CA-D5C420311421"></exclusiveGateway>
<userTask id="sid-2CCB5862-1AB2-4327-9FBE-A11DC613B258" name="运行人员接收" flowable:candidateGroups="operatingCrew"> <userTask id="sid-2CCB5862-1AB2-4327-9FBE-A11DC613B258" name="运行人员接收" flowable:candidateGroups="operatingCrew">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="2"></flowable:formProperty>
<flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener> <flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener>
</extensionElements> </extensionElements>
</userTask> </userTask>
@ -18,17 +20,20 @@
<sequenceFlow id="sid-2BD654BF-BFE4-481D-A710-185D10F7C413" sourceRef="sid-2CCB5862-1AB2-4327-9FBE-A11DC613B258" targetRef="sid-24261C82-08E4-4F0A-B069-5F2BB1E1ECEF"></sequenceFlow> <sequenceFlow id="sid-2BD654BF-BFE4-481D-A710-185D10F7C413" sourceRef="sid-2CCB5862-1AB2-4327-9FBE-A11DC613B258" targetRef="sid-24261C82-08E4-4F0A-B069-5F2BB1E1ECEF"></sequenceFlow>
<userTask id="sid-33C2D3CB-1B69-4234-9AE9-3747F37BE8C5" name="许可人许可" flowable:candidateGroups="licensor"> <userTask id="sid-33C2D3CB-1B69-4234-9AE9-3747F37BE8C5" name="许可人许可" flowable:candidateGroups="licensor">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="3"></flowable:formProperty>
<flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener> <flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener>
</extensionElements> </extensionElements>
</userTask> </userTask>
<userTask id="sid-1D70C4B2-A79B-4C02-AA30-9D755484C4B6" name="工作结束"> <userTask id="sid-1D70C4B2-A79B-4C02-AA30-9D755484C4B6" name="工作结束" flowable:candidateGroups="licensor">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="4"></flowable:formProperty>
<flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener> <flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener>
</extensionElements> </extensionElements>
</userTask> </userTask>
<sequenceFlow id="sid-9FDA7FDD-A163-4496-B850-77C7A44C3F1F" sourceRef="sid-33C2D3CB-1B69-4234-9AE9-3747F37BE8C5" targetRef="sid-1D70C4B2-A79B-4C02-AA30-9D755484C4B6"></sequenceFlow> <sequenceFlow id="sid-9FDA7FDD-A163-4496-B850-77C7A44C3F1F" sourceRef="sid-33C2D3CB-1B69-4234-9AE9-3747F37BE8C5" targetRef="sid-1D70C4B2-A79B-4C02-AA30-9D755484C4B6"></sequenceFlow>
<userTask id="sid-7A6326EA-6129-47EF-88D1-0FC14033B25A" name="工作票终结"> <userTask id="sid-7A6326EA-6129-47EF-88D1-0FC14033B25A" name="工作票终结" flowable:candidateGroups="licensor">
<extensionElements> <extensionElements>
<flowable:formProperty id="new_property_1" type="string" default="5"></flowable:formProperty>
<flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener> <flowable:taskListener event="create" class="org.springblade.flow.engine.listener.DynamicTaskUserListener"></flowable:taskListener>
</extensionElements> </extensionElements>
</userTask> </userTask>

Loading…
Cancel
Save