package com.lf.server.service.sys;
|
|
import com.lf.server.entity.ctrl.CountEntity;
|
import com.lf.server.entity.sys.ReportEntity;
|
import com.lf.server.helper.StringHelper;
|
import com.lf.server.helper.WordHelper;
|
import com.lf.server.mapper.sys.ReportMapper;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 报告模板
|
* @author WWW
|
*/
|
@Service
|
public class ReportService implements ReportMapper {
|
@Autowired
|
ReportMapper reportMapper;
|
|
@Override
|
public Integer selectCount(String name) {
|
name = StringHelper.getLikeStr(name);
|
|
return reportMapper.selectCount(name);
|
}
|
|
@Override
|
public List<ReportEntity> selectByPage(String name, Integer limit, Integer offset) {
|
name = StringHelper.getLikeStr(name);
|
|
return reportMapper.selectByPage(name, limit, offset);
|
}
|
|
@Override
|
public List<ReportEntity> selectAll() {
|
return reportMapper.selectAll();
|
}
|
|
@Override
|
public ReportEntity selectById(int id) {
|
return reportMapper.selectById(id);
|
}
|
|
@Override
|
public Integer insert(ReportEntity entity) {
|
return reportMapper.insert(entity);
|
}
|
|
@Override
|
public Integer inserts(List<ReportEntity> list) {
|
return reportMapper.inserts(list);
|
}
|
|
@Override
|
public Integer delete(int id) {
|
return reportMapper.delete(id);
|
}
|
|
@Override
|
public Integer deletes(List<Integer> ids) {
|
return reportMapper.deletes(ids);
|
}
|
|
@Override
|
public Integer update(ReportEntity entity) {
|
return reportMapper.update(entity);
|
}
|
|
@Override
|
public Integer updates(List<ReportEntity> list) {
|
return reportMapper.updates(list);
|
}
|
|
@Override
|
public List<CountEntity> countSizes() {
|
return reportMapper.countSizes();
|
}
|
|
@Override
|
public List<CountEntity> countServices() {
|
return reportMapper.countServices();
|
}
|
|
@Override
|
public List<CountEntity> countOperates() {
|
return reportMapper.countOperates();
|
}
|
|
/**
|
* 创建 用户流量统计 Word
|
*/
|
public void createCountSizesWord() {
|
List<CountEntity> list = countOperates();
|
if (null == list || list.isEmpty()) {
|
return;
|
}
|
|
int rows = 1;
|
String inputFile = "D:\\LF\\用户流量统计.docx";
|
String outPutFile = "D:\\LF\\用户流量统计_new.docx";
|
|
ArrayList<String[]> addList = new ArrayList<>();
|
for (CountEntity ce : list) {
|
String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getM2(), ce.getCount().toString()};
|
addList.add(strs);
|
}
|
|
WordHelper.generateWord(inputFile, outPutFile, null, addList);
|
}
|
}
|