Commit 4c39dedc by zhangkb

系统管理导入导出接口修改代码提交

parent 9cbfe82a
......@@ -169,6 +169,12 @@
<artifactId>cas-security-spring-boot-starter</artifactId>
<version>1.0.0-beta-1</version>
</dependency>
<!-- gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
......
package com.keymobile.tagmanager.api;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.keymobile.tagmanager.model.SysTag;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Api(value = "Excel文件处理", tags = "Excel文件处理")
@RestController
@RequestMapping(value = "/Excel")
public class ExcelParser {
@ApiOperation(value = "解析Excel文件", notes = "解析Excel文件")
@PostMapping("/parseExcel")
public List<SysTag> importSystem(MultipartFile file, HttpServletResponse response) throws Exception {
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setHeadRows(1);
params.setNeedVerify(false);
ExcelImportResult<SysTag> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SysTag.class, params);
List<SysTag> sysTags = excelImportResult.getList();
return sysTags;
}
}
package com.keymobile.tagmanager.api;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.keymobile.tagmanager.logging.LogConstants;
import com.keymobile.tagmanager.logging.LogManager;
import com.keymobile.tagmanager.model.SysTag;
import com.keymobile.tagmanager.model.system.SysApplication;
import com.keymobile.tagmanager.model.system.SysConstruction;
import com.keymobile.tagmanager.model.system.SysFunction;
import com.keymobile.tagmanager.model.system.SysInfo;
import com.keymobile.tagmanager.model.system.SysOperations;
import com.keymobile.tagmanager.service.ExcelParserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
@Api(value = "Excel文件处理", tags = "Excel文件处理")
@RestController
@RequestMapping(value = "/Excel")
public class ExcelParser {
@Autowired
private ExcelParserService excelParserService;
@ApiOperation(value = "解析Excel文件", notes = "解析Excel文件")
@PostMapping("/parseExcel")
public List<SysTag> importSystem(MultipartFile file, HttpServletResponse response) throws Exception {
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setHeadRows(1);
params.setNeedVerify(false);
ExcelImportResult<SysTag> excelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SysTag.class, params);
List<SysTag> sysTags = excelImportResult.getList();
return sysTags;
}
@ApiOperation(value = "解析系统Excel文件", notes = "解析系统Excel文件")
@PostMapping("/parseSysExcel")
public List<SysInfo> importSystemExcel(MultipartFile file) throws Exception {
return excelParserService.importSystemExcel(file);
}
@ApiOperation(value = "系统导出(系统id传参样式:4,9,10,23)", notes = "系统导出(系统id传参样式:4,9,10,23)")
@GetMapping(value = "/exportSystemExcel")
public void exportSystem(@RequestParam String systemIdString,HttpServletRequest request,
HttpServletResponse response) throws Exception{
if(StringUtils.isNotBlank(systemIdString)) {
List<Long> systemIds = new ArrayList<>();
String[] systemId = systemIdString.split(",");
for(String sid : systemId) {
systemIds.add(Long.valueOf(sid));
}
excelParserService.exportSystemExcel(systemIds, request, response);
}
LogManager.logInfo(LogConstants.CTX_OPTFILETAG, "导出系统");
}
}
package com.keymobile.tagmanager.model.system;
import java.io.Serializable;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
public class SysApplication implements Serializable, IExcelModel, IExcelDataModel{
@Excel(name = "系统代码", orderNum = "1", width=30)
private String systemCode;
@Excel(name = "业务牵头部门", orderNum = "2", width=30)
private String informationApplicationDepartment;
@Excel(name = "业务牵头部门联系人", orderNum = "3", width=30)
private String fillingPerson;
@Excel(name = "业务域", orderNum = "4", width=30)
private String businessDomain;
@Excel(name = "立项号", orderNum = "5", width=30)
private String itemNo;
@Excel(name = "无形资产主数据号", orderNum = "6", width=30)
private String intangibleNo;
@Excel(name = "开发支岀资产主数据号", orderNum = "7", width=30)
private String devNo;
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
public String getInformationApplicationDepartment() {
return informationApplicationDepartment;
}
public void setInformationApplicationDepartment(String informationApplicationDepartment) {
this.informationApplicationDepartment = informationApplicationDepartment;
}
public String getFillingPerson() {
return fillingPerson;
}
public void setFillingPerson(String fillingPerson) {
this.fillingPerson = fillingPerson;
}
public String getBusinessDomain() {
return businessDomain;
}
public void setBusinessDomain(String businessDomain) {
this.businessDomain = businessDomain;
}
public String getItemNo() {
return itemNo;
}
public void setItemNo(String itemNo) {
this.itemNo = itemNo;
}
public String getIntangibleNo() {
return intangibleNo;
}
public void setIntangibleNo(String intangibleNo) {
this.intangibleNo = intangibleNo;
}
public String getDevNo() {
return devNo;
}
public void setDevNo(String devNo) {
this.devNo = devNo;
}
@org.springframework.data.annotation.Transient
private String errMsg;
@org.springframework.data.annotation.Transient
private int excelRowNum;
@Override
public String getErrorMsg() {
return errMsg;
}
@Override
public void setErrorMsg(String errorMsg) {
this.errMsg = errorMsg;
}
@Override
public Integer getRowNum() {
return excelRowNum;
}
@Override
public void setRowNum(Integer rowNum) {
this.excelRowNum = rowNum;
}
}
package com.keymobile.tagmanager.model.system;
import java.io.Serializable;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
public class SysConstruction implements Serializable, IExcelModel, IExcelDataModel{
@Excel(name = "系统代码", orderNum = "1", width=30)
private String systemCode;
@Excel(name = "系统建设实施方", orderNum = "2", width=30)
private String constructionDepartment;
@Excel(name = "系统建设实施方项目经理", orderNum = "3", width=30)
private String personnelList;
@Excel(name = "系统功能点", orderNum = "4", width=30)
private String systemFunction;
@Excel(name = "系统功能模块描述", orderNum = "5", width=30)
private String moduleDescription;
@Excel(name = "调用接口名称", orderNum = "6", width=30)
private String callRelationship;
@Excel(name = "系统上线时间", orderNum = "7", width=30)
private String systemOnlineTime;
@Excel(name = "项目实际投入人力(人/月)", orderNum = "8", width=30)
private String projectHumanInput;
@Excel(name = "项目实际投入金额(万元)", orderNum = "9", width=30)
private String projectMoneyInput;
@Excel(name = "项目过程文档存放地址", orderNum = "10", width=30)
private String documents;
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
public String getConstructionDepartment() {
return constructionDepartment;
}
public void setConstructionDepartment(String constructionDepartment) {
this.constructionDepartment = constructionDepartment;
}
public String getPersonnelList() {
return personnelList;
}
public void setPersonnelList(String personnelList) {
this.personnelList = personnelList;
}
public String getSystemFunction() {
return systemFunction;
}
public void setSystemFunction(String systemFunction) {
this.systemFunction = systemFunction;
}
public String getModuleDescription() {
return moduleDescription;
}
public void setModuleDescription(String moduleDescription) {
this.moduleDescription = moduleDescription;
}
public String getCallRelationship() {
return callRelationship;
}
public void setCallRelationship(String callRelationship) {
this.callRelationship = callRelationship;
}
public String getSystemOnlineTime() {
return systemOnlineTime;
}
public void setSystemOnlineTime(String systemOnlineTime) {
this.systemOnlineTime = systemOnlineTime;
}
public String getProjectHumanInput() {
return projectHumanInput;
}
public void setProjectHumanInput(String projectHumanInput) {
this.projectHumanInput = projectHumanInput;
}
public String getProjectMoneyInput() {
return projectMoneyInput;
}
public void setProjectMoneyInput(String projectMoneyInput) {
this.projectMoneyInput = projectMoneyInput;
}
public String getDocuments() {
return documents;
}
public void setDocuments(String documents) {
this.documents = documents;
}
@org.springframework.data.annotation.Transient
private String errMsg;
@org.springframework.data.annotation.Transient
private int excelRowNum;
@Override
public String getErrorMsg() {
return errMsg;
}
@Override
public void setErrorMsg(String errorMsg) {
this.errMsg = errorMsg;
}
@Override
public Integer getRowNum() {
return excelRowNum;
}
@Override
public void setRowNum(Integer rowNum) {
this.excelRowNum = rowNum;
}
}
package com.keymobile.tagmanager.model.system;
import java.io.Serializable;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
public class SysFunction implements Serializable, IExcelModel, IExcelDataModel{
@Excel(name = "系统代码", orderNum = "1", width=30)
private String systemCode;
@Excel(name = "系统功能点", orderNum = "2", width=30)
private String systemFunction;
@Excel(name = "备注", orderNum = "3", width=30)
private String comment;
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
public String getSystemFunction() {
return systemFunction;
}
public void setSystemFunction(String systemFunction) {
this.systemFunction = systemFunction;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
@org.springframework.data.annotation.Transient
private String errMsg;
@org.springframework.data.annotation.Transient
private int excelRowNum;
@Override
public String getErrorMsg() {
return errMsg;
}
@Override
public void setErrorMsg(String errorMsg) {
this.errMsg = errorMsg;
}
@Override
public Integer getRowNum() {
return excelRowNum;
}
@Override
public void setRowNum(Integer rowNum) {
this.excelRowNum = rowNum;
}
}
package com.keymobile.tagmanager.model.system;
import java.io.Serializable;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
public class SysOperations implements Serializable, IExcelModel, IExcelDataModel{
@Excel(name = "系统代码", orderNum = "1", width=30)
private String systemCode;
@Excel(name = "运维类型", orderNum = "2", width=30)
private String maintenanceClassification;
@Excel(name = "系统定级", orderNum = "3", width=30)
private String importantSystem;
@Excel(name = "系统安全保护等级", orderNum = "4", width=30)
private String securityProtectionLevel;
@Excel(name = "系统运维实施方", orderNum = "5", width=30)
private String operationDepartment;
@Excel(name = "系统运维时间", orderNum = "6", width=30)
private String operationTime;
@Excel(name = "运维负责人A", orderNum = "7", width=30)
private String operationPeoplea;
@Excel(name = "运维负责人B", orderNum = "8", width=30)
private String operationPeopleb;
@Excel(name = "月均系统使用人数", orderNum = "9", width=30)
private String systemUsePerMonth;
@Excel(name = "月均用户登录次数", orderNum = "10", width=30)
private String userLoginPerMonth;
@Excel(name = "年均需求变更量", orderNum = "11", width=30)
private String needChangePerYear;
@Excel(name = "年均基础工单量", orderNum = "12", width=30)
private String wordOrderPerYear;
@Excel(name = "系统退役时间", orderNum = "13", width=30)
private String systemOfflineTime;
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
public String getMaintenanceClassification() {
return maintenanceClassification;
}
public void setMaintenanceClassification(String maintenanceClassification) {
this.maintenanceClassification = maintenanceClassification;
}
public String getImportantSystem() {
return importantSystem;
}
public void setImportantSystem(String importantSystem) {
this.importantSystem = importantSystem;
}
public String getSecurityProtectionLevel() {
return securityProtectionLevel;
}
public void setSecurityProtectionLevel(String securityProtectionLevel) {
this.securityProtectionLevel = securityProtectionLevel;
}
public String getOperationDepartment() {
return operationDepartment;
}
public void setOperationDepartment(String operationDepartment) {
this.operationDepartment = operationDepartment;
}
public String getOperationTime() {
return operationTime;
}
public void setOperationTime(String operationTime) {
this.operationTime = operationTime;
}
public String getOperationPeoplea() {
return operationPeoplea;
}
public void setOperationPeoplea(String operationPeoplea) {
this.operationPeoplea = operationPeoplea;
}
public String getOperationPeopleb() {
return operationPeopleb;
}
public void setOperationPeopleb(String operationPeopleb) {
this.operationPeopleb = operationPeopleb;
}
public String getSystemUsePerMonth() {
return systemUsePerMonth;
}
public void setSystemUsePerMonth(String systemUsePerMonth) {
this.systemUsePerMonth = systemUsePerMonth;
}
public String getUserLoginPerMonth() {
return userLoginPerMonth;
}
public void setUserLoginPerMonth(String userLoginPerMonth) {
this.userLoginPerMonth = userLoginPerMonth;
}
public String getNeedChangePerYear() {
return needChangePerYear;
}
public void setNeedChangePerYear(String needChangePerYear) {
this.needChangePerYear = needChangePerYear;
}
public String getWordOrderPerYear() {
return wordOrderPerYear;
}
public void setWordOrderPerYear(String wordOrderPerYear) {
this.wordOrderPerYear = wordOrderPerYear;
}
public String getSystemOfflineTime() {
return systemOfflineTime;
}
public void setSystemOfflineTime(String systemOfflineTime) {
this.systemOfflineTime = systemOfflineTime;
}
@org.springframework.data.annotation.Transient
private String errMsg;
@org.springframework.data.annotation.Transient
private int excelRowNum;
@Override
public String getErrorMsg() {
return errMsg;
}
@Override
public void setErrorMsg(String errorMsg) {
this.errMsg = errorMsg;
}
@Override
public Integer getRowNum() {
return excelRowNum;
}
@Override
public void setRowNum(Integer rowNum) {
this.excelRowNum = rowNum;
}
}
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