Browse Source

Merge branch 'wxz_feign_exception_show' into develop

# Conflicts:
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java
master
wxz 4 years ago
parent
commit
19619c886c
  1. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java
  2. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java
  3. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  4. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml
  5. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  6. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  7. 20
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java
  8. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java
  9. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java
  10. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java
  11. 7
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java

12
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) {

14
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<ScreenW
}
returnDto.setParticipateTotal(participateTotal);
returnDto.setParticipateUserTotal(participateUserTotal);
returnDto.setSubRankList(CollectionUtils.isNotEmpty(returnDto.getSubRankList()) && returnDto.getSubRankList().size() >= formDTO.getTopRow() ?
returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()) : returnDto.getSubRankList());
//按照组织次数降序排列
if(CollectionUtils.isNotEmpty(returnDto.getSubRankList())){
Collections.sort(returnDto.getSubRankList(), new Comparator<WorkRecordSubRank>() {
@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;
}

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -321,6 +321,7 @@
and sca.PID=#{agencyId}
</otherwise>
</choose>
order by CONVERT ( sca.AGENCY_NAME USING gbk ) ASC
</select>
<!-- 根据agencyId查询网格 -->

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

@ -137,5 +137,6 @@
and m.PARENT_AGENCY_ID=#{agencyId}
</otherwise>
</choose>
order by CONVERT ( m.grid_name USING gbk ) ASC
</select>
</mapper>

4
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 {
/**

2
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 {
/**

20
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<DataStatisticalOpenFeignClient> {
private DataStatisticalOpenFeignClientFallBack fallback = new DataStatisticalOpenFeignClientFallBack();
@Override
public DataStatisticalOpenFeignClient create(Throwable cause) {
log.error(ExceptionUtils.getThrowableErrorStackTrace(cause));//自己写的工具类
return fallback;
}
}

3
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<Scr
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public void collect(ScreenCollFormDTO<ScreenCustomerWorkRecordDictDTO> 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());

3
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<ScreenW
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public void collectOrgDaily(ScreenCollFormDTO<ScreenWorkRecordCommonFormDTO> 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());

3
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<Scree
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public void collect(ScreenCollFormDTO<ScreenWorkRecordCommonFormDTO> 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());

7
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);
}
}

Loading…
Cancel
Save