Browse Source

Merge remote-tracking branch 'origin/dev_screen_data_2.0' into dev_screen_data_2.0

master
zxc 5 years ago
parent
commit
4d1ca838c5
  1. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ExtractScreenFormDTO.java
  2. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java
  3. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  5. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ExtractScreenFormDTO.java

@ -17,5 +17,9 @@ public class ExtractScreenFormDTO implements Serializable {
private String customerId; private String customerId;
private String monthId; private String monthId;
private String dateId; private String dateId;
private String startMonth;
private String endMonth;
private String startDate;
private String endDate;
} }

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java

@ -2,6 +2,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -33,14 +34,14 @@ public class ScreenExtractDailyController {
} }
/** /**
* @param extractOriginFormDTO * @param formDTO
* @Description 抽取数据到大屏 * @Description 抽取数据到大屏
* @author zxc * @author zxc
* @date 2020/9/24 10:15 上午 * @date 2020/9/24 10:15 上午
*/ */
@PostMapping("extractmonthlyyall") @PostMapping("extractmonthlyyall")
public Result screenExtractMonthly(@RequestBody ExtractOriginFormDTO extractOriginFormDTO) { public Result screenExtractMonthly(@RequestBody ExtractScreenFormDTO formDTO) {
screenExtractService.extractDailyAll(extractOriginFormDTO); screenExtractService.extractMonthlyAll(formDTO);
return new Result(); return new Result();
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenExtractService.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.toscreen; package com.epmet.service.evaluationindex.extract.toscreen;
import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
/** /**
* @Author zxc * @Author zxc
@ -17,11 +18,11 @@ public interface ScreenExtractService {
void extractDailyAll(ExtractOriginFormDTO extractOriginFormDTO); void extractDailyAll(ExtractOriginFormDTO extractOriginFormDTO);
/** /**
* @param extractOriginFormDTO * @param formDTO
* @Description 抽取数据到大屏 * @Description 抽取数据到大屏
* @author zxc * @author zxc
* @date 2020/9/24 10:15 上午 * @date 2020/9/24 10:15 上午
*/ */
void extractMonthlyAll(ExtractOriginFormDTO extractOriginFormDTO); void extractMonthlyAll(ExtractScreenFormDTO formDTO);
} }

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java

@ -119,8 +119,12 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
entity.setJoinTotal(issue.getIssueIncr()); entity.setJoinTotal(issue.getIssueIncr());
GridUserCountResultDTO user = userCountMap.get(gridId); GridUserCountResultDTO user = userCountMap.get(gridId);
//百人人均议题:统计周期内总的议题数/(注册用户数/100) //百人人均议题:统计周期内总的议题数/(注册用户数/100)
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); log.debug("issue:{}", JSON.toJSONString(issue));
entity.setAvgIssue(avgIssueCount); log.debug("user:{}", JSON.toJSONString(user));
if (!user.getRegTotal().equals(0)) {
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()).divide(new BigDecimal(NumConstant.ONE_HUNDRED)));
entity.setAvgIssue(avgIssueCount);
}
}); });
@ -227,7 +231,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
} }
private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map<String, ScreenUserJoinEntity> result) { private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map<String, ScreenUserJoinEntity> result) {
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMMDD)); DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMM));
ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(dimIdBean, ScreenUserJoinEntity.class); ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(dimIdBean, ScreenUserJoinEntity.class);
if (org instanceof DimGridEntity) { if (org instanceof DimGridEntity) {
DimGridEntity grid = (DimGridEntity) org; DimGridEntity grid = (DimGridEntity) org;

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java

@ -71,7 +71,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
} }
@Override @Override
public void extractMonthlyAll(ExtractOriginFormDTO formDTO) { public void extractMonthlyAll(ExtractScreenFormDTO formDTO) {
List<String> customerIds = new ArrayList<>(); List<String> customerIds = new ArrayList<>();
if (StringUtils.isNotBlank(formDTO.getCustomerId())) { if (StringUtils.isNotBlank(formDTO.getCustomerId())) {
@ -83,13 +83,13 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
} }
if (!CollectionUtils.isEmpty(customerIds)) { if (!CollectionUtils.isEmpty(customerIds)) {
customerIds.forEach(customerId -> { customerIds.forEach(customerId -> {
if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { if (StringUtils.isNotBlank(formDTO.getStartMonth()) && StringUtils.isNotBlank(formDTO.getEndMonth())) {
List<String> daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); List<String> daysBetween = DateUtils.getMonthBetween(formDTO.getStartDate(), formDTO.getEndDate());
daysBetween.forEach(dateId -> { daysBetween.forEach(monthId -> {
extractMonthly(customerId, dateId); extractMonthly(customerId, monthId);
}); });
} else if (StringUtils.isNotBlank(formDTO.getDateId())) { } else if (StringUtils.isNotBlank(formDTO.getMonthId())) {
extractMonthly(customerId, formDTO.getDateId()); extractMonthly(customerId, formDTO.getMonthId());
} else { } else {
String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", "");
extractMonthly(customerId, dateId); extractMonthly(customerId, dateId);

Loading…
Cancel
Save