From 16bd05b9518086e6d53c561ecdfd47c1e5bfe4f6 Mon Sep 17 00:00:00 2001 From: wangchao Date: Thu, 12 Nov 2020 16:27:10 +0800 Subject: [PATCH 1/9] =?UTF-8?q?extstaffinfo=20=20=20=20=20=20=E8=BD=AC?= =?UTF-8?q?=E8=AE=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/IssueShiftedFromTopicFormDTO.java | 2 ++ .../java/com/epmet/service/impl/CustomerStaffServiceImpl.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueShiftedFromTopicFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueShiftedFromTopicFormDTO.java index 16ac17dca2..399062ece8 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueShiftedFromTopicFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueShiftedFromTopicFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -73,6 +74,7 @@ public class IssueShiftedFromTopicFormDTO implements Serializable { /** * 议题创建时间 * */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdTime; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 17f0ae9f5e..7cf683e111 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -594,14 +594,15 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl govOrgResult = govOrgOpenFeignClient.staffInfoExt(result); if(govOrgResult.success() && null != govOrgResult.getData()){ return govOrgResult.getData(); } } + log.warn("com.epmet.service.impl.CustomerStaffServiceImpl.extStaffInfo,根据传入的用户Id未找到对应的工作人员,传参:{}",JSON.toJSONString(staffParam)); return null; } From 2244ae5c4d64d7a4732cbabdf5c87f0b33f324db Mon Sep 17 00:00:00 2001 From: wxz Date: Sat, 14 Nov 2020 13:35:44 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=B1=BB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0MessageMode=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/exception/RenException.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java index 8d6285a26c..73ae4bf6b5 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java @@ -19,6 +19,12 @@ import org.apache.commons.lang3.StringUtils; * @since 1.0.0 */ public class RenException extends RuntimeException { + + public enum MessageMode { + //code_内部信息_外部信息 + CODE_INTERNAL_EXTERNAL + } + private static final long serialVersionUID = 1L; private int code; /** @@ -47,7 +53,7 @@ public class RenException extends RuntimeException { } } - public RenException(int code, String internalMsg, String msg) { + public RenException(int code, String internalMsg, String msg, MessageMode mode) { this(code, internalMsg); this.msg = msg; } From 55df7c1e7714a4d8c7c3f7d1200cf6c77fb24610 Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 16 Nov 2020 13:26:23 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8A=BD=E5=8F=96=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E7=BB=B4=E5=BA=A6-=E7=BD=91=E6=A0=BC=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E6=95=B0=E6=8D=AE=EF=BC=8C=E4=BB=A5=E7=BB=B4?= =?UTF-8?q?=E5=BA=A6-=E7=BD=91=E6=A0=BC=E6=95=B0=E6=8D=AE=E4=B8=BA?= =?UTF-8?q?=E4=B8=BB=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=88=A0=E9=99=A4=E7=9A=84?= =?UTF-8?q?=E7=BB=84=E6=95=B0=E6=8D=AE=E4=BC=9A=E8=A2=AB=E7=A7=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginGroupMainDailyDao.java | 10 ++++++++ .../FactOriginGroupMainDailyService.java | 2 +- .../FactOriginGroupMainDailyServiceImpl.java | 7 +++++- .../todata/impl/GroupExtractServiceImpl.java | 24 ++++++++++++------- .../extract/FactOriginGroupMainDailyDao.xml | 21 ++++++++++++++++ 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index e5e603a40f..5bd0c89103 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -79,6 +79,16 @@ public interface FactOriginGroupMainDailyDao extends BaseDao groups); + /** * @param customerId * @return diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java index f6fc9f2dc6..c9a74e31b8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java @@ -64,7 +64,7 @@ public interface FactOriginGroupMainDailyService extends BaseService originGroupData, List memberList); + boolean insertExtractedData(boolean isFirst, String customerId, String dateId, List originGroupData, List memberList, List missing); /** * @param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java index 093905835b..ab3efce8b4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java @@ -84,7 +84,7 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl originGroupData, List memberList) { + public boolean insertExtractedData(boolean isFirst, String customerId, String dateId,List originGroupData, List memberList,List missing) { if (isFirst) { //isFirst baseDao.deleteBatchMemberByCustomerId(customerId,null,null); @@ -95,8 +95,13 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl memberList = new LinkedList<>(); if (!CollectionUtils.isEmpty(originGroupData)) { List gridList = dimGridService.getGridAttributes(param.getCustomerId(),originGroupData.stream().map(FactOriginGroupMainDailyDTO::getGridId).distinct().collect(Collectors.toList())); - + List missingGroups = new LinkedList<>(); if (!CollectionUtils.isEmpty(gridList)) { Map gridMap = gridList.stream().collect(Collectors.toMap(GridAttributesResultDTO::getGridId, Function.identity(), (key1, key2) -> key2)); - if (!CollectionUtils.isEmpty(originGroupData)) { + + + for(Iterator iter = originGroupData.iterator(); + iter.hasNext();){ + FactOriginGroupMainDailyDTO pointer = iter.next(); + if(null == gridMap.get(pointer.getGridId())){ + missingGroups.add(pointer.getId()); + iter.remove(); + } + } + originGroupData.forEach(group -> { GridAttributesResultDTO attr = gridMap.get(group.getGridId()); if (null != attr) { @@ -141,14 +148,15 @@ public class GroupExtractServiceImpl implements GroupExtractService { } }); - } + factOriginGroupMainDailyService.insertExtractedData( count <= NumConstant.ZERO ? true : false, param.getCustomerId(), param.getDateId(), originGroupData, - memberList + memberList, + missingGroups ); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index 4710c224fa..c2c75be60f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -64,6 +64,17 @@ + + + DELETE FROM + fact_origin_group_member_daily + WHERE + CUSTOMER_ID = #{customerId} + + GROUP_ID = #{groupId} + + + DELETE FROM fact_origin_group_main_daily @@ -74,6 +85,16 @@ + + + DELETE FROM + fact_origin_group_main_daily + + CUSTOMER_ID = #{customerId} + AND + DATE_ID = + + UPDATE fact_origin_group_main_daily From 1f495c3d9f24fa704687b307844d3802cbd8f9a9 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 16 Nov 2020 14:04:06 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=20dimGrid=20=E7=BB=B4=E5=BA=A6=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=97=B6=E7=9A=84=E6=83=85=E5=86=B5=E5=85=BC?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PublicPartExtractServiceImpl.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 3c58609ada..f26101c3dd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -112,14 +112,18 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { return; } Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); - issueTotal.forEach(issue -> { + for (FactIssueGridMonthlyEntity issue : issueTotal) { String gridId = issue.getGridId(); ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + log.warn("gridId:{} is not exist in dimGrid,monthId:{},gridId:{}", formDTO.getCustomerId(), formDTO.getMonthId(), gridId); + continue; + } entity.setJoinTotal(issue.getIssueIncr()); GridUserCountResultDTO user = userCountMap.get(gridId); if (user == null) { log.warn("gridId:{} is not exist in issue,customerId:{},monthId:{},gridId:{}", JSON.toJSONString(issue), formDTO.getCustomerId(), formDTO.getMonthId(), gridId); - return; + continue; } //百人人均议题:统计周期内总的议题数/(注册用户数/100) log.debug("issue:{}", JSON.toJSONString(issue)); @@ -129,7 +133,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { .divide(new BigDecimal(NumConstant.ONE_HUNDRED)), 4, BigDecimal.ROUND_HALF_UP); entity.setAvgIssue(avgIssueCount); } - }); + } //获取该月 表决的人数 @@ -153,6 +157,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { for (Map.Entry> entry : voteMap.entrySet()) { String gridId = entry.getKey(); ScreenUserJoinEntity entity = insertMap.get(gridId); + if (entity == null) { + log.warn("gridId:{} is not exist in dimGrid,monthId:{},gridId:{}", formDTO.getCustomerId(), formDTO.getMonthId(), gridId); + continue; + } List issueList = entry.getValue(); BigDecimal bigDecimal = new BigDecimal(0); BigDecimal votedByIssueCount = new BigDecimal(issueList.get(0).getIssueCount()); From cc54476df01323f65c8903be0c84e8bb8c2afcd7 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 16 Nov 2020 14:11:06 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=BE=97=E5=88=86=E5=86=99=E5=85=A5?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=89=93=E5=8D=B0=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/ScreenExtractServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 1ad6a429fc..2ca72cacc5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -243,7 +243,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { param.setDateId(monthId); screenGrassrootsGovernDataAbsorptionService.userScoreDataHub(param); }catch(Exception e){ - log.error("大屏热心市民/党员得分数据写入失败,参数为:{}",JSON.toJSONString(formDTO)); + log.error("大屏热心市民/党员得分数据写入失败,参数为:{}" + JSON.toJSONString(formDTO), e); } //此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量 ExecutorService pool = Executors.newSingleThreadExecutor(); From ce4d6e4f917e76acec3cfe6f8b6d9d2f5ff4d89c Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 16 Nov 2020 14:30:07 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=BE=97=E5=88=86=E5=86=99=E5=85=A5?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=89=93=E5=8D=B0=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...srootsGovernDataAbsorptionServiceImpl.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index d791fb239e..53aebc29cb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.utils.DateUtils; @@ -21,16 +22,13 @@ import com.epmet.service.project.ProjectService; import com.epmet.service.topic.TopicService; import com.epmet.service.user.UserService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; import java.math.BigDecimal; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @@ -91,10 +89,10 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr dateId = DateUtils.getBeforeNMonth(NumConstant.ONE); }else{ String dateType = DateUtils.identifyTimeDimension(dateId); - if(StringUtils.isEmpty(dateType) || !org.apache.commons.lang3.StringUtils.equalsAny(dateType,"date","month")){ + if (StringUtils.isEmpty(dateType) || !StringUtils.equalsAny(dateType, "date", "month")) { dateId = DateUtils.getBeforeNMonth(NumConstant.ONE); - }else if(org.apache.commons.lang3.StringUtils.equals(dateType,"date")){ - dateId = dateId.substring(NumConstant.ZERO,dateId.length() - NumConstant.TWO); + } else if (StringUtils.equals(dateType, "date")) { + dateId = dateId.substring(NumConstant.ZERO, dateId.length() - NumConstant.TWO); } } final String finalDateId = dateId; @@ -125,7 +123,19 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr //6.存入数据库 //不按照时间删除,每次插入之前将该客户下的所有历史数据清空 - screenPartyUserRankDataService.dataClean(registeredUsers,param.getCustomerId()); + //过滤 统计维度中没有的数据 + Set gridIdSet = new HashSet<>(); + List newInsertList = registeredUsers.stream() + .filter(o -> { + if (StringUtils.isBlank(o.getGridName())) { + gridIdSet.add(o.getGridId()); + return false; + } else { + return true; + } + }).collect(Collectors.toList()); + log.warn("userScoreDataHub grids:{} not in DimGrid", JSON.toJSONString(gridIdSet)); + screenPartyUserRankDataService.dataClean(newInsertList, param.getCustomerId()); } /** From 64954f43dee90d374b4a0e6b115c0215ca8a288a Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 16 Nov 2020 15:02:12 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=97=A5=E6=8A=BD=E5=8F=96=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20=E5=BC=82=E6=AD=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/ScreenExtractDailyController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java index 133dc09f8c..c2e4d0f6d6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java @@ -5,6 +5,7 @@ import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,6 +28,7 @@ public class ScreenExtractDailyController { * @author zxc * @date 2020/9/24 10:15 上午 */ + @Async @PostMapping("extractdailyall") public Result screenExtractDaily(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { screenExtractService.extractDailyAll(extractOriginFormDTO); From 851bc4f3d7e1c6b7bec6f372d8e3e0562b1ae862 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 16 Nov 2020 15:25:37 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=97=A5=E6=8A=BD=E5=8F=96=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20=E4=BD=BF=E7=94=A8=E7=BA=BF=E7=A8=8B=E6=B1=A0?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ScreenExtractDailyController.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java index c2e4d0f6d6..07919aa425 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java @@ -1,24 +1,33 @@ package com.epmet.controller; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.concurrent.*; + /** * @Author zxc * @DateTime 2020/9/24 9:42 上午 */ +@Slf4j @RestController @RequestMapping("screenextract") public class ScreenExtractDailyController { - + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() + .setNameFormat("ScreenExtractDailyController-pool-%d").build(); + ExecutorService threadPool = new ThreadPoolExecutor(1, 1, + 10L, TimeUnit.MINUTES, + new LinkedBlockingQueue<>(500), namedThreadFactory, new ThreadPoolExecutor.CallerRunsPolicy()); @Autowired private ScreenExtractService screenExtractService; @@ -28,10 +37,17 @@ public class ScreenExtractDailyController { * @author zxc * @date 2020/9/24 10:15 上午 */ - @Async @PostMapping("extractdailyall") public Result screenExtractDaily(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { - screenExtractService.extractDailyAll(extractOriginFormDTO); + threadPool.submit(() -> { + log.info("screenExtractDaily start,param:{}", JSON.toJSONString(extractOriginFormDTO)); + try { + screenExtractService.extractDailyAll(extractOriginFormDTO); + log.info("screenExtractDaily end"); + } catch (Exception e) { + log.error("screenExtractDaily exception", e); + } + }); return new Result(); } From b7753e02728406d5b87e891c850e7af54dc65264 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 16 Nov 2020 16:59:27 +0800 Subject: [PATCH 9/9] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=EF=BC=8Cfeginclient?= =?UTF-8?q?=E5=A4=9A=E6=B7=BB=E5=8A=A0url=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/feign/OperCustomizeFeignClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java index 015b0d3684..b59a5c7a20 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; //@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class, url = "localhost:8089") -@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class,url="localhost:8089") +@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class) public interface OperCustomizeFeignClient { /**