....
This commit is contained in:
parent
345ca548dc
commit
85d1045648
@ -1,8 +1,7 @@
|
||||
package com.nbclass.activity.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.text.Collator;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -14,6 +13,7 @@ import com.nbclass.activity.service.DataDictService;
|
||||
import com.nbclass.exception.ParameterException;
|
||||
import com.nbclass.system.service.UserService;
|
||||
import com.nbclass.util.JWTUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@ -293,7 +293,7 @@ public class ContentController extends BaseController {
|
||||
service.update(entity);
|
||||
if(entity.getApplicationId()!=null){
|
||||
//更新审核申请单状态
|
||||
service.updateApplicationStatus(entity.getApplicationId());
|
||||
service.updateApplicationStatus(entity.getId(),entity.getApplicationId());
|
||||
}
|
||||
desc="修改案例,案例类型:"+type+",案例ID:"+entity.getId()+",案例标题:"+entity.getTitle();
|
||||
}else{
|
||||
@ -325,11 +325,11 @@ public class ContentController extends BaseController {
|
||||
for (Long aLong : IdList) {
|
||||
//案例是否发布
|
||||
Content editContent = service.getEditContent(aLong);
|
||||
if(editContent.getRelease() != 5 && editContent.getRelease() !=3){
|
||||
if(editContent.getStatus() != 5 && editContent.getStatus() !=3 || editContent.getStatus() == 2){
|
||||
throw new ParameterException("案例已上线或审核中,无法删除!");
|
||||
}
|
||||
if(editContent.getRelease() == 3){
|
||||
|
||||
service.deleteApplication(editContent.getApplicationId());
|
||||
}
|
||||
}
|
||||
service.delete(IdList);
|
||||
@ -496,4 +496,32 @@ public class ContentController extends BaseController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 案例统计
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCensus")
|
||||
@ResponseBody
|
||||
public Result getCensus(Integer type){
|
||||
//根据type获取统计信息 1、本周统计 2、本月统计 3、本季度统计 4、年度统计
|
||||
List<Census> list = service.getCensus(type);
|
||||
Long count = 0L;
|
||||
for (Census census : list) {
|
||||
count += census.getCount();
|
||||
}
|
||||
List<Integer> list2 = new ArrayList<>();
|
||||
list.sort(Comparator.comparing(Census::getId));
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i).getId() == 254 || list.get(i).getId() == 262 || list.get(i).getId() == 267){
|
||||
list.remove(i);
|
||||
}
|
||||
list2.add(list.get(i).getCount());
|
||||
}
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("count",count);
|
||||
map.put("list",list2);
|
||||
return Result.success(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.nbclass.activity.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.nbclass.activity.model.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -220,4 +221,10 @@ public interface ContentMapper extends MyMapper<Content> {
|
||||
*/
|
||||
Application getApplication(Long contentId);
|
||||
|
||||
/**
|
||||
* 本周统计案例数量
|
||||
* @return
|
||||
*/
|
||||
List<Census> getCensus(Integer type);
|
||||
|
||||
}
|
||||
|
||||
12
src/main/java/com/nbclass/activity/model/Census.java
Normal file
12
src/main/java/com/nbclass/activity/model/Census.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.nbclass.activity.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Census {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.nbclass.activity.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.nbclass.activity.model.*;
|
||||
@ -154,7 +155,7 @@ public interface ContentService {
|
||||
* 更新审核申请单状态
|
||||
* @param applicationId
|
||||
*/
|
||||
void updateApplicationStatus(Long applicationId);
|
||||
void updateApplicationStatus(Long contentId,Long applicationId);
|
||||
|
||||
/**
|
||||
* 获取审核列表
|
||||
@ -190,4 +191,5 @@ public interface ContentService {
|
||||
*/
|
||||
void deleteRelease(Long contentId);
|
||||
|
||||
List<Census> getCensus(Integer type);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.nbclass.activity.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
@ -407,11 +408,13 @@ public class ContentServiceImpl implements ContentService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateApplicationStatus(Long applicationId) {
|
||||
public void updateApplicationStatus(Long contentId,Long applicationId) {
|
||||
//更新审核申请单状态
|
||||
mapper.updateApplicationStatus(applicationId);
|
||||
//更新审核人状态
|
||||
mapper.updateCheckStatus(applicationId);
|
||||
//更新案例状态(上架后重新申请)
|
||||
mapper.updateContentRelease(contentId,1,2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -466,5 +469,10 @@ public class ContentServiceImpl implements ContentService {
|
||||
mapper.updateContentRelease(contentId,4,2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Census> getCensus(Integer type) {
|
||||
return mapper.getCensus(type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
<result column="release" property="release"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="checkStatus" property="checkStatus"/>
|
||||
<result column="applicationId" property="applicationId"/>
|
||||
|
||||
|
||||
<!-- <association property="application" javaType="com.nbclass.activity.model.Application" column="id" select="getApplicationStatus">-->
|
||||
@ -280,7 +281,11 @@
|
||||
</select>
|
||||
|
||||
<select id="getEditContent" resultMap="BaseResultMap2">
|
||||
select * from content where id = #{contentId}
|
||||
select
|
||||
c.*,
|
||||
a.id as applicationId,
|
||||
IF(a.status=2,c.`release`,IFNULL(a.status,5)) as status
|
||||
from content c left join application a on c.id = a.content_id where c.id = #{contentId}
|
||||
</select>
|
||||
|
||||
<insert id="saveApplication" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
@ -413,8 +418,14 @@
|
||||
|
||||
<update id="updateContentRelease">
|
||||
update content set
|
||||
<if test="release!=null and release == 1">
|
||||
online_time = null,
|
||||
</if>
|
||||
<if test="release!=null and release == 2">
|
||||
online_time = now(),
|
||||
</if>
|
||||
<if test="contentId!=null and release!=null and visibility!=null">
|
||||
`release` = #{release},visibility = #{visibility},online_time = now()
|
||||
`release` = #{release},visibility = #{visibility}
|
||||
</if>
|
||||
where id = #{contentId}
|
||||
</update>
|
||||
@ -431,4 +442,31 @@
|
||||
select * from application where content_id = #{contentId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getCensus" resultType="com.nbclass.activity.model.Census">
|
||||
SELECT
|
||||
DISTINCT item.id,
|
||||
count(c.id) AS count
|
||||
FROM
|
||||
data_dict_item item
|
||||
LEFT JOIN content_tags tags ON item.id = tags.tid
|
||||
LEFT JOIN content c ON c.id = tags.cid
|
||||
WHERE
|
||||
item.dictid = 26
|
||||
GROUP BY
|
||||
item.id,c.id
|
||||
<if test="type!=null and type==1">
|
||||
and YEARWEEK( date_format(c.online_time, '%Y-%m-%d' ), 1 ) = YEARWEEK(now())
|
||||
</if>
|
||||
<if test="type!=null and type==2">
|
||||
AND DATE_FORMAT( c.online_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )
|
||||
</if>
|
||||
<if test="type!=null and type==3">
|
||||
AND QUARTER(c.online_time)=QUARTER(now())
|
||||
</if>
|
||||
<if test="type!=null and type==4">
|
||||
AND YEAR(c.online_time)=YEAR(NOW())
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -5,42 +5,204 @@
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<br/><br/><br/>
|
||||
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
|
||||
<div id="main" style="width: 600px;height:400px;"></div>
|
||||
<div id="main" style="width: 1500px;height:800px;"></div><br/><br/><br/>
|
||||
<div id="main2" style="width: 1500px;height:800px;"></div><br/><br/><br/>
|
||||
<div id="main3" style="width: 1500px;height:800px;"></div><br/><br/><br/>
|
||||
<div id="main4" style="width: 1500px;height:800px;"></div>
|
||||
<script type="text/javascript">
|
||||
function getCensus(){
|
||||
var count = [];
|
||||
//初始化下拉框
|
||||
$.getJSON("/cases/console/content/getCensus?type=1",function (data){
|
||||
console.log(data)
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = echarts.init(document.getElementById('main'));
|
||||
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
|
||||
title: {
|
||||
text: '本周案例上传'
|
||||
text: '本周案例上传数量:'+data.data.count
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data:['数量']
|
||||
data:['周案例上传统计表']
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
|
||||
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
|
||||
axisLabel: { interval: 0, rotate: 30 }
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [120, 200, 150, 80, 70, 110, 130],
|
||||
name:'周案例上传统计表',
|
||||
data: data.data.list,
|
||||
type: 'bar',
|
||||
showBackground: true,
|
||||
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
}
|
||||
},
|
||||
barWidth : 30,//柱图宽度
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
myChart.setOption(option);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getCensus2(){
|
||||
var count = [];
|
||||
//初始化下拉框
|
||||
$.getJSON("/cases/console/content/getCensus?type=2",function (data){
|
||||
console.log(data)
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = echarts.init(document.getElementById('main2'));
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
|
||||
title: {
|
||||
text: '本月案例上传数量:'+data.data.count
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data:['月案例上传统计表']
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
|
||||
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
|
||||
axisLabel: { interval: 0, rotate: 30 }
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name:'月案例上传统计表',
|
||||
data: data.data.list,
|
||||
type: 'bar',
|
||||
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
},
|
||||
barWidth : 30,//柱图宽度
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
myChart.setOption(option);
|
||||
});
|
||||
}
|
||||
|
||||
function getCensus3(){
|
||||
var count = [];
|
||||
//初始化下拉框
|
||||
$.getJSON("/cases/console/content/getCensus?type=3",function (data){
|
||||
console.log(data)
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = echarts.init(document.getElementById('main3'));
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
|
||||
title: {
|
||||
text: '本季度案例上传数量:'+data.data.count
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data:['季度案例上传统计表']
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
|
||||
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
|
||||
axisLabel: { interval: 0, rotate: 30 }
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name:'季度案例上传统计表',
|
||||
data: data.data.list,
|
||||
type: 'bar',
|
||||
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
},
|
||||
barWidth : 30,//柱图宽度
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
myChart.setOption(option);
|
||||
});
|
||||
}
|
||||
|
||||
function getCensus4(){
|
||||
var count = [];
|
||||
//初始化下拉框
|
||||
$.getJSON("/cases/console/content/getCensus?type=3",function (data){
|
||||
console.log(data)
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = echarts.init(document.getElementById('main4'));
|
||||
// 指定图表的配置项和数据
|
||||
var option = {
|
||||
|
||||
title: {
|
||||
text: '年度案例上传数量:'+data.data.count
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
data:['年度案例上传统计表']
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['信广龙广告-BD部', '信广龙广告-文案策划部', '信广龙广告-媒介部', '信广龙广告-活动部', '信广龙广告-客服项目部', '信广龙广告-创意视觉部', '信蜂互动',"信因视觉","上海知微-客服部",
|
||||
"上海知微-视觉设计部","上海知微-视频部","上海知微-活动部","武汉初度-客户部","武汉初度-文案策划部","武汉初度-设计部","武汉初度-视频部","武汉初度-运营部"],
|
||||
axisLabel: { interval: 0, rotate: 30 }
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name:'年度案例上传统计表',
|
||||
data: data.data.list,
|
||||
type: 'bar',
|
||||
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
},
|
||||
barWidth : 30,//柱图宽度
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 使用刚指定的配置项和数据显示图表。
|
||||
myChart.setOption(option);
|
||||
});
|
||||
}
|
||||
|
||||
$(function (){
|
||||
getCensus();
|
||||
getCensus2();
|
||||
getCensus3();
|
||||
getCensus4();
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
<label class="col-sm-2 control-label">状态:</label>
|
||||
<div class="col-sm-2">
|
||||
<select id="applicationStatus" class="selectpicker" disabled="disabled">
|
||||
<option value="">请选择</option>
|
||||
</select>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">关联部门:</label>
|
||||
@ -35,7 +36,6 @@
|
||||
<label class="col-sm-2 control-label">案例类型:</label>
|
||||
<div class="col-sm-2">
|
||||
<select id="contentType18" name="tagLists" class="selectpicker">
|
||||
<option value="">请选择</option>
|
||||
</select>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">案例用途:</label>
|
||||
|
||||
@ -217,7 +217,14 @@
|
||||
{field: 'createtime', title: '创建时间', align : "center", width: "50"},
|
||||
{field: 'updatetime', title: '修改时间', align : "center", width: "50"},
|
||||
{field: 'onlineTime', title: '上线时间', align : "center", width: "50"},
|
||||
{field: 'position', title: '关联部门', align : "center", width: "50"},
|
||||
{field: 'position', title: '关联部门', align : "center", width: "50", formatter:function(value,row, index){
|
||||
for(var i = 0; i < row.tagList.length;i++){
|
||||
if(row.tagList[i].id === 26){
|
||||
return row.tagList[i].tagName;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}},
|
||||
{field: 'userName', title: '创建者', align : "center", width: "450"},
|
||||
/* {field: 'title', title: '标题', align : "left", width: "25%", formatter: function(value, row, index) {
|
||||
if(value!=null && $.trim(value)!='' && value.length>25){
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
</section>
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="box box-default">
|
||||
<!--<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">功能开发中 ...</h3>
|
||||
|
||||
@ -38,6 +38,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</section>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user