From 64c2ee199850230910f900ec0d4ab30913dbcc6d Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Sun, 4 Feb 2024 14:55:29 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=BA=A4=E6=8E=A5=E7=8F=AD=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/duty/service/impl/ImsDutyRecServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java index ff91a6a..c5b1caa 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java @@ -1420,17 +1420,18 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpllambdaQuery() - .eq(ImsDutyLogEntity::getDutyId, imsDutyLogEntity.getDutyId()) + .eq(ImsDutyLogEntity::getDutyId, headDutyMain.getId()) .last("limit 1")); - update.setCarryTime(DateUtil.format(new Date(), PATTERN_DATETIME)); - imsDutyLogService.updateById(update); + if(ObjectUtil.isNotEmpty(update)) { + update.setCarryTime(DateUtil.format(new Date(), PATTERN_DATETIME)); + imsDutyLogService.updateById(update); // imsDutyLogService.update(Wrappers.lambdaUpdate() // .set(ImsDutyLogEntity::getCarryTime, DateUtil.format(new Date(), PATTERN_DATETIME)) // .eq(ImsDutyLogEntity::getDutyId,imsDutyLogEntity.getDutyId()) // ); - log.info("更新值班日志"); + log.info("更新值班日志"); + } } ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class); // 更新交班值班 From 8507fa7e425ef1dabb440036c3e109bddf08f3d8 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Sun, 4 Feb 2024 16:05:31 +0800 Subject: [PATCH 02/13] =?UTF-8?q?#=20=E9=A3=8E=E9=99=A9=E7=82=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/safeproduct/Constants.java | 2 +- .../hzims/safeproduct/constants/DictConstants.java | 21 +++++++++++ .../safeproduct/entity/DangerSourceEntity.java | 11 ++++++ .../safeproduct/hazard/vo/DangerSourceVO.java | 5 +++ .../hazard/controller/DangerSourceController.java | 8 ++++ .../hazard/service/IDangerSourceService.java | 8 ++++ .../service/impl/DangerSourceServiceImpl.java | 41 +++++++++++++++++++++ .../hazard/wrapper/DangerSourceWrapper.java | 2 + .../hzims/safeproduct/vo/DangerSourceExportVO.java | 43 ++++++++++++++++++++++ 9 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/vo/DangerSourceExportVO.java diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java index eceea8d..fad01b2 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; * @Author: py */ public class Constants { - public final static String APP_NAME = "hzims-safeproduct"; + public final static String APP_NAME = "hzims-safeproduct-hx"; /** * 安全生产标准化评审标准 diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/DictConstants.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/DictConstants.java index e829c5b..a01b53e 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/DictConstants.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/DictConstants.java @@ -1,5 +1,11 @@ package com.hnac.hzims.safeproduct.constants; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.Optional; + /** * @author xiashandong * @created 2021/5/27 10:09 @@ -11,4 +17,19 @@ public interface DictConstants { String DANGER_TYPE = "dangerType"; /**危险等级**/ String RISK_LEVEL = "riskLevel"; + + @AllArgsConstructor + enum DangerSourceTypeEnum { + OPERATION(1,"作业活动"), + EQUIPMENT(2,"设备"), + ; + @Getter + private Integer type; + @Getter + private String typeName; + public static String getTypeNameByType(Integer type) { + Optional first = Arrays.stream(DangerSourceTypeEnum.class.getEnumConstants()).filter(e -> type.equals(e.getType())).findFirst(); + return first.map(DangerSourceTypeEnum::getTypeName).orElse(null); + } + } } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java index ebca8f7..7d56405 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java @@ -1,5 +1,7 @@ package com.hnac.hzims.safeproduct.entity; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.NullSerializer; @@ -7,6 +9,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; import org.springblade.core.tenant.mp.TenantEntity; @@ -23,12 +27,14 @@ public class DangerSourceEntity extends TenantEntity { private static final long serialVersionUID = 1L; @ApiModelProperty("所属机构") + @QueryField(condition = SqlCondition.EQUAL) private Long refDept; @ApiModelProperty("所属机构名称") private String refDeptName; @ApiModelProperty(value = "危险源库ID") + @QueryField(condition = SqlCondition.EQUAL) private Long libraryId; /** @@ -36,6 +42,7 @@ public class DangerSourceEntity extends TenantEntity { */ @ApiModelProperty(value = "危险源类型 1=作业活动 2=设备") @JsonSerialize(nullsUsing = NullSerializer.class) + @QueryField(condition = SqlCondition.EQUAL) private Integer type; /** * 设备ID @@ -45,6 +52,7 @@ public class DangerSourceEntity extends TenantEntity { private Long eqId; @ApiModelProperty("设备编号") + @QueryField(condition = SqlCondition.LIKE) private String emCode; @ApiModelProperty("设备名称") @@ -53,11 +61,13 @@ public class DangerSourceEntity extends TenantEntity { * 危险源名称 */ @ApiModelProperty(value = "危险源名称") + @QueryField(condition = SqlCondition.LIKE) private String name; /** * 危险因素 */ @ApiModelProperty(value = "危险因素") + @QueryField(condition = SqlCondition.LIKE) private String dangerEle; /** @@ -80,6 +90,7 @@ public class DangerSourceEntity extends TenantEntity { */ @ApiModelProperty(value = "风险等级 10=稍有危险 20=一般危险 30=显著危险 40=高度危险") @JsonSerialize(nullsUsing = NullSerializer.class) + @QueryField(condition = SqlCondition.EQUAL) private Integer level; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java index edab947..a212b4b 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/hazard/vo/DangerSourceVO.java @@ -1,5 +1,7 @@ package com.hnac.hzims.safeproduct.hazard.vo; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; import com.hnac.hzims.safeproduct.hazard.enums.DangerSourceLevelEnum; import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO; @@ -23,6 +25,9 @@ public class DangerSourceVO extends DangerSourceEntity { @ApiModelProperty(value = "危险等级Name") private String applyTypeName; + @ApiModelProperty(value = "危险源类型名称") + private String typeName; + @ApiModelProperty("创建人名称") private String createUserName; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java index 268a02b..39e784f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/controller/DangerSourceController.java @@ -22,6 +22,7 @@ import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -119,4 +120,11 @@ public class DangerSourceController extends BladeController { public R importDangerSource(@RequestBody HazardInstanceDTO req) { return R.status(dangerSourceService.importDangerSource(req)); } + + @GetMapping("/exportDangerSource") + @ApiOperation("导出危险源") + @ApiOperationSupport(order = 90) + public void exportDangerSource(DangerSourceEntity req, HttpServletResponse response) { + dangerSourceService.exportDangerSource(req,response); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java index 44d2889..eb26ebf 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java @@ -13,6 +13,7 @@ import org.springblade.core.tool.api.R; import org.springblade.system.vo.CreateTableVO; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -44,4 +45,11 @@ public interface IDangerSourceService extends BaseService { List safes(String safeInfos); Boolean importDangerSource(HazardInstanceDTO req); + + /** + * 导出危险源 + * @param req 筛选条件 + * @param response 请求响应 + */ + void exportDangerSource(DangerSourceEntity req, HttpServletResponse response); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java index d4a369c..4a8e35e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java @@ -1,5 +1,8 @@ package com.hnac.hzims.safeproduct.hazard.service.impl; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -9,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.feign.IEmInfoClient; +import com.hnac.hzims.operational.maintenance.vo.MaintenanceTaskQueryVO; import com.hnac.hzims.safeproduct.constants.DictConstants; import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; import com.hnac.hzims.safeproduct.hazard.dto.DangerSourcePositionDTO; @@ -25,6 +29,7 @@ import com.hnac.hzims.safeproduct.hazard.service.IDangerSourceService; import com.hnac.hzims.safeproduct.utils.ExcelToolListener; import com.hnac.hzims.safeproduct.utils.TableJsonUtils; import com.hnac.hzims.safeproduct.hazard.vo.DangerSourcePositionVO; +import com.hnac.hzims.safeproduct.vo.DangerSourceExportVO; import com.hnac.hzims.safeproduct.vo.DangerSourceReportVO; import com.hnac.hzims.safeproduct.hazard.vo.DangerSourceVO; import com.hnac.hzims.safeproduct.vo.SourceVO; @@ -33,6 +38,7 @@ import com.hnac.hzims.safeproduct.hazard.wrapper.DangerSourceWrapper; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; +import org.apache.poi.ss.usermodel.BorderStyle; import org.springblade.core.excel.support.ExcelException; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; @@ -52,9 +58,12 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -342,6 +351,38 @@ public class DangerSourceServiceImpl extends BaseServiceImpl dangerSourceList = this.list(Condition.getQueryWrapper(req)); + List voList = DangerSourceWrapper.build().listVO(dangerSourceList); + List exportVOList = BeanUtil.copy(voList, DangerSourceExportVO.class); + // 设置响应头 + // URLEncoder.encode防止中文乱码 + String fileName; + try { + fileName = URLEncoder.encode("危险点列表", "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + response.setContentType("application/vnd.ms-excel"); + response.setCharacterEncoding("UTF-8"); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); + contentWriteCellStyle.setBorderTop(BorderStyle.THIN); + contentWriteCellStyle.setBorderRight(BorderStyle.THIN); + contentWriteCellStyle.setBorderBottom(BorderStyle.THIN); + contentWriteCellStyle.setWrapped(true); + try { + EasyExcel.write(response.getOutputStream(), DangerSourceExportVO.class) + .registerWriteHandler(new HorizontalCellStyleStrategy(new WriteCellStyle(), contentWriteCellStyle)) + .autoCloseStream(Boolean.FALSE).sheet("危险点列表") + .doWrite(exportVOList); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override public List listByTenantId(String tenantId) { return this.baseMapper.listByTenantId(tenantId); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java index e71adde..658b5f6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/wrapper/DangerSourceWrapper.java @@ -29,6 +29,8 @@ public class DangerSourceWrapper extends BaseEntityWrapper Date: Sun, 4 Feb 2024 17:27:09 +0800 Subject: [PATCH 03/13] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=8D=AB?= =?UTF-8?q?=E7=94=9F=E8=87=AA=E6=9F=A5=E8=A1=A8=E6=A0=BC=E5=BC=8F=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/vo/HygieneRecordDetailVO.java | 6 ++ .../service/impl/HygieneRecordServiceImpl.java | 35 ++++++++++-- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 62 +++++++++++++++++++++ .../main/resources/template/卫生自查表.docx | Bin 11487 -> 11555 bytes 4 files changed, 97 insertions(+), 6 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java index 1aeae76..52bee71 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java @@ -47,4 +47,10 @@ public class HygieneRecordDetailVO { @ApiModelProperty("检查信息列表") private List checkList; + + @ApiModelProperty("年份") + private String year; + + @ApiModelProperty("月份") + private String month; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index 608f1ed..48d21fb 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -94,7 +94,7 @@ public class HygieneRecordServiceImpl extends ServiceImpl hygienePlanEntity.getStandardScore()) { @@ -122,7 +122,7 @@ public class HygieneRecordServiceImpl extends ServiceImpl hygienePlanEntity.getStandardScore()) { @@ -138,11 +138,11 @@ public class HygieneRecordServiceImpl extends ServiceImpl checkDetailVOList = new ArrayList<>(); - for (int i = 0; i < zoneIds.length ; i++) { + for (int i = 0; i < zoneIds.length; i++) { HygieneZoneDetailVO zoneDetailVO = new HygieneZoneDetailVO(); HygieneZoneEntity hygieneZoneEntity = hygieneZoneService.getById(zoneIds[i]); BeanUtils.copyProperties(hygieneZoneEntity, zoneDetailVO); @@ -169,6 +169,29 @@ public class HygieneRecordServiceImpl extends ServiceImpl checkList = hygieneRecordDetailVO.getCheckList(); + List res = new ArrayList<>(); + checkList.forEach(item -> { + String[] checkItem = item.getCheckItem().split(","); + String[] checkItemScore = item.getCheckItemScore().split(","); + for (int i = 0; i < checkItem.length; i++) { + HygieneZoneDetailVO hygieneZoneDetailVO = new HygieneZoneDetailVO(); + hygieneZoneDetailVO.setZone(item.getZone()); + hygieneZoneDetailVO.setPrincipal(item.getPrincipal()); + hygieneZoneDetailVO.setResult(item.getResult()); + hygieneZoneDetailVO.setScore(item.getScore()); + hygieneZoneDetailVO.setCheckItem(checkItem[i]); + hygieneZoneDetailVO.setCheckItemScore(checkItemScore[i]); + res.add(hygieneZoneDetailVO); + } + }); + // 表头 + String code = hygieneRecordDetailVO.getCode(); + hygieneRecordDetailVO.setYear(code.substring(4, 8)); + hygieneRecordDetailVO.setMonth(code.substring(8, 10)); + hygieneRecordDetailVO.setCheckList(res); Map params = BaseUtil.obj2Map(hygieneRecordDetailVO); String templateFile = "template/卫生自查表" + SafeProductConstant.DOCX_SUFFIX; String wordPath = savePath + "/卫生自查表" + SafeProductConstant.DOCX_SUFFIX; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index 3118280..20028cd 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -6,6 +6,10 @@ import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.apache.poi.xwpf.usermodel.XWPFTable; +import org.apache.poi.xwpf.usermodel.XWPFTableCell; +import org.apache.poi.xwpf.usermodel.XWPFTableRow; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; @@ -106,11 +110,15 @@ public class BaseUtil { * 数据写入 * @param templatePath 模板文件路径 * @param params 数据参数 + * @return 文件 */ public static XWPFDocument fillDocument(String templatePath, Map params) { XWPFDocument xwpfDocument = null; try { xwpfDocument = WordExportUtil.exportWord07(templatePath, params); + if (templatePath.equals("template/卫生自查表.docx")) { + formatHygieneRecordTable(xwpfDocument); + } } catch (Exception e) { log.error("数据写入异常: {}", e.getMessage()); e.printStackTrace(); @@ -119,6 +127,60 @@ public class BaseUtil { } /** + * 卫生自查表格式处理 + * @param xwpfDocument word文件类 + */ + private static void formatHygieneRecordTable(XWPFDocument xwpfDocument) { + // 获取文档中所有的表格 + List tableList = xwpfDocument.getTables(); + if (tableList.size() > 0) { + // 循环表格 + for (XWPFTable table : tableList) { + // 获取表格所有行数 + List rows = table.getRows(); + // 第三行到倒数第二行为需合并区域 + for (int row = 3; row < rows.size() - 1;) { + 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); + mergeCellsVertically(table, 1, row, index - 1); + mergeCellsVertically(table, 4, row, index - 1); + mergeCellsVertically(table, 5, row, index - 1); + row = index; + } + } + } + } + + /** + * word单元格行合并 + * @param table 表格 + * @param col 合并行所在列 + * @param startRow 开始行 + * @param endRow 结束行 + */ + public static void mergeCellsVertically(XWPFTable table, int col, int startRow, int endRow) { + for (int i = startRow; i <= endRow; i++) { + XWPFTableCell cell = table.getRow(i).getCell(col); + if (i == startRow) { + // The first merged cell is set with RESTART merge value + cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.RESTART); + } else { + // Cells which join (merge) the first one, are set with CONTINUE + cell.getCTTc().addNewTcPr().addNewVMerge().setVal(STMerge.CONTINUE); + } + } + } + + /** * 读取本地pdf,这里设置的是预览 * @param response 响应类 * @param filePath 文件路径 diff --git a/hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx b/hzims-service/safeproduct/src/main/res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?q?update:=20=E5=88=A0=E5=8E=BB=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/safeproduct/controller/RehearsalController.java | 1 - .../java/com/hnac/hzims/safeproduct/controller/TrainController.java | 1 - .../java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index 72f5a91..4182137 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -2,7 +2,6 @@ package com.hnac.hzims.safeproduct.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.service.IRehearsalPlanService; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java index 8bbf0ea..f65f90d 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java @@ -2,7 +2,6 @@ package com.hnac.hzims.safeproduct.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.dto.TestScoreDTO; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java index c40c905..09cc4df 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java @@ -70,7 +70,7 @@ public class TestServiceImpl extends ServiceImpl impleme TestEntity test = getTestByCode(testEntity.getCode()); // 获取姓名数组 String people = test.getPeopleName(); - String[] person = people.split(",|,"); + String[] person = people.split(","); // 新增参考人员成绩数据 List scoreList = getReferenceTestScore(test, person); return R.status(testScoreService.saveBatch(scoreList)); @@ -169,7 +169,7 @@ public class TestServiceImpl extends ServiceImpl impleme boolean removeByIds = testScoreService.removeByIds(scoreIds); // 若删除成功,新增新的考试成绩数据 if (removeByIds) { - String[] person = testEntity.getPeopleName().split(",|,"); + String[] person = testEntity.getPeopleName().split(","); // 新增参考人员成绩数据 List scoreList = getReferenceTestScore(testEntity, person); return testScoreService.saveBatch(scoreList); From cab3e13fb25fae14cb115c1ce5a64b4f89b05d32 Mon Sep 17 00:00:00 2001 From: liwen Date: Sun, 4 Feb 2024 17:28:56 +0800 Subject: [PATCH 05/13] =?UTF-8?q?update:=20safeproduct=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=90=8D=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/safeproduct/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java index fad01b2..eceea8d 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/Constants.java @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; * @Author: py */ public class Constants { - public final static String APP_NAME = "hzims-safeproduct-hx"; + public final static String APP_NAME = "hzims-safeproduct"; /** * 安全生产标准化评审标准 From 4f36b1a680f6243fc2ddaff18e6fb349ab8134b0 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Sun, 4 Feb 2024 19:15:40 +0800 Subject: [PATCH 06/13] =?UTF-8?q?#=20=E9=A3=8E=E9=99=A9=E7=82=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/common/support/constants/Order.java | 5 +++ .../hnac/hzims/common/support/utils/Condition.java | 49 ++++++++++++++++++++++ .../safeproduct/entity/DangerSourceEntity.java | 2 + .../hazard/service/IDangerSourceService.java | 11 +++++ .../service/impl/DangerSourceServiceImpl.java | 28 +++---------- 5 files changed, 72 insertions(+), 23 deletions(-) create mode 100644 hzims-biz-common/src/main/java/com/hnac/hzims/common/support/constants/Order.java create mode 100644 hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/constants/Order.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/constants/Order.java new file mode 100644 index 0000000..67e68c4 --- /dev/null +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/constants/Order.java @@ -0,0 +1,5 @@ +package com.hnac.hzims.common.support.constants; + +public enum Order { + ASC,DESC; +} diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java new file mode 100644 index 0000000..c593bb0 --- /dev/null +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/support/utils/Condition.java @@ -0,0 +1,49 @@ +package com.hnac.hzims.common.support.utils; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.google.common.collect.Lists; +import com.hnac.hzims.common.support.constants.Order; +import org.springblade.core.tool.utils.BeanUtil; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.function.Function; + +public class Condition extends org.springblade.core.mp.support.Condition { + + public static List getFieldList(Object object) { + Class clazz = object.getClass(); + List fields = Lists.newArrayList(); + while (null != clazz){ + fields.addAll(Arrays.asList(clazz.getDeclaredFields())); + clazz = clazz.getSuperclass(); + } + return fields; + } + + public static LambdaQueryWrapper getQueryWrapper(Object query, Class clazz, Map> orderFields) { + QueryWrapper queryWrapper = getQueryWrapper(BeanUtil.copy(query,clazz)); + List fields = getFieldList(query); + // 填充排序字段 + orderFields.forEach((fieldName,order) -> { + Optional existField = fields.stream().filter(field -> camel2under(fieldName).equals(camel2under(field.getName()))).findAny(); + if(existField.isPresent()) { + if(Order.ASC.equals(order)) { + queryWrapper.orderByAsc(fieldName); + } + else if(Order.DESC.equals(order)) { + queryWrapper.orderByDesc(fieldName); + } + } + }); + return queryWrapper.lambda(); + } + + private static String camel2under(String c) { + String separator = "_"; + c = c.replaceAll("([a-z])([A-Z])", "$1" + separator + "$2").toUpperCase(); + return c; + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java index 7d56405..f40f1a0 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/DangerSourceEntity.java @@ -49,6 +49,7 @@ public class DangerSourceEntity extends TenantEntity { */ @ApiModelProperty(value = "设备ID") @JsonSerialize(nullsUsing = NullSerializer.class) + @QueryField(condition = SqlCondition.EQUAL) private Long eqId; @ApiModelProperty("设备编号") @@ -74,6 +75,7 @@ public class DangerSourceEntity extends TenantEntity { * 应用类型 */ @ApiModelProperty(value = "应用类型") + @QueryField(condition = SqlCondition.EQUAL) private String applyType; /** * 可能导致的事故 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java index eb26ebf..53b565a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/IDangerSourceService.java @@ -1,6 +1,9 @@ package com.hnac.hzims.safeproduct.hazard.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.common.support.constants.Order; +import com.hnac.hzims.common.support.utils.Condition; import com.hnac.hzims.safeproduct.hazard.dto.DangerSourceDTO; import com.hnac.hzims.safeproduct.entity.DangerSourceEntity; import com.hnac.hzims.safeproduct.hazard.dto.HazardInstanceDTO; @@ -14,7 +17,9 @@ import org.springblade.system.vo.CreateTableVO; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @author xiashandong @@ -52,4 +57,10 @@ public interface IDangerSourceService extends BaseService { * @param response 请求响应 */ void exportDangerSource(DangerSourceEntity req, HttpServletResponse response); + + default LambdaQueryWrapper getQueryWrapper(Object req) { + Map param = new HashMap<>(); + param.put("create_time",Order.DESC); + return Condition.getQueryWrapper(req,DangerSourceEntity.class,param); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java index 4a8e35e..8e0418a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/hazard/service/impl/DangerSourceServiceImpl.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.common.support.constants.Order; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.operational.maintenance.vo.MaintenanceTaskQueryVO; @@ -183,28 +184,7 @@ public class DangerSourceServiceImpl extends BaseServiceImpl> pageCondition(DangerSourceEntity req, Query query) { - Wrapper queryWrapper = new LambdaQueryWrapper() {{ - orderByDesc(DangerSourceEntity::getCreateTime); - if (req.getType() != null) { - eq(DangerSourceEntity::getType, req.getType()); - } - if (null != req.getEqId()) { - eq(DangerSourceEntity::getEqId, req.getEqId()); - } - if (null != req.getLevel()) { - eq(DangerSourceEntity::getLevel, req.getLevel()); - } - if (StringUtil.isNotBlank(req.getName())) { - like(DangerSourceEntity::getName, req.getName()); - } - if (StringUtil.isNotBlank(req.getDangerEle())) { - like(DangerSourceEntity::getDangerEle, req.getDangerEle()); - } - if (StringUtil.isNotBlank(req.getApplyType())) { - eq(DangerSourceEntity::getApplyType, req.getApplyType()); - } - }}; - IPage page = super.page(Condition.getPage(query), queryWrapper); + IPage page = super.page(Condition.getPage(query), getQueryWrapper(req)); page.setRecords(DangerSourceWrapper.build().listVO(page.getRecords())); return R.data(page); } @@ -336,6 +316,8 @@ public class DangerSourceServiceImpl extends BaseServiceImpl sourceList = req.getHazardList().stream().map(h -> { DangerSourceEntity result = JSONObject.parseObject(JSON.toJSONString(h), DangerSourceEntity.class); result.setId(null); + result.setEmCode(req.getEmCode()); + result.setEmName(req.getEmName()); result.setLibraryId(h.getId()); result.setRefDept(req.getDeptId()); result.setRefDeptName(req.getDeptName()); @@ -352,7 +334,7 @@ public class DangerSourceServiceImpl extends BaseServiceImpl dangerSourceList = this.list(Condition.getQueryWrapper(req)); + List dangerSourceList = this.list(getQueryWrapper(req)); List voList = DangerSourceWrapper.build().listVO(dangerSourceList); List exportVOList = BeanUtil.copy(voList, DangerSourceExportVO.class); // 设置响应头 From f8e5c61f661347a53001421c9c8af2237cf81e64 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Sun, 4 Feb 2024 19:16:41 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspect/task/vo/InspectTaskExportVO.java | 4 ++ .../inspect/task/controller/TaskController.java | 14 ++--- .../hzinfo/inspect/task/mapper/TaskMapper.java | 4 ++ .../hnac/hzinfo/inspect/task/mapper/TaskMapper.xml | 26 +++++++++ .../hzinfo/inspect/task/service/ITaskService.java | 2 +- .../inspect/task/service/impl/TaskServiceImpl.java | 61 ++++++++++++---------- 6 files changed, 76 insertions(+), 35 deletions(-) diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java index 09ebb52..8dcb112 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/vo/InspectTaskExportVO.java @@ -71,5 +71,9 @@ public class InspectTaskExportVO { @ExcelProperty(value = "巡检状态", index = 9) @ColumnWidth(value = 20) private String status; + @ApiModelProperty("巡检类型") + @ExcelProperty(value = "巡检类型", index = 10) + @ColumnWidth(value = 20) + private String type; } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java index 314dff3..c82d332 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java @@ -120,7 +120,7 @@ public class TaskController extends BladeController { @PostMapping("/listPage") @ApiOperation(value = "巡检任务分页查询-站长级", notes = "传入task") @ApiOperationSupport(order = 1) - public R> listPage(@RequestBody TaskDTO taskDTO) { + public R> listPage(@RequestBody TaskDTO taskDTO) { return R.data(taskService.page(taskDTO)); } @@ -158,12 +158,12 @@ public class TaskController extends BladeController { @ApiOperation(value = "巡检任务导出", notes = "传入计划id") public void exportTaskList(HttpServletResponse response,@RequestBody TaskDTO task) { try { - if(ObjectUtils.isEmpty(task.getStartTime())&&ObjectUtils.isEmpty(task.getEndTime())){ - LocalDateTime date = LocalDateTime.now(); - LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); - task.setStartTime(firstDay); - task.setEndTime(date); - } +// if(ObjectUtils.isEmpty(task.getStartTime())&&ObjectUtils.isEmpty(task.getEndTime())){ +// LocalDateTime date = LocalDateTime.now(); +// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); +// task.setStartTime(firstDay); +// task.setEndTime(date); +// } response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("UTF-8"); // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java index c2a70ef..b540c27 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.java @@ -1,5 +1,6 @@ package com.hnac.hzinfo.inspect.task.mapper; +import com.hnac.hzinfo.inspect.task.dto.TaskDTO; import com.hnac.hzinfo.inspect.task.vo.TaskCountVO; import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO; import org.springblade.core.datascope.annotation.UserDataAuth; @@ -27,6 +28,9 @@ public interface TaskMapper extends UserDataScopeBaseMapper { */ List getListPage(@Param("page") IPage page, @Param("task") TaskListQuery task); + List getAllPageList(@Param("page") IPage page, @Param("task") TaskDTO taskDTO); + List getAllExportList(@Param("task") TaskDTO taskDTO); + List mainQueryPage(@Param("page") IPage page, @Param("task") TaskListQuery task); /** diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml index 6197bb8..1d984f9 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml @@ -173,6 +173,32 @@ order by t.UPDATE_TIME desc + + - SELECT P.DEFECT_GRADING as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM from + SELECT P.DEFECT_LEVEL as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM from hzims_oper_phenomenon P WHERE DATE_FORMAT(P.CREATE_TIME,'%Y-%m') = #{month} @@ -13,16 +13,16 @@ #{item} - and P.DEFECT_GRADING IS NOT NULL + and P.DEFECT_LEVEL IS NOT NULL AND P.IS_DEFECT='1' AND P.IS_DELETED = '0' - GROUP BY P.DEFECT_GRADING,P.HANDLE_STATUS - ORDER BY P.DEFECT_GRADING + GROUP BY P.DEFECT_LEVEL,P.HANDLE_STATUS + ORDER BY P.DEFECT_LEVEL