From 82e77e00b1658cac4504b10e06ea7249642c059e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Fri, 14 Apr 2023 10:12:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=B0=B4=E7=94=B5=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=8A=A5=E5=91=8A=E8=AF=A6=E6=83=85=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=20=E5=B7=A5=E4=BD=9C=E7=A5=A8=20=E6=93=8D=E4=BD=9C=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../areamonthly/vo/StandardTicketWithAreaVo.java | 2 +- .../com/hnac/hzims/middle/MiddleApplication.java | 12 +++- .../middle/systemlog/config/SysLogConfig.java | 3 +- .../src/main/resources/application.yml | 2 + .../hnac/hzims/middle/MiddleApplicationTests.java | 2 +- .../hzims/operational/OperationApplication.java | 9 ++- .../web/AreaMonthlyDetailsController.java | 6 +- .../mapper/StandardTicketInfoMapper.java | 13 +++++ .../mapper/xml/StandardTicketInfoMapper.xml | 6 ++ .../impl/StandardTicketInfoServiceImpl.java | 37 +++++++++--- .../workTicket/mapper/WorkTicketInfoMapper.java | 68 +++++++++++++--------- .../workTicket/mapper/xml/WorkTicketInfoMapper.xml | 6 ++ .../service/impl/WorkTicketInfoServiceImpl.java | 38 +++++++++--- 13 files changed, 147 insertions(+), 57 deletions(-) diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java index 3f9e5ca..9b278bf 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketWithAreaVo.java @@ -29,7 +29,7 @@ public class StandardTicketWithAreaVo { * 月份 */ @ApiModelProperty("月份") - private YearMonth YearMonth; + private YearMonth yearMonth; /** diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java index 4b48c6c..f678c01 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java @@ -13,9 +13,15 @@ import org.springframework.context.annotation.ComponentScan; @MapperScan("com.hnac.hzims.*.**.mapper.**") @ComponentScan(basePackages = {"com.hnac.*"}) public class MiddleApplication { + static { + System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.username", "nacos"); + System.setProperty("spring.cloud.nacos.password", "nacos"); + } - public static void main(String[] args) { - BladeApplication.run("hzims-middle", MiddleApplication.class, args); - } + public static void main(String[] args) { + BladeApplication.run("hzims-middle", MiddleApplication.class, args); + } } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java index 5c99a58..b9f6fdc 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.Timer; +import java.util.TimerTask; /** * @Author WL @@ -28,7 +29,7 @@ public class SysLogConfig { SyslogTimerTask myTimeTask = new SyslogTimerTask(statisticsService); //3.通过timer定时定频率调用SyslogTimerTask的业务逻辑 // 即 第一次执行是在当前时间的两秒之后,之后每隔60分钟执行一次 - timer.schedule(myTimeTask,2000L,60000L); + timer.schedule(myTimeTask, 2000L, (60L * 1000L)); } } diff --git a/hzims-service/hzims-middle/src/main/resources/application.yml b/hzims-service/hzims-middle/src/main/resources/application.yml index 6428635..5630ab0 100644 --- a/hzims-service/hzims-middle/src/main/resources/application.yml +++ b/hzims-service/hzims-middle/src/main/resources/application.yml @@ -4,6 +4,8 @@ server: #数据源配置 spring: + main: + allow-bean-definition-overriding: true #排除DruidDataSourceAutoConfigure autoconfigure: exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure diff --git a/hzims-service/hzims-middle/src/test/java/com/hnac/hzims/middle/MiddleApplicationTests.java b/hzims-service/hzims-middle/src/test/java/com/hnac/hzims/middle/MiddleApplicationTests.java index ad2db3e..b63584e 100644 --- a/hzims-service/hzims-middle/src/test/java/com/hnac/hzims/middle/MiddleApplicationTests.java +++ b/hzims-service/hzims-middle/src/test/java/com/hnac/hzims/middle/MiddleApplicationTests.java @@ -3,7 +3,7 @@ package com.hnac.hzims.middle; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -@SpringBootTest +@SpringBootTest(classes = MiddleApplication.class) class MiddleApplicationTests { @Test diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java index 3dc2e04..cad2e11 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java @@ -41,13 +41,12 @@ import javax.annotation.Resource; public class OperationApplication extends SpringBootServletInitializer { static{ - System.setProperty("--spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042"); - System.setProperty("--spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042"); - System.setProperty("--spring.cloud.nacos.username", "nacos"); - System.setProperty("--spring.cloud.nacos.password", "nacos"); + System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042"); + System.setProperty("spring.cloud.nacos.username", "nacos"); + System.setProperty("spring.cloud.nacos.password", "nacos"); } - public static void main(String[] args) { BladeApplication.run(OperationalConstants.APP_NAME, OperationApplication.class, args); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java index 2857f91..574821d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java @@ -73,7 +73,7 @@ public class AreaMonthlyDetailsController { * * @return */ - @ApiOperation("操作票 根据月份,区域 获取操作详情数据") + @ApiOperation("操作票 根据月份,区域 获取操作详情分页列表数据") @GetMapping("/areaMonthlyWithOperation/{page}/{size}") public R areaMonthlyWithOperation( @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, @@ -118,9 +118,9 @@ public class AreaMonthlyDetailsController { } /** - * 根据月份和区域查询工作票列表详情 + * 根据月份和区域查询工作票分页列表数据 */ - @ApiOperation("根据月份和区域查询工作票列表详情") + @ApiOperation("根据月份和区域查询工作票分页列表数据") @GetMapping("/workTicketListByMonthAndArea/{page}/{size}") R> workTicketListByMonthAndArea( @ApiParam(name = "page", value = "当前页", required = true) @PathVariable("page") Long page, diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.java index de7fb17..704ce9f 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/StandardTicketInfoMapper.java @@ -1,6 +1,9 @@ package com.hnac.hzims.ticket.standardTicket.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.vo.OperateTicketStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO; @@ -42,4 +45,14 @@ public interface StandardTicketInfoMapper extends UserDataScopeBaseMapper getOperateTicketReportStatistic(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("deptIdList") List deptIdList); + + + /** + * 分页查询 + * @param searchPage + * @param queryWrapper + * @return + */ + Page selectPages(Page searchPage, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml index dc58a4d..6996bd2 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/mapper/xml/StandardTicketInfoMapper.xml @@ -76,4 +76,10 @@ + + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index fb7f139..92b7aec 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -331,23 +331,26 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); //开票来源 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), StandardTicketInfoEntity::getTaskType, + queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", areaVo.getTaskType()); //编号 - queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), StandardTicketInfoEntity::getCode, areaVo.getCode()); + queryWrapper.like(Func.isNotEmpty(areaVo.getCode()),"sti.code" , areaVo.getCode()); //状态 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), StandardTicketInfoEntity::getStatus, + queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", areaVo.getStatus()); //开始时间 - queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), StandardTicketInfoEntity::getCreateTime, + queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", areaVo.getStartTime()); //结束时间 - queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), StandardTicketInfoEntity::getCreateTime, + queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", areaVo.getEndTime()); - queryWrapper.eq("CREATE_DEPT", areaVo.getAreaId()); + + queryWrapper.eq("sti.CREATE_DEPT", areaVo.getAreaId()); queryWrapper.eq(areaVo.getYearMonth() != null, - "date_format(create_time,'%Y-%m')", areaVo.getYearMonth()); - Page standardTicketInfoEntityPage = baseMapper.selectPage(searchPage, queryWrapper); + "date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth()); + queryWrapper.eq("tie.status",1); + Page standardTicketInfoEntityPage = baseMapper.selectPages(searchPage, queryWrapper); + //数据转换StandardTicketInfoEntity ==> StandardTicketVo List standardTicketInfoVOList = new ArrayList<>(); if (CollectionUtil.isNotEmpty(standardTicketInfoEntityPage.getRecords())) { @@ -364,10 +367,11 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl DictCache.getValue(DictConstants.TICKET_SOURCE_TYPE,t)).orElse(null)); + standardTicketVo.setTaskTypeName(Optional.ofNullable(item.getTaskType()).map(t -> DictCache.getValue(DictConstants.TICKET_SOURCE_TYPE, t)).orElse(null)); return standardTicketVo; }).collect(Collectors.toList()); } + Page page = new Page<>(); page.setSize(standardTicketInfoEntityPage.getSize()); page.setCurrent(standardTicketInfoEntityPage.getCurrent()); @@ -379,6 +383,21 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl ticketInfoEvaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getTicketId, item.getId()); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, + TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + int count = ticketInfoEvaluateService.count(ticketInfoEvaluateEntityLambdaQueryWrapper); + return count > 0; + } + /** * 首页-当月操作票获取 * diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java index aec3ad2..bdee63c 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java @@ -1,5 +1,8 @@ package com.hnac.hzims.ticket.workTicket.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketReportStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO; @@ -22,30 +25,43 @@ import java.util.Map; @Mapper public interface WorkTicketInfoMapper extends UserDataScopeBaseMapper { - int countByMap(Map map); - - int qualifiedCount(Integer type,int year,int month); - - /** - * 获取安全检查项工作票项统计 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param dept 机构 - * @return - */ - SafeCheckStatisticVO getWorkTicketStatistic(@Param("startDate") String startDate, - @Param("endDate") String endDate, - @Param("dept") Long dept); - - /** - * 获取站点统计报表 - 工作票 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param dept 机构ID - * @return - */ - @UserDataAuth - List getWorkTicketReportStatistic(@Param("startDate") String startDate, - @Param("endDate") String endDate, - @Param("deptIdList") List dept); + int countByMap(Map map); + + int qualifiedCount(Integer type, int year, int month); + + /** + * 获取安全检查项工作票项统计 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param dept 机构 + * @return + */ + SafeCheckStatisticVO getWorkTicketStatistic(@Param("startDate") String startDate, + @Param("endDate") String endDate, + @Param("dept") Long dept); + + /** + * 获取站点统计报表 - 工作票 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param dept 机构ID + * @return + */ + @UserDataAuth + List getWorkTicketReportStatistic(@Param("startDate") String startDate, + @Param("endDate") String endDate, + @Param("deptIdList") List dept); + + + /** + * 分页查询 + * + * @param pageEntity + * @param queryWrapper + * @return + */ + Page selectPages(Page pageEntity, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml index 6c1ec1f..2daaf81 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml @@ -79,4 +79,10 @@ + + diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java index 60b5d45..f569ab3 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java @@ -14,6 +14,8 @@ import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.feign.ITaskClient; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; @@ -93,6 +95,7 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); //开票来源 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getTaskType()), WorkTicketInfoEntity::getTaskType, + queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", areaVo.getTaskType()); //编号 - queryWrapper.lambda().like(Func.isNotEmpty(areaVo.getCode()), WorkTicketInfoEntity::getCode, areaVo.getCode()); + queryWrapper.like(Func.isNotEmpty(areaVo.getCode()), "sti.code", areaVo.getCode()); //状态 - queryWrapper.lambda().eq(Func.isNotEmpty(areaVo.getStatus()), WorkTicketInfoEntity::getStatus, + queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", areaVo.getStatus()); //开始时间 - queryWrapper.lambda().lt(Func.isNotEmpty(areaVo.getStartTime()), WorkTicketInfoEntity::getCreateTime, + queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", areaVo.getStartTime()); //结束时间 - queryWrapper.lambda().le(Func.isNotEmpty(areaVo.getEndTime()), WorkTicketInfoEntity::getCreateTime, + queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", areaVo.getEndTime()); - queryWrapper.eq("create_dept", areaVo.getAreaId()); - queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(create_time,'%Y-%m')", + queryWrapper.eq("sti.create_dept", areaVo.getAreaId()); + queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth()); - Page workTicketInfoEntityPage = baseMapper.selectPage(pageEntity, queryWrapper); + //如果为1为合格 + queryWrapper.eq("tie.status",1); + Page workTicketInfoEntityPage = baseMapper.selectPages(pageEntity, queryWrapper); //数据转换 List standardWorkList = new ArrayList<>(); if (CollectionUtil.isNotEmpty(workTicketInfoEntityPage.getRecords())) { @@ -918,4 +923,21 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl bladePage = BladePage.of(page); return bladePage; } + + + /** + * 判断是否存在合格率 如果存在返回true 否则为false + * + * @param item + * @return + */ + private boolean isTicketPercentById(WorkTicketInfoEntity item) { + LambdaQueryWrapper ticketInfoEvaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getTicketId, item.getId()); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, + TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + // 查询合格评价 + int count = ticketInfoEvaluateService.count(ticketInfoEvaluateEntityLambdaQueryWrapper); + return count > 0; + } }