Commit 298a324a by 阳浪

投稿统计

parent 69a3ae0d
......@@ -35,6 +35,9 @@ public interface EventTrackApiClients {
@GetMapping("/api/eventTrack/queryDeptByType")
List<EventTrackDeptNumVo> queryDeptByType(@RequestParam(value = "date",required = false) String date, @RequestParam("types")List<Integer> types);
@GetMapping("/api/eventTrack/queryTgNumByDept")
List<EventTrackDeptNumVo> queryTgNumByDept(@RequestParam(value = "typeId", required = false)Long typeId);
@GetMapping("/api/eventTrack/queryListByType")
List<EventTrackVo> queryListByType(@RequestParam("type") Integer type, @RequestParam("accountId") Long accountId);
......
......@@ -28,30 +28,35 @@ public class EventTrackController {
@GetMapping("/api/eventTrack/addEvent")
public void addEvent(@RequestParam("type") String type, @RequestParam("businessId") Long businessId){
eventTrackService.addEvent(type,businessId);
public void addEvent(@RequestParam("type") String type, @RequestParam("businessId") Long businessId) {
eventTrackService.addEvent(type, businessId);
}
@GetMapping("/api/eventTrack/getTodayNum")
public EventTrackDayNumVo getTodayNum(@RequestParam(value = "date",required = false) String date){
public EventTrackDayNumVo getTodayNum(@RequestParam(value = "date", required = false) String date) {
return eventTrackService.getTodayNum(date);
}
@GetMapping("/api/eventTrack/getNumByType")
public DayNumVo getNumByType(@RequestParam(value = "date",required = false) String date, @RequestParam("types") List<Integer> types){
return eventTrackService.getNumByType(date,types);
public DayNumVo getNumByType(@RequestParam(value = "date", required = false) String date, @RequestParam("types") List<Integer> types) {
return eventTrackService.getNumByType(date, types);
}
@GetMapping("/api/eventTrack/queryNumByType")
public List<EventTrackTypeNumVo> queryNumByType(@RequestParam(value = "date",required = false) String date, @RequestParam("types")List<Integer> types
,@RequestParam(value = "subName",required = false) String subName){
return eventTrackService.queryNumByType(date,types,subName);
public List<EventTrackTypeNumVo> queryNumByType(@RequestParam(value = "date", required = false) String date, @RequestParam("types") List<Integer> types
, @RequestParam(value = "subName", required = false) String subName) {
return eventTrackService.queryNumByType(date, types, subName);
}
@GetMapping("/api/eventTrack/queryDeptByType")
public List<EventTrackDeptNumVo> queryDeptByType(@RequestParam(value = "date",required = false) String date, @RequestParam("types")List<Integer> types){
return eventTrackService.queryDeptByType(date,types);
public List<EventTrackDeptNumVo> queryDeptByType(@RequestParam(value = "date", required = false) String date, @RequestParam("types") List<Integer> types) {
return eventTrackService.queryDeptByType(date, types);
}
@GetMapping("/api/eventTrack/queryTgNumByDept")
public List<EventTrackDeptNumVo> queryTgNumByDept(@RequestParam(value = "typeId", required = false)Long typeId){
return eventTrackService.queryTgNumByDept(typeId);
}
@GetMapping("/api/eventTrack/queryListByType")
......
......@@ -25,6 +25,8 @@ public interface EventTrackMapper extends BaseMapper<EventTrack> {
List<EventTrackTypeNumVo> queryNumByType(@Param("deptId") Long deptId,@Param("date") String date,@Param("dateString") String dateString,@Param("types")List<Integer> types,@Param("subNameList")List<String> subNameList);
List<EventTrackTypeNumVo> queryTgNumByDept(@Param("deptName") String deptName,@Param("typeId")Long typeId);
List<EventTrackDeptNumVo> queryDeptByType(@Param("date") String date,@Param("dateString") String dateString, @Param("types")List<Integer> types);
Integer getNum(@Param("type")Integer type, @Param("businessId")Long businessId);
......
......@@ -30,6 +30,8 @@ public interface EventTrackService extends IService<EventTrack> {
List<EventTrackDeptNumVo> queryDeptByType(String date, List<Integer> types);
List<EventTrackDeptNumVo> queryTgNumByDept(Long typeId);
List<EventTrackVo> queryListByType(Integer type, Long accountId);
Integer getExamTotal(String subType,String year);
......
......@@ -11,9 +11,11 @@ import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.site.application.domain.DataClassification;
import com.yizhi.site.application.domain.EventTrack;
import com.yizhi.site.application.domain.Publication;
import com.yizhi.site.application.mapper.EventTrackMapper;
import com.yizhi.site.application.service.DataClassificationService;
import com.yizhi.site.application.service.EventTrackService;
import com.yizhi.site.application.service.PublicationService;
import com.yizhi.site.application.vo.domain.EventTrackVo;
import com.yizhi.site.application.vo.site.DayNumVo;
import com.yizhi.site.application.vo.site.EventTrackDayNumVo;
......@@ -54,6 +56,9 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
private DataClassificationService dataClassificationService;
@Autowired
private PublicationService publicationService;
@Autowired
IdGenerator idGenerator;
@Override
......@@ -65,6 +70,9 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
userId = businessId;
ContextHolder.get().setAccountId(userId);
}
if(Objects.equals(type,"event_my_publication")){
Publication publication = publicationService.publicationView(businessId);
}
EventTrack eventTrack = new EventTrack();
if(businessId!=null){
DataClassification dataClassification = dataClassificationService.selectById(businessId);
......@@ -266,6 +274,38 @@ public class EventTrackServiceImpl extends ServiceImpl<EventTrackMapper, EventTr
}
@Override
public List<EventTrackDeptNumVo> queryTgNumByDept(Long typeId) {
List<EventTrackDeptNumVo> eventTrackDeptNumVoList = this.baseMapper.queryGropByList();
if(CollUtil.isNotEmpty(eventTrackDeptNumVoList)){
eventTrackDeptNumVoList.stream().forEach(eventTrackDeptNumVo -> {
List<EventTrackTypeNumVo> eventTrackTypeNumVoList = this.baseMapper.queryTgNumByDept(eventTrackDeptNumVo.getDeptName(),typeId);
if(CollectionUtil.isNotEmpty(eventTrackTypeNumVoList)){
List<EventTrackTypeNumVo> voList = Lists.newArrayList();
eventTrackTypeNumVoList.stream().forEach(numVo->{
Optional<EventTrackTypeNumVo> optional= voList.stream().filter(v->Objects.equals(v.getType(),numVo.getType())).findFirst();
if(optional!=null&&optional.isPresent()){
EventTrackTypeNumVo vo = optional.get();
if(numVo.getNum()!=null) {
if(vo.getNum()!=null) {
vo.setNum(numVo.getNum()+vo.getNum());
}else{
vo.setNum(numVo.getNum());
}
}
}else{
voList.add(numVo);
}
});
eventTrackDeptNumVo.setEventTrackTypeNumVoList(voList);
}else {
eventTrackDeptNumVo.setEventTrackTypeNumVoList(eventTrackTypeNumVoList);
}
});
}
return eventTrackDeptNumVoList;
}
@Override
public List<EventTrackVo> queryListByType(Integer type, Long accountId) {
EventTrack eventTrack = new EventTrack();
eventTrack.setType(type);
......
......@@ -127,4 +127,13 @@
SELECT COUNT(DISTINCT create_by_id) FROM cloud_portal.event_track
WHERE sub_type =#{subType} and DATE_FORMAT(create_time,'%Y') = #{year}
</select>
<select id="queryTgNumByDept" resultType="com.yizhi.site.application.vo.site.EventTrackTypeNumVo">
select count(1) num ,DATE_FORMAT(create_time, '%m' ) subType from publication where dept_name=#{deptName}
<if test="typeId!=null">
and type_one = #{typeId}
</if>
and create_time >= DATE_SUB(NOW(), INTERVAL 4 MONTH)
group by DATE_FORMAT( create_time, '%m' )
</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