导入excel

This commit is contained in:
ly19960718 2021-01-15 10:58:14 +08:00
parent 8cb74de635
commit c8972c40bd
11 changed files with 163 additions and 49 deletions

View File

@ -32,6 +32,10 @@ public class ScoreProperties {
private Double deptSettlescore4; private Double deptSettlescore4;
private Double deptSettlescore5; private Double deptSettlescore5;
private Double deptEventscoreUp;
private Double deptEventscoreDown;
public Integer getBossGrossscore() { public Integer getBossGrossscore() {
return bossGrossscore; return bossGrossscore;
} }
@ -143,4 +147,20 @@ public class ScoreProperties {
public void setLowscore(Double lowscore) { public void setLowscore(Double lowscore) {
this.lowscore = lowscore; this.lowscore = lowscore;
} }
public Double getDeptEventscoreUp() {
return deptEventscoreUp;
}
public void setDeptEventscoreUp(Double deptEventscoreUp) {
this.deptEventscoreUp = deptEventscoreUp;
}
public Double getDeptEventscoreDown() {
return deptEventscoreDown;
}
public void setDeptEventscoreDown(Double deptEventscoreDown) {
this.deptEventscoreDown = deptEventscoreDown;
}
} }

View File

@ -20,6 +20,8 @@ import java.util.Map;
import com.cm.common.exception.SearchException; import com.cm.common.exception.SearchException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletResponse;
/** /**
* @ClassName: DeptAssessController * @ClassName: DeptAssessController
* @Description: 职能部门考核 * @Description: 职能部门考核
@ -38,24 +40,6 @@ public class DeptAssessController extends AbstractController {
/* @ApiOperation(value = "职能部门考核分页列表", notes = "职能部门考核分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagedeptassess")
public SuccessResultList<List<DeptAssessDTO>> listPageDeptAssess(ListPage page) throws SearchException{
Map<String, Object> params = requestParams();
page.setParams(params);
String url = partyBuildingProperties.getDeptassesstUrl()+DEPT_ASSESS_LIST_URL;
RestTemplate restTemplate = new RestTemplate();
restTemplate.getForObject(url,String.class,params);
return ;
}*/
@ApiOperation(value = "手动统计数据", notes = "手动统计数据接口") @ApiOperation(value = "手动统计数据", notes = "手动统计数据接口")
@ -68,6 +52,17 @@ public class DeptAssessController extends AbstractController {
@ApiOperation(value = "导出excel统计数据", notes = "导出excel统计数据")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("excelManualDeptData/{year}/{quarter}")
@CheckRequestBodyAnnotation
public void excelManualDeptData(@PathVariable("year") String year, @PathVariable("quarter") String quarter, HttpServletResponse response) throws Exception {
deptAssessService.excelManualDeptData(year,quarter,response);
}
@ApiOperation(value = "职能部门考核列表", notes = "职能部门考核列表接口") @ApiOperation(value = "职能部门考核列表", notes = "职能部门考核列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@ -80,6 +75,9 @@ public class DeptAssessController extends AbstractController {
/* @Autowired /* @Autowired
private IDeptAssessService deptAssessService; private IDeptAssessService deptAssessService;
@Autowired @Autowired

View File

@ -1,5 +1,6 @@
package com.cm.bigdata.controller.apis.deptassesschangescore; package com.cm.bigdata.controller.apis.deptassesschangescore;
import com.cm.bigdata.config.properties.ScoreProperties;
import com.cm.bigdata.pojo.dtos.deptassess.DeptAssessAllQuarterDTO; import com.cm.bigdata.pojo.dtos.deptassess.DeptAssessAllQuarterDTO;
import com.cm.bigdata.pojo.dtos.deptassess.DeptAssessDTO; import com.cm.bigdata.pojo.dtos.deptassess.DeptAssessDTO;
import com.cm.bigdata.pojo.dtos.deptassesschangescore.DeptAssessScoreDetailsDTO; import com.cm.bigdata.pojo.dtos.deptassesschangescore.DeptAssessScoreDetailsDTO;
@ -44,6 +45,13 @@ public class DeptAssessChangeScoreController extends AbstractController {
private IDeptAssessChangeScoreService deptAssessChangeScoreService; private IDeptAssessChangeScoreService deptAssessChangeScoreService;
@Autowired @Autowired
private SecurityComponent securityComponent; private SecurityComponent securityComponent;
@Autowired
private ScoreProperties scoreProperties;
@ApiOperation(value = "职能部门加减分列表", notes = "职能部门加减分列表接口") @ApiOperation(value = "职能部门加减分列表", notes = "职能部门加减分列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@ -80,16 +88,18 @@ public class DeptAssessChangeScoreController extends AbstractController {
if(deptAssessChangeScoreVO.getChangeScore() == 0.0){ if(deptAssessChangeScoreVO.getChangeScore() == 0.0){
throw new ParamsException("请输入正确的改变分数"); throw new ParamsException("请输入正确的改变分数");
} }
Double up = scoreProperties.getDeptEventscoreUp();
Double down = scoreProperties.getDeptEventscoreDown();
if("1".equals(deptAssessChangeScoreVO.getChangeScoreType())){ if("1".equals(deptAssessChangeScoreVO.getChangeScoreType())){
Double num = deptAssessChangeScoreVO.getDeptCaseTotalScore() + deptAssessChangeScoreVO.getChangeScore(); Double num = deptAssessChangeScoreVO.getDeptCaseTotalScore() + deptAssessChangeScoreVO.getChangeScore();
if(num > 100){ if(num > up){
throw new ParamsException("【输入分数+总分】超出总分上限"); throw new ParamsException("【输入分数+总分】超出总分上限");
} }
} }
if("2".equals(deptAssessChangeScoreVO.getChangeScoreType())){ if("2".equals(deptAssessChangeScoreVO.getChangeScoreType())){
Double num = deptAssessChangeScoreVO.getDeptCaseTotalScore() - deptAssessChangeScoreVO.getChangeScore(); Double num = deptAssessChangeScoreVO.getDeptCaseTotalScore() - deptAssessChangeScoreVO.getChangeScore();
if(num < 0.0){ if(num < down){
throw new ParamsException("【总分-输入分数】超出总分下限"); throw new ParamsException("【总分-输入分数】超出总分下限");
} }
} }

View File

@ -1,5 +1,6 @@
package com.cm.bigdata.pojo.dtos.deptassess; package com.cm.bigdata.pojo.dtos.deptassess;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@ -12,6 +12,7 @@ import com.cm.common.result.SuccessResultList;
import com.cm.bigdata.pojo.dtos.deptassess.DeptAssessDTO; import com.cm.bigdata.pojo.dtos.deptassess.DeptAssessDTO;
import com.cm.bigdata.pojo.vos.deptassess.DeptAssessVO; import com.cm.bigdata.pojo.vos.deptassess.DeptAssessVO;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -25,6 +26,15 @@ import java.util.Map;
public interface IDeptAssessService { public interface IDeptAssessService {
/**
* 导出案件统计数据
* @param deptTotalYear
* @param deptTotalQuarter
* @return
* @throws Exception
*/
void excelManualDeptData(String deptTotalYear, String deptTotalQuarter, HttpServletResponse response) throws Exception;
/** /**
* 查询所有部门指定年的季度总分 * 查询所有部门指定年的季度总分
* @param year * @param year

View File

@ -1,5 +1,6 @@
package com.cm.bigdata.service.deptassess.impl; package com.cm.bigdata.service.deptassess.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cm.bigdata.config.properties.PartyBuildingProperties; import com.cm.bigdata.config.properties.PartyBuildingProperties;
@ -24,6 +25,7 @@ import com.cm.bigdata.pojo.vos.deptassess.DeptAssessVO;
import com.cm.bigdata.service.deptassess.IDeptAssessService; import com.cm.bigdata.service.deptassess.IDeptAssessService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.http.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -32,6 +34,8 @@ import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -57,13 +61,72 @@ public class DeptAssessServiceImpl extends AbstractService implements IDeptAsses
private IDeptAssessChangeScoreService deptAssessChangeScoreService; private IDeptAssessChangeScoreService deptAssessChangeScoreService;
//部门考核列表数据接口 //部门考核列表数据接口
private final static String DEPT_ASSESS_LIST_URL_1 = "/resource/caseexamine/listdeptcasetimeout"; private final static String DEPT_ASSESS_LIST_URL_1 = "/resource/caseexamine/listdeptcasetimeout";
private final static String DEPT_ASSESS_LIST_URL_2 = "/resource/caseexamine/getreportcasescore"; private final static String DEPT_ASSESS_LIST_URL_2 = "/resource/caseexamine/getreportcasescore";
/** /**
* 导出案件统计数据
* @param deptTotalYear
* @param deptTotalQuarter
* @return
* @throws Exception
*/
public void excelManualDeptData(String deptTotalYear, String deptTotalQuarter, HttpServletResponse response) throws Exception{
String excelName = "y年q季度职能部门考核分数统计表";
String fileName = URLEncoder.encode("党费管理Excel模板", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"部门名称","统计年份","统计季度","部门已处理案件数量","案件处理情况分数","部门超时案件数量","案件处置时效分数","案件处理结果分数",
"案件督查分数","总分","自定义共加分","最终得分","数据统计时间"
};
List<List<String>> listHeader = new ArrayList<>();
for (String item : headers){
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
}
Map<String,Object> params = new HashMap<>();
params.put("deptTotalQuarter",deptTotalQuarter);
params.put("deptTotalYear",deptTotalYear);
List<DeptAssessDTO> deptAssessDTOs = deptAssessDao.listDeptAssess(params);
List<List<String>> listData = new ArrayList<>();
for (DeptAssessDTO d : deptAssessDTOs) {
List<String> data = new ArrayList<String>();
data.add(d.getDeptName());
data.add(d.getDeptTotalYear());
data.add(d.getDeptTotalQuarter());
data.add(d.getDeptCaseNum().toString());
data.add(""+d.getDeptCaseSettleScore().toString()+"");
data.add(d.getDeptCaseTimeoutNum().toString());
data.add(""+d.getDeptCaseTimeoutScore().toString()+"");
data.add(d.getDeptCaseGrossScore().toString());
Integer num = deptInspectorService.countDeptInspectorNum(d.getDeptTotalYear(),d.getDeptTotalQuarter(),d.getDeptId());
data.add(""+num.toString()+"");
data.add(d.getDeptCaseTotalScore().toString()+"");
double zdy = deptAssessChangeScoreService.getDeptChangeScore(d.getDeptAssessId());
data.add(zdy+"");
Double eventScore = totalEvenSocre(d.getDeptCaseTotalScore(),zdy);
data.add(eventScore.toString()+"");
data.add(d.getDeptTotalTime());
listData.add(data);
}
EasyExcel.write(response.getOutputStream()).sheet("职能部门考核分数表").head(listHeader).doWrite(listData);
}
/**
* 初始化手动案件统计数据 * 初始化手动案件统计数据
* @param deptTotalYear * @param deptTotalYear
* @param deptTotalQuarter * @param deptTotalQuarter
@ -453,13 +516,16 @@ public class DeptAssessServiceImpl extends AbstractService implements IDeptAsses
public Double totalEvenSocre(Double num1,Double num2){ public Double totalEvenSocre(Double num1,Double num2){
Double up = scoreProperties.getDeptEventscoreUp();
Double down = scoreProperties.getDeptEventscoreDown();
Double socere = 0.0; Double socere = 0.0;
socere = num1 + num2; socere = num1 + num2;
if(socere < 0.0){ if(socere < down){
socere = 0.0; socere = down;
} }
if(socere > 100){ if(socere > up){
socere = 100.0; socere = up;
} }
return socere; return socere;
} }

View File

@ -140,7 +140,7 @@ public class DeptAssessChangeScoreServiceImpl extends AbstractService implements
dto.setScoreCause(scoreCause); dto.setScoreCause(scoreCause);
dto.setScoreWay("系统判定"); dto.setScoreWay("系统判定");
dto.setChangeScoreTime(time); dto.setChangeScoreTime(time);
dto.setChangeScoreUser(""); dto.setChangeScoreUser("系统");
return dto; return dto;
} }

View File

@ -1,6 +1,6 @@
server: server:
port: 8087 port: 8080
url: http://192.168.0.111:8087/bigdata url: http://192.168.0.120:8080/bigdata
title: bigdata title: bigdata
servlet: servlet:
context-path: /bigdata context-path: /bigdata
@ -150,4 +150,6 @@ score:
dept-settlescore-2: 0.5 #案件处理情况扣分值 dept-settlescore-2: 0.5 #案件处理情况扣分值
dept-settlescore-3: 20 #处理结果总分值 dept-settlescore-3: 20 #处理结果总分值
dept-settlescore-4: 1 #案件督查扣分值 dept-settlescore-4: 1 #案件督查扣分值
dept-settlescore-5: 40 #案件处置时效默认分值 dept-settlescore-5: 40 #案件处置时效默认分值
dept-eventscore-up: 100 #最终得分上限
dept-eventscore-down: 0 #最终得分下限

View File

@ -146,7 +146,7 @@
return '<font color="blue">'+rowData+'分</font>'; return '<font color="blue">'+rowData+'分</font>';
} }
}, },
{field: 'deptTotalYear', width: 150, title: '统计年份', align:'center', {field: 'deptTotalYear', width: 120, title: '统计年份', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -155,7 +155,7 @@
return rowData; return rowData;
} }
}, },
{field: 'deptTotalQuarter', width: 150, title: '统计季度', align:'center', {field: 'deptTotalQuarter', width: 120, title: '统计季度', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -164,7 +164,7 @@
return rowData; return rowData;
} }
}, },
{field: 'deptTotalTime', width: 150, title: '数据统计时间', align:'center', {field: 'deptTotalTime', width: 180, title: '数据统计时间', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {

View File

@ -36,6 +36,9 @@
<button type="button" id="search" class="layui-btn layui-btn-sm"> <button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索 <i class="fa fa-lg fa-search"></i> 搜索
</button> </button>
<button type="button" id="excel" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 导出数据
</button>
</div> </div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table> <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 --> <!-- 表头按钮组 -->
@ -144,7 +147,7 @@
return '<font color="blue">'+rowData+'分</font>'; return '<font color="blue">'+rowData+'分</font>';
} }
}, },
{field: 'deptTotalYear', width: 150, title: '统计年份', align:'center', {field: 'deptTotalYear', width: 120, title: '统计年份', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -153,7 +156,7 @@
return rowData; return rowData;
} }
}, },
{field: 'deptTotalQuarter', width: 150, title: '统计季度', align:'center', {field: 'deptTotalQuarter', width: 120, title: '统计季度', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -162,7 +165,7 @@
return rowData; return rowData;
} }
}, },
{field: 'deptTotalTime', width: 150, title: '数据统计时间', align:'center', {field: 'deptTotalTime', width: 180, title: '数据统计时间', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -243,21 +246,19 @@
$(document).on('click', '#search', function() { $(document).on('click', '#search', function() {
reloadTable(1); reloadTable(1);
}); });
//手动统计 $(document).on('click', '#excel', function() {
$(document).on('click', '#total', function() {
var v1 = $('#deptTotalYear').val(); var v1 = $('#deptTotalYear').val();
var v2 = $('#deptTotalQuarter').val(); var v2 = $('#deptTotalQuarter').val();
total(v1,v2); excel(v1,v2);
}); });
function excel(v1,v2){
function total(v1,v2){
if(v1 === ''){ if(v1 === ''){
layer.msg('请选择统计年份') layer.msg('请选择导出数据年份')
} }
if(v2 === ''){ if(v2 === ''){
layer.msg('请选择统计季度') layer.msg('请选择导出数据季度')
} }
var v2Str = ""; var v2Str = "";
if(v2 === '1'){ if(v2 === '1'){
@ -272,29 +273,35 @@
if(v2 === '4'){ if(v2 === '4'){
v2Str = '第四季度' v2Str = '第四季度'
} }
top.dialog.msg('确定要统计'+v1+'年'+v2Str+'的数据吗?', {
top.dialog.msg('确定要导出'+v1+'年'+v2Str+'的数据吗?', {
time: 0, time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no], btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3, shade: 0.3,
yes: function (index) { yes: function (index) {
top.dialog.close(index); top.dialog.close(index);
var layIndex; var layIndex;
top.restAjax.get(top.restAjax.path('api/deptassess/initManualDeptData/{year}/{quarter}', [v1,v2]), {}, null, function (code, data) { window.open(top.restAjax.path('api/deptassess/excelManualDeptData/{year}/{quarter}', [v1,v2]));
top.dialog.msg('统计完成', {time: 1000}); /* top.restAjax.get(top.restAjax.path('api/deptassess/excelManualDeptData/{year}/{quarter}', [v1,v2]), {}, null, function (code, data) {
top.dialog.msg('导出完成', {time: 1000});
reloadTable(); reloadTable();
}, function (code, data) { }, function (code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);
}, function () { }, function () {
layIndex = top.dialog.msg('统计中...', {icon: 16, time: 0, shade: 0.3}); layIndex = top.dialog.msg('导出中...', {icon: 16, time: 0, shade: 0.3});
}, function () { }, function () {
top.dialog.close(layIndex); top.dialog.close(layIndex);
}); });*/
} }
}); });
} }
//按钮事件 //按钮事件
table.on('tool(dataTable)',function(obj){ table.on('tool(dataTable)',function(obj){
var layEvent = obj.event; var layEvent = obj.event;

View File

@ -96,7 +96,7 @@
return rowData; return rowData;
} }
}, },
{field: 'changeScoreTime', width: 150, title: '操作时间', align:'center', {field: 'changeScoreTime', width: 180, title: '操作时间', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
return rowData; return rowData;