Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
haungxing 3 months ago
parent
commit
e5cd9f49d8
  1. 75
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/ComprehensiveElectricVo.java
  2. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/DeviceElectricVo.java
  3. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/TableHeadVo.java
  4. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailImgVO.java
  5. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailStrVO.java
  6. 5
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java
  7. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailImgVO.java
  8. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailStrVO.java
  9. 5
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java
  10. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailImgVO.java
  11. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailStrVO.java
  12. 7
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailVO.java
  13. 12
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneEvaluationExportVO.java
  14. 41
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneEvaluationPeopleExportVO.java
  15. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java
  16. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java
  17. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailImgVO.java
  18. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailStrVO.java
  19. 7
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java
  20. 40
      hzims-service/equipment/src/main/java/com/hnac/hzims/delian/service/impl/DeLianServiceImpl.java
  21. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/controller/ElectricReportController.java
  22. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/IElectricReportService.java
  23. 183
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java
  24. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/interruption/mapper/InterruptionMapper.java
  25. 57
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/ErrorCode.java
  26. 16
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ResultBooleanStrategy.java
  27. 8
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java
  28. 49
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisServiceImpl.java
  29. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  30. 40
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  31. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyRecQRRecordMapper.java
  32. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  33. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java
  34. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java
  35. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java
  36. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  37. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  38. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java
  39. 40
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  40. 28
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java
  41. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java
  42. 112
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java
  43. 35
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  44. 78
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java
  45. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生考核表(五周).docx
  46. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生考核表(四周).docx
  47. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生考核表.xlsx

75
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/ComprehensiveElectricVo.java

