Commit ade7cf56 authored by 赵啸非's avatar 赵啸非

修改统计报表

parent 02407efc
......@@ -25,7 +25,7 @@ public interface PhQueueStatService extends ICRUDService<PhQueueStatEntity,Long>
Rest<Void> updateSitePhStat(PhQueueStatEntity entity, Context context);
List<PhQueueStatEntity> getBillInfos(PhQueueStatQuery query, Integer datePattern, PageInfo pageInfo, Context context);
List<PhQueueStatEntity> getBillInfos(PhQueueStatQuery query, PageInfo pageInfo, Context context);
}
\ No newline at end of file
......@@ -4,7 +4,9 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.common.code.TimeUnitEnum;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.ph.model.PhQueueEntity;
import com.mortals.xhx.module.ph.model.PhQueueQuery;
import com.mortals.xhx.module.ph.model.PhQueueStatQuery;
......@@ -12,6 +14,7 @@ import com.mortals.xhx.module.ph.service.PhQueueService;
import com.mortals.xhx.module.pj.model.PjEvaluateEntity;
import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity;
import com.mortals.xhx.module.pj.model.PjEvaluateStatQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
......@@ -162,7 +165,7 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
Map<String, List<PhQueueEntity>> collect = phQueueEntities.stream().collect(Collectors.groupingBy(x -> x.getSectionName()));
collect.entrySet().stream().forEach(item -> {
String hallName = item.getKey();
if(ObjectUtils.isEmpty(hallName)) return;
if (ObjectUtils.isEmpty(hallName)) return;
List<PhQueueEntity> value = item.getValue();
Double intAvg = value.stream().mapToInt(e -> e.getWaitTime()).average().orElse(0D);
log.info("更新站点评价统计数据,站点名称:{},日期:{},大厅:{},评价数量:{}", entity.getSiteName(), currentDate, entity.getHallName(), phQueueEntities.size());
......@@ -207,7 +210,7 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
Map<String, List<PhQueueEntity>> collect = phQueueEntities.stream().collect(Collectors.groupingBy(x -> x.getSectionName()));
collect.entrySet().stream().forEach(item -> {
String bussiness = item.getKey();
if(ObjectUtils.isEmpty(bussiness)) return;
if (ObjectUtils.isEmpty(bussiness)) return;
List<PhQueueEntity> value = item.getValue();
Double intAvg = value.stream().mapToInt(e -> e.getWaitTime()).average().orElse(0D);
log.info("更新站点评价统计数据,站点名称:{},日期:{},业务:{},评价数量:{}", entity.getSiteName(), currentDate, entity.getBusiness(), phQueueEntities.size());
......@@ -251,7 +254,7 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
Map<String, List<PhQueueEntity>> collect = phQueueEntities.stream().collect(Collectors.groupingBy(x -> x.getSectionName()));
collect.entrySet().stream().forEach(item -> {
String window = item.getKey();
if(ObjectUtils.isEmpty(window))return;
if (ObjectUtils.isEmpty(window)) return;
List<PhQueueEntity> value = item.getValue();
Double intAvg = value.stream().mapToInt(e -> e.getWaitTime()).average().orElse(0D);
log.info("更新站点评价统计数据,站点名称:{},日期:{},业务:{},评价数量:{}", entity.getSiteName(), currentDate, entity.getBusiness(), phQueueEntities.size());
......@@ -292,24 +295,31 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
@Override
public List<PhQueueStatEntity> getBillInfos(PhQueueStatQuery query, Integer datePattern, PageInfo pageInfo, Context context) {
List<PhQueueStatEntity> statList = new ArrayList<>();
if (datePattern == TimeUnitEnum.DAY.getValue()) {
query.setGroupList(Arrays.asList("day"));
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("day", OrderCol.DESCENDING), new OrderCol("createTime")));
statList = this.getDao().getStatList(query, pageInfo);
} else if (datePattern == TimeUnitEnum.MONTH.getValue()) {
query.setGroupList(Arrays.asList("month"));
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("createTime")));
statList = this.getDao().getStatList(query, pageInfo);
} else if (datePattern == TimeUnitEnum.YEAR.getValue()) {
query.setGroupList(Arrays.asList("year"));
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("createTime")));
statList = this.getDao().getStatList(query, pageInfo);
} else {
throw new AppException("不支持当前日期格式查询统计!");
public Result<PhQueueStatEntity> find(PhQueueStatEntity entity, PageInfo pageInfo, Context context) throws AppException {
Result<PhQueueStatEntity> result = new Result<>();
PhQueueStatQuery query = new PhQueueStatQuery();
BeanUtils.copyProperties(entity, query, BeanUtil.getNullPropertyNames(entity));
List<PhQueueStatEntity> billInfos = this.getBillInfos(query, pageInfo, context);
result.setList(billInfos);
result.setPageInfo(pageInfo);
return super.find(entity, pageInfo, context);
}
@Override
public List<PhQueueStatEntity> getBillInfos(PhQueueStatQuery query, PageInfo pageInfo, Context context) {
if (!ObjectUtils.isEmpty(query.getGroupList())) {
//针对groupList分组 进行排序
if (query.getGroupList().contains("year") && query.getGroupList().contains("month") && query.getGroupList().contains("day")) {
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("day", OrderCol.DESCENDING), new OrderCol("createTime")));
} else if (query.getGroupList().contains("year") && query.getGroupList().contains("month")) {
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("createTime")));
} else if (query.getGroupList().contains("year")) {
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("createTime")));
}
}
return statList;
return this.getDao().getStatList(query, pageInfo);
}
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ public interface PjEvaluateStatService extends ICRUDService<PjEvaluateStatEntity
Rest<Void> updateSitePjStat(PjEvaluateStatEntity entity, Context context);
List<PjEvaluateStatEntity> getBillInfos(PjEvaluateStatQuery query, Integer datePattern, PageInfo pageInfo, Context context);
List<PjEvaluateStatEntity> getBillInfos(PjEvaluateStatQuery query, PageInfo pageInfo, Context context);
}
\ No newline at end of file
......@@ -47,8 +47,7 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
Result<PjEvaluateStatEntity> result = new Result<>();
PjEvaluateStatQuery query = new PjEvaluateStatQuery();
BeanUtils.copyProperties(entity, query, BeanUtil.getNullPropertyNames(entity));
List<PjEvaluateStatEntity> billInfos = this.getBillInfos(query, TimeUnitEnum.DAY.getValue(), pageInfo, context);
List<PjEvaluateStatEntity> billInfos = this.getBillInfos(query, pageInfo, context);
result.setList(billInfos);
result.setPageInfo(pageInfo);
return result;
......@@ -59,7 +58,7 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
//todo 统计站点评价 分站点--部门 ||窗口编号||评价选项 ==》评价数量
//查询指定日期当前站点所有评价数量
Calendar calendar = Calendar.getInstance();
calendar.set(entity.getYear(), entity.getMonth()-1, entity.getDay());
calendar.set(entity.getYear(), entity.getMonth() - 1, entity.getDay());
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd");//yyyy-年,MM-月,dd-日,HH-时,mm-分,ss-秒
String currentDate = date.format(calendar.getTime());
......@@ -291,23 +290,17 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
@Override
public List<PjEvaluateStatEntity> getBillInfos(PjEvaluateStatQuery query, Integer datePattern, PageInfo pageInfo, Context context) {
List<PjEvaluateStatEntity> statList = new ArrayList<>();
if (datePattern == TimeUnitEnum.DAY.getValue()) {
query.setGroupList(Arrays.asList("year","month","day"));
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("day", OrderCol.DESCENDING), new OrderCol("createTime")));
statList = this.getDao().getStatList(query, pageInfo);
} else if (datePattern == TimeUnitEnum.MONTH.getValue()) {
query.setGroupList(Arrays.asList("year","month"));
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("createTime")));
statList = this.getDao().getStatList(query, pageInfo);
} else if (datePattern == TimeUnitEnum.YEAR.getValue()) {
query.setGroupList(Arrays.asList("year"));
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("createTime")));
statList = this.getDao().getStatList(query, pageInfo);
} else {
throw new AppException("不支持当前日期格式查询统计!");
public List<PjEvaluateStatEntity> getBillInfos(PjEvaluateStatQuery query, PageInfo pageInfo, Context context) {
if (!ObjectUtils.isEmpty(query.getGroupList())) {
//针对groupList分组 进行排序
if (query.getGroupList().contains("year") && query.getGroupList().contains("month") && query.getGroupList().contains("day")) {
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("day", OrderCol.DESCENDING), new OrderCol("createTime")));
} else if (query.getGroupList().contains("year") && query.getGroupList().contains("month")) {
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("month", OrderCol.DESCENDING), new OrderCol("createTime")));
} else if (query.getGroupList().contains("year")) {
query.setOrderColList(Arrays.asList(new OrderCol("year", OrderCol.DESCENDING), new OrderCol("createTime")));
}
}
return statList;
return this.getDao().getStatList(query, pageInfo);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment