Commit 376e700f by wqc

大屏接口

parent c358eb9a
......@@ -104,8 +104,8 @@ public class BigScreenController {
@ApiOperation("办案总量")
@GetMapping(value = "/getBazlNums")
public ResultVo getbazlNums() throws SQLException {
return ResultVo.success(bigScreenService.getbazlNums());
public ResultVo getbazlNums(@RequestParam String pcNo) throws SQLException {
return ResultVo.success(bigScreenService.getbazlNums(pcNo));
}
@ApiOperation("取保候审案件长期未结列表")
......@@ -151,5 +151,29 @@ public class BigScreenController {
return ResultVo.success(bigScreenService.getZdmgajData(diqu));
}
@ApiOperation("办理群众来信情况")
@GetMapping(value = "/getBlqzlxData")
public ResultVo getBlqzlxData(@RequestParam String diqu) throws SQLException {
return ResultVo.success(bigScreenService.getBlqzlxData(diqu));
}
@ApiOperation("38项案件质量主要评价指标")
@GetMapping(value = "/getZlzypjzb")
public ResultVo getZlzypjzb(@RequestParam String diqu,String type) throws SQLException {
return ResultVo.success(bigScreenService.getZlzypjzb(diqu,type));
}
@ApiOperation("取保案件长期未结")
@GetMapping(value = "/getQbajcqwj")
public ResultVo getQbajcqwj(@RequestParam String diqu) throws SQLException {
return ResultVo.success(bigScreenService.getQbajcqwj(diqu));
}
@ApiOperation("久诉未判案件列表")
@GetMapping(value = "/getJswpajlb")
public ResultVo getJswpajlb(@RequestParam String diqu) throws SQLException {
return ResultVo.success(bigScreenService.getJswpajlb(diqu));
}
}
......@@ -67,6 +67,13 @@ public class DataCollectFileController {
return ResultVo.success(dataCollectFileService.importFljdToDb(file));
}
@ApiOperation("导入38项案件质量主要评价指标")
@PostMapping(value = "/importAjzlzypjzb")
public ResultVo importAjzlzypjzb(MultipartFile file) {
AssertUtils.isTrue(file != null && file.getSize() > 0, "请选择文件");
return ResultVo.success(dataCollectFileService.importAjzlzypjzb(file));
}
@ApiOperation("执行文件汇聚")
@PostMapping(value = "/execute")
public ResultVo executeDb(@RequestParam("dataCollectSettingId") Integer dataCollectSettingId, @RequestParam("collectType") Integer collectType, MultipartFile file) {
......
package com.zq.datacollect.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "ajzlzypjzb")
@Builder
public class AjzlzypjzbMajor {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
private String numerator;
private String denominator;
private String ratio;
private String unit;
private String numeratorName;
private String denominatorName;
private String ratioName;
private String targetName;
private String pcNo;
/**
* createTime
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
}
package com.zq.datacollect.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "target_type")
@Builder
public class TargetType {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
private String numeratorName;
private String denominatorName;
private String ratioName;
}
......@@ -55,6 +55,7 @@ public class ConnectDB implements ApplicationRunner {
druidDataSource.setUrl(url);
druidDataSource.setUsername(ds.getUsername());
druidDataSource.setPassword(ds.getPassword());
druidDataSource.setQueryTimeout(20 * 1000);
druidDataSource.init();
DruidPooledConnection connection = druidDataSource.getConnection();
connectionMap.put(ds.getId(), connection);
......
package com.zq.datacollect.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.datacollect.entity.AjzlzypjzbMajor;
import com.zq.datacollect.entity.Ajzlzypjzbdy;
@DS("hjk")
public interface AjzlzypjzbMajorMapper extends BaseMapper<AjzlzypjzbMajor> {
}
package com.zq.datacollect.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.datacollect.entity.TargetType;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@DS("hjk")
public interface TargetTypeMapper extends BaseMapper<TargetType> {
@Select("SELECT numerator_name as caseRatio FROM target_type")
List<Object> selectNumeratorName();
@Select("SELECT denominator_name FROM target_type")
List<Object> selectDenominatorName();
@Select("SELECT ratio_name FROM target_type")
List<Object> selectRatioName();
@Select("SELECT target_name FROM target_type")
List<Object> selectTargetName();
}
......@@ -29,7 +29,7 @@ public interface BigScreenService {
Object getModelEffect(String shiyuan) throws SQLException;
Object getbazlNums() throws SQLException;
Object getbazlNums(String pcNo) throws SQLException;
Object getQbhsajcqwjList() throws SQLException;
......@@ -44,4 +44,12 @@ public interface BigScreenService {
Object getJianDuData(String diqu, String type) throws SQLException;
Object getZdmgajData(String diqu) throws SQLException;
Object getBlqzlxData(String diqu) throws SQLException;
Object getZlzypjzb(String diqu,String type) throws SQLException;
Object getQbajcqwj(String diqu) throws SQLException;
Object getJswpajlb(String diqu) throws SQLException;
}
......@@ -24,4 +24,6 @@ public interface DataCollectFileService {
Object importBacxToDb(MultipartFile file);
Object importFljdToDb(MultipartFile file);
Object importAjzlzypjzb(MultipartFile file);
}
......@@ -18,7 +18,6 @@ import com.zq.datacollect.service.BigScreenService;
import com.zq.datacollect.service.CommonQuerysService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
......@@ -53,7 +52,6 @@ public class BigScreenServiceImpl implements BigScreenService {
private ConnectionHolder connectionHolder;
public List<Map<String, Object>> CommonQuery(Map<String, Object> body) throws SQLException {
// body.remove("token");
JSONObject jsonObject = JSONUtil.parseObj(body);
String queryName = jsonObject.get("queryName").toString();
CommonQuerySettings one = commonQuerysService.getOne(new LambdaQueryWrapper<CommonQuerySettings>().eq(CommonQuerySettings::getQueryName, queryName));
......@@ -364,9 +362,10 @@ public class BigScreenServiceImpl implements BigScreenService {
}
@Override
public Object getbazlNums() throws SQLException {
public Object getbazlNums(String pcNo) throws SQLException {
Map<String, Object> body = new HashMap<>();
body.put("queryName", "办案总量");
body.put("pcNo","'" + pcNo + "'");
List<Map<String, Object>> mapList = CommonQuery(body);
return mapList;
}
......@@ -500,4 +499,68 @@ public class BigScreenServiceImpl implements BigScreenService {
}
@Override
public Object getBlqzlxData(String diqu) throws SQLException {
Map<String, Object> body = new HashMap<>();
body.put("diqu","'" + diqu + "'");
List<Map<String, Object>> mapList =null;
if (diqu!=null&&diqu.equals("")) {
body.put("queryName","办理群众来信情况1");
mapList=CommonQuery(body);
}else{
body.put("queryName","办理群众来信情况2");
mapList=CommonQuery(body);
}
return mapList;
}
@Override
public Object getZlzypjzb(String diqu,String type) throws SQLException {
List<Map<String, Object>> mapList = null;
if (diqu == null || diqu.equals("")) {
Map<String, Object> body = new HashMap<>();
body.put("diqu", "'" + diqu + "'");
body.put("type", "'" + type + "'");
body.put("queryName", "38项案件质量主要评价指标1");
mapList = CommonQuery(body);
} else {
Map<String, Object> body = new HashMap<>();
body.put("diqu", "'" + diqu + "'");
body.put("type", "'" + type + "'");
body.put("queryName", "38项案件质量主要评价指标2");
mapList = CommonQuery(body);
}
return mapList;
}
@Override
public Object getQbajcqwj(String diqu) throws SQLException {
Map<String, Object> body = new HashMap<>();
body.put("diqu","'" + diqu + "'");
List<Map<String, Object>> mapList =null;
if (diqu!=null&&diqu.equals("")) {
body.put("queryName","取保案件长期未结1");
mapList=CommonQuery(body);
}else{
body.put("queryName","取保案件长期未结2");
mapList=CommonQuery(body);
}
return mapList;
}
@Override
public Object getJswpajlb(String diqu) throws SQLException {
Map<String, Object> body = new HashMap<>();
body.put("diqu","'" + diqu + "'");
List<Map<String, Object>> mapList =null;
if (diqu!=null&&diqu.equals("")) {
body.put("queryName","久诉未判案件列表1");
mapList=CommonQuery(body);
}else{
body.put("queryName","久诉未判案件列表2");
mapList=CommonQuery(body);
}
return mapList;
}
}
......@@ -52,6 +52,12 @@ public class DataCollectFileServiceImpl extends ServiceImpl<DataCollectSettingFi
@Resource
private FljdDataMapper fljdDataMapper;
@Resource
private AjzlzypjzbMajorMapper ajzlzypjzbMajorMapper;
@Resource
private TargetTypeMapper targetTypeMapper;
@Override
public DataCollectSettingFile get(Integer dataCollectSettingId) {
return lambdaQuery().eq(DataCollectSettingFile::getDataCollectSettingId, dataCollectSettingId).one();
......@@ -260,13 +266,13 @@ public class DataCollectFileServiceImpl extends ServiceImpl<DataCollectSettingFi
}
end++;
}
List<Object> dataType =reader.readRow(1);
List<Object> dataType = reader.readRow(1);
for (List<Object> objectList : readList) {
String city = Convert.toStr(CollUtil.get(objectList, 0), "");
int index = 1;
int k=1;
int k = 1;
for (int i = 0; i < rateList.size(); i++) {
String typeName = Convert.toStr(CollUtil.get(dataType, k++), "");
FljdData fljdData = new FljdData();
......@@ -281,4 +287,72 @@ public class DataCollectFileServiceImpl extends ServiceImpl<DataCollectSettingFi
return "导入库成功";
}
@Override
public Object importAjzlzypjzb(MultipartFile file) {
List<AjzlzypjzbMajor> list = ajzlzypjzbMajorMapper.selectList(Wrappers.lambdaQuery(AjzlzypjzbMajor.builder().build()));
if (list != null && list.size() > 0) {
for (AjzlzypjzbMajor one : list) {
ajzlzypjzbMajorMapper.deleteById(one.getId());
}
}
ExcelReader reader;
try {
reader = ExcelUtil.getReader(file.getInputStream());
} catch (IOException e) {
e.printStackTrace();
throw new BusinessException("文件解析失败");
}
List<List<Object>> readList = reader.read(3, 18);
List<Object> titleRow = reader.readRow(16);
int end = 0;
String pre = "";
List<String> rateList = new ArrayList<>();
for (Object o : titleRow) {
String str = Convert.toStr(o);
String content = str.trim();
if ("单位".equals(content)) {
end++;
continue;
}
if (StrUtil.isBlank(pre) || !pre.equals(content)) {
pre = content;
rateList.add(pre);
}
end++;
}
List<Object> denominatorName = targetTypeMapper.selectDenominatorName();
List<Object> numeratorName = targetTypeMapper.selectNumeratorName();
List<Object> ratioName = targetTypeMapper.selectRatioName();
List<Object> targetName = targetTypeMapper.selectTargetName();
for (List<Object> objectList : readList) {
String city = Convert.toStr(CollUtil.get(objectList, 0), "");
int index = 1;
int k = 0;
int a = 0;
int b = 0;
int c = 0;
for (int i = 0; i < rateList.size(); i++) {
String denominator = Convert.toStr(CollUtil.get(denominatorName, k++), "");
String numerator = Convert.toStr(CollUtil.get(numeratorName, a++), "");
String ratio = Convert.toStr(CollUtil.get(ratioName, b++), "");
String target = Convert.toStr(CollUtil.get(targetName, c++), "");
AjzlzypjzbMajor major = new AjzlzypjzbMajor();
major.setUnit(city);
major.setNumerator(Convert.toStr(CollUtil.get(objectList, index++)));
major.setDenominator(Convert.toStr(CollUtil.get(objectList, index++)));
major.setRatio(Convert.toStr(CollUtil.get(objectList, index++)));
major.setNumeratorName(numerator);
major.setDenominatorName(denominator);
major.setRatioName(ratio);
major.setTargetName(target);
major.setCreateTime(DateUtil.date());
if (major.getNumerator() != null && major.getDenominator() != null && major.getRatio() != null) {
ajzlzypjzbMajorMapper.insert(major);
}
}
}
return "导入成功";
}
}
......@@ -53,7 +53,7 @@ spring:
# 最小连接数
min-idle: 10
# 最大连接数
max-active: 20
max-active: 100
# 获取连接超时时间
max-wait: 5000
# 连接有效性检测时间
......
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