diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java index 3064252ce7..6837104b36 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java @@ -25,22 +25,16 @@ public class ExceptionUtils { * @return 返回异常信息 */ public static String getErrorStackTrace(Exception ex){ - return getErrorStackTraceOfThrowable(ex); + return getThrowableErrorStackTrace(ex); } - /** - * @Description Throwable级别的错误信息 - * @return - * @author wxz - * @date 2021.07.07 14:37 - */ - public static String getErrorStackTraceOfThrowable(Throwable t) { + public static String getThrowableErrorStackTrace(Throwable ex) { StringWriter sw = null; PrintWriter pw = null; try { sw = new StringWriter(); pw = new PrintWriter(sw, true); - t.printStackTrace(pw); + ex.printStackTrace(pw); }finally { try { if(pw != null) { diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index 52de467168..313d7008b6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -167,8 +167,18 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl= formDTO.getTopRow() ? - returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()) : returnDto.getSubRankList()); + //按照组织次数降序排列 + if(CollectionUtils.isNotEmpty(returnDto.getSubRankList())){ + Collections.sort(returnDto.getSubRankList(), new Comparator() { + @Override + public int compare(WorkRecordSubRank o1, WorkRecordSubRank o2) { + return o2.getParticipateTotal().compareTo(o1.getParticipateTotal()); + } + }); + if(returnDto.getSubRankList().size() >= formDTO.getTopRow()){ + returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()); + } + } return returnDto; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 183e74bb02..6f83783845 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -321,6 +321,7 @@ and sca.PID=#{agencyId} + order by CONVERT ( sca.AGENCY_NAME USING gbk ) ASC diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index a700e40792..ac5f466642 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -137,5 +137,6 @@ and m.PARENT_AGENCY_ID=#{agencyId} + order by CONVERT ( m.grid_name USING gbk ) ASC \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index ee5daf2a47..360cb3c71a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -8,6 +8,7 @@ import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack; +import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -20,7 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody; * @author: jianjun liu */ //url="http://localhost:8108" -@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class) +//@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class, url = "http://localhost:6666") +@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallbackFactory = DataStatisticalOpenFeignClientFallBackFactory.class) public interface DataStatisticalOpenFeignClient { /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index 4846a3e557..e15214e9d7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -19,7 +19,7 @@ import org.springframework.stereotype.Component; * @author: jianjun liu * email:liujianjun@git.elinkit.com.cn */ -@Component +//@Component public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOpenFeignClient { /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java new file mode 100644 index 0000000000..70768329c8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java @@ -0,0 +1,20 @@ +package com.epmet.feign.impl; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class DataStatisticalOpenFeignClientFallBackFactory implements FallbackFactory { + + private DataStatisticalOpenFeignClientFallBack fallback = new DataStatisticalOpenFeignClientFallBack(); + + @Override + public DataStatisticalOpenFeignClient create(Throwable cause) { + log.error(ExceptionUtils.getThrowableErrorStackTrace(cause));//自己写的工具类 + return fallback; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java index 7a6291717a..e082a9af8c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java @@ -35,6 +35,7 @@ import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.Arrays; import java.util.List; @@ -108,7 +109,7 @@ public class ScreenCustomerWorkRecordDictServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if (data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())) { int affectedRows = baseDao.deleteBatch(data.getCustomerId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index 8f4d4f7c84..504a948c50 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.entity.plugins.ScreenWorkRecordOrgDailyEntity; import com.epmet.service.plugins.ScreenWorkRecordOrgDailyService; import com.google.common.collect.Lists; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; /** * 工作日志-组织按日统计(累计值) @@ -42,7 +43,7 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if (data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())) { int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java index 7ecd3c4eb6..a153cbac9e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java @@ -29,6 +29,7 @@ import com.epmet.service.plugins.ScreenWorkRecordOrgMonthlyService; import com.google.common.collect.Lists; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; /** * 工作日志-组织按月统计 @@ -51,7 +52,7 @@ public class ScreenWorkRecordOrgMonthlyServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if(data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())){ int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java index ccb3d23d6a..8745239867 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java @@ -8,8 +8,10 @@ package com.epmet.controller; +import com.epmet.feign.DataStatisticalOpenFeignClient; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -24,10 +26,15 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("demo") @Api(tags="定时任务") public class DemoController { + + @Autowired + private DataStatisticalOpenFeignClient client; + @GetMapping("testAlarm") public void testAlarm() { //for (int i = 0; i < 20; i++) { log.error("测试消息"); //} + client.agencyGridIssueStats(null); } }