Commit 2618c5f1 authored by 赵啸非's avatar 赵啸非

添加排号与评价统计报表

parent 8264ee31
...@@ -9,6 +9,7 @@ import com.mortals.xhx.common.code.PlatformTypeEnum; ...@@ -9,6 +9,7 @@ import com.mortals.xhx.common.code.PlatformTypeEnum;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.ph.model.PhQueueStatEntity;
import com.mortals.xhx.module.ph.service.PhQueueService; import com.mortals.xhx.module.ph.service.PhQueueService;
import com.mortals.xhx.module.ph.service.PhQueueStatService; import com.mortals.xhx.module.ph.service.PhQueueStatService;
import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity; import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity;
...@@ -41,13 +42,12 @@ public class SitePjStatTaskImpl implements ITaskExcuteService { ...@@ -41,13 +42,12 @@ public class SitePjStatTaskImpl implements ITaskExcuteService {
private PhQueueStatService phQueueStatService; private PhQueueStatService phQueueStatService;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("站点评价统计任务"); log.info("站点评价统计任务");
int year = DateUtil.date().year(); int year = DateUtil.date().year();
int month = DateUtil.date().month()+1; int month = DateUtil.date().month() + 1;
int day = DateUtil.date().dayOfMonth(); int day = DateUtil.date().dayOfMonth();
SitePdu sitePdu = new SitePdu(); SitePdu sitePdu = new SitePdu();
...@@ -68,6 +68,19 @@ public class SitePjStatTaskImpl implements ITaskExcuteService { ...@@ -68,6 +68,19 @@ public class SitePjStatTaskImpl implements ITaskExcuteService {
sitestatEntity.setDay(day); sitestatEntity.setDay(day);
//设置年月日 //设置年月日
pjEvaluateStatService.updateSitePjStat(sitestatEntity, null); pjEvaluateStatService.updateSitePjStat(sitestatEntity, null);
//设置排号
PhQueueStatEntity phQueueStatEntity = new PhQueueStatEntity();
sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId());
sitestatEntity.setSiteName(site.getSiteName());
sitestatEntity.setSiteCode(site.getSiteCode());
sitestatEntity.setYear(year);
sitestatEntity.setMonth(month);
sitestatEntity.setDay(day);
phQueueStatService.updateSitePhStat(phQueueStatEntity, null);
}); });
} }
...@@ -84,7 +97,7 @@ public class SitePjStatTaskImpl implements ITaskExcuteService { ...@@ -84,7 +97,7 @@ public class SitePjStatTaskImpl implements ITaskExcuteService {
public static void main(String[] args) { public static void main(String[] args) {
int year = DateUtil.date().year(); int year = DateUtil.date().year();
int month = DateUtil.date().month()+1; int month = DateUtil.date().month() + 1;
int day = DateUtil.date().dayOfMonth(); int day = DateUtil.date().dayOfMonth();
System.out.println(year + "年" + month + "月" + day + "日"); System.out.println(year + "年" + month + "月" + day + "日");
......
package com.mortals.xhx.module.ph.dao; package com.mortals.xhx.module.ph.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.ph.model.PhQueueStatEntity; import com.mortals.xhx.module.ph.model.PhQueueStatEntity;
import com.mortals.xhx.module.ph.model.PhQueueStatQuery;
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 +20,8 @@ import java.util.List; ...@@ -14,4 +20,8 @@ import java.util.List;
public interface PhQueueStatDao extends ICRUDDao<PhQueueStatEntity,Long>{ public interface PhQueueStatDao extends ICRUDDao<PhQueueStatEntity,Long>{
String SQLID_GET_STATLIST = "getStatList";
List<PhQueueStatEntity> getStatList(PhQueueStatQuery query, PageInfo pageInfo);
} }
package com.mortals.xhx.module.ph.dao.ibatis; package com.mortals.xhx.module.ph.dao.ibatis;
import org.springframework.stereotype.Repository; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.xhx.module.ph.dao.PhQueueStatDao; import com.mortals.xhx.module.ph.dao.PhQueueStatDao;
import com.mortals.xhx.module.ph.model.PhQueueStatEntity; import com.mortals.xhx.module.ph.model.PhQueueStatEntity;
import java.util.Date; import com.mortals.xhx.module.ph.model.PhQueueStatQuery;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
/** /**
* 排队叫号汇总统计DaoImpl DAO接口 * 排队叫号汇总统计DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2024-06-24 * @date 2024-06-24
*/ */
@Repository("phQueueStatDao") @Repository("phQueueStatDao")
public class PhQueueStatDaoImpl extends BaseCRUDDaoMybatis<PhQueueStatEntity,Long> implements PhQueueStatDao { public class PhQueueStatDaoImpl extends BaseCRUDDaoMybatis<PhQueueStatEntity, Long> implements PhQueueStatDao {
@Override
public List<PhQueueStatEntity> getStatList(PhQueueStatQuery 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.ph.service; package com.mortals.xhx.module.ph.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.ph.model.PhQueueStatEntity; import com.mortals.xhx.module.ph.model.PhQueueStatEntity;
import com.mortals.xhx.module.ph.dao.PhQueueStatDao; import com.mortals.xhx.module.ph.dao.PhQueueStatDao;
import com.mortals.xhx.module.ph.model.PhQueueStatQuery;
import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity; import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity;
import java.util.List;
/** /**
* PhQueueStatService * PhQueueStatService
* *
...@@ -19,4 +23,9 @@ public interface PhQueueStatService extends ICRUDService<PhQueueStatEntity,Long> ...@@ -19,4 +23,9 @@ public interface PhQueueStatService extends ICRUDService<PhQueueStatEntity,Long>
PhQueueStatDao getDao(); PhQueueStatDao getDao();
Rest<Void> updateSitePhStat(PhQueueStatEntity entity, Context context); Rest<Void> updateSitePhStat(PhQueueStatEntity entity, Context context);
List<PhQueueStatEntity> getBillInfos(PhQueueStatQuery query, Integer datePattern, PageInfo pageInfo, Context context);
} }
\ No newline at end of file
package com.mortals.xhx.module.ph.web; package com.mortals.xhx.module.ph.web;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.ph.model.PhQueueQuery;
import com.mortals.xhx.module.ph.model.PhQueueStatQuery;
import com.mortals.xhx.module.pj.model.PjEvaluateQuery;
import com.mortals.xhx.module.pj.model.PjEvaluateStatEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.ph.model.PhQueueStatEntity; import com.mortals.xhx.module.ph.model.PhQueueStatEntity;
import com.mortals.xhx.module.ph.service.PhQueueStatService; import com.mortals.xhx.module.ph.service.PhQueueStatService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Arrays; import java.util.Arrays;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
/** /**
* * 排队叫号汇总统计
* 排队叫号汇总统计 *
* * @author zxfei
* @author zxfei * @date 2024-06-24
* @date 2024-06-24 */
*/
@RestController @RestController
@RequestMapping("ph/queue/stat") @RequestMapping("ph/queue/stat")
public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQueueStatService,PhQueueStatEntity,Long> { @Slf4j
public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQueueStatService, PhQueueStatEntity, Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
public PhQueueStatController(){ @Autowired
super.setModuleDesc( "排队叫号汇总统计"); private ISiteFeign siteFeign;
public PhQueueStatController() {
super.setModuleDesc("排队叫号汇总统计");
} }
@Override @Override
...@@ -46,5 +73,60 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ ...@@ -46,5 +73,60 @@ public class PhQueueStatController extends BaseCRUDJsonBodyMappingController<PhQ
super.init(model, context); super.init(model, context);
} }
@PostMapping(value = "/stat")
@UnAuth
public Rest<String> addAttendanceRecordCustom(@RequestBody PhQueueQuery phQueueQuery) {
Rest<String> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code = 1;
try {
//天数区间分段计算
DateTime attendStart = DateUtil.parseDate(phQueueQuery.getTaketimeStart());
DateTime attendEnd = DateUtil.parseDate(phQueueQuery.getTaketimeEnd());
Long compare = DateUtil.between(attendEnd, attendStart, DateUnit.DAY);
StopWatch stopWatch = new StopWatch("stopwatch");
log.info("计算天数区间:{}", compare);
for (int i = 0; i <= compare.intValue(); i++) {
DateTime curDate = DateUtil.offsetDay(attendStart, i);
log.info("记录日期:{}", curDate.toDateStr());
stopWatch.start("执行本地方法");
SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1);
Rest<RespData<List<SitePdu>>> resp = siteFeign.list(sitePdu);
if (resp.getCode() == 1) {
List<SitePdu> sitePduList = resp.getData().getData();
sitePduList.stream().forEach(site -> {
PhQueueStatEntity sitestatEntity = new PhQueueStatEntity();
sitestatEntity.initAttrValue();
sitestatEntity.setSiteId(site.getId());
sitestatEntity.setSiteName(site.getSiteName());
sitestatEntity.setSiteCode(site.getSiteCode());
sitestatEntity.setYear(curDate.year());
sitestatEntity.setMonth(curDate.month() + 1);
sitestatEntity.setDay(curDate.dayOfMonth());
//设置年月日
this.service.updateSitePhStat(sitestatEntity, context);
});
}
stopWatch.stop();
log.info("日期:{} 完成,耗时:{}ms", curDate.toDateStr(), stopWatch.getLastTaskTimeMillis());
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception e) {
code = -1;
this.doException(this.request, busiDesc, model, e);
model.put("message_info", e.getMessage());
}
this.init(model, context);
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
} }
\ No newline at end of file
...@@ -73,7 +73,7 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController< ...@@ -73,7 +73,7 @@ public class PjEvaluateStatController extends BaseCRUDJsonBodyMappingController<
} }
@PostMapping(value = "/pjstat") @PostMapping(value = "/stat")
@UnAuth @UnAuth
public Rest<String> addAttendanceRecordCustom(@RequestBody PjEvaluateQuery pjEvaluateQuery) { public Rest<String> addAttendanceRecordCustom(@RequestBody PjEvaluateQuery pjEvaluateQuery) {
Rest<String> ret = new Rest(); Rest<String> ret = new Rest();
......
<?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.ph.dao.ibatis.PhQueueStatDaoImpl">
<!-- 获取统计列表 -->
<select id="getStatList" parameterType="paramDto" resultMap="PhQueueStatEntity-Map">
select
<!-- 获取分组字段 -->
<if test="groupList != null and !groupList.isEmpty()">
<foreach collection="groupList" open="" close="" index="index" item="item">
${item},
</foreach>
</if>
id,
year,
month,
day,
<!-- 评价数量-->
sum(IFNULL(a.ph_count,0)) ph_count
from mortals_xhx_ph_queue_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
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
</foreach> </foreach>
</if> </if>
id, id,
site_id,
createTime,
year, year,
month, month,
day, day,
......
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