Browse Source

项目历史数据

dev
zhaoqifeng 3 years ago
parent
commit
b7abc3eb1c
  1. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/CustomerStaffGridDTO.java
  2. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  3. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
  5. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  6. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/HistoryDataService.java
  7. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  8. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  9. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java
  10. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  11. 75
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/HistoryDataServiceImpl.java
  12. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
  13. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
  14. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  15. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml
  16. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  17. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

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

11
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<String>().ok("gridAndOrgDaily耗时" + l+ "s");
}
@PostMapping("projectHistoryData")
public Result projectHistoryData(@RequestBody ExtractOriginFormDTO formDTO) {
historyDataService.projectAddGridId(formDTO.getCustomerId());
return new Result();
}
}

10
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<FactOriginProject
*/
List<OrgStatisticsResultDTO> getMemberProjectCount(@Param("customerId") String customerId, @Param("dateId") String dateId);
/**
* 更新历史数据
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:48
*/
void updateHistoryData(CustomerStaffGridDTO dto);
}

10
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<ScreenProjectDataEntity> {
* @Date 2022/3/7 16:00
*/
List<DataCheckDTO> getCheckResult(ExtractOriginFormDTO formDTO);
/**
* 更新历史数据
* @Param list
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:48
*/
void updateHistoryData(CustomerStaffGridDTO dto);
}

10
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<ProjectEntity> {
* @return
*/
List<ResiEventDTO> getEventList(@Param("customerId") String customerId, @Param("projectId") String projectId);
/**
* 更新历史数据
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:48
*/
void updateHistoryData(CustomerStaffGridDTO dto);
}

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

10
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<FactOrigi
* @return java.util.Map<java.lang.String,java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>>
*/
Map<String, List<OrgStatisticsResultDTO>> getMemberProjectCount(String customerId, String dateId, Integer type);
/**
* 更新项目表历史数据
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:46
*/
void updateHistoryData(CustomerStaffGridDTO dto);
}

16
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<FactO
return list.stream().collect(Collectors.groupingBy(OrgStatisticsResultDTO::getStaffId));
}
/**
* 更新项目表历史数据
*
* @param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:46
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHistoryData(CustomerStaffGridDTO dto) {
baseDao.updateHistoryData(dto);
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java

@ -20,6 +20,7 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
@ -157,4 +158,13 @@ public interface ScreenProjectDataService extends BaseService<ScreenProjectDataE
*/
void extractCategory(String customerId);
/**
* 更新项目表历史数据
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:46
*/
void updateHistoryData(CustomerStaffGridDTO dto);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectImgDataDao;
import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.ScreenProjectImgDataDTO;
import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO;
@ -390,4 +391,18 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
}
}
/**
* 更新项目表历史数据
*
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:46
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHistoryData(CustomerStaffGridDTO dto) {
baseDao.updateHistoryData(dto);
}
}

75
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/HistoryDataServiceImpl.java

@ -0,0 +1,75 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.RoleKeyConstants;
import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.user.result.StaffRoleInfoDTO;
import com.epmet.service.HistoryDataService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService;
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService;
import com.epmet.service.org.CustomerGridService;
import com.epmet.service.project.ProjectService;
import com.epmet.service.user.UserService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/3/15 10:12
*/
@Service
public class HistoryDataServiceImpl implements HistoryDataService {
@Resource
CustomerGridService customerGridService;
@Resource
private UserService userService;
@Resource
private ProjectService projectService;
@Resource
private FactOriginProjectMainDailyService factOriginProjectMainDailyService;
@Resource
private ScreenProjectDataService screenProjectDataService;
/**
* 网格员立项来源改为work_event
*
* @param customerId
* @Param customerId
* @Return
* @Author zhaoqifeng
* @Date 2022/3/15 10:13
*/
@Override
public void projectAddGridId(String customerId) {
List<CustomerStaffGridDTO> staffGridList = customerGridService.getCustomerStaffGridList(customerId);
List<StaffRoleInfoDTO> staffInfoList = userService.getStaffByRoleKey(customerId, RoleKeyConstants.ROLE_KEY_GRID_MEMBER);
if (CollectionUtils.isEmpty(staffGridList) || CollectionUtils.isEmpty(staffInfoList)) {
return;
}
Map<String, StaffRoleInfoDTO> staffMap = staffInfoList.stream().collect(Collectors.toMap(StaffRoleInfoDTO :: getStaffId,
Function.identity()));
List<CustomerStaffGridDTO> 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);
});
}
}

10
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<ProjectEntity> {
* @return
*/
Map<String, ResiEventDTO> getEventList(String customerId, String projectId);
/**
* 更新项目表历史数据
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:46
*/
void updateHistoryData(CustomerStaffGridDTO dto);
}

16
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<ProjectDao, ProjectEntit
return list.stream().collect(Collectors.toMap(ResiEventDTO::getProjectId, Function.identity()));
}
/**
* 更新项目表历史数据
*
* @param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/3/16 9:46
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHistoryData(CustomerStaffGridDTO dto) {
baseDao.updateHistoryData(dto);
}
}

14
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -1211,4 +1211,18 @@
AGENCY_ID,
PROJECT_CREATOR
</select>
<update id="updateHistoryData">
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'
</update>
</mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

@ -458,4 +458,19 @@
AGENCY_ID,
DATE_ID DESC
</select>
<update id="updateHistoryData">
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'
</update>
</mapper>

1
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

12
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml

@ -268,4 +268,16 @@
and rero.CUSTOMER_ID = #{customerId}
</select>
<update id="updateHistoryData">
UPDATE
project
SET
ORIGIN = 'work_event',
ORIGIN_ID = #{gridId}
WHERE
CREATED_BY = #{staffId}
AND CUSTOMER_ID = #{customerId}
AND AGENCY_ID = #{agencyId}
AND ORIGIN = 'agency'
</update>
</mapper>

Loading…
Cancel
Save