Commit 6ce9241f authored by 赵啸非's avatar 赵啸非

添加排号与评价统计报表

parent 5c9cd9bc
package com.mortals.xhx.module.pj.dao; package com.mortals.xhx.module.pj.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity; import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity;
import com.mortals.xhx.module.pj.model.PjEvaluateStatQuery;
import java.util.List; import java.util.List;
/** /**
* 评价汇总统计Dao * 评价汇总统计Dao
...@@ -14,4 +17,8 @@ import java.util.List; ...@@ -14,4 +17,8 @@ import java.util.List;
public interface PjEvaluateStatDao extends ICRUDDao<PjEvaluateStatEntity,Long>{ public interface PjEvaluateStatDao extends ICRUDDao<PjEvaluateStatEntity,Long>{
String SQLID_GET_STATLIST = "getStatList";
List<PjEvaluateStatEntity> getStatList(PjEvaluateStatQuery query, PageInfo pageInfo);
} }
package com.mortals.xhx.module.pj.dao.ibatis; package com.mortals.xhx.module.pj.dao.ibatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.xhx.module.pj.model.PjEvaluateStatQuery;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.pj.dao.PjEvaluateStatDao; import com.mortals.xhx.module.pj.dao.PjEvaluateStatDao;
import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity; import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity;
...@@ -17,5 +21,14 @@ import java.util.List; ...@@ -17,5 +21,14 @@ import java.util.List;
public class PjEvaluateStatDaoImpl extends BaseCRUDDaoMybatis<PjEvaluateStatEntity,Long> implements PjEvaluateStatDao { public class PjEvaluateStatDaoImpl extends BaseCRUDDaoMybatis<PjEvaluateStatEntity,Long> implements PjEvaluateStatDao {
@Override
public List<PjEvaluateStatEntity> getStatList(PjEvaluateStatQuery query, PageInfo pageInfo) {
ParamDto queryParam = super.getQueryParam(query);
if (pageInfo.getPrePageResult() == -1) {
return getSqlSession().selectList(SQLID_GET_STATLIST, queryParam);
} else {
RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
return getSqlSession().selectList(SQLID_GET_STATLIST, queryParam, rowBounds);
}
}
} }
package com.mortals.xhx.module.pj.service; package com.mortals.xhx.module.pj.service;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity; import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity;
import com.mortals.xhx.module.pj.dao.PjEvaluateStatDao; import com.mortals.xhx.module.pj.dao.PjEvaluateStatDao;
import java.util.List;
/** /**
* PjEvaluateStatService * PjEvaluateStatService
* *
...@@ -23,4 +27,9 @@ public interface PjEvaluateStatService extends ICRUDService<PjEvaluateStatEntity ...@@ -23,4 +27,9 @@ public interface PjEvaluateStatService extends ICRUDService<PjEvaluateStatEntity
* @return * @return
*/ */
Rest<Void> updateSitePjStat(PjEvaluateStatEntity entity, Context context); Rest<Void> updateSitePjStat(PjEvaluateStatEntity entity, Context context);
List<PjEvaluateStatEntity> getBillInfos(Long siteId, String createTimeStart, Integer datePattern, PageInfo pageInfo, Context context);
} }
\ No newline at end of file
package com.mortals.xhx.module.pj.service.impl; package com.mortals.xhx.module.pj.service.impl;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.common.code.TimeUnitEnum;
import com.mortals.xhx.module.pj.model.PjEvaluateEntity; import com.mortals.xhx.module.pj.model.PjEvaluateEntity;
import com.mortals.xhx.module.pj.model.PjEvaluateQuery; import com.mortals.xhx.module.pj.model.PjEvaluateQuery;
import com.mortals.xhx.module.pj.model.PjEvaluateStatQuery; import com.mortals.xhx.module.pj.model.PjEvaluateStatQuery;
...@@ -17,10 +20,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -17,10 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -69,6 +69,7 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat ...@@ -69,6 +69,7 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
return Rest.ok(); return Rest.ok();
} }
private void updateSitePjCount(PjEvaluateStatEntity entity, List<PjEvaluateEntity> pjEvaluateEntities) { private void updateSitePjCount(PjEvaluateStatEntity entity, List<PjEvaluateEntity> pjEvaluateEntities) {
if (ObjectUtils.isEmpty(entity.getSiteId())) return; if (ObjectUtils.isEmpty(entity.getSiteId())) return;
if (0L >= entity.getSiteId()) return; if (0L >= entity.getSiteId()) return;
...@@ -271,4 +272,29 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat ...@@ -271,4 +272,29 @@ public class PjEvaluateStatServiceImpl extends AbstractCRUDServiceImpl<PjEvaluat
} }
}); });
} }
@Override
public List<PjEvaluateStatEntity> getBillInfos(Long siteId, String createTimeStart, Integer datePattern, PageInfo pageInfo, Context context) {
List<PjEvaluateStatEntity> statList = new ArrayList<>();
PjEvaluateStatQuery query = new PjEvaluateStatQuery();
query.setSiteId(siteId);
query.setCreateTimeStart(createTimeStart);
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("不支持当前日期格式查询统计!");
}
return statList;
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.pj.dao.ibatis.PjEvaluateStatDaoImpl">
<!-- 获取统计列表 -->
<select id="getStatList" parameterType="paramDto" resultMap="PjEvaluateStatEntity-Map">
select
<!-- 获取分组字段 -->
<if test="groupList != null and !groupList.isEmpty()">
<foreach collection="groupList" open="" close="" index="index" item="item">
${item},
</foreach>
</if>
id,
siteId,
createTime,
year,
month,
day,
<!-- 评价数量-->
sum(IFNULL(a.pj_count,0)) pj_count
from mortals_xhx_pj_evaluate_stat as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_group_by_"/>
<include refid="_orderCols_"/>
</select>
</mapper>
\ 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