Browse Source

Merge branch 'dev_screen_data_2.0' into dev_temp

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
9a4668b5c4
  1. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/backdoor/BackDoorController.java
  2. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/BackDoorService.java
  3. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/impl/BackDoorServiceImpl.java
  4. 199
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java

9
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/backdoor/BackDoorController.java

@ -3,10 +3,7 @@ package com.epmet.datareport.controller.backdoor;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.service.backdoor.BackDoorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @Author zxc
@ -20,8 +17,8 @@ public class BackDoorController {
private BackDoorService backDoorService;
@PostMapping("backdoor")
public Result backDoor(@RequestHeader("Data-Type")String dataType, @RequestHeader("AppId")String appId, @RequestHeader("target")String target){
return new Result().ok(backDoorService.backDoor(dataType,appId,target));
public Result backDoor(@RequestHeader("Data-Type")String dataType, @RequestHeader("AppId")String appId, @RequestHeader("target")String target, @RequestBody Object o){
return new Result().ok(backDoorService.backDoor(dataType,appId,target,o));
}
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/BackDoorService.java

@ -8,6 +8,6 @@ import com.epmet.commons.tools.utils.Result;
*/
public interface BackDoorService {
Object backDoor(String dataType, String appId, String target);
Object backDoor(String dataType, String appId, String target, Object o);
}

14
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/impl/BackDoorServiceImpl.java

@ -9,6 +9,7 @@ import com.epmet.datareport.constant.*;
import com.epmet.datareport.service.backdoor.BackDoorService;
import com.epmet.dto.result.AppIdInfoResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -20,30 +21,31 @@ import java.util.Map;
* @DateTime 2020/10/21 5:17 下午
*/
@Service
@Slf4j
public class BackDoorServiceImpl implements BackDoorService {
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Override
public Object backDoor(String dataType, String appId, String target) {
public Object backDoor(String dataType, String appId, String target, Object o) {
Result<AppIdInfoResultDTO> appIdInfoResultDTOResult = commonServiceOpenFeignClient.appIdInfo(appId);
if (!appIdInfoResultDTOResult.success()){
throw new RenException("获取accessToken失败......");
}
AppIdInfoResultDTO data = appIdInfoResultDTOResult.getData();
String url = FactConstant.URL.concat(target);
Map map = new HashMap(16);
Map<String,String> headerMap = new HashMap<>(16);
headerMap.put("AccessToken",data.getAccessToken());
headerMap.put("AppId",data.getAppId());
headerMap.put("AuthType","jwt");
headerMap.put("Data-Type",dataType);
// headerMap.put("Authorization","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJhcHAiOiJnb3YiLCJjbGllbnQiOiJ3eG1wIiwiZXhwIjoxNjAzODY2MjY2LCJ1c2VySWQiOiI0ZWYwYTA4YTBiNWVmOTM0ZjBiOGE4YzQ2ODJjMzY2NSIsImlhdCI6MTYwMzI2MTQ2Nn0.pW1Wzss-xtj6vUuJbvglUltdDWlUKqTyVQ6rGQ7WpSaE_Iz1uAd5XWI5OGLajyU4-aYCW14Dw3C-XoFepyiZJQ");
map.put("bizType","community");
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(map),headerMap);
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(o),headerMap);
log.info(JSON.toJSONString(stringResult),stringResult.error());
if (!stringResult.success()){
throw new RenException("请求【"+url+"】失败......"+stringResult.error());
}
JSONObject jsonObject = JSON.parseObject(stringResult.getData());
System.out.println(jsonObject);
return jsonObject;
}
}

199
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java

@ -194,10 +194,11 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
}
}
final List<FactOriginProjectMainDailyEntity> mainList = list;
List<FactOriginProjectLogDailyEntity> logList = new ArrayList<>();
//节点发起人 部门流转退回结案
List<ProcessInfoDTO> processList = projectProcessService.getProcessListByCustomer(customerId, dateString);
if (!CollectionUtils.isEmpty(processList)) {
List<FactOriginProjectLogDailyEntity> logList = processList.stream().map(process -> {
logList = processList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
@ -243,67 +244,11 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
return entity;
}).collect(Collectors.toList());
//节点发起人 响应
List<ProcessInfoDTO> responseList = projectProcessService.getResponseProcessList(customerId, dateString);
if (!CollectionUtils.isEmpty(responseList)) {
logList.addAll(responseList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE);
entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId());
entity.setPid(process.getAgencyId());
} else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
} else {
if (!process.getPids().contains(StrConstant.COLON)) {
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
} else {
String[] orgArray = process.getPids().split(StrConstant.COLON);
if (orgArray.length > NumConstant.ONE) {
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(), "");
if (path.endsWith(StrConstant.COLON)) {
path = path.substring(NumConstant.ZERO, path.length() - NumConstant.ONE);
}
entity.setPids(path);
} else {
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}", process.getAgencyId(), process.getPids());
entity.setPid(NumConstant.ZERO_STR);
entity.setPids("");
}
}
}
return entity;
}).collect(Collectors.toList()));
}
//项目评论人
List<ProcessInfoDTO> satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString);
satisfactionRecordList.forEach(log -> mainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> {
//进行满意度评价的居民的所属机关的父机机关信息
log.setPid(main.getPid());
log.setPids(main.getPids());
}));
logList.addAll(satisfactionRecordList.stream().map(process -> {
}
//节点发起人 响应
List<ProcessInfoDTO> responseList = projectProcessService.getResponseProcessList(customerId, dateString);
if (!CollectionUtils.isEmpty(responseList)) {
logList.addAll(responseList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
@ -317,67 +262,123 @@ public class ProjectExtractServiceImpl implements ProjectExtractService {
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE);
entity.setOrgId(process.getGridId());
entity.setOrgType("grid");
entity.setPids(process.getPids());
entity.setPid(process.getPid());
return entity;
}).collect(Collectors.toList()));
//节点接收人
List<ProcessInfoDTO> processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString);
logList.addAll(processStaffList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ZERO);
entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId());
entity.setPid(process.getAgencyId());
}else if (StringUtils.isNotBlank(process.getGridId())) {
} else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(StrConstant.COLON)){
} else {
if (!process.getPids().contains(StrConstant.COLON)) {
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
} else {
String[] orgArray = process.getPids().split(StrConstant.COLON);
if(orgArray.length > NumConstant.ONE){
if (orgArray.length > NumConstant.ONE) {
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),"");
if(path.endsWith(StrConstant.COLON)){
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE);
String path = process.getPids().replaceAll(process.getAgencyId(), "");
if (path.endsWith(StrConstant.COLON)) {
path = path.substring(NumConstant.ZERO, path.length() - NumConstant.ONE);
}
entity.setPids(path);
}else{
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}",process.getAgencyId(),process.getPids());
} else {
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}", process.getAgencyId(), process.getPids());
entity.setPid(NumConstant.ZERO_STR);
entity.setPids("");
}
}
}
return entity;
}).collect(Collectors.toList()));
}
if (!logList.isEmpty()) {
factOriginProjectLogDailyService.deleteByDate(customerId, dateString);
factOriginProjectLogDailyService.insertBatch(logList);
//项目评论人
List<ProcessInfoDTO> satisfactionRecordList = projectProcessService.getSatisfactionRecord(customerId, dateString);
satisfactionRecordList.forEach(log -> mainList.stream().filter(project -> log.getProjectId().equals(project.getId())).forEach(main -> {
//进行满意度评价的居民的所属机关的父机机关信息
log.setPid(main.getPid());
log.setPids(main.getPids());
}));
logList.addAll(satisfactionRecordList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ONE);
entity.setOrgId(process.getGridId());
entity.setOrgType("grid");
entity.setPids(process.getPids());
entity.setPid(process.getPid());
return entity;
}).collect(Collectors.toList()));
//节点接收人
List<ProcessInfoDTO> processStaffList = projectProcessService.getProcessStaffByCustomer(customerId, dateString);
logList.addAll(processStaffList.stream().map(process -> {
//获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(process.getCreatedTime());
FactOriginProjectLogDailyEntity entity = new FactOriginProjectLogDailyEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(process.getAgencyId());
entity.setYearId(dimId.getYearId());
entity.setQuarterId(dimId.getQuarterId());
entity.setMonthId(dimId.getMonthId());
entity.setDateId(dimId.getDateId());
entity.setProjectId(process.getProjectId());
entity.setOperationUserId(process.getStaffId());
entity.setActionCode(process.getOperation());
entity.setIsActive(NumConstant.ZERO);
entity.setPids(process.getPids());
if (StringUtils.isNotBlank(process.getDepartmentId())) {
entity.setOrgType("department");
entity.setOrgId(process.getDepartmentId());
entity.setPid(process.getAgencyId());
}else if (StringUtils.isNotBlank(process.getGridId())) {
entity.setOrgType("grid");
entity.setOrgId(process.getGridId());
entity.setPid(process.getAgencyId());
}else{
if(!process.getPids().contains(StrConstant.COLON)){
entity.setPids("");
entity.setPid(NumConstant.ZERO_STR);
}else{
String[] orgArray = process.getPids().split(StrConstant.COLON);
if(orgArray.length > NumConstant.ONE){
entity.setPid(orgArray[orgArray.length - NumConstant.TWO]);
String path = process.getPids().replaceAll(process.getAgencyId(),"");
if(path.endsWith(StrConstant.COLON)){
path =path.substring(NumConstant.ZERO,path.length() - NumConstant.ONE);
}
entity.setPids(path);
}else{
log.warn("【data-statistical】业务数据抽取模块,ProjectExtractServiceImpl.saveOriginProjectDaily:查询出的项目节点发起人所属的orgIdPath不正确,agencyId->{},orgIdPath->{}",process.getAgencyId(),process.getPids());
entity.setPid(NumConstant.ZERO_STR);
entity.setPids("");
}
}
}
return entity;
}).collect(Collectors.toList()));
if (!logList.isEmpty()) {
factOriginProjectLogDailyService.deleteByDate(customerId, dateString);
factOriginProjectLogDailyService.insertBatch(logList);
}
}
/**

Loading…
Cancel
Save