@ -0,0 +1,75 @@
package com.hnac.hzims.electric.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class ComprehensiveElectricVo {
@ApiModelProperty(value = "月份")
private String month;
@ApiModelProperty(value = "本月电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double monthGenerate;
@ApiModelProperty(value = "去年同月")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastMonthGenerate;
@ApiModelProperty(value = "月同比")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastMonthGenerateRate;
@ApiModelProperty(value = "年发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double yearGenerate;
@ApiModelProperty(value = "去年同期")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastYearGenerate;
@ApiModelProperty(value = "年同比")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastYearGenerateRate;
@ApiModelProperty(value = "本月降雨")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double monthRain;
@ApiModelProperty(value = "去年同月")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastMonthRain;
@ApiModelProperty(value = "年降雨量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double yearRain;
@ApiModelProperty(value = "去年同期")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastYearRain;
@ApiModelProperty(value = "本月等效小时")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double monthEquivalent;
@ApiModelProperty(value = "去年同月")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastMonthEquivalent;
@ApiModelProperty(value = "年等效小时")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double yearEquivalent;
@ApiModelProperty(value = "去年同期")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastYearEquivalent;
}

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/DeviceElectricVo.java

@ -5,7 +5,7 @@ import lombok.Data;
/**
* @author 表头
* @author ysj
*/
@Data
public class DeviceElectricVo {

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/electric/vo/TableHeadVo.java

@ -7,7 +7,7 @@ import java.util.List;
/**
* @author 表头
* @author ysj
*/
@Data
public class TableHeadVo {

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆维保记录VO类-图片实体类")
public class CarMaintenanceDetailImgVO extends CarMaintenanceDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆维保记录VO类-图片字符串类")
public class CarMaintenanceDetailStrVO extends CarMaintenanceDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

5
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java

@ -1,12 +1,10 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author liwen
@ -64,9 +62,6 @@ public class CarMaintenanceDetailVO {
@ApiModelProperty("维保类型")
private String maintenanceType;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆用车记录VO类-图片实体类")
public class CarUsedRecordDetailImgVO extends CarUsedRecordDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆用车记录VO类-图片字符串类")
public class CarUsedRecordDetailStrVO extends CarUsedRecordDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

5
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java

@ -1,13 +1,11 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author liwen
@ -65,9 +63,6 @@ public class CarUsedRecordDetailVO {
@ApiModelProperty("确认时间")
private Date confirmationTime;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "会议记录VO类-图片实体类")
public class ConferenceRecordDetailImgVO extends ConferenceRecordDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "会议记录VO类-图片实体类")
public class ConferenceRecordDetailStrVO extends ConferenceRecordDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

7
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailVO.java

@ -1,13 +1,9 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-15
@ -55,9 +51,6 @@ public class ConferenceRecordDetailVO {
@ApiModelProperty("会议附件")
private String filePath;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

12
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneEvaluationExportDTO.java → hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneEvaluationExportVO.java

@ -1,6 +1,5 @@
package com.hnac.hzims.safeproduct.dto;
package com.hnac.hzims.safeproduct.vo;
import com.hnac.hzims.safeproduct.vo.HygieneEvaluationPeopleVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -12,8 +11,8 @@ import java.util.List;
* @date 2024-08-20
*/
@Data
@ApiModel(value = "卫生考核导出DTO类")
public class HygieneEvaluationExportDTO {
@ApiModel(value = "卫生考核导出VO类")
public class HygieneEvaluationExportVO {
@ApiModelProperty(value = "年份")
private String year;
@ -51,9 +50,6 @@ public class HygieneEvaluationExportDTO {
@ApiModelProperty(value = "第五周结束日")
private String fifthWeekEnd;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "考核人员列表")
private List<HygieneEvaluationPeopleVO> evaluationList;
private List<HygieneEvaluationPeopleExportVO> evaluationList;
}

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

@ -0,0 +1,41 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2024-08-22
*/
@Data
@ApiModel(value = "卫生考核人员导出VO类")
public class HygieneEvaluationPeopleExportVO {
@ApiModelProperty(value = "单位")
private String unit;
@ApiModelProperty(value = "负责人")
private String principal;
@ApiModelProperty(value = "合计分")
private Long sumScore;
@ApiModelProperty(value = "第一周考核分")
private Long firstWeekScore;
@ApiModelProperty(value = "第二周考核分")
private Long secondWeekScore;
@ApiModelProperty(value = "第三周考核分")
private Long thirdWeekScore;
@ApiModelProperty(value = "第四周考核分")
private Long fourthWeekScore;
@ApiModelProperty(value = "第五周考核分")
private Long fifthWeekScore;
@ApiModelProperty(value = "备注")
private String remark;
}

6
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java

@ -4,12 +4,14 @@ import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@ApiModel(value = "演练记录表VO类")
public class RehearsalRecordDetailImgVO extends RehearsalRecordDetailVO{
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "演练记录表VO类-图片实体类")
public class RehearsalRecordDetailImgVO extends RehearsalRecordDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;

6
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java

@ -3,12 +3,14 @@ package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@ApiModel(value = "演练记录表VO类")
public class RehearsalRecordDetailStrVO extends RehearsalRecordDetailVO{
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "演练记录表VO类-图片字符串类")
public class RehearsalRecordDetailStrVO extends RehearsalRecordDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "培训记录表VO类-图片实体类")
public class TrainRecordDetailImgVO extends TrainRecordDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "培训记录表VO类-图片字符串类")
public class TrainRecordDetailStrVO extends TrainRecordDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

7
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java

@ -1,13 +1,9 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-15
@ -55,9 +51,6 @@ public class TrainRecordDetailVO {
@ApiModelProperty("培训附件")
private String filePath;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

40
hzims-service/equipment/src/main/java/com/hnac/hzims/delian/service/impl/DeLianServiceImpl.java

@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
@ -30,6 +31,9 @@ public class DeLianServiceImpl implements IDeLianService {
private String hostId;
@Value("${deLian.passWord}")
private String passWord;
private final RedisTemplate redisTemplate;
private final static String load_strategys_key = "hzims:equipment:delian:strategys:key";
@Override
public List<StrategyDataVO> getStrategys() {
@ -37,12 +41,13 @@ public class DeLianServiceImpl implements IDeLianService {
HashMap<String, Object> requestData = new HashMap<String, Object>() {{
put("Strategy_Type", 0);
}};
param.put("request_data",requestData);
param.put("request_cmd",DeLianConstants.STRATEGYS.getCode());
param.put("request_data", requestData);
param.put("request_cmd", DeLianConstants.STRATEGYS.getCode());
String jsonString = JSON.toJSONString(param);
HttpResponse response = HttpRequest.post(deLianUrl).body(jsonString).execute();
if(response.getStatus() == HttpServletResponse.SC_OK ) {
if (response.getStatus() == HttpServletResponse.SC_OK) {
List<StrategyDataVO> responseData = JSONObject.parseArray(JSONObject.parseObject(response.body()).getString("response_data"), StrategyDataVO.class);
redisTemplate.opsForValue().set(load_strategys_key, responseData);
return responseData;
}
return new ArrayList<>();
@ -50,16 +55,28 @@ public class DeLianServiceImpl implements IDeLianService {
@Override
public R executeScene(String key) {
long start = System.currentTimeMillis();
log.info("executeScene接口请求开始------");
HashMap<String, Object> param = getOauthToken();
param.put("request_cmd",DeLianConstants.EXECUTESCENE.getCode());
List<StrategyDataVO> strategys = getStrategys();
param.put("request_cmd", DeLianConstants.EXECUTESCENE.getCode());
List<StrategyDataVO> strategys = new ArrayList<>();
if (redisTemplate.hasKey(load_strategys_key)) {
strategys = (List<StrategyDataVO>) redisTemplate.opsForValue().get(load_strategys_key);
} else {
strategys = getStrategys();
}
for (StrategyDataVO strategy : strategys) {
if (key.equals(strategy.getSn())){
param.put("request_data",strategy.getSID());
if (key.equals(strategy.getSn())) {
param.put("request_data", strategy.getSID());
}
}
long start1 = System.currentTimeMillis();
log.info("deLian策略查询耗时:{}", start1 - start);
log.info("deLian一键执行接口请求开始------");
HttpResponse response = HttpRequest.post(deLianUrl).body(JSON.toJSONString(param)).execute();
if(response.getStatus() == HttpServletResponse.SC_OK ) {
if (response.getStatus() == HttpServletResponse.SC_OK) {
long end = System.currentTimeMillis();
log.info("deLian一键执行接口耗时:{}", end - start1);
return R.success("执行成功");
}
return R.fail("执行成功");
@ -78,15 +95,14 @@ public class DeLianServiceImpl implements IDeLianService {
String jsonString = JSON.toJSONString(param);
HttpResponse response = HttpRequest.post(deLianUrl).body(jsonString).execute();
String token = JSONObject.parseObject(response.body()).getString("request_token");
if(response.getStatus() == HttpServletResponse.SC_OK &&
if (response.getStatus() == HttpServletResponse.SC_OK &&
StringUtils.isNotBlank(token)) {
param.remove("request_data");
param.remove("request_cmd");
param.put("request_token",token);
param.put("request_token", token);
return param;
}else {
} else {
throw new ServiceException("获取权限失败,请稍后重试!");
}
}
}

10
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/controller/ElectricReportController.java

@ -2,6 +2,7 @@ package com.hnac.hzims.electric.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.electric.service.IElectricReportService;
import com.hnac.hzims.electric.vo.ComprehensiveElectricVo;
import com.hnac.hzims.equipment.entity.EmAssociationEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
@ -35,4 +37,12 @@ public class ElectricReportController extends BladeController {
@RequestParam(value = "time") String time) {
return R.data(service.basics(deptId,type,time));
}
@GetMapping("/comprehensive")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "综合报表", notes = "传入 deptId")
public R<List<ComprehensiveElectricVo>> comprehensive(@RequestParam(value = "deptId") Long deptId,
@RequestParam(value = "year") String year) {
return R.data(service.comprehensive(deptId,year));
}
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/IElectricReportService.java

@ -1,5 +1,8 @@
package com.hnac.hzims.electric.service;
import com.hnac.hzims.electric.vo.ComprehensiveElectricVo;
import java.util.List;
import java.util.Map;
/**
@ -9,4 +12,6 @@ public interface IElectricReportService {
Map<String, Object> basics(Long deptId, Long type,String time);
List<ComprehensiveElectricVo> comprehensive(Long deptId,String year);
}

183
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java

@ -1,6 +1,8 @@
package com.hnac.hzims.electric.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.electric.entity.ThirtyEntity;
@ -8,17 +10,15 @@ import com.hnac.hzims.electric.entity.ThreeEntity;
import com.hnac.hzims.electric.service.IElectricReportService;
import com.hnac.hzims.electric.service.ThirtyService;
import com.hnac.hzims.electric.service.ThreeService;
import com.hnac.hzims.electric.vo.ComprehensiveElectricVo;
import com.hnac.hzims.electric.vo.DeviceElectricVo;
import com.hnac.hzims.electric.vo.TableHeadVo;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.operational.station.vo.StationsByDeptIdsParamVo;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -26,11 +26,13 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@ -48,14 +50,16 @@ public class ElectricReportServiceImpl implements IElectricReportService {
private final ThirtyService thirtyService;
private final IEmInfoService deviceService;
private final ISysClient sysClient;
private final IStationClient stationClient;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final RedisTemplate redisTemplate;
public final static String DEVICE_CACHE_COFIG_FINAL = "hzims:equipment:emInfo:deviceCode.emInfoList";
/**
* 基础报表
* @param deptId
@ -92,6 +96,125 @@ public class ElectricReportServiceImpl implements IElectricReportService {
}
/**
* 综合报表
* @param deptId
* @return
*/
@Override
public List<ComprehensiveElectricVo> comprehensive(Long deptId,String year) {
// 查询站点
StationEntity param = new StationEntity();
param.setRefDept(deptId);
R<StationEntity> station = stationClient.getStationByCodeOrRedDept(param);
if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){
return new ArrayList<>();
}
// 查询设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(DEVICE_CACHE_COFIG_FINAL).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
// 设备装机容量
double installedCapacity = devices.stream().filter(device->device.getCreateDept().equals(deptId)).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum();
// 查询两年发电量
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse(year,"yyyy"));
calendar.add(Calendar.YEAR,1);
Date end = calendar.getTime();
calendar.add(Calendar.YEAR,-2);
Date start = calendar.getTime();
List<ThreeEntity> threes = threeService.list(Wrappers.<ThreeEntity>lambdaQuery()
.eq(ThreeEntity::getStationId,station.getData().getCode())
.ge(ThreeEntity::getStrMonth, DateUtil.format(start,DateUtil.PATTERN_DATE))
.le(ThreeEntity::getStrMonth, DateUtil.format(end,DateUtil.PATTERN_DATE))
);
calendar.setTime(DateUtil.parse(year,"yyyy"));
calendar.add(Calendar.YEAR,1);
Date finish = calendar.getTime();
calendar.add(Calendar.YEAR,-1);
Date current = calendar.getTime();
// fixme 随机器模拟数据
Random random = new Random();
List<ComprehensiveElectricVo> electrics = new ArrayList<>();
while (current.compareTo(finish) < 0){
ComprehensiveElectricVo comprehensive = new ComprehensiveElectricVo();
comprehensive.setMonth(current.getMonth() + 1 + "月");
String currentMon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String currentYear = DateUtil.format(calendar.getTime(),"yyyy");
calendar.add(Calendar.YEAR,-1);
String lastMon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String lastYear = DateUtil.format(calendar.getTime(),"yyyy");
calendar.add(Calendar.YEAR,1);
// 电量
if(CollectionUtil.isNotEmpty(threes)){
comprehensive.setMonthGenerate(threes.stream().filter(o->o.getStrMonth().contains(currentMon)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
comprehensive.setLastMonthGenerate(threes.stream().filter(o->o.getStrMonth().contains(lastMon)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
if(comprehensive.getMonthGenerate() > 0 && comprehensive.getLastMonthGenerate() > 0){
comprehensive.setLastMonthGenerateRate(BigDecimal.valueOf(comprehensive.getMonthGenerate() / comprehensive.getLastMonthGenerate() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
comprehensive.setLastMonthGenerateRate(0.0);
}
// 本月等效小时
if(comprehensive.getMonthGenerate() > 0){
comprehensive.setMonthEquivalent(BigDecimal.valueOf(comprehensive.getMonthGenerate() / installedCapacity).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
comprehensive.setMonthEquivalent(0.0);
}
// 去年同月等效小时
if(comprehensive.getLastMonthGenerate() > 0){
comprehensive.setLastMonthEquivalent(BigDecimal.valueOf(comprehensive.getLastMonthGenerate() / installedCapacity).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
comprehensive.setLastMonthEquivalent(0.0);
}
comprehensive.setYearGenerate(threes.stream().filter(o->o.getStrMonth().contains(currentYear)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
comprehensive.setLastYearGenerate(threes.stream().filter(o->o.getStrMonth().contains(lastYear)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
if(comprehensive.getYearGenerate() > 0 && comprehensive.getLastYearGenerate() > 0){
comprehensive.setLastYearGenerateRate(BigDecimal.valueOf(comprehensive.getYearGenerate() / comprehensive.getLastYearGenerate() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}
if(CollectionUtil.isEmpty(electrics)){
// 本年等效小时
comprehensive.setYearEquivalent(comprehensive.getMonthEquivalent());
// 去年同期等效小时
comprehensive.setLastYearEquivalent(comprehensive.getLastMonthEquivalent());
}else{
// 累计等效小时
comprehensive.setYearEquivalent(electrics.stream().mapToDouble(ComprehensiveElectricVo::getMonthEquivalent).sum() + comprehensive.getMonthEquivalent());
comprehensive.setLastYearEquivalent(electrics.stream().mapToDouble(ComprehensiveElectricVo::getLastMonthEquivalent).sum() + comprehensive.getLastMonthEquivalent());
}
}else{
comprehensive.setMonthGenerate(0.0);
comprehensive.setLastMonthGenerate(0.0);
comprehensive.setYearGenerate(0.0);
comprehensive.setLastYearGenerate(0.0);
comprehensive.setLastMonthGenerateRate(0.0);
comprehensive.setLastYearGenerateRate(0.0);
comprehensive.setMonthEquivalent(0.0);
comprehensive.setLastMonthEquivalent(0.0);
comprehensive.setYearEquivalent(0.0);
comprehensive.setLastYearEquivalent(0.0);
}
// 降雨 : fixme 模拟降雨
comprehensive.setMonthRain(BigDecimal.valueOf(random.nextDouble() * 10 * 8).setScale(2, RoundingMode.HALF_UP).doubleValue());
comprehensive.setLastMonthRain(BigDecimal.valueOf(random.nextDouble() * 10 * 8).setScale(2, RoundingMode.HALF_UP).doubleValue());
if(CollectionUtil.isEmpty(electrics)){
comprehensive.setYearRain(comprehensive.getMonthRain());
comprehensive.setLastYearRain(comprehensive.getLastMonthRain());
}else{
// 累计降雨
comprehensive.setYearRain(electrics.stream().mapToDouble(ComprehensiveElectricVo::getMonthRain).sum() + comprehensive.getMonthRain());
comprehensive.setLastYearRain(electrics.stream().mapToDouble(ComprehensiveElectricVo::getLastMonthRain).sum() + comprehensive.getLastMonthRain());
}
electrics.add(comprehensive);
calendar.add(Calendar.MONTH,1);
current = calendar.getTime();
}
return electrics;
}
/**
* 确认机构级别
* @param deptId
* @return
@ -450,17 +573,17 @@ public class ElectricReportServiceImpl implements IElectricReportService {
// 日
if (type == 0) {
// 站点设备集合
List<EmInfoEntity> devices = deviceService.list(Wrappers.<EmInfoEntity>lambdaQuery()
.eq(EmInfoEntity::getCreateDept,station.getData().getRefDept())
.eq(EmInfoEntity::getEmType,2)
.eq(EmInfoEntity::getHomePageDisplay,1)
);
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(DEVICE_CACHE_COFIG_FINAL).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
if(CollectionUtil.isEmpty(devices)){
return new HashMap<>();
}
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device->device.getCreateDept().equals(station.getData().getRefDept())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(stationDevices)){
return new HashMap<>();
}
Date date = DateUtil.parse(time,DateUtil.PATTERN_DATE);
// 根据设备查询当日有功/无功电量
List<DeviceElectricVo> electrics = this.deviceElectrics(devices,date);
List<DeviceElectricVo> electrics = this.deviceElectrics(stationDevices,date);
// 表头
List<TableHeadVo> tableHeads = new ArrayList<>();
@ -475,7 +598,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
tableHeads.add(secondHead);
// 根据设备分组
devices.forEach(device->{
stationDevices.forEach(device->{
TableHeadVo tableHead = new TableHeadVo();
tableHead.setTableName(device.getName() + "发电量(kWh)");
tableHead.setIsChildren(true);
@ -486,24 +609,25 @@ public class ElectricReportServiceImpl implements IElectricReportService {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH,1);
Date end = calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date start = calendar.getTime();
List<List<Object>> tableDate = new ArrayList<>();
while (start.compareTo(end) < 0){
List<Object> item = new ArrayList<>();
String hours = DateUtil.format(start,"yyyy-MM-dd HH");
item.add(start.getMonth() + 1 + "月");
item.add(start.getHours() + "时");
// 总计:有功、无功
item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getGenerate).sum());
item.add(electrics.stream().filter(electric -> electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getReactiveGenerate).sum());
// 遍历机组
devices.stream().sorted(Comparator.comparing(EmInfoEntity::getEmIndex)).forEach(device->{
item.add(electrics.stream().filter(electric -> electric.getDeviceCode().equals(device.getNumber()) && electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getGenerate).sum());
item.add(electrics.stream().filter(electric -> electric.getDeviceCode().equals(device.getNumber()) && electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getReactiveGenerate).sum());
stationDevices.stream().sorted(Comparator.comparing(EminfoAndEmParamVo::getOrd)).forEach(device->{
item.add(electrics.stream().filter(electric -> electric.getDeviceCode().equals(device.getEmCode()) && electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getGenerate).sum());
item.add(electrics.stream().filter(electric -> electric.getDeviceCode().equals(device.getEmCode()) && electric.getStrTime().contains(hours)).mapToDouble(DeviceElectricVo::getReactiveGenerate).sum());
});
calendar.add(Calendar.DAY_OF_MONTH,1);
calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
tableDate.add(item);
}
@ -641,18 +765,19 @@ public class ElectricReportServiceImpl implements IElectricReportService {
* @param devices
* @return
*/
private List<DeviceElectricVo> deviceElectrics(List<EmInfoEntity> devices,Date date) {
private List<DeviceElectricVo> deviceElectrics(List<EminfoAndEmParamVo> devices,Date date) {
List<DeviceElectricVo> electrics = new ArrayList<>();
devices.forEach(device->{
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH,1);
Date endTime = calendar.getTime();
LocalDateTime end = LocalDateTime.parse(DateUtil.format(new Date(), DateUtil.format(endTime,DateUtil.PATTERN_DATETIME)), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date startTime = calendar.getTime();
LocalDateTime start = LocalDateTime.parse(DateUtil.format(new Date(), DateUtil.format(startTime,DateUtil.PATTERN_DATETIME)), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME));
AnalyseCodeByAnalyseDataPO param = new AnalyseCodeByAnalyseDataPO();
param.setDeviceCode(device.getNumber());
param.setDeviceCode(device.getEmCode());
List<AnalyzeDataConditionPO> conditions = new ArrayList<>();
// 有功电量
AnalyzeDataConditionPO generate = new AnalyzeDataConditionPO();
@ -674,7 +799,8 @@ public class ElectricReportServiceImpl implements IElectricReportService {
reactive.setSignages("reactive_generation");
reactive.setTimeInterval(1);
reactive.setBeginTime(start);
reactive.setEndTime(end);conditions.add(reactive);
reactive.setEndTime(end);
conditions.add(reactive);
param.setSignboardConditions(conditions);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(param);
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){
@ -682,24 +808,25 @@ public class ElectricReportServiceImpl implements IElectricReportService {
}
while (startTime.compareTo(endTime) < 0){
DeviceElectricVo electric = new DeviceElectricVo();
electric.setDeviceCode(device.getEmCode());
electric.setStrTime(DateUtil.format(startTime,"yyyy-MM-dd HH"));
electric.setTime(startTime.getHours());
if(ObjectUtil.isEmpty(result.getData().get(0)) || CollectionUtil.isEmpty(result.getData().get(0).getList())){
if(CollectionUtil.isNotEmpty(result.getData()) && ObjectUtil.isNotEmpty(result.getData().get(0)) && CollectionUtil.isNotEmpty(result.getData().get(0).getList())){
electric.setGenerate(result.getData().get(0).getList().stream().filter(o->o.getTs().contains(electric.getStrTime())).mapToDouble(val->{
if(StringUtils.isEmpty(val.getVal())){
return 0.0;
}
return Double.parseDouble(val.getVal());
return Double.parseDouble(val.getVal()) * device.getRideCount();
}).sum());
}else{
electric.setGenerate(0.0);
}
if(ObjectUtil.isEmpty(result.getData().get(1)) || CollectionUtil.isEmpty(result.getData().get(1).getList())){
if(CollectionUtil.isNotEmpty(result.getData()) && result.getData().size() > 1 && ObjectUtil.isNotEmpty(result.getData().get(1)) && CollectionUtil.isNotEmpty(result.getData().get(1).getList())){
electric.setReactiveGenerate(result.getData().get(1).getList().stream().filter(o->o.getTs().contains(electric.getStrTime())).mapToDouble(val->{
if(StringUtils.isEmpty(val.getVal())){
return 0.0;
}
return Double.parseDouble(val.getVal());
return Double.parseDouble(val.getVal()) * device.getRideCount();
}).sum());
}else{
electric.setReactiveGenerate(0.0);

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/business/interruption/mapper/InterruptionMapper.java

@ -1,15 +1,15 @@
package com.hnac.hzims.business.interruption.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.business.interruption.entity.InterruptionEntity;
import com.hnac.hzims.business.interruption.vo.InterruptionStationVo;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
* @author ysj
*/
public interface InterruptionMapper extends BaseMapper<InterruptionEntity> {
public interface InterruptionMapper extends UserDataScopeBaseMapper<InterruptionEntity> {
List<InterruptionStationVo> interruptionStations();
}

57
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/ErrorCode.java

@ -0,0 +1,57 @@
package com.hnac.hzims.bigmodel.zhipuai.constants;
import com.hnac.hzinfo.exception.HzServiceException;
import lombok.Getter;
import org.springblade.core.tool.api.IResultCode;
import org.springblade.core.tool.api.ResultCode;
/**
* @Author: ypj
* @Date: 2024/8/22 11:17
*/
@Getter
public enum ErrorCode implements IResultCode {
GET_DATA_FAILURE(1888000001, "获取数据失败"),
ANALYSIS_FAILURE(1888000002, "分析失败"),
STRATEGY_NOT_FOUND(1888000003, "策略未找到"),
GET_FILE_CONTENT_FAILURE(1888000004, "获取文件内容失败"),
REQUEST_TEXT_IS_EMPTY(1888000005, "交互文字内容不能为空"),
EMPTY_ANALYSIS_TYPE(1888000006, "识别类型为空"),
UNKNOWN_ANALYSIS_TYPE(1888000007, "未知的识别类型"),
NO_COMPARATOR(1888000008, "未获取到对比对象"),
NO_COMPARISON_TYPE(1888000009, "未获取到对比类型"),
GET_RESULT_FAIL(1888000010, "获取结果失败"),;
private final int code;
private final String msg;
ErrorCode(int code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public String getMessage() {
return this.msg;
}
public HzServiceException throwException() {
return new HzServiceException(this);
}
public static HzServiceException throwCommonException(String msg) {
return new HzServiceException(new IResultCode() {
@Override
public String getMessage() {
return msg;
}
@Override
public int getCode() {
return ResultCode.FAILURE.getCode();
}
});
}
}

16
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ResultBooleanStrategy.java

@ -2,9 +2,9 @@ package com.hnac.hzims.bigmodel.zhipuai.handler;
import com.hnac.hzims.bigmodel.zhipuai.constants.BaseEnum;
import com.hnac.hzims.bigmodel.zhipuai.constants.ComparisonType;
import com.hnac.hzims.bigmodel.zhipuai.constants.ErrorCode;
import com.hnac.hzims.bigmodel.zhipuai.constants.ResultStrategyType;
import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
import com.hnac.hzinfo.exception.HzServiceException;
import org.springframework.util.Assert;
import java.util.Objects;
@ -23,18 +23,24 @@ public class ResultBooleanStrategy implements ResultStrategy<Boolean> {
public Boolean getResult(ZhipuAnalysisInfoEntity info, Object resultData) {
Object comparator = convertOriginalData(info.getResultCondition(), info.getResultType());
Assert.isTrue(Objects.nonNull(comparator), () -> {
throw new HzServiceException("没有获取到对比对象");
throw ErrorCode.NO_COMPARATOR.throwException();
});
ComparisonType comparisonType = BaseEnum.getInstance(info.getResultJudgeModel(), ComparisonType.class);
switch (comparisonType) {
Assert.isTrue(Objects.nonNull(comparisonType), () -> {
throw ErrorCode.NO_COMPARISON_TYPE.throwException();
});
switch (Objects.requireNonNull(comparisonType)) {
case EQUAL:
return comparator.equals(resultData);
case GREATER:
return ((Comparable) comparator).compareTo(resultData) < 0;
if (comparator instanceof Comparable && resultData instanceof Comparable) {
return ((Comparable) comparator).compareTo((Comparable)resultData) < 0;
}
break;
case LESS:
return ((Comparable) comparator).compareTo(resultData) > 0;
}
return null;
throw ErrorCode.GET_RESULT_FAIL.throwException();
}
}

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java

@ -1,6 +1,7 @@
package com.hnac.hzims.bigmodel.zhipuai.handler;
import cn.hutool.core.lang.Assert;
import com.hnac.hzims.bigmodel.zhipuai.constants.ErrorCode;
import com.hnac.hzinfo.exception.HzServiceException;
import com.zhipu.oapi.Constants;
import com.zhipu.oapi.service.v4.model.ChatCompletionRequest;
@ -58,14 +59,13 @@ public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
messages.add(chatMessage);
String requestId = String.format(requestIdTemplate, System.currentTimeMillis());
ChatCompletionRequest request = ChatCompletionRequest.builder()
return ChatCompletionRequest.builder()
.model(getAnalysisModel())
.stream(Boolean.FALSE)
.invokeMethod(Constants.invokeMethod)
.messages(messages)
.requestId(requestId)
.build();
return request;
}
@Override
@ -73,7 +73,7 @@ public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
ModelApiResponse response = sendRequest(text, url);
log.info("get zhi pu ai response : {}", Optional.ofNullable(response).map(JsonUtil::toJson).orElse("null"));
Assert.<HzServiceException>isTrue(Objects.nonNull(response) && response.isSuccess(), () -> {
throw new HzServiceException(response.getMsg());
throw ErrorCode.throwCommonException(Optional.ofNullable(response).map(ModelApiResponse::getMsg).orElse("没有收到大模型平台响应"));
});
try {
String resultJson = response.getData().getChoices().get(0).getMessage().getContent().toString();
@ -81,7 +81,7 @@ public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
return resultJson;
} catch (Exception e) {
log.info("get data from response error", e);
throw new HzServiceException("获取数据失败");
throw ErrorCode.GET_DATA_FAILURE.throwException();
}
}

49
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.bigmodel.api.dto.BigModelAnalysisRequestDTO;
import com.hnac.hzims.bigmodel.api.dto.BigModelAnalysisResponseDTO;
import com.hnac.hzims.bigmodel.zhipuai.constants.BaseEnum;
import com.hnac.hzims.bigmodel.zhipuai.constants.ErrorCode;
import com.hnac.hzims.bigmodel.zhipuai.constants.ResultStrategyType;
import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
import com.hnac.hzims.bigmodel.zhipuai.handler.ResultStrategy;
@ -41,29 +42,29 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
private final ZhipuAnalysisInfoService infoService;
private final String multiQuestionBrief = "从给出的图片回答以下{}个问题\n";
private static final String MULTI_QUESTION_BRIEF = "从给出的图片回答以下{}个问题\n";
private final String multiQuestionPrefix = "第{}个问题,";
private static final String MULTI_QUESTION_PREFIX = "第{}个问题,";
private final String multiQuestionConstrains = "- 不要在输出中添加任何注释和思考过程和其他多余的内容,以JSON格式输出简单结果,{}结果只包含'是'或者'否'\n";
private static final String MULTI_QUESTION_CONSTRAINS = "- 不要在输出中添加任何注释和思考过程和其他多余的内容,以JSON格式输出简单结果,{}结果只包含'是'或者'否'\n";
private final String multiQuestionConstrainsList = "'{}'代表第{}个问题,";
private static final String MULTI_QUESTION_CONSTRAINS_LIST = "'{}'代表第{}个问题,";
@Override
public ZhipuAnalysisFileResponse analysis(ZhipuAnalysisFileRequest request) {
Assert.isTrue(StringUtil.isNotBlank(request.getFilePath()) || StringUtil.isNotBlank(request.getUrl()), () -> {
throw new HzServiceException("文件为空");
throw ErrorCode.GET_FILE_CONTENT_FAILURE.throwException();
});
ZhipuAnalysisFileResponse response = new ZhipuAnalysisFileResponse();
ZhipuAnalysisInfoEntity info = getAnalysisInfo(request);
Assert.isTrue(Objects.nonNull(info), () -> {
throw new HzServiceException("没有找到对应的策略信息");
throw ErrorCode.STRATEGY_NOT_FOUND.throwException();
});
ZhipuAnalyser analyser = analysisFactory.getAnalysisStrategy(info.getModel());
Assert.isTrue(StringUtil.isNotBlank(info.getRequestContent()), () -> {
throw new HzServiceException("智谱平台交互内容为空");
throw ErrorCode.REQUEST_TEXT_IS_EMPTY.throwException();
});
//拼接文字内容
StringBuilder textBuilder = new StringBuilder();
@ -78,13 +79,13 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
Object resultObject = analyser.getResultValue(analyser.getText(), info.getResultKey(), getSendUrl(request));
Assert.isTrue(Objects.nonNull(resultObject), () -> {
throw new HzServiceException("智谱平台分析失败");
throw ErrorCode.ANALYSIS_FAILURE.throwException();
});
String resultStr = resultObject.toString();
ResultStrategyType strategyType = BaseEnum.getInstance(info.getResultStrategy(), ResultStrategyType.class);
Assert.isTrue(Objects.nonNull(strategyType), () -> {
throw new HzServiceException("没有找到对应的结果数据解析策略");
throw ErrorCode.STRATEGY_NOT_FOUND.throwException();
});
ResultStrategy strategy = strategyType.getStrategy();
@ -100,14 +101,14 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
if (StringUtil.isNotBlank(request.getUrl())) {
return request.getUrl();
}
if (StringUtil.isNotBlank(request.getFilePath())) {
Assert.isTrue(StringUtil.isNotBlank(request.getFilePath()), () -> {
throw ErrorCode.GET_FILE_CONTENT_FAILURE.throwException();
});
try {
return FileUtil.getBase64(request.getFilePath());
} catch (IOException e) {
throw new HzServiceException("获取文件内容失败");
}
throw ErrorCode.GET_FILE_CONTENT_FAILURE.throwException();
}
return null;
}
@Override
@ -121,7 +122,7 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
.eq(StringUtil.isNotBlank(request.getCheckTypeSon()), ZhipuAnalysisInfoEntity::getCheckTypeSon, request.getCheckTypeSon())
.last("limit 1;"));
}
log.info("the analysis information is {}", Optional.ofNullable(result).map(r -> JsonUtil.toJson(r)).orElse("null"));
log.debug("the analysis information is {}", Optional.ofNullable(result).map(r -> JsonUtil.toJson(r)).orElse("null"));
return result;
}
@ -131,15 +132,15 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
BigModelAnalysisResponseDTO response = new BigModelAnalysisResponseDTO();
try {
Assert.isTrue(StringUtil.isNotBlank(request.getUrl()), () -> {
throw new HzServiceException("文件为空");
throw ErrorCode.GET_FILE_CONTENT_FAILURE.throwException();
});
Assert.isTrue(CollectionUtil.isNotEmpty(request.getCodeList()) || CollectionUtil.isNotEmpty(request.getCheckTypeSonList()), () -> {
throw new HzServiceException("识别类型为空");
throw ErrorCode.EMPTY_ANALYSIS_TYPE.throwException();
});
List<ZhipuAnalysisInfoEntity> infoList = infoService.list(Wrappers.<ZhipuAnalysisInfoEntity>lambdaQuery().in(CollectionUtil.isNotEmpty(request.getCodeList()), ZhipuAnalysisInfoEntity::getCode, request.getCodeList())
.in(CollectionUtil.isNotEmpty(request.getCheckTypeSonList()), ZhipuAnalysisInfoEntity::getCheckTypeSon, request.getCheckTypeSonList()));
Assert.isTrue(CollectionUtil.isNotEmpty(infoList), () -> {
throw new HzServiceException("未知的识别类型");
throw ErrorCode.UNKNOWN_ANALYSIS_TYPE.throwException();
});
ZhipuAnalyser analyser = analysisFactory.getAnalysisStrategy(infoList.get(0).getModel());
@ -148,7 +149,7 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
if (null == resultMap) {
response.setCode(ResultCode.FAILURE.getCode());
response.setMsg("智谱大模型分析失败");
response.setMsg(ErrorCode.ANALYSIS_FAILURE.getMsg());
return response;
}
@ -184,9 +185,9 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
response.setMsg(e.getMessage());
} else {
response.setCode(ResultCode.FAILURE.getCode());
response.setMsg("智谱大模型分析失败");
response.setMsg(ErrorCode.ANALYSIS_FAILURE.getMsg());
}
log.error("智谱大模型分析失败", e);
log.error(ErrorCode.ANALYSIS_FAILURE.getMessage(), e);
}
return response;
}
@ -196,18 +197,18 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
StringBuilder titleBuilder = new StringBuilder();
StringBuilder formatBuilder = new StringBuilder();
stringBuilder.append(ZhipuAnalyser.QUESTION_PROFILE)
.append(StringUtil.format(multiQuestionBrief, infoList.size()));
.append(StringUtil.format(MULTI_QUESTION_BRIEF, infoList.size()));
formatBuilder.append("{");
for (int index = 1; index <= infoList.size(); index++) {
ZhipuAnalysisInfoEntity infoEntity = infoList.get(index - 1);
stringBuilder.append(StringUtil.format(multiQuestionPrefix, index));
titleBuilder.append(StringUtil.format(multiQuestionConstrainsList, infoEntity.getResultKey(), index));
stringBuilder.append(StringUtil.format(MULTI_QUESTION_PREFIX, index));
titleBuilder.append(StringUtil.format(MULTI_QUESTION_CONSTRAINS_LIST, infoEntity.getResultKey(), index));
formatBuilder.append(infoEntity.getRequestOutputFormat()).append(",");
}
formatBuilder.deleteCharAt(formatBuilder.length() - 1);
formatBuilder.append("}");
stringBuilder.append(ZhipuAnalyser.QUESTION_CONSTRAINS)
.append(StringUtil.format(multiQuestionConstrains, titleBuilder.toString()))
.append(StringUtil.format(MULTI_QUESTION_CONSTRAINS, titleBuilder.toString()))
.append(ZhipuAnalyser.QUESTION_OUTPUT_FORMAT).append(formatBuilder);
return stringBuilder.toString();
}

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -46,9 +46,10 @@ public class RealTargetScheduledTask {
/**
* 水电站-机组实时加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal(String param) {
//@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -59,9 +60,10 @@ public class RealTargetScheduledTask {
/**
* 水电站-机组指标加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerTarget(String param) {
//@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerTarget() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

40
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -1485,24 +1485,36 @@ public class RealTargetServiceImpl implements RealTargetService {
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
Calendar calendar = Calendar.getInstance();
// 结束日期
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
Date end = calendar.getTime();
calendar.add(Calendar.DAY_OF_MONTH,-1);
// 开始日期
String start = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH") + ":00:00";
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>();
Date start = calendar.getTime();
List<AnalyseDataTaosVO> records = dataService.periodTargetData(DateUtil.format(start,"yyyy-MM-dd HH") + ":00:00", DateUtil.format(end,DateUtil.PATTERN_DATETIME), 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
List<ActivePowerVo> activePowers = new ArrayList<>();
while (start.compareTo(end) < 0){
String time = DateUtil.format(start,"yyyy-MM-dd HH");
ActivePowerVo active = new ActivePowerVo();
active.setStrHour(time);
active.setHour(start.getHours());
if(CollectionUtil.isNotEmpty(records)){
Optional<AnalyseDataTaosVO> analyseData = records.stream().filter(o->o.getTs().contains(time)).findFirst();
if(analyseData.isPresent()){
if(StringUtil.isNotBlank(analyseData.get().getVal())){
active.setActivePower(analyseData.get().getVal());
}else{
active.setActivePower("0.0");
}
return records.stream().map(record -> {
ActivePowerVo load = new ActivePowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss");
load.setStrHour(DateUtil.format(time,"yyyy-MM-dd HH"));
load.setHour(time.getHours());
if(StringUtil.isNotBlank(record.getVal())){
load.setActivePower(record.getVal());
}else{
active.setActivePower("0.0");
}
return load;
}).sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList());
}else{
active.setActivePower("0.0");
}
activePowers.add(active);
calendar.add(Calendar.HOUR_OF_DAY,1);
start = calendar.getTime();
}
return activePowers.stream().sorted(Comparator.comparing(ActivePowerVo::getStrHour)).collect(Collectors.toList());
}
/**

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyRecQRRecordMapper.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecQRRecordEntity;
import com.hnac.hzims.operational.main.vo.ImsDutyRecQRRecordVo;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import org.springframework.web.bind.annotation.RequestParam;
@ -24,6 +25,7 @@ public interface ImsDutyRecQRRecordMapper extends UserDataScopeBaseMapper<ImsDut
* @return
*/
@UserDataAuth
List<ImsDutyRecQRRecordVo> selectPageList(IPage page,@Param(value = "vo") ImsDutyRecQRRecordVo vo);
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

@ -105,9 +105,10 @@ public class HydroelectricServiceImpl implements HydroelectricService {
result.setWeather(week.getDaily());
}
}
List<EminfoAndEmParamVo> statonDevices = devices.stream().filter(device-> station.getRefDept().equals(device.getCreateDept())).collect(Collectors.toList());
// 设备
if(CollectionUtil.isNotEmpty(devices)){
result.setDevices(devices.stream().filter(device-> station.getRefDept().equals(device.getCreateDept())).map(iter->{
if(CollectionUtil.isNotEmpty(statonDevices)){
result.setDevices(statonDevices.stream().map(iter->{
HydroelectricDeviceVo device = new HydroelectricDeviceVo();
device.setDeivceCode(iter.getEmCode());
device.setDeivceName(iter.getName());
@ -124,6 +125,13 @@ public class HydroelectricServiceImpl implements HydroelectricService {
}else{
device.setCapacityRate(0.0);
}
}else{
device.setState(false);
device.setInstalledCapacity(0.0);
device.setActivePower(0.0);
device.setReactivePower(0.0);
device.setGuideOpen(0.0);
device.setCapacityRate(0.0);
}
// 指标数据
Optional<HydropowerUnitTargetVo> target = targets.stream().filter(o-> iter.getEmCode().equals(o.getDeviceCode())).findFirst();

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

@ -19,7 +19,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -41,7 +40,7 @@ import java.util.Map;
@AllArgsConstructor
@Business(module = Constants.APP_NAME, value = "车辆管理", ignore = false)
@Api(value = "车辆管理", tags = "车辆管理接口")
public class CarController extends BladeController {
public class CarController {
private final ICarService carService;

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

@ -17,7 +17,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -38,7 +37,7 @@ import java.util.Map;
@RequestMapping("/conference")
@Business(module = Constants.APP_NAME, value = "会议管理", ignore = false)
@Api(value = "会议管理", tags = "会议管理接口")
public class ConferenceController extends BladeController {
public class ConferenceController {
private final IConferencePlanService conferencePlanService;

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

@ -20,7 +20,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -41,7 +40,7 @@ import java.util.Map;
@RequestMapping("/hygiene")
@Business(module = Constants.APP_NAME, value = "卫生自查")
@Api(value = "卫生自查", tags = "卫生自查接口")
public class HygieneController extends BladeController {
public class HygieneController {
private final IHygienePlanService hygienePlanService;

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

@ -19,7 +19,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -40,7 +39,7 @@ import java.util.Map;
@RequestMapping("/rehearsal")
@Business(module = Constants.APP_NAME, value = "演练管理", ignore = false)
@Api(value = "演练管理", tags = "演练管理接口")
public class RehearsalController extends BladeController {
public class RehearsalController {
private final IRehearsalRecordService rehearsalRecordService;

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

@ -23,7 +23,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -45,7 +44,7 @@ import java.util.Map;
@RequestMapping("/train")
@Business(module = Constants.APP_NAME, value = "培训管理", ignore = false)
@Api(value = "培训管理", tags = "培训管理接口")
public class TrainController extends BladeController {
public class TrainController {
private final ITrainPlanService trainPlanService;

1
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java

@ -10,7 +10,6 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**

40
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java

@ -17,11 +17,14 @@ import com.hnac.hzims.safeproduct.mapper.CarMaintenanceMapper;
import com.hnac.hzims.safeproduct.mapper.CarMapper;
import com.hnac.hzims.safeproduct.service.ICarMaintenanceService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailImgVO;
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailStrVO;
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO;
import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -123,20 +126,6 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
public void exportCarMaintenanceData(Long id, HttpServletResponse response) {
CarMaintenanceDetailVO carMaintenanceDetailVO = this.getCarMaintenance(id);
// 数据处理
// 图片
List<ImageEntity> list = new ArrayList<>();
if (StringUtils.isNotEmpty(carMaintenanceDetailVO.getImgPath())) {
String[] imgArr = carMaintenanceDetailVO.getImgPath().split(",");
for (String img : imgArr) {
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath +
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150);
list.add(imageEntity);
}
} else {
// 添加空的ImageEntity,防止数据填入时显示"{{"
list.add(new ImageEntity());
}
carMaintenanceDetailVO.setImages(list);
// 表头年月
String code = carMaintenanceDetailVO.getCode();
carMaintenanceDetailVO.setYear(code.substring(4, 8));
@ -148,7 +137,28 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
} else {
carMaintenanceDetailVO.setMaintenanceType(CarMaintenanceTypeEnum.REPAIR.getDesc());
}
Map<String, Object> params = BaseUtil.obj2Map(carMaintenanceDetailVO);
// 图片
Map<String, Object> params;
if (StringUtils.isNotEmpty(carMaintenanceDetailVO.getImgPath())) {
List<ImageEntity> list = new ArrayList<>();
CarMaintenanceDetailImgVO imgVO = new CarMaintenanceDetailImgVO();
BeanUtils.copyProperties(carMaintenanceDetailVO, imgVO);
String[] imgArr = carMaintenanceDetailVO.getImgPath().split(",");
for (String img : imgArr) {
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath +
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150);
list.add(imageEntity);
}
imgVO.setImages(list);
params = BaseUtil.obj2Map(imgVO);
} else {
List<String> list = new ArrayList<>();
list.add("");
CarMaintenanceDetailStrVO strVO = new CarMaintenanceDetailStrVO();
BeanUtils.copyProperties(carMaintenanceDetailVO, strVO);
strVO.setImages(list);
params = BaseUtil.obj2Map(strVO);
}
String templateFile = "template/车辆维保记录单" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/车辆维保记录单" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/车辆维保记录单" + SafeProductConstant.PDF_SUFFIX;

28
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java

@ -14,11 +14,14 @@ import com.hnac.hzims.safeproduct.enums.CarUsedRecordEnum;
import com.hnac.hzims.safeproduct.mapper.CarUsedRecordMapper;
import com.hnac.hzims.safeproduct.service.ICarUsedRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailImgVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailStrVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -117,25 +120,32 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
public void exportCarUsedRecordData(Long id, HttpServletResponse response) {
CarUsedRecordDetailVO carUsedRecordDetailVO = this.getCarUsedRecord(id);
// 数据处理
// 表头年月
String code = carUsedRecordDetailVO.getCode();
carUsedRecordDetailVO.setYear(code.substring(4, 8));
carUsedRecordDetailVO.setMonth(code.substring(8, 10));
// 图片
List<ImageEntity> list = new ArrayList<>();
Map<String, Object> params;
if (StringUtils.isNotEmpty(carUsedRecordDetailVO.getImgPath())) {
List<ImageEntity> list = new ArrayList<>();
CarUsedRecordDetailImgVO imgVO = new CarUsedRecordDetailImgVO();
BeanUtils.copyProperties(carUsedRecordDetailVO, imgVO);
String[] imgArr = carUsedRecordDetailVO.getImgPath().split(",");
for (String img : imgArr) {
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath +
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150);
list.add(imageEntity);
}
imgVO.setImages(list);
params = BaseUtil.obj2Map(imgVO);
} else {
// 添加空的ImageEntity,防止数据填入时显示"{{"
list.add(new ImageEntity());
List<String> list = new ArrayList<>();
list.add("");
CarUsedRecordDetailStrVO strVO = new CarUsedRecordDetailStrVO();
BeanUtils.copyProperties(carUsedRecordDetailVO, strVO);
strVO.setImages(list);
params = BaseUtil.obj2Map(strVO);
}
carUsedRecordDetailVO.setImages(list);
// 表头年月
String code = carUsedRecordDetailVO.getCode();
carUsedRecordDetailVO.setYear(code.substring(4, 8));
carUsedRecordDetailVO.setMonth(code.substring(8, 10));
Map<String, Object> params = BaseUtil.obj2Map(carUsedRecordDetailVO);
String templateFile = "template/用车记录单" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/用车记录单" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/用车记录单" + SafeProductConstant.PDF_SUFFIX;

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

@ -17,9 +17,12 @@ import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper;
import com.hnac.hzims.safeproduct.service.IConferenceRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailImgVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailStrVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -120,28 +123,33 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap
String standardContent = conferenceRecordDetailVO.getContent().replaceAll("\n", "\r\n");
conferenceRecordDetailVO.setContent(standardContent);
// 图片
List<ImageEntity> list = new ArrayList<>();
Map<String, Object> params;
if (StringUtils.isNotEmpty(conferenceRecordDetailVO.getImgPath())) {
List<ImageEntity> list = new ArrayList<>();
ConferenceRecordDetailImgVO imgVO = new ConferenceRecordDetailImgVO();
BeanUtils.copyProperties(conferenceRecordDetailVO, imgVO);
String[] imgArr = conferenceRecordDetailVO.getImgPath().split(",");
for (String img : imgArr) {
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath +
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150);
list.add(imageEntity);
}
imgVO.setImages(list);
params = BaseUtil.obj2Map(imgVO);
} else {
// 添加空的ImageEntity,防止数据填入时显示"{{"
list.add(new ImageEntity());
List<String> list = new ArrayList<>();
list.add("");
ConferenceRecordDetailStrVO strVO = new ConferenceRecordDetailStrVO();
BeanUtils.copyProperties(conferenceRecordDetailVO, strVO);
strVO.setImages(list);
params = BaseUtil.obj2Map(strVO);
}
conferenceRecordDetailVO.setImages(list);
Map<String, Object> params = BaseUtil.obj2Map(conferenceRecordDetailVO);
String templateFile = "template/会议记录表" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/会议记录表" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/会议记录表" + SafeProductConstant.PDF_SUFFIX;
BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath,"filePath", response);
}
/**
* 查询会议记录表详情
*/

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

@ -1,24 +1,19 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
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.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.HygieneEvaluationExportDTO;
import com.hnac.hzims.safeproduct.vo.HygieneEvaluationExportVO;
import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum;
import com.hnac.hzims.safeproduct.hazard.util.ExcelConvertPdf;
import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper;
import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
@ -26,9 +21,6 @@ import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.*;
import com.hnac.hzinfo.exception.HzServiceException;
import com.itextpdf.text.DocumentException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -42,14 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.ZoneId;
@ -250,6 +235,9 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
// 周结束日
LocalDate lastWeekDay = firstWeekDay.with(TemporalAdjusters.next(DayOfWeek.SATURDAY));
Date weekEnd = DateUtil.toDate(lastWeekDay);
if (lastDate.before(weekEnd)) {
weekEnd = lastDate;
}
// 存储周数据
HygieneWeekVO weekVO = new HygieneWeekVO();
weekVO.setWeekNum(weekNum++);
@ -339,12 +327,11 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
throw new HzServiceException(ResultCode.FAILURE, "无卫生考核数据");
}
// 数据处理
HygieneEvaluationExportDTO exportDTO = new HygieneEvaluationExportDTO();
exportDTO.setRemark(page.getRemark());
HygieneEvaluationExportVO exportVO = new HygieneEvaluationExportVO();
// 年份、月份
String[] time = month.split("-");
exportDTO.setYear(time[0]);
exportDTO.setMonth(time[1]);
exportVO.setYear(time[0]);
exportVO.setMonth(time[1]);
// 周数据
List<HygieneWeekVO> weekList = page.getWeekList();
weekList.forEach(week -> {
@ -354,52 +341,71 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
end = end.substring(end.indexOf("-") + 1);
switch (week.getWeekNum()) {
case 1:
exportDTO.setFirstWeekStart(start);
exportDTO.setFirstWeekEnd(end);
exportVO.setFirstWeekStart(start);
exportVO.setFirstWeekEnd(end);
break;
case 2:
exportDTO.setSecondWeekStart(start);
exportDTO.setSecondWeekEnd(end);
exportVO.setSecondWeekStart(start);
exportVO.setSecondWeekEnd(end);
break;
case 3:
exportDTO.setThirdWeekStart(start);
exportDTO.setThirdWeekEnd(end);
exportVO.setThirdWeekStart(start);
exportVO.setThirdWeekEnd(end);
break;
case 4:
exportDTO.setFourthWeekStart(start);
exportDTO.setFourthWeekEnd(end);
exportVO.setFourthWeekStart(start);
exportVO.setFourthWeekEnd(end);
break;
case 5:
exportDTO.setFifthWeekStart(start);
exportDTO.setFifthWeekEnd(end);
exportVO.setFifthWeekStart(start);
exportVO.setFifthWeekEnd(end);
break;
}
});
// 考核人员数据
exportDTO.setEvaluationList(page.getEvaluationList());
// 封装参数
Map<String, Object> params = BaseUtil.obj2Map(exportDTO);
TemplateExportParams templateParams = new TemplateExportParams("template/卫生考核表.xlsx", true);
// 导出
try {
String fileName = URLEncoder.encode("卫生考核表.xlsx", "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=utf-8");
Workbook workbook = ExcelExportUtil.exportExcel(templateParams, params);
Sheet sheet = workbook.getSheetAt(0);
BaseUtil.mergeCell(0, 0, JSONArray.parseArray(JSON.toJSONString(exportDTO)), "unit").forEach(sheet::addMergedRegion);
BaseUtil.mergeCell(0, 7, JSONArray.parseArray(JSON.toJSONString(exportDTO)), "remark").forEach(sheet::addMergedRegion);
String pdfPath = "D://" + "/卫生考核表" + SafeProductConstant.PDF_SUFFIX;
OutputStream outputStream = Files.newOutputStream(Paths.get(pdfPath));
ExcelConvertPdf.excelConvertPdf(workbook, outputStream);
BaseUtil.readPdf(response, pdfPath);
} catch (UnsupportedEncodingException e) {
log.error("卫生考核表导出异常-UnsupportedEncodingException:" + e.getMessage());
} catch (DocumentException e) {
log.error("卫生考核表导出异常-DocumentException:" + e.getMessage());
} catch (IOException e) {
log.error("卫生考核表导出异常-IOException:" + e.getMessage());
List<HygieneEvaluationPeopleExportVO> evaluationExportList = new ArrayList<>();
List<HygieneEvaluationPeopleVO> evaluationList = page.getEvaluationList();
evaluationList.forEach(x -> {
HygieneEvaluationPeopleExportVO peopleExportVO = new HygieneEvaluationPeopleExportVO();
peopleExportVO.setUnit(x.getUnit());
peopleExportVO.setPrincipal(x.getPrincipal());
peopleExportVO.setSumScore(x.getSumScore());
peopleExportVO.setRemark(page.getRemark());
List<HygieneEvaluationScoreVO> scoreList = x.getScoreList();
scoreList.forEach(score -> {
Long weekScore = score.getScore();
switch (score.getWeekNum()) {
case 1:
peopleExportVO.setFirstWeekScore(weekScore);
break;
case 2:
peopleExportVO.setSecondWeekScore(weekScore);
break;
case 3:
peopleExportVO.setThirdWeekScore(weekScore);
break;
case 4:
peopleExportVO.setFourthWeekScore(weekScore);
break;
case 5:
peopleExportVO.setFifthWeekScore(weekScore);
break;
}
});
evaluationExportList.add(peopleExportVO);
});
exportVO.setEvaluationList(evaluationExportList);
Map<String, Object> params = BaseUtil.obj2Map(exportVO);
String templateFile;
// 根据周数匹配不同模板文件
if (weekList.size() == 4) {
templateFile = "template/卫生考核表(四周)" + SafeProductConstant.DOCX_SUFFIX;
} else {
templateFile = "template/卫生考核表(五周)" + SafeProductConstant.DOCX_SUFFIX;
}
String wordPath = savePath + "/卫生考核表" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/卫生考核表" + SafeProductConstant.PDF_SUFFIX;
BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, "",response);
}
/**

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

@ -19,10 +19,13 @@ import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailImgVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailStrVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -163,20 +166,32 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
// 评价:换行符使用\r\n
String standardCommand = trainRecordDetailVO.getCommand().replaceAll("\n", "\r\n");
trainRecordDetailVO.setCommand(standardCommand);
// 图片
if (StringUtils.isNotEmpty(trainRecordDetailVO.getImgPath())) {
trainRecordDetailVO.setImages(Arrays.stream(trainRecordDetailVO.getImgPath().split(",")).map(img->
new ImageEntity(BaseUtil.imgToByte(savePath + BaseUtil.downloadFileByUrl(img, savePath)), 180, 150)
).collect(Collectors.toList()));
} else {
// 添加空的ImageEntity,防止数据填入时显示"{{"
trainRecordDetailVO.setImages(Collections.singletonList(new ImageEntity()));
}
// 表头年月
String code = trainRecordDetailVO.getCode();
trainRecordDetailVO.setYear(code.substring(4, 8));
trainRecordDetailVO.setMonth(code.substring(8, 10));
Map<String, Object> params = BaseUtil.obj2Map(trainRecordDetailVO);
// 图片
Map<String, Object> params;
if (StringUtils.isNotEmpty(trainRecordDetailVO.getImgPath())) {
List<ImageEntity> list = new ArrayList<>();
TrainRecordDetailImgVO imgVO = new TrainRecordDetailImgVO();
BeanUtils.copyProperties(trainRecordDetailVO, imgVO);
String[] imgArr = trainRecordDetailVO.getImgPath().split(",");
for (String img : imgArr) {
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath +
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150);
list.add(imageEntity);
}
imgVO.setImages(list);
params = BaseUtil.obj2Map(imgVO);
} else {
List<String> list = new ArrayList<>();
list.add("");
TrainRecordDetailStrVO strVO = new TrainRecordDetailStrVO();
BeanUtils.copyProperties(trainRecordDetailVO, strVO);
strVO.setImages(list);
params = BaseUtil.obj2Map(strVO);
}
String templateFile = "template/培训记录表" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/培训记录表" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/培训记录表" + SafeProductConstant.PDF_SUFFIX;

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

@ -153,6 +153,9 @@ public class BaseUtil {
if ("template/车辆检查表.docx".equals(templatePath)) {
formatCarCheckRecordTable(xwpfDocument);
}
if ("template/卫生考核表(四周).docx".equals(templatePath) || "template/卫生考核表(五周).docx".equals(templatePath)) {
formatHygieneEvaluationTable(xwpfDocument, params);
}
} catch (Exception e) {
e.printStackTrace();
}
@ -160,6 +163,44 @@ public class BaseUtil {
}
/**
* 卫生考核表格式处理
* @param xwpfDocument word文件类
* @param params 数据参数
*/
private static void formatHygieneEvaluationTable(XWPFDocument xwpfDocument, Map<String, Object> params) {
// 获取文档中所有的表格
List<XWPFTable> tableList = xwpfDocument.getTables();
if (!tableList.isEmpty()) {
// 循环表格
for (XWPFTable table : tableList) {
// 获取表格所有行数
List<XWPFTableRow> rows = table.getRows();
// 第三行到倒数第三行为需合并区域
for (int row = 3; row < rows.size();) {
XWPFTableCell startCell = rows.get(row).getCell(0);
String startText = startCell.getText();
int index = row + 1;
for (; index < rows.size(); index++) {
XWPFTableCell endCell = rows.get(index).getCell(0);
String endText = endCell.getText();
if (!startText.equals(endText)) {
break;
}
}
mergeCellsVertically(table, 0, row, index - 1);
// 判断周数:为五周时,备注在第9列;为四周时,备注在第8列
if (ObjectUtil.isNotEmpty(params.get("fifthWeekStart"))) {
mergeCellsVertically(table, 8, row, index - 1);
} else {
mergeCellsVertically(table, 7, row, index - 1);
}
row = index;
}
}
}
}
/**
* 车辆检查表格式处理
* @param xwpfDocument word文件类
*/
@ -424,41 +465,4 @@ public class BaseUtil {
throw new ServiceException("标准总分值未全部分配");
}
}
/**
*
* @param initRow 起始行数
* @param initColumn 起始列数
* @param data 数据
* @param attribute 合并属性
* @return 单元格列表
*/
public static List<CellRangeAddress> mergeCell(int initRow, int initColumn, com.alibaba.fastjson.JSONArray data, String attribute) {
List<CellRangeAddress> result = Lists.newArrayList();
String initAttribute = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(data.get(0))).getString(attribute);
int mergeCount = 1;
for (int index = 0; index < data.size(); index++) {
if (index == 0) {
continue;
}
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(data.get(index)));
if (object.getString(attribute).equals(initAttribute)) {
mergeCount++;
}
else {
if (mergeCount > 1) {
result.add(new CellRangeAddress(initRow, initRow+mergeCount-1, initColumn, initColumn));
}
initRow = initRow+mergeCount;
initAttribute = object.getString(attribute);
mergeCount = 1;
}
if (index == data.size() -1) {
if (mergeCount > 1) {
result.add(new CellRangeAddress(initRow, initRow + mergeCount-1, initColumn, initColumn));
}
}
}
return result;
}
}

BIN
hzims-service/safeproduct/src/main/resources/template/卫生考核表(五周).docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/卫生考核表(四周).docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/卫生考核表.xlsx

Binary file not shown.
Loading…
Cancel
Save