From f11d6a85da423ce9af852e8ad083fcdc3493ac51 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 11 Jan 2024 18:58:04 +0800 Subject: [PATCH 1/5] =?UTF-8?q?#=E5=B7=A5=E4=BD=9C=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8D=95=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java index 2965c3a..280ee87 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java @@ -31,7 +31,7 @@ public class WorkTaskEntity extends TenantEntity { private String headName; @ApiModelProperty(value = "工作负责人名称") - private Date headHandlTime; + private Date headHandleTime; @ApiModelProperty(value = "班组ID") private Long groupId; @@ -52,7 +52,7 @@ public class WorkTaskEntity extends TenantEntity { private Date planStartTime; @ApiModelProperty(value = "工作计划结束时间") - private Date endStartTime; + private Date planEndTime; @ApiModelProperty(value = "工作任务") private String workTask; From d73c8a9113bf3bd4d19810dd6b93a6042f92d456 Mon Sep 17 00:00:00 2001 From: liwen Date: Fri, 12 Jan 2024 09:22:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?update:=20=E8=BD=A6=E8=BE=86=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/safeproduct/dto/RehearsalExportDTO.java | 14 +- hzims-service/safeproduct/pom.xml | 8 ++ .../safeproduct/controller/CarController.java | 10 +- .../com/hnac/hzims/safeproduct/jobs/CarJob.java | 33 ++++- .../hnac/hzims/safeproduct/mapper/CarMapper.xml | 6 +- .../safeproduct/mapper/RehearsalPlanMapper.xml | 16 +-- .../service/ICarCheckRecordService.java | 8 ++ .../service/ICarMaintenanceService.java | 10 ++ .../hzims/safeproduct/service/ICarService.java | 8 ++ .../safeproduct/service/ICarUsedRecordService.java | 8 ++ .../service/impl/CarCheckRecordServiceImpl.java | 20 ++- .../service/impl/CarMaintenanceServiceImpl.java | 86 +++-------- .../safeproduct/service/impl/CarServiceImpl.java | 15 +- .../service/impl/CarUsedRecordServiceImpl.java | 21 +++ .../safeproduct/service/impl/TestServiceImpl.java | 12 +- .../service/impl/TrainRecordServiceImpl.java | 12 +- .../hnac/hzims/safeproduct/utils/AsposeUtil.java | 53 +++++++ .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 159 +++++++++++++++++---- .../safeproduct/src/main/resources/License.xml | 15 ++ .../resources/template/车辆维保记录单.docx | Bin 0 -> 11538 bytes 20 files changed, 376 insertions(+), 138 deletions(-) create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/AsposeUtil.java create mode 100644 hzims-service/safeproduct/src/main/resources/License.xml create mode 100644 hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java index 800f911..df269e3 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/RehearsalExportDTO.java @@ -37,19 +37,7 @@ public class RehearsalExportDTO { @ExcelProperty(value = "演练地点", index = 4) private String location; - @ApiModelProperty("参演人数") - @ExcelProperty(value = "参演人数", index = 5) - private Integer peopleNum; - - @ApiModelProperty("演练实际开始时间") - @ExcelProperty(value = "演练实际开始时间", index = 6) - private Date actualStartTime; - - @ApiModelProperty("演练实际结束时间") - @ExcelProperty(value = "演练实际结束时间", index = 7) - private Date actualEndTime; - @ApiModelProperty("演练状态") - @ExcelProperty(value = "演练状态", index = 8) + @ExcelProperty(value = "演练状态", index = 5) private String rehearsalStatus; } diff --git a/hzims-service/safeproduct/pom.xml b/hzims-service/safeproduct/pom.xml index a048dd1..cfede4f 100644 --- a/hzims-service/safeproduct/pom.xml +++ b/hzims-service/safeproduct/pom.xml @@ -160,6 +160,14 @@ false + + org.springframework.boot + spring-boot-maven-plugin + + + true + + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java index 20ce27e..88779d5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java @@ -120,7 +120,6 @@ public class CarController extends BladeController { @GetMapping("/carMaintenancePage") @ApiImplicitParams({ - @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string") @@ -169,7 +168,6 @@ public class CarController extends BladeController { @GetMapping("/carUsedRecordPage") @ApiImplicitParams({ - @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string") }) @ApiOperation(value = "用车记录分页") @@ -244,14 +242,14 @@ public class CarController extends BladeController { @GetMapping("/exportCarUsedRecordData") @ApiOperation(value = "导出用车记录单") @ApiOperationSupport(order = 25) - public void exportCarUsedRecordData() { - + public void exportCarUsedRecordData(@RequestParam Long id, HttpServletResponse response) { + carUsedRecordService.exportCarUsedRecordData(id, response); } @GetMapping("/exportCarCheckRecordData") @ApiOperation(value = "导出车检记录单") @ApiOperationSupport(order = 26) - public void exportCarCheckRecordData() { - + public void exportCarCheckRecordData(@RequestParam Long id, HttpServletResponse response) { + carCheckRecordService.exportCarCheckRecordData(id, response); } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java index 86c7e55..93132b0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java @@ -1,12 +1,18 @@ package com.hnac.hzims.safeproduct.jobs; +import com.alibaba.excel.util.CollectionUtils; import com.hnac.hzims.safeproduct.entity.CarEntity; +import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity; +import com.hnac.hzims.safeproduct.enums.CarInsuranceStatusEnum; +import com.hnac.hzims.safeproduct.enums.CarMaintenanceStatusEnum; +import com.hnac.hzims.safeproduct.service.ICarMaintenanceService; import com.hnac.hzims.safeproduct.service.ICarService; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; import org.springblade.core.tool.utils.DateUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @@ -23,9 +29,13 @@ public class CarJob { @Autowired ICarService carService; + @Autowired + ICarMaintenanceService carMaintenanceService; + /** * 车辆台账自动变更 */ + @Transactional(rollbackFor = Exception.class) @XxlJob("autoChangeCarStatus") public ReturnT autoChangeCarStatus(String param) { // 获取时间范围 @@ -33,9 +43,26 @@ public class CarJob { Date before = DateUtil.minusDays(current, 1); String today = DateUtil.format(current, "yyyy-mm-dd"); String yesterday = DateUtil.format(before, "yyyy-mm-dd"); + // 车包状态变更 List uninsuredCarList = carService.getCarListByInsuranceTime(today, yesterday); -// uninsuredCarList.forEach(car -> car.setInsuranceStatus()); -// List carListByMaintenanceTime = carService.getCarListByMaintenanceTime(today, yesterday); - return ReturnT.SUCCESS; + uninsuredCarList.forEach(car -> car.setInsuranceStatus(CarInsuranceStatusEnum.UNINSURED.getValue())); + boolean insuranceUpdate = carService.updateBatchById(uninsuredCarList); + if (!insuranceUpdate) { + return ReturnT.FAIL; + } + // 维保状态变更 + List unMaintainedCarList = carService.getCarListByMaintenanceTime(today, yesterday); + unMaintainedCarList.forEach(car -> { + // 查询车辆在两次维保时间内是否有确认过的维保记录 + String lastMaintenanceTime = DateUtil.format(car.getMaintenanceLastTime(), "yyyy-mm-dd"); + String nextMaintenanceTime = DateUtil.format(car.getMaintenanceNextTime(), "yyyy-mm-dd"); + List carMaintenanceList = carMaintenanceService.getCarMaintenanceByCarIdAndTime(car.getId(), + lastMaintenanceTime, nextMaintenanceTime); + // 若无维保记录,说明在规定范围内未进行有效维保 + if (CollectionUtils.isEmpty(carMaintenanceList)) { + car.setMaintenanceStatus(CarMaintenanceStatusEnum.UNMAINTAINED.getValue()); + } + }); + return carService.updateBatchById(unMaintainedCarList) ? ReturnT.SUCCESS : ReturnT.FAIL; } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml index 0122ec9..695be59 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml @@ -44,7 +44,7 @@ \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml index 38b8ac3..8ff4810 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml @@ -73,23 +73,21 @@ \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java index e9dfc26..0e734d5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java @@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO; import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO; import org.springblade.core.mp.support.Query; +import javax.servlet.http.HttpServletResponse; import java.util.Map; /** @@ -60,4 +61,11 @@ public interface ICarCheckRecordService extends IService { * @return true-成功,false-失败 */ boolean removeCarCheckRecord(Long id); + + /** + * 导出车检记录单 + * @param id 车检记录id + * @param response 响应类 + */ + void exportCarCheckRecordData(Long id, HttpServletResponse response); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java index a925669..dcccb68 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java @@ -10,6 +10,7 @@ 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; /** @@ -55,4 +56,13 @@ public interface ICarMaintenanceService extends IService { * @param response 响应类 */ void exportCarMaintenanceData(Long id, HttpServletResponse response); + + /** + * 根据车辆id和时间查询相关维保记录 + * @param carId 车辆id + * @param lastTime 上次维保时间 + * @param nextTime 下次维保时间 + * @return 车辆维保记录列表 + */ + List getCarMaintenanceByCarIdAndTime(Long carId, String lastTime, String nextTime); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java index ce6daed..e25b6d6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java @@ -32,4 +32,12 @@ public interface ICarService extends IService { * @return 车辆列表数据 */ List getCarListByInsuranceTime(String today, String yesterday); + + /** + * 根据维保时间查询车辆列表 + * @param today 当天 + * @param yesterday 昨天 + * @return 车辆列表数据 + */ + List getCarListByMaintenanceTime(String today, String yesterday); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java index 53af9f1..3e849ab 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java @@ -9,6 +9,7 @@ import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import javax.servlet.http.HttpServletResponse; import java.util.Map; /** @@ -54,4 +55,11 @@ public interface ICarUsedRecordService extends IService { * @return true-成功,false-失败 */ boolean updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity); + + /** + * 导出用车记录单 + * @param id 用车记录id + * @param response 响应类 + */ + void exportCarUsedRecordData(Long id, HttpServletResponse response); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java index 5e6db20..4f69d47 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java @@ -15,18 +15,18 @@ import com.hnac.hzims.safeproduct.mapper.CarMapper; import com.hnac.hzims.safeproduct.service.ICarCheckItemService; import com.hnac.hzims.safeproduct.service.ICarCheckRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; -import com.hnac.hzims.safeproduct.vo.CarCheckItemVO; import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO; import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -46,6 +46,9 @@ public class CarCheckRecordServiceImpl extends ServiceImpl params = BaseUtil.obj2Map(carCheckRecordEntity); + String templateFile = "template/车检记录单.docx"; + String wordPath = savePath + "/车检记录单.docx"; + String pdfPath = savePath + "/车检记录单.pdf"; + BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, response); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java index 79836c5..b3001f4 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java @@ -1,10 +1,7 @@ package com.hnac.hzims.safeproduct.service.impl; import cn.hutool.core.date.DatePattern; -import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.util.CollectionUtils; -import com.alibaba.excel.write.metadata.WriteSheet; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -19,23 +16,15 @@ import com.hnac.hzims.safeproduct.service.ICarService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO; import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO; -import com.hnac.hzims.ticket.constants.WorkTicketConstants; -import org.apache.poi.xwpf.usermodel.XWPFDocument; -import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.DateUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.net.URLEncoder; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -52,6 +41,9 @@ public class CarMaintenanceServiceImpl extends ServiceImpl params = BaseUtil.convertObjectToMap(carMaintenanceEntity); -// String templateFile = "" - try { - List res = new ArrayList<>(); - XWPFDocument document = BaseUtil.fillDocument("template/", params); - res.add(document); - BaseUtil.exportWord(res, ""); - } catch (Exception e) { - throw new RuntimeException(e); - } -// String pdfPath = this.getFileSavePath() + params.get("code") + "_" + params.get("addressEquName") +".pdf"; -// AsposeUtil.wordToPdf(wordPath, pdfPath); -// PdfUtils.readPdf(response,pdfPath); -// ServletOutputStream outputStream = null; -// try { -// outputStream = response.getOutputStream(); -// CarMaintenanceDetailVO carMaintenance = getCarMaintenance(id); -// // 设置响应头 -// // URLEncoder.encode防止中文乱码 -// String fileName = URLEncoder.encode("车辆维保记录单", "UTF-8"); -// response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); -// response.setContentType("application/vnd.ms-excel"); -// response.setCharacterEncoding("UTF-8"); -// List dataList = new ArrayList<>(); -// dataList.add(carMaintenance); -// String templatePath = "template/车辆维保记录单.xlsx"; -// Resource resource = new ClassPathResource(templatePath); -// // ExcelWriter初始化 -// ExcelWriter excelWriter = EasyExcel -// .write(response.getOutputStream(), CarMaintenanceDetailVO.class) -// .autoCloseStream(Boolean.TRUE) -// .withTemplate(resource.getInputStream()) -// .build(); -// WriteSheet writeSheet = EasyExcel.writerSheet(1, "车辆维保记录单").build(); -// excelWriter.write(dataList, writeSheet); -// excelWriter.finish(); -// } catch (Exception e) { -// // 重置response -// response.reset(); -// response.setContentType("application/json"); -// response.setCharacterEncoding("utf-8"); -// throw new ServiceException("车辆维保记录单导出异常: " + e.getMessage()); -// } finally { -// if (outputStream != null) { -// try { -// outputStream.close(); -// } catch (IOException e) { -// log.error("车辆维保记录单导出响应头输出流关闭异常: " + e.getMessage()); -// } -// } -// } + Map params = BaseUtil.obj2Map(carMaintenanceEntity); + String templateFile = "template/车辆维保记录单.docx"; + String wordPath = savePath + "/车辆维保记录单.docx"; + String pdfPath = savePath + "/车辆维保记录单.pdf"; + BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, response); + } + + /** + * 根据车辆id和时间查询相关维保记录 + */ + @Override + public List getCarMaintenanceByCarIdAndTime(Long carId, String lastTime, String nextTime) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarMaintenanceEntity::getCarId, carId) + .ge(CarMaintenanceEntity::getEndTime, lastTime) + .le(CarMaintenanceEntity::getEndTime, nextTime) + .eq(CarMaintenanceEntity::getMaintenanceStatus, CarMaintenanceStatusEnum.MAINTAINED.getValue()) + .orderByDesc(CarMaintenanceEntity::getCreateTime); + return this.list(queryWrapper); } /** diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java index d9e8adf..376c288 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java @@ -110,8 +110,19 @@ public class CarServiceImpl extends ServiceImpl implements @Override public List getCarListByInsuranceTime(String today, String yesterday) { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().le(CarEntity::getInsurancePayLastTime, today) - .ge(CarEntity::getInsurancePayNextTime, today); + queryWrapper.lambda().lt(CarEntity::getInsurancePayNextTime, today) + .ge(CarEntity::getInsurancePayNextTime, yesterday); + return this.list(queryWrapper); + } + + /** + * 根据维保时间查询车辆列表 + */ + @Override + public List getCarListByMaintenanceTime(String today, String yesterday) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().lt(CarEntity::getMaintenanceNextTime, today) + .ge(CarEntity::getMaintenanceNextTime, yesterday); return this.list(queryWrapper); } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java index d8f2295..b2bcfd6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java @@ -11,15 +11,20 @@ import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity; 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.AsposeUtil; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO; import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO; +import org.apache.poi.xwpf.usermodel.XWPFDocument; 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.factory.annotation.Value; import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -33,6 +38,9 @@ import java.util.Map; @Service public class CarUsedRecordServiceImpl extends ServiceImpl implements ICarUsedRecordService { + @Value("${hzims.car.savePath}") + private String savePath; + /** * 新增用车记录 */ @@ -98,6 +106,19 @@ public class CarUsedRecordServiceImpl extends ServiceImpl params = BaseUtil.obj2Map(carUsedRecordEntity); + String templateFile = "template/用车记录单.docx"; + String wordPath = savePath + "/用车记录单.docx"; + String pdfPath = savePath + "/用车记录单.pdf"; + BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, response); + } + + /** * 查询是否存在同月编号 * @param currentMonth 当月 * @return 存在则返回上一编号,否则返回null 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 9df05c4..eeaa00a 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 @@ -51,12 +51,13 @@ public class TestServiceImpl extends ServiceImpl impleme if (trainPlanEntity.getIsTest().equals(SafeProductConstant.TRAIN_PLAN_HAS_NO_TEST)) { return R.fail("该培训计划无法新增考试"); } - // 获取当月时间(yyyymm) - String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); + // 获取当月时间 + String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date()); + String currentSimpleMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); // 查询是否存在同月编号 - String lastCode = getLastCode(currentMonth); + String lastCode = getLastCode(currentNormMonth); // 若不存在,新增编号 - String code = BaseUtil.getUniqueCode("KSJL", lastCode, currentMonth); + String code = BaseUtil.getUniqueCode("KSJL", lastCode, currentSimpleMonth); testEntity.setCode(code); boolean saveTest = this.save(testEntity); // 若新增考试记录成功,添加相关的参考人员数据 @@ -195,8 +196,7 @@ public class TestServiceImpl extends ServiceImpl impleme * @return 存在则返回上一编号,否则返回null */ private String getLastCode(String currentMonth) { - String month = currentMonth.substring(currentMonth.length() - 2); - List list = getTestByMonth(month); + List list = getTestByMonth(currentMonth); if (CollectionUtils.isEmpty(list)) { return null; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java index 3405311..c2312e4 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java @@ -56,12 +56,13 @@ public class TrainRecordServiceImpl extends ServiceImpl list = getTrainByMonth(month); + List list = getTrainByMonth(currentMonth); if (CollectionUtils.isEmpty(list)) { return null; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/AsposeUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/AsposeUtil.java new file mode 100644 index 0000000..43295f3 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/AsposeUtil.java @@ -0,0 +1,53 @@ +package com.hnac.hzims.safeproduct.utils; + +import cn.hutool.system.SystemUtil; +import com.aspose.words.Document; +import com.aspose.words.FontSettings; +import com.aspose.words.License; +import com.aspose.words.SaveFormat; +import lombok.SneakyThrows; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; + +/** + * + */ +public class AsposeUtil { + + /** + * 加载license 用于破解 不生成水印 + * + * @author LCheng + * @date 2020/12/25 13:51 + */ + @SneakyThrows + private static void getLicense() { + try (InputStream is = AsposeUtil.class.getClassLoader().getResourceAsStream("License.xml")) { + License license = new License(); + license.setLicense(is); + } + } + + /** + * word转pdf + * + * @param wordPath word文件保存的路径 + * @param pdfPath 转换后pdf文件保存的路径 + * @author LCheng + * @date 2020/12/25 13:51 + */ + @SneakyThrows + public static void wordToPdf(String wordPath, String pdfPath) { + getLicense(); + File file = new File(pdfPath); + try (FileOutputStream os = new FileOutputStream(file)) { + if(SystemUtil.getOsInfo().isLinux()) { + FontSettings.setFontsFolder("/usr/share/fonts/chinese", true); + } + Document doc = new Document(wordPath); + doc.save(os, SaveFormat.PDF); + } + } +} 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 e36ac90..2f26680 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 @@ -2,16 +2,21 @@ package com.hnac.hzims.safeproduct.utils; import cn.afterturn.easypoi.word.WordExportUtil; import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.ticket.annotation.DateTimeToMap; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.IOUtils; import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.io.*; import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.net.URLEncoder; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; /** * 公用工具类 @@ -50,26 +55,6 @@ public class BaseUtil { } /** - * 对象转map - * @param entity 对象 - * @return map - */ - public static Map convertObjectToMap(Object entity) { - Map map = new HashMap<>(); - Field[] fields = entity.getClass().getFields(); - try { - for (Field field : fields) { - field.setAccessible(true); - Object value = field.get(entity); - map.put(field.getName(), value); - } - } catch (IllegalAccessException e) { - log.info("对象转map异常: {}", e.getMessage()); - } - return map; - } - - /** * 文件导出 * @param documents doc文件 * @param savePath 存储路径 @@ -81,7 +66,6 @@ public class BaseUtil { for (XWPFDocument document : documents) { document.write(out); } - out.close(); } catch (IOException e) { log.error("文件导出异常: {}", e.getMessage()); } finally { @@ -109,4 +93,125 @@ public class BaseUtil { } return xwpfDocument; } + + /** + * 读取本地pdf,这里设置的是预览 + * @param response 响应类 + * @param filePath 文件路径 + */ + public static void readPdf(HttpServletResponse response, String filePath) { + response.reset(); + response.setContentType("application/pdf"); + FileInputStream fileInputStream = null; + OutputStream outputStream = null; + try { + File file = new File(filePath); + fileInputStream = new FileInputStream(file); + outputStream = response.getOutputStream(); + IOUtils.write(IOUtils.toByteArray(fileInputStream), outputStream); + response.setHeader("Content-Disposition", + "inline; filename= " + URLEncoder.encode(file.getName(), "UTF-8")); + outputStream.flush(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fileInputStream != null) { + fileInputStream.close(); + } + if (outputStream != null) { + outputStream.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static Map obj2Map(Object obj) { + if(ObjectUtil.isNotEmpty(obj) && null != obj.getClass()) { + Map result = new HashMap<>(); + List fieldList = new ArrayList<>(); + Class clazz = obj.getClass(); + while(clazz != null) { + fieldList.addAll(Arrays.asList(clazz.getDeclaredFields())); + clazz = clazz.getSuperclass(); + } + fieldList.forEach(field -> { + field.setAccessible(true); + Object value; + try { + value = field.get(obj); + } catch (IllegalAccessException e) { + throw new ServiceException("获取属性性出错"); + } + if(value instanceof List) { + List> list = ((List) value).stream().map(BaseUtil::obj2Map).collect(Collectors.toList()); + result.put(field.getName(),list); + } + else if(value instanceof LocalDateTime) { + DateTimeToMap dateTimeToMap = field.getAnnotation(DateTimeToMap.class); + LocalDateTime time = (LocalDateTime) value; + if(ObjectUtil.isEmpty(dateTimeToMap)) { + result.put(field.getName(),time.format(DateUtil.TIME_FORMATTER)); + } + else { + result.putAll(LocalDateConvertMap(time,dateTimeToMap.prefix(),dateTimeToMap.split())); + } + } + else if(value instanceof Date) { + DateTimeToMap dateTimeToMap = field.getAnnotation(DateTimeToMap.class); + Date time = (Date) value; + if(ObjectUtil.isEmpty(dateTimeToMap)) { + result.put(field.getName(),DateUtil.format(time,DateUtil.PATTERN_DATETIME)); + } + else { + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"year", time.getYear()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"month", time.getMonth()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"day", time.getDay()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"hour", time.getHours()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"minuter", time.getMinutes()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"second", time.getSeconds()); + } + } + else { + result.put(field.getName(),value); + } + }); + return result; + } + return null; + } + + /** + * 将时间按格式转化为map对象 + * @param dateTime 待转换时间 + * @param prefix 转换格式Key前缀 + * @param split 转换格式Key分隔符 + * @return map对象 + */ + public static Map LocalDateConvertMap(LocalDateTime dateTime,String prefix,String split) { + HashMap result = new HashMap() {{ + put(prefix + split + "year", dateTime.getYear()); + put(prefix + split + "month", dateTime.getMonthValue()); + put(prefix + split + "day", dateTime.getDayOfMonth()); + put(prefix + split + "hour", dateTime.getHour()); + put(prefix + split + "minuter", dateTime.getMinute()); + put(prefix + split + "second", dateTime.getSecond()); + }}; + return result; + } + + public static void exportDocument(String templateFile, Map params, String wordPath, String pdfPath, HttpServletResponse response) { + try { + List res = new ArrayList<>(); + XWPFDocument document = BaseUtil.fillDocument(templateFile, params); + res.add(document); + BaseUtil.exportWord(res, wordPath); + } catch (Exception e) { + throw new RuntimeException(e); + } + AsposeUtil.wordToPdf(wordPath, pdfPath); + BaseUtil.readPdf(response,pdfPath); + } } diff --git a/hzims-service/safeproduct/src/main/resources/License.xml b/hzims-service/safeproduct/src/main/resources/License.xml new file mode 100644 index 0000000..2cbce45 --- /dev/null +++ b/hzims-service/safeproduct/src/main/resources/License.xml @@ -0,0 +1,15 @@ + + + + Aspose.Total for Java + Aspose.Words for Java + + Enterprise + 20991231 + 20991231 + 8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7 + + + sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU= + + diff --git a/hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx b/hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx new file mode 100644 index 0000000000000000000000000000000000000000..95d10d34693ab7789e1b94ed1af0e40b4f3765e9 GIT binary patch literal 11538 zcma)i1yo(hvNrDS?gaPX?hxF9ySux)yK6XjaCdhPgb+MPaCesw@;!pWad`HrQbZIo{FZWqM393>N}Xi+ zyGCPNFk9W?&qN*9jVv^={6}$Hh1LNqSTspmL6T8@KxC@HakC`LJDFw}5Z{^9tHmVM zf>f*56ZrVzDim;{Q1w6wiH}Iivu7NGXsZCmY}b~1?1jv9jyf4IpKHTdY3nh691#0SHbxTX z;rypjM!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rypquEXWnVqD5v&pDRoWPLHMi#0y`fVi4BNl%| zMSFGlat1UbzIYx7+}yHK@KCnK>UoK~zGBvi@UkajpQ_i>!f?m37Pm=)y?*~XN&iFepZkSB z{rknDj}dP0B(NiJ+S~qXG?Q4i&S36bJg?slrEi)ct`zRrk{sA#gM6zLeTZD|>W%PM zmm3!MtLXGWEI4IRXqdprBP|p20fou137avxXOj{E=2xx)CFNux*zvD(m4?T`wqKW{bq2MOi7UK zW4KPTA-p;`uPkw%5n#h@6nH{@P7Ks^9A8ylpl%DMl*fULjJevGZ}dBH&)sQdzRA@> zKc}MI4vQ;W`BIv0Z&V{bRG$>@me=$VCrj62|=unC3(*9L2JFQ8EgR2dvUcLGa;+;QotZ+ zK!5LVe-FxQT!4Uqh+aR_DgJAS{utoDAH%+7nm^hbqY|9_ublF`(%&=B8|DwCRR6*J zdQbi@WpCWhKiZqJxAqUF=f5ZUJJ<6~_z!)rbNn0jC-d`nYky}a{*A7CeVYHH^e?XB z@9^L0b$`Q|K>rE<583Yjn)Dlq?2q;~>8RJj-Jg`Qw+a9Epu8omKiV5a?%lsK)9=Rq zp2XgOe|XC6-@yNo(taQ5_k)waN0P<)(}aJH@jLwY<=WqHOp-t0|608Lj{m)``8S^a zm1Xxos+_;We`n?W4X^sk=YMnb{s8~~cz^db@BPyKSDoVD&*|@#iodlYzrL~m0RCOK Xke34g_0}Q1l9;DnpC?+XH_-nB$e54L literal 0 HcmV?d00001 From 4b191b643aadf3e39cde72095090903f0f99421e Mon Sep 17 00:00:00 2001 From: liwen Date: Fri, 12 Jan 2024 09:23:43 +0800 Subject: [PATCH 3/5] =?UTF-8?q?update:=20=E5=8D=AB=E7=94=9F=E8=87=AA?= =?UTF-8?q?=E6=9F=A5=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java | 3 +++ .../java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java | 3 +++ .../com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java | 3 --- .../java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java | 6 ++++++ .../com/hnac/hzims/safeproduct/controller/HygieneController.java | 2 ++ .../java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml | 4 ++-- .../com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml | 2 +- .../hzims/safeproduct/service/impl/HygienePlanServiceImpl.java | 8 ++++++++ 8 files changed, 25 insertions(+), 6 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java index d4c074f..0345876 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java @@ -24,6 +24,9 @@ public class HygienePlanDTO extends BaseEntity { @ApiModelProperty("卫生自查计划id") private Long id; + @ApiModelProperty("单位") + private String unit; + @ApiModelProperty("计划名称") private String name; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java index f4af9aa..39a641f 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java @@ -24,6 +24,9 @@ public class HygienePlanEntity extends BaseEntity { @ApiModelProperty("计划名称") private String name; + @ApiModelProperty("单位") + private String unit; + @ApiModelProperty("标准总分值") private Integer standardScore; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java index 275d3dd..e58f745 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java @@ -59,7 +59,4 @@ public class HygieneRecordEntity extends BaseEntity { @Size(max = 1000, message = "检查图片字段长度不能超过1000") @ApiModelProperty("检查图片") private String imgPath; - - @ApiModelProperty("自查记录状态") - private String hygieneRecordStatus; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java index a41e72e..f342328 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java @@ -21,6 +21,12 @@ import java.util.List; @ApiModel(value = "卫生自查计划详情VO类") public class HygienePlanDetailVO extends BaseEntity { + @ApiModelProperty("计划名称") + private String name; + + @ApiModelProperty("单位") + private String unit; + @ApiModelProperty("标准总分值") private Integer standardScore; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java index e0e36e9..63bdafe 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java @@ -72,6 +72,8 @@ public class HygieneController extends BladeController { @GetMapping("/planPage") @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "name", value = "名称", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml index ce87bbb..39919c0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml @@ -20,9 +20,9 @@ SELECT - t1.unit, t1.scheduled_start_time, t1.scheduled_end_time, t1.theme, t1.location, t1.conference_method, - t1.host, t2.actual_start_time, t2.actual_end_time, t1.conference_status + unit, scheduled_start_time, scheduled_end_time, theme, location, conference_method, host, conference_status FROM - hzims_conference_plan t1 - LEFT JOIN hzims_conference_record t2 ON t1.id = t2.conference_plan_id + hzims_conference_plan WHERE - t1.is_deleted = 0 + is_deleted = 0 - AND t1.unit like concat('%', #{unit}, '%') + AND unit like concat('%', #{unit}, '%') - AND t1.scheduled_start_time >= #{startTime} + AND scheduled_start_time >= #{startTime} - AND t1.scheduled_end_time < #{endTime} + AND scheduled_end_time < #{endTime} ORDER BY - t1.create_time DESC + create_time DESC \ No newline at end of file From c0e42ea515302a03214e82f96926bd6b452f2bc6 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 12 Jan 2024 09:39:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?#=E5=B7=A5=E4=BD=9C=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8D=95=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java | 3 +++ .../com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java | 6 +++--- .../src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java | 3 --- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java index 280ee87..1afffae 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/entity/WorkTaskEntity.java @@ -36,6 +36,9 @@ public class WorkTaskEntity extends TenantEntity { @ApiModelProperty(value = "班组ID") private Long groupId; + @ApiModelProperty(value = "班组名称") + private String groupName; + @ApiModelProperty(value = "班组成员ID : 按 “,”分割") private String member; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index 22c5ad2..6872338 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java @@ -186,11 +186,11 @@ public class AlarmServiceImpl extends BaseServiceImpl // 站点查询 List stations = this.stations(); if(CollectionUtil.isEmpty(stations)){ - return null; + return new TextMessage(new ArrayList().toString()); } List effectives = stations.stream().filter(station->depts.contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList()); if(CollectionUtil.isEmpty(effectives)){ - return null; + return new TextMessage(new ArrayList().toString()); } // 条件过滤 QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -205,7 +205,7 @@ public class AlarmServiceImpl extends BaseServiceImpl } List alarms = this.list(queryWrapper); if(CollectionUtil.isEmpty(alarms)){ - return null; + return new TextMessage(new ArrayList().toString()); } return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList()))); } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java index a44e902..373ef43 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java @@ -62,9 +62,6 @@ public class AlarmHandler extends TextWebSocketHandler { return; } TextMessage sendMessage = alarmService.majorAlarm(depts); - if(ObjectUtil.isEmpty(sendMessage)){ - return; - } session.sendMessage(sendMessage); } }