diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java index b792e6ea15..3e318c72d4 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java @@ -20,7 +20,6 @@ package com.epmet.dto.org; import lombok.Data; import java.io.Serializable; -import java.util.Date; /** @@ -46,6 +45,7 @@ public class CustomerStaffGridDTO implements Serializable { * 网格ID */ private String gridId; + private String gridName; /** * 上级组织ID */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 84cb0c6964..b84b8bc30b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -41,6 +41,7 @@ import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.entity.stats.DimCustomerEntity; import com.epmet.entity.stats.DimDateEntity; import com.epmet.entity.stats.DimMonthEntity; +import com.epmet.service.HistoryDataService; import com.epmet.service.StatsDemoService; import com.epmet.service.StatsPartyMemberVanguardService; import com.epmet.service.evaluationindex.extract.dataToIndex.*; @@ -60,6 +61,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; @@ -139,6 +141,8 @@ public class DemoController { private DimCustomerService dimCustomerService; @Autowired private ScreenProjectDataService screenProjectDataService; + @Resource + private HistoryDataService historyDataService; @GetMapping("testAlarm") public void testAlarm() { @@ -1139,4 +1143,11 @@ public class DemoController { long l = (end - start) / 1000; return new Result().ok("gridAndOrgDaily耗时" + l+ "s"); } + + + @PostMapping("projectHistoryData") + public Result projectHistoryData(@RequestBody ExtractOriginFormDTO formDTO) { + historyDataService.projectAddGridId(formDTO.getCustomerId()); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index 7d1c6903ab..66d2d286f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -23,6 +23,7 @@ import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.pingyin.result.*; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; @@ -550,4 +551,13 @@ public interface FactOriginProjectMainDailyDao extends BaseDao getMemberProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId); + /** + * 更新历史数据 + * @Param dto + * @Return + * @Author zhaoqifeng + * @Date 2022/3/16 9:48 + */ + void updateHistoryData(CustomerStaffGridDTO dto); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index bf82610651..db2b42ba5b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.result.DataCheckDTO; import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO; @@ -122,4 +123,13 @@ public interface ScreenProjectDataDao extends BaseDao { * @Date 2022/3/7 16:00 */ List getCheckResult(ExtractOriginFormDTO formDTO); + + /** + * 更新历史数据 + * @Param list + * @Return + * @Author zhaoqifeng + * @Date 2022/3/16 9:48 + */ + void updateHistoryData(CustomerStaffGridDTO dto); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index e154508f30..5930a90611 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ProjectDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.project.*; import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; import com.epmet.entity.project.ProjectEntity; @@ -204,4 +205,13 @@ public interface ProjectDao extends BaseDao { * @return */ List getEventList(@Param("customerId") String customerId, @Param("projectId") String projectId); + + /** + * 更新历史数据 + * @Param dto + * @Return + * @Author zhaoqifeng + * @Date 2022/3/16 9:48 + */ + void updateHistoryData(CustomerStaffGridDTO dto); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/HistoryDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/HistoryDataService.java new file mode 100644 index 0000000000..f2ac7a321d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/HistoryDataService.java @@ -0,0 +1,19 @@ +package com.epmet.service; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/3/15 10:09 + */ +public interface HistoryDataService { + /** + * 网格员立项来源改为work_event + * + * @Param customerId + * @Return + * @Author zhaoqifeng + * @Date 2022/3/15 10:13 + */ + void projectAddGridId(String customerId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 6e1268f727..965b6536db 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -23,6 +23,7 @@ import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.pingyin.result.*; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; @@ -490,4 +491,13 @@ public interface FactOriginProjectMainDailyService extends BaseService> */ Map> getMemberProjectCount(String customerId, String dateId, Integer type); + + /** + * 更新项目表历史数据 + * @Param dto + * @Return + * @Author zhaoqifeng + * @Date 2022/3/16 9:46 + */ + void updateHistoryData(CustomerStaffGridDTO dto); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index a307aaf171..d0ee740780 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -31,6 +31,7 @@ import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.pingyin.result.*; import com.epmet.dto.result.CostDayResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; @@ -44,6 +45,7 @@ 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.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; @@ -734,5 +736,19 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl staffGridList = customerGridService.getCustomerStaffGridList(customerId); + List staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER); + if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) { + return; + } + Map staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId, + Function.identity())); + List list = staffGridList.stream().filter(p -> null != staffMap.get(p.getStaffId())).map(item -> { + StaffRoleInfoDTO staffInfo = staffMap.get(item.getStaffId()); + CustomerStaffGridDTO dto = ConvertUtils.sourceToTarget(item, CustomerStaffGridDTO.class); + dto.setStaffId(staffInfo.getStaffId()); + return dto; + }).collect(Collectors.toList()); + + list.forEach(part -> { + //更新project表 + projectService.updateHistoryData(part); + //更新fact_origin_project_main_daily + factOriginProjectMainDailyService.updateHistoryData(part); + //更新screen_project_data + screenProjectDataService.updateHistoryData(part); + }); + + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index 23367bfa06..bd8584c7c1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -20,6 +20,7 @@ package com.epmet.service.project; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.dto.project.ProjectGridDTO; import com.epmet.dto.project.ResiEventDTO; @@ -204,4 +205,13 @@ public interface ProjectService extends BaseService { * @return */ Map getEventList(String customerId, String projectId); + + /** + * 更新项目表历史数据 + * @Param dto + * @Return + * @Author zhaoqifeng + * @Date 2022/3/16 9:46 + */ + void updateHistoryData(CustomerStaffGridDTO dto); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 9b409ce75f..75cd4ff714 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.project.ProjectDao; import com.epmet.dto.ProjectDTO; +import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.project.*; import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; @@ -31,6 +32,7 @@ import com.epmet.service.project.ProjectService; import com.github.pagehelper.PageHelper; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; @@ -263,5 +265,19 @@ public class ProjectServiceImpl extends BaseServiceImpl + + + UPDATE + fact_origin_project_main_daily + SET + ORIGIN = 'work_event', + ORIGIN_ID = #{gridId}, + GRID_ID = #{gridId} + WHERE + PROJECT_CREATOR = #{staffId} + AND CUSTOMER_ID = #{customerId} + AND AGENCY_ID = #{agencyId} + AND ORIGIN = 'agency' + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 95c907ce97..51f9a0fcb6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -458,4 +458,19 @@ AGENCY_ID, DATE_ID DESC + + + UPDATE + screen_project_data + SET + ORIGIN = 'work_event', + ORG_TYPE = 'grid', + ORG_ID = #{gridId}, + ORG_NAME = #{gridName} + WHERE + PROJECT_CREATOR = #{staffId} + AND CUSTOMER_ID = #{customerId} + AND ORG_ID = #{agencyId} + AND ORIGIN = 'agency' + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index adcaf8e50d..e6cd7f3321 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -120,6 +120,7 @@ ca.PID, cg.PIDS, csg.GRID_ID, + cg.GRID_NAME, csg.USER_ID AS staffId FROM customer_staff_grid csg diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index 7b92a7b440..f309d79bf4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -268,4 +268,16 @@ and rero.CUSTOMER_ID = #{customerId} + + UPDATE + project + SET + ORIGIN = 'work_event', + ORIGIN_ID = #{gridId} + WHERE + CREATED_BY = #{staffId} + AND CUSTOMER_ID = #{customerId} + AND AGENCY_ID = #{agencyId} + AND ORIGIN = 'agency' +