Browse Source

小组数据抽取 bug修改

master
wangchao 5 years ago
parent
commit
af99db1002
  1. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java
  2. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml
  6. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java

@ -1,5 +1,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
@ -11,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 原始数据清洗
@ -114,7 +118,15 @@ public class FactOriginExtractController {
**/
@PostMapping("groupdatacleaning")
public Result groupDataCleaning(@RequestBody ExtractOriginFormDTO param) {
groupExtractService.extractGroupData(param);
if(StringUtils.isNotBlank(param.getStartDate()) && StringUtils.isNotBlank(param.getEndDate())){
List<String> finalDaysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate());
ExtractOriginFormDTO paramNew = ConvertUtils.sourceToTarget(param, ExtractOriginFormDTO.class);
for (int i = 0; i < finalDaysBetween.size(); i++) {
String dateDimId = finalDaysBetween.get(i);
paramNew.setDateId(dateDimId);
groupExtractService.extractGroupData(paramNew);
}
}else groupExtractService.extractGroupData(param);
return new Result();
}
}

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

@ -85,19 +85,21 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOri
@Override
@Transactional(rollbackFor = Exception.class)
public boolean insertExtractedData(boolean isFirst, String customerId, String dateId,List<FactOriginGroupMainDailyDTO> originGroupData, List<ExtractGroupMemberActionRecordResultDTO> memberList,List<String> missing) {
if (isFirst) {
//isFirst
baseDao.deleteBatchMemberByCustomerId(customerId,null,null);
} else {
if(StringUtils.isNotBlank(dateId)){
baseDao.deleteBatchMemberByCustomerId(customerId,dateId,"date");
if(!CollectionUtils.isEmpty(originGroupData)) {
if (isFirst) {
//isFirst
baseDao.deleteBatchMemberByCustomerId(customerId, null, null);
} else {
if (StringUtils.isNotBlank(dateId)) {
baseDao.deleteBatchMemberByCustomerId(customerId, dateId, "date");
}
}
}
//删除要插入的组主表数据
baseDao.deleteBatchByGroupId(customerId,originGroupData.stream().map(FactOriginGroupMainDailyDTO :: getId).distinct().collect(Collectors.toList()));
//删除要插入的组主表数据
baseDao.deleteBatchByGroupId(customerId, originGroupData.stream().map(FactOriginGroupMainDailyDTO::getId).distinct().collect(Collectors.toList()));
baseDao.insertBatchMain(originGroupData);
baseDao.insertBatchMembers(memberList);
baseDao.insertBatchMain(originGroupData);
baseDao.insertBatchMembers(memberList);
}
if(!CollectionUtils.isEmpty(missing)){
baseDao.deleteBatchByGroupId(customerId,missing);
baseDao.deleteMemberByGroupList(customerId,missing);

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

@ -88,7 +88,7 @@ public class GroupExtractServiceImpl implements GroupExtractService {
log.info("extractGroupData extractGroupData:result:{},param:{}", JSON.toJSONString(originGroupData), JSON.toJSONString(param));
List<ExtractGroupMemberActionRecordResultDTO> memberList = new LinkedList<>();
if (!CollectionUtils.isEmpty(originGroupData)) {
List<GridAttributesResultDTO> gridList = dimGridService.getGridAttributes(param.getCustomerId(),originGroupData.stream().map(FactOriginGroupMainDailyDTO::getGridId).distinct().collect(Collectors.toList()));
List<GridAttributesResultDTO> gridList = dimGridService.getGridAttributes(param.getCustomerId(),null);
if (!CollectionUtils.isEmpty(gridList)) {
Map<String, GridAttributesResultDTO> gridMap =

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java

@ -186,7 +186,7 @@ public class DimGridServiceImpl extends BaseServiceImpl<DimGridDao, DimGridEntit
**/
@Override
public List<GridAttributesResultDTO> getGridAttributes(String customerId,List<String> gridIds) {
if(CollectionUtils.isEmpty(gridIds)) return Collections.EMPTY_LIST;
return baseDao.selectGridAttributes(customerId,gridIds);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml

@ -186,7 +186,7 @@
oper.UPDATED_TIME AS joinDate,
IF(groupp.CREATED_BY = oper.CUSTOMER_USER_ID,'leader','member') AS leaderFlag,
groupp.CREATED_BY AS groupOwnerId,
'join' AS actionCode
IF(groupp.CREATED_BY = oper.CUSTOMER_USER_ID,'join','create') AS actionCode
FROM
RESI_GROUP groupp

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml

@ -104,11 +104,14 @@
dg.DEL_FLAG = '0'
AND da.DEL_FLAG = '0'
AND da.CUSTOMER_ID = #{customerId}
AND
(
<foreach collection="gridIds" item="gridId" separator=" OR ">
dg.id = #{gridId}
</foreach>
)
<if test="null != gridIds and gridIds.size() > 0">
AND
(
<foreach collection="gridIds" item="gridId" separator=" OR ">
dg.id = #{gridId}
</foreach>
)
</if>
</select>
</mapper>
Loading…
Cancel
Save