合并分支 'dev_20230216' 到 'master'
Dev 20230216 查看合并请求 laws-foton-slrs/foton-slrs-system-rest!29
This commit is contained in:
@@ -477,4 +477,8 @@ public interface workFlowFeignClient {
|
||||
String deleteOAByMandatory(@RequestParam("todoId") String todoId,@RequestParam("assignee") String assignee);
|
||||
@RequestMapping(value = "/bat-wkflow/datas/bus-process-new/selectBusProcessNew",method = RequestMethod.GET)
|
||||
String selectBusProcessNew(@RequestParam("taskId")String taskId);
|
||||
@RequestMapping(value = "/bat-wkflow/datas/bus-process-new/deleteReplyToenNotice",method = RequestMethod.POST)
|
||||
List<BusProcessNew> deleteReplyToenNotice(@RequestParam("taskId") String taskId,@RequestParam("answerer") String answerer);
|
||||
@RequestMapping(value = "/bat-wkflow/datas/bus-process-new/selectAskId",method = RequestMethod.GET)
|
||||
String selectAskId(@RequestParam("taskId") String taskId);
|
||||
}
|
||||
|
||||
@@ -426,4 +426,12 @@ public class workFlowFeignClientImpl {
|
||||
public String selectBusProcessNew(@RequestParam("taskId")String taskId) {
|
||||
return workFlowFeignClient.selectBusProcessNew(taskId);
|
||||
}
|
||||
|
||||
public List<BusProcessNew> deleteReplyToenNotice(@RequestParam("taskId") String taskId,@RequestParam("answerer") String answerer) {
|
||||
return workFlowFeignClient.deleteReplyToenNotice(taskId,answerer);
|
||||
}
|
||||
|
||||
public String selectAskId(@RequestParam("taskId") String taskId) {
|
||||
return workFlowFeignClient.selectAskId(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,6 @@ public class BusProcessName implements Serializable {
|
||||
private String isEnd;
|
||||
|
||||
private String taskBackAssignee;
|
||||
|
||||
private boolean showreceive;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.common.Page;
|
||||
import com.adc.da.login.util.JwtUtils;
|
||||
import com.adc.da.slrs.StandardQA.service.Impl.SarAgenldAcceptButtonServiceImpl;
|
||||
import com.adc.da.slrs.esRevisePlan.dao.EsRevisePlanDao;
|
||||
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan;
|
||||
import com.adc.da.slrs.esRevisePlan.service.IEsRevisePlanLogService;
|
||||
@@ -29,6 +30,7 @@ import com.adc.da.workFlow.service.WorkFlowService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import oracle.ucp.proxy.annotation.Post;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
@@ -83,6 +85,9 @@ public class WorkFlowController {
|
||||
@Autowired
|
||||
private IEsRevisePlanLogService esRevisePlanLogService;
|
||||
|
||||
@Autowired
|
||||
private SarAgenldAcceptButtonServiceImpl sarAgenldAcceptButtonService;
|
||||
|
||||
// @Autowired
|
||||
// private ExportExcelMapper exportExcelMapper;
|
||||
|
||||
@@ -259,6 +264,7 @@ public class WorkFlowController {
|
||||
@ApiOperation(value = "管控流程接收任务")
|
||||
@GetMapping("/acceptTack")
|
||||
public Integer acceptTack(@RequestParam("nowEsId") String nowEsId, @RequestParam("oaFlag") String oaFlag, @RequestParam("taskId") String taskId) {
|
||||
sarAgenldAcceptButtonService.add(taskId);
|
||||
return workFlowFeignClient.acceptTack(nowEsId,oaFlag,taskId);
|
||||
}
|
||||
|
||||
@@ -507,6 +513,16 @@ public class WorkFlowController {
|
||||
pageInfo.setCount(Long.valueOf(0));
|
||||
pageInfo.setPageSize(taskCommonQuery.getSize());
|
||||
}
|
||||
for (BusProcessName data : pageInfo.getList()){
|
||||
if(StringUtils.isNotBlank(data.getTaskIds())){
|
||||
String s = sarAgenldAcceptButtonService.selectIsNot(data.getTaskIds());
|
||||
if(s.equals("1")){
|
||||
data.setShowreceive(false);
|
||||
}else {
|
||||
data.setShowreceive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@@ -958,6 +974,19 @@ public class WorkFlowController {
|
||||
public String selectBusProcessNew(@RequestParam("taskId") String taskId) {
|
||||
return workFlowFeignClient.selectBusProcessNew(taskId);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "问答中心(第一个人回答以后删除其他人的代办任务以及OA提醒)")
|
||||
@PostMapping("/deleteReplyToenNotice")
|
||||
public List<BusProcessNew> deleteReplyToenNotice(@RequestParam("taskId") String taskId,@RequestParam("answerer") String answerer) {
|
||||
return workFlowFeignClient.deleteReplyToenNotice(taskId,answerer);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "问答中心(通过taskId获取提问Id)")
|
||||
@GetMapping("/selectAskId")
|
||||
public String selectAskId(@RequestParam("taskId") String taskId) {
|
||||
return workFlowFeignClient.selectAskId(taskId);
|
||||
}
|
||||
@ApiOperation(value = "OA待办强制删除")
|
||||
@GetMapping("/deleteOAByMandatory")
|
||||
public String deleteOAByMandatory(@RequestParam("todoId") String todoId,@RequestParam("assignee") String assignee) {
|
||||
|
||||
@@ -115,6 +115,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
//企业标准导出
|
||||
addInterceptor.excludePathPatterns("/api/lawss/sarBussionessStand/exportSarBussionessStand");
|
||||
|
||||
addInterceptor.excludePathPatterns("/api/lawss/sarFileSplitItems/exportTemplate");
|
||||
|
||||
//预警导出
|
||||
addInterceptor.excludePathPatterns("/api/sys/EarlyWarning/exportWarning");
|
||||
|
||||
@@ -156,6 +158,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
addInterceptor.excludePathPatterns("/api/lawss/sarBussionessStand/importSarBussionessStandFile");
|
||||
addInterceptor.excludePathPatterns("/api/sarLawsDetailedList/sar-laws-detailed-list/importData");
|
||||
|
||||
//企标标准导入模板下载
|
||||
addInterceptor.excludePathPatterns("/api/lawss/sarBussionessStand/exportTemplateFile");
|
||||
|
||||
//doc文檔重新轉換
|
||||
addInterceptor.excludePathPatterns("/api/sarStandardsInfo/sar-standards-info/convertDocAll_GNW");
|
||||
addInterceptor.excludePathPatterns("/api/sarStandardsInfo/sar-standards-info/convertDocAll_QB");
|
||||
|
||||
+49
@@ -5,8 +5,11 @@ import com.adc.da.slrs.StandardQA.dao.AskQuestionsDao;
|
||||
import com.adc.da.slrs.StandardQA.entity.*;
|
||||
import com.adc.da.slrs.StandardQA.service.Impl.AskQuestionsServiceImpl;
|
||||
import com.adc.da.slrs.StandardQA.service.Impl.AskUserServiceImpl;
|
||||
import com.adc.da.slrs.StandardQA.service.Impl.ReplyServiceImpl;
|
||||
import com.adc.da.slrs.StandardQA.service.Impl.SubscriptionServiceImpl;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.impl.SarStandardsInfoServiceImpl;
|
||||
import com.adc.da.slrs.sarUser.dao.TsUserDao;
|
||||
import com.adc.da.slrs.sarUser.entity.TsUser;
|
||||
import com.adc.da.util.LoginUserUtil;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
@@ -41,6 +44,12 @@ public class AskQuestionsController extends BaseController<AskQuestions> {
|
||||
@Autowired
|
||||
private AskUserServiceImpl askUserService;
|
||||
|
||||
@Autowired
|
||||
private ReplyServiceImpl replyService;
|
||||
|
||||
@Autowired
|
||||
private TsUserDao tsUserDao;
|
||||
|
||||
@Autowired
|
||||
private SubscriptionServiceImpl subscriptionService;
|
||||
|
||||
@@ -262,4 +271,44 @@ public class AskQuestionsController extends BaseController<AskQuestions> {
|
||||
return Result.success(askQuestionsList);
|
||||
}
|
||||
|
||||
@PostMapping("/selectQuestionReplyInfo")
|
||||
public ResponseMessage selectQuestionReplyInfo(String id){
|
||||
List<Object> objects = new ArrayList<>();
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
AskQuestions askQuestions = askQuestionsService.getById(id);
|
||||
if(askQuestions!=null) {
|
||||
TsUser tsUser = tsUserDao.selectById(askQuestions.getQuestioner());
|
||||
if(tsUser!=null){
|
||||
askQuestions.setQuestioner(tsUser.getUname());
|
||||
}
|
||||
if(askQuestions.getClassification().equals("BUSINESS_STAND")){
|
||||
askQuestions.setClassification("企业标准");
|
||||
}
|
||||
if(askQuestions.getClassification().equals("FOREIGN")){
|
||||
askQuestions.setClassification("海外标准");
|
||||
}
|
||||
if(askQuestions.getClassification().equals("INLAND")){
|
||||
askQuestions.setClassification("国内标准");
|
||||
}
|
||||
if(askQuestions.getClassification().equals("OTHER")){
|
||||
askQuestions.setClassification("公共标准");
|
||||
}
|
||||
QueryWrapper<Reply> replyQueryWrapper = new QueryWrapper<>();
|
||||
replyQueryWrapper.eq("ASK_ID", id);
|
||||
List<Reply> list = replyService.list(replyQueryWrapper);
|
||||
if(!list.isEmpty()){
|
||||
for (Reply reply : list){
|
||||
TsUser ruser = tsUserDao.selectById(reply.getAnswerer());
|
||||
if(ruser!=null){
|
||||
reply.setAnswerer(ruser.getUname());
|
||||
}
|
||||
}
|
||||
}
|
||||
objects.add(askQuestions);
|
||||
objects.add(list);
|
||||
}
|
||||
}
|
||||
return Result.success(objects);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
-1
@@ -73,7 +73,6 @@ public class ReplyController extends BaseController<Reply> {
|
||||
return Result.success("200","归档成功",null);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/listByPage")
|
||||
public ResponseMessage updateReply(@RequestBody ReplyPage reply){
|
||||
return Result.success(replyService.listByPage(reply));
|
||||
@@ -90,4 +89,16 @@ public class ReplyController extends BaseController<Reply> {
|
||||
replyService.updateBatchById(replyList);
|
||||
return Result.success("200","编辑成功",null);
|
||||
}
|
||||
|
||||
@PostMapping("/selectListSize")
|
||||
public ResponseMessage selectListSize(String askId){
|
||||
//1:查询当前问题下是否有其他回答 如果是第一次回答则删除 其他人的代办任务,如果非第一次回答则跳过当前步骤
|
||||
QueryWrapper<Reply> replyQueryWrapper = new QueryWrapper<>();
|
||||
replyQueryWrapper.eq("ASK_ID",askId);
|
||||
List<Reply> list = replyService.list(replyQueryWrapper);
|
||||
if(list.isEmpty()){
|
||||
return Result.success(null);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.adc.da.slrs.StandardQA.controller;
|
||||
|
||||
import com.adc.da.slrs.StandardQA.service.SarAgenldAcceptButtonService;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/lawss/SarAgenldAcceptButton")
|
||||
@Api(description = "|SarAgenldAcceptButton|")
|
||||
public class SarAgenldAcceptButtonController {
|
||||
|
||||
@Autowired
|
||||
private SarAgenldAcceptButtonService sarAgenldAcceptButtonService;
|
||||
|
||||
@GetMapping("/selectIsNot")
|
||||
public String selectIsNot(String pid){
|
||||
return sarAgenldAcceptButtonService.selectIsNot(pid);
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public ResponseMessage add(String id){
|
||||
sarAgenldAcceptButtonService.add(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.adc.da.slrs.StandardQA.dao;
|
||||
|
||||
import com.adc.da.slrs.StandardQA.entity.SarAgenldAcceptButton;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface SarAgenldAcceptButtonDao extends BaseMapper<SarAgenldAcceptButton> {
|
||||
}
|
||||
@@ -68,4 +68,7 @@ public class Reply extends BaseEntity {
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ConvertMqEO> fileList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String taskId;
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.adc.da.slrs.StandardQA.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sar_agenld_accept_button")
|
||||
@ApiModel(value="SarAgenldAcceptButton对象", description="")
|
||||
@Data
|
||||
public class SarAgenldAcceptButton {
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId(value = "ID", type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
@TableField("TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
@TableField("TYPE")
|
||||
private String type;
|
||||
|
||||
@TableField("CREATE_TIME")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@TableField("UPDATE_TIME")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.adc.da.slrs.StandardQA.service.Impl;
|
||||
|
||||
import com.adc.da.slrs.StandardQA.dao.SarAgenldAcceptButtonDao;
|
||||
import com.adc.da.slrs.StandardQA.entity.SarAgenldAcceptButton;
|
||||
import com.adc.da.slrs.StandardQA.service.SarAgenldAcceptButtonService;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public class SarAgenldAcceptButtonServiceImpl extends ServiceImpl<SarAgenldAcceptButtonDao, SarAgenldAcceptButton> implements SarAgenldAcceptButtonService {
|
||||
|
||||
@Autowired
|
||||
private SarAgenldAcceptButtonDao sarAgenldAcceptButtonDao;
|
||||
|
||||
@Override
|
||||
public String selectIsNot(String pid){
|
||||
QueryWrapper<SarAgenldAcceptButton> objectQueryWrapper = new QueryWrapper<>();
|
||||
objectQueryWrapper.eq("TASK_ID",pid);
|
||||
List<SarAgenldAcceptButton> sarAgenldAcceptButtons = sarAgenldAcceptButtonDao.selectList(objectQueryWrapper);
|
||||
if(!sarAgenldAcceptButtons.isEmpty()){
|
||||
if(sarAgenldAcceptButtons.get(0).getType().equals("1")){
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
|
||||
public void add(String id) {
|
||||
SarAgenldAcceptButton sarAgenldAcceptButton = new SarAgenldAcceptButton();
|
||||
sarAgenldAcceptButton.setTaskId(id);
|
||||
sarAgenldAcceptButton.setType("1");
|
||||
sarAgenldAcceptButtonDao.insert(sarAgenldAcceptButton);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.adc.da.slrs.StandardQA.service;
|
||||
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
|
||||
public interface SarAgenldAcceptButtonService {
|
||||
|
||||
void add(String id);
|
||||
|
||||
String selectIsNot(String pid);
|
||||
}
|
||||
+21
-2
@@ -84,9 +84,24 @@ public class SarBussStandAttrInfoExecl extends BaseEntity {
|
||||
|
||||
private String xgjh;
|
||||
|
||||
//附件
|
||||
//发布稿附件
|
||||
private String fbgbuss;
|
||||
|
||||
//编制说明附件
|
||||
private String bzsmbuss;
|
||||
|
||||
//历史版本附件
|
||||
private String lsbbbuss;
|
||||
|
||||
//其他文件附件
|
||||
private String qtwjbuss;
|
||||
|
||||
//修改单附件
|
||||
private String xgd;
|
||||
|
||||
//关联文件附件
|
||||
private String glwjbuss;
|
||||
|
||||
//标准中文名称
|
||||
private String standName;
|
||||
|
||||
@@ -109,7 +124,7 @@ public class SarBussStandAttrInfoExecl extends BaseEntity {
|
||||
private String issueTime;
|
||||
|
||||
//标准编号
|
||||
private String standCode;
|
||||
private String standNumber;
|
||||
|
||||
//标准英文名称
|
||||
private String standEnName;
|
||||
@@ -171,6 +186,10 @@ public class SarBussStandAttrInfoExecl extends BaseEntity {
|
||||
//备案日期
|
||||
private String barq;
|
||||
|
||||
private String menuId;
|
||||
|
||||
private String standCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> attrInfoMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
+78
-5
@@ -1,6 +1,7 @@
|
||||
package com.adc.da.slrs.sarBussionessStand.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.adc.da.Log.BusinessType;
|
||||
import com.adc.da.Log.EpcLog;
|
||||
import com.adc.da.common.FileUnZip;
|
||||
@@ -21,6 +22,7 @@ import com.adc.da.http.PageInfo;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.util.LoginUserUtil;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.utils.IOUtils;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
@@ -31,8 +33,12 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -46,9 +52,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -416,9 +420,9 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
|
||||
|
||||
@ApiOperation(value = "导入功能")
|
||||
@PostMapping("/importSarBussionessStandFile")
|
||||
public ResponseMessage<String> importSarBussionessStandFile(@RequestParam(value = "file",required = false)MultipartFile file) throws Exception{
|
||||
public ResponseMessage<String> importSarBussionessStandFile(@RequestParam(value = "file",required = false)MultipartFile file,String menuId,String userId) throws Exception{
|
||||
|
||||
return sarBussionessStandEOService.importSarBussionessStandFile(file);
|
||||
return sarBussionessStandEOService.importSarBussionessStandFile(file,menuId,userId);
|
||||
}
|
||||
@ApiOperation(value = "|SarBussionessStand|判断原文译文")
|
||||
@GetMapping("/emptyFileAnewStorage")
|
||||
@@ -437,5 +441,74 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
|
||||
public ResponseMessage newRpetitionFile (){
|
||||
return sarBussionessStandEOService.newRpetitionFile();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SarBussionessStand|导入模板下载")
|
||||
@GetMapping("/exportTemplateFile")
|
||||
public void exportTemplateFile(String fileName,HttpServletResponse response, HttpServletRequest request)throws Exception{
|
||||
|
||||
OutputStream os = null;
|
||||
OutputStream excelOS = null;
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
String fileOriName = "标准导入模板";
|
||||
if (org.apache.commons.lang3.StringUtils.isNotEmpty(fileName)) {
|
||||
fileOriName = fileName;
|
||||
}
|
||||
try{
|
||||
//创建临时文件夹
|
||||
String fileNowPath = filePath + "/tempZip/" + UUIDUtils.randomUUID20() + "/" + fileOriName;
|
||||
File nowFile = new File(fileNowPath);
|
||||
if (nowFile.exists()){
|
||||
nowFile.delete();
|
||||
}
|
||||
nowFile.mkdirs();
|
||||
String fileName2 = "导入模板.xls";
|
||||
HSSFSheet sheetItems = workbook.createSheet("模板");
|
||||
sheetItems.setDefaultColumnWidth(16);
|
||||
Row rowHeader = sheetItems.createRow(1);//开始创建标题行
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(0, 0, 0, 25));
|
||||
Row row2 = sheetItems.createRow(0);//开始创建填写说明
|
||||
String exportFieldName = FieldConvertUtil.exportFieldName;
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(exportFieldName)) {
|
||||
String[] headerArr = exportFieldName.split(",");
|
||||
for (int i=0;i < headerArr.length; i++) {
|
||||
rowHeader.createCell(i).setCellValue(headerArr[i]);
|
||||
}
|
||||
}
|
||||
Cell cellA2 = row2.createCell(0);
|
||||
cellA2.setCellValue(FieldConvertUtil.exportName);
|
||||
//sheetItems.setColumnWidth(0, 20 * 150);
|
||||
row2.setHeight((short) (100 * 25));
|
||||
HSSFCellStyle cellStyle =workbook.createCellStyle();
|
||||
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.TOP);
|
||||
cellStyle.setWrapText(true);
|
||||
cellA2.setCellStyle(cellStyle);
|
||||
String repFileName = fileName2.replaceAll("/","_");
|
||||
excelOS = new FileOutputStream(fileNowPath + "/" + repFileName);
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\""+ ReadExcel.encodeFileName(fileOriName+".zip", request) +"\"");
|
||||
response.setContentType("application/force-download");
|
||||
response.flushBuffer();
|
||||
os = response.getOutputStream();
|
||||
workbook.write(excelOS);
|
||||
excelOS.flush();
|
||||
excelOS.close();
|
||||
ZipUtil.zip(fileNowPath,fileNowPath+".zip");
|
||||
FileInputStream fis = new FileInputStream(fileNowPath+".zip");
|
||||
int len = 0;
|
||||
while ((len = fis.read()) != -1) {
|
||||
os.write(len);
|
||||
}
|
||||
os.flush();
|
||||
os.close(); // 后开先关
|
||||
fis.close(); // 先开后关
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new com.adc.da.exception.AdcDaBaseException("下载文件失败,请重试");
|
||||
} finally {
|
||||
org.apache.poi.util.IOUtils.closeQuietly(os);
|
||||
org.apache.poi.util.IOUtils.closeQuietly(excelOS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -126,5 +126,8 @@ public interface SarBussionessStandDao extends BaseMapper<SarBussionessStand> {
|
||||
List<OldSystem> getBussionessStandInfo();
|
||||
|
||||
void updateByIdInfo(@Param("strFile")String strFile, @Param("attfId")String attfId);
|
||||
|
||||
@Select("select * from sar")
|
||||
String setDtqbbhbuss(String dtqbbhbuss);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
|
||||
void checkFileByEncrypt();
|
||||
ResponseMessage emptyFileAnewStorage(String type);
|
||||
|
||||
ResponseMessage<String> importSarBussionessStandFile(MultipartFile file)throws Exception;
|
||||
ResponseMessage<String> importSarBussionessStandFile(MultipartFile file,String menuId,String userId)throws Exception;
|
||||
|
||||
ResponseMessage repetitionFile();
|
||||
|
||||
|
||||
+770
-273
File diff suppressed because it is too large
Load Diff
@@ -59,4 +59,7 @@ public interface ITsResourceService extends IService<TsResource> {
|
||||
List<String> getChildMenuList(String menuId);
|
||||
|
||||
boolean dealWithData();
|
||||
|
||||
List<TsResource> getByMenuId(String menuId)throws Exception;
|
||||
|
||||
}
|
||||
|
||||
+9
@@ -1,5 +1,6 @@
|
||||
package com.adc.da.slrs.sarResource.service.impl;
|
||||
|
||||
import com.adc.da.exception.AdcDaBaseException;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
|
||||
@@ -490,6 +491,14 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TsResource> getByMenuId(String menuId) throws Exception{
|
||||
QueryWrapper<TsResource> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("ID",menuId);
|
||||
List<TsResource> tsResources = baseMapper.selectList(queryWrapper);
|
||||
return tsResources;
|
||||
}
|
||||
|
||||
public boolean dealData(TsResource tsResource,Map<String,TsResource> map){
|
||||
if (null!=tsResource.getParentId() && !"".equals(tsResource.getParentId()) && !"0".equals(tsResource.getParentId())){
|
||||
tsResource.setParentIds(tsResource.getParentIds()+tsResource.getParentId()+",");
|
||||
|
||||
@@ -72,4 +72,7 @@ public interface TsUserDao extends BaseMapper<TsUser> {
|
||||
Integer selectUserByRole(@Param("role") RoleUserDTO roleSelectDTO);
|
||||
|
||||
List<TsUser> selectUserByRoleByPage(@Param("role") RoleUserDTO roleSelectDTO);
|
||||
|
||||
@Select("select UNAME from ts_user where USID = #{userId}")
|
||||
String selectByName(String userId);
|
||||
}
|
||||
|
||||
@@ -90,4 +90,6 @@ public interface ITsUserService extends IService<TsUser> {
|
||||
List<UpDTO> selectNameById(List<String> strings,String type);
|
||||
|
||||
IPage<TsUser> getAllUsers(TsUser tsUser);
|
||||
|
||||
String userIdByName(String userId);
|
||||
}
|
||||
|
||||
@@ -522,5 +522,11 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
|
||||
return tsUserPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String userIdByName(String userId) {
|
||||
String userName = tsUserDao.selectByName(userId);
|
||||
return userName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.adc.da.slrs.sarVppsTree.dao;
|
||||
|
||||
import com.adc.da.slrs.sarVppsTree.entity.SarVppsTree;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +15,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface SarVppsTreeDao extends BaseMapper<SarVppsTree> {
|
||||
|
||||
@Select("select sar_vpps_tree.CHINESE_NAME from sar_vpps_tree where sar_vpps_tree.VPPS_CODE = #{cycvppsbmbuss} and sar_vpps_tree.TYPE = 'car';")
|
||||
String getCycvppscnbuss(@Param("cycvppsbmbuss") String cycvppsbmbuss);
|
||||
|
||||
@Select("select sar_vpps_tree.CHINESE_NAME from sar_vpps_tree where sar_vpps_tree.VPPS_CODE = #{kcvppsbmbuss} and sar_vpps_tree.TYPE = 'truck';")
|
||||
String getKcvppscnbuss(@Param("kcvppsbmbuss") String kcvppsbmbuss);
|
||||
}
|
||||
|
||||
+30
-3
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ZipUtil;
|
||||
import com.adc.da.att.controller.AttFileEOController;
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.att.util.CommonExportUtil;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.common.ConvertHtml2Excel;
|
||||
import com.adc.da.common.FileUnZip;
|
||||
@@ -546,8 +547,7 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
// 导入参数设置,默认即可
|
||||
ImportParams params = new ImportParams();
|
||||
try {
|
||||
String fields[] = {"条款号", "条款名称","内容简介","责任部门",
|
||||
"FO","责任工程师","SVPPS","适用车辆类型","要求类型","企标覆盖关系"};
|
||||
String fields[] = {"条款号", "条款名称","条款内容","条款附件"};
|
||||
params.setImportFields(fields);
|
||||
List<SarFileSplitItemsImportDto> result = new ArrayList<>();
|
||||
// 解析excel,并返回校验信息
|
||||
@@ -583,6 +583,12 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
//是则不读取
|
||||
continue;
|
||||
}
|
||||
//判断此行数据是否全部为空
|
||||
if(sarStandImportDto.getItemsNum().contains("模板说明")){
|
||||
i++;
|
||||
//是则不读取
|
||||
continue;
|
||||
}
|
||||
i = 0;
|
||||
datasUpdate.add(sarStandImportDto);
|
||||
}
|
||||
@@ -658,5 +664,26 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
return Result.error("0", "该条数据标准号在标准库中不存在");
|
||||
}
|
||||
|
||||
|
||||
//导入模板下载
|
||||
@ApiOperation(value = "拆分导入模板下载")
|
||||
@GetMapping(value = "/exportTemplate")
|
||||
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
String[] headers = { "条款号","条款名称","条款内容","条款附件"};
|
||||
try{
|
||||
String fileName = "拆分导入模板下载/导入模板";
|
||||
StringBuilder descBuilder = new StringBuilder()
|
||||
.append("模板说明:")
|
||||
.append("\n")
|
||||
.append("1:条款号,条款名称,条款内容不能为空")
|
||||
.append("\n")
|
||||
.append("2:将附件存放在zip格式的文件夹中,名称与后缀输入于附件中即可")
|
||||
.append("\n")
|
||||
.append("3:图片格式格式为jpg")
|
||||
.append("\n");
|
||||
//生成模板
|
||||
CommonExportUtil.exportTemplate(fileName,headers,descBuilder.toString(), response,request);
|
||||
}catch (Exception e){
|
||||
throw new AdcDaBaseException("下载文件失败,请重试");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-108
@@ -1,12 +1,14 @@
|
||||
package com.adc.da.slrs.standardSplit.dto;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yangxuenan
|
||||
* date: 2020/5/9 14:40
|
||||
*/
|
||||
@Data
|
||||
public class SarFileSplitItemsImportDto {
|
||||
@Excel(name = "条款号", orderNum = "1")
|
||||
private String itemsNum;
|
||||
@@ -14,32 +16,35 @@ public class SarFileSplitItemsImportDto {
|
||||
@Excel(name = "条款名称", orderNum = "1")
|
||||
private String itemsName;
|
||||
|
||||
@Excel(name = "内容简介", orderNum = "1")
|
||||
@Excel(name = "条款附件", orderNum = "1")
|
||||
private String itermsConditions;
|
||||
|
||||
@Excel(name = "责任部门", orderNum = "1")
|
||||
private String responsibleUnit;
|
||||
// @Excel(name = "责任部门", orderNum = "1")
|
||||
// private String responsibleUnit;
|
||||
|
||||
@Excel(name = "条款内容", orderNum = "1")
|
||||
private String mag;
|
||||
|
||||
// @Excel(name = "责任部门", orderNum = "1")
|
||||
private String newcarPutTime;
|
||||
// private String newcarPutTime;
|
||||
|
||||
@Excel(name = "FO", orderNum = "1")
|
||||
private String fo;
|
||||
// @Excel(name = "FO", orderNum = "1")
|
||||
// private String fo;
|
||||
|
||||
@Excel(name = "责任工程师", orderNum = "1")
|
||||
private String dutyEngineer;
|
||||
// @Excel(name = "责任工程师", orderNum = "1")
|
||||
// private String dutyEngineer;
|
||||
//
|
||||
// @Excel(name = "SVPPS", orderNum = "1")
|
||||
// private String svpps;
|
||||
|
||||
@Excel(name = "SVPPS", orderNum = "1")
|
||||
private String svpps;
|
||||
|
||||
@Excel(name = "适用车辆类型", orderNum = "1")
|
||||
private String applyArctic;
|
||||
|
||||
@Excel(name = "要求类型", orderNum = "1")
|
||||
private String claimType;
|
||||
|
||||
@Excel(name = "企标覆盖关系", orderNum = "1")
|
||||
private String busStandCover;
|
||||
// @Excel(name = "适用车辆类型", orderNum = "1")
|
||||
// private String applyArctic;
|
||||
//
|
||||
// @Excel(name = "要求类型", orderNum = "1")
|
||||
// private String claimType;
|
||||
//
|
||||
// @Excel(name = "企标覆盖关系", orderNum = "1")
|
||||
// private String busStandCover;
|
||||
|
||||
|
||||
|
||||
@@ -56,93 +61,4 @@ public class SarFileSplitItemsImportDto {
|
||||
// private String relevanceFile;
|
||||
//
|
||||
// private String relevanceFileName;
|
||||
|
||||
|
||||
public String getItemsNum() {
|
||||
return itemsNum;
|
||||
}
|
||||
|
||||
public void setItemsNum(String itemsNum) {
|
||||
this.itemsNum = itemsNum;
|
||||
}
|
||||
|
||||
public String getItemsName() {
|
||||
return itemsName;
|
||||
}
|
||||
|
||||
public void setItemsName(String itemsName) {
|
||||
this.itemsName = itemsName;
|
||||
}
|
||||
|
||||
public String getItermsConditions() {
|
||||
return itermsConditions;
|
||||
}
|
||||
|
||||
public void setItermsConditions(String itermsConditions) {
|
||||
this.itermsConditions = itermsConditions;
|
||||
}
|
||||
|
||||
public String getResponsibleUnit() {
|
||||
return responsibleUnit;
|
||||
}
|
||||
|
||||
public void setResponsibleUnit(String responsibleUnit) {
|
||||
this.responsibleUnit = responsibleUnit;
|
||||
}
|
||||
|
||||
public String getNewcarPutTime() {
|
||||
return newcarPutTime;
|
||||
}
|
||||
|
||||
public void setNewcarPutTime(String newcarPutTime) {
|
||||
this.newcarPutTime = newcarPutTime;
|
||||
}
|
||||
|
||||
public String getFo() {
|
||||
return fo;
|
||||
}
|
||||
|
||||
public void setFo(String fo) {
|
||||
this.fo = fo;
|
||||
}
|
||||
|
||||
public String getDutyEngineer() {
|
||||
return dutyEngineer;
|
||||
}
|
||||
|
||||
public void setDutyEngineer(String dutyEngineer) {
|
||||
this.dutyEngineer = dutyEngineer;
|
||||
}
|
||||
|
||||
public String getSvpps() {
|
||||
return svpps;
|
||||
}
|
||||
|
||||
public void setSvpps(String svpps) {
|
||||
this.svpps = svpps;
|
||||
}
|
||||
|
||||
public String getApplyArctic() {
|
||||
return applyArctic;
|
||||
}
|
||||
|
||||
public void setApplyArctic(String applyArctic) {
|
||||
this.applyArctic = applyArctic;
|
||||
}
|
||||
|
||||
public String getClaimType() {
|
||||
return claimType;
|
||||
}
|
||||
|
||||
public void setClaimType(String claimType) {
|
||||
this.claimType = claimType;
|
||||
}
|
||||
|
||||
public String getBusStandCover() {
|
||||
return busStandCover;
|
||||
}
|
||||
|
||||
public void setBusStandCover(String busStandCover) {
|
||||
this.busStandCover = busStandCover;
|
||||
}
|
||||
}
|
||||
|
||||
+44
-4
@@ -15,10 +15,11 @@ import com.adc.da.common.ReadWordTable;
|
||||
import com.adc.da.slrs.standardSplit.entity.*;
|
||||
import com.adc.da.slrs.standardSplit.service.SarFileSplitInfoEOService;
|
||||
import com.adc.da.sys.common.SelectionResult;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.sys.entity.DicTypeEO;
|
||||
import com.adc.da.sys.service.IDicTypeEOService;
|
||||
import com.adc.da.sys.util.LoginUserUtil;
|
||||
import com.adc.da.sys.util.UUIDUtils;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -37,7 +38,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.adc.da.common.SplitFilePragraTypeEnum;
|
||||
|
||||
@@ -94,6 +94,10 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
||||
private SarFileSplitItemsParamsEODao sarFileSplitItemsParamsEODao;
|
||||
@Autowired
|
||||
private SarFileSplitInfoEODao dao;
|
||||
@Autowired
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
@Autowired
|
||||
private IDicTypeEOService dicTypeEOService;
|
||||
|
||||
@Override
|
||||
public List<SarFileSplitInfoEO> queryByPage(BasePage page) throws Exception{
|
||||
@@ -184,8 +188,9 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
||||
String regex = "^[0-9]*$";
|
||||
for (IBodyElement element : elements) {
|
||||
// 段落
|
||||
XWPFParagraph p = null;
|
||||
if (element instanceof XWPFParagraph) {
|
||||
XWPFParagraph p = (XWPFParagraph)element;
|
||||
p = (XWPFParagraph)element;
|
||||
|
||||
// 处理段落生成编号不识别问题
|
||||
String paragraphString = p.getText();
|
||||
@@ -660,8 +665,36 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
||||
}
|
||||
|
||||
private void addItermsConditionsOfTable(SarFileSplitItemsEO message, List<SarFileSplitItemsValEO> itemsValList, XWPFTable table) throws IOException {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder tabaleStringNew = new StringBuilder("");
|
||||
//将表格转为html字符串
|
||||
int numberOfRows = table.getNumberOfRows();
|
||||
for (int i = 0; i <numberOfRows ; i++) {
|
||||
List<XWPFTableCell> tableCells = table.getRow(i).getTableCells();
|
||||
for (int j = 0; j <tableCells.size() ; j++) {
|
||||
List<XWPFParagraph> paragraphs = tableCells.get(j).getParagraphs();
|
||||
for (XWPFParagraph data : paragraphs){
|
||||
for (XWPFRun xwrun : data.getRuns()) {
|
||||
VerticalAlign subscript = xwrun.getSubscript();
|
||||
String smalltext = xwrun.getText(0);
|
||||
if (ObjectUtils.isNotEmpty(smalltext)) {
|
||||
switch (subscript) {
|
||||
case BASELINE:
|
||||
xwrun.setText(smalltext);
|
||||
break;
|
||||
case SUBSCRIPT:
|
||||
xwrun.setText("<span class=sub>" + smalltext + "</span>");
|
||||
break;
|
||||
case SUPERSCRIPT:
|
||||
xwrun.setText("<span class=sup>" + smalltext + "</span>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReadWordTable readWordTable = new ReadWordTable();
|
||||
String tableStr = readWordTable.readTable(table);
|
||||
tabaleStringNew.append(tableStr);
|
||||
@@ -709,6 +742,13 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
for (SarFileSplitInfoEO data : rows){
|
||||
List<DicTypeEO> dicTypeEO = dicTypeEODao.selectPidByCode(data.getFileType());
|
||||
if(dicTypeEO!=null){
|
||||
data.setFileTypeShow(dicTypeEO.get(0).getDicTypeName());
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
+174
-152
@@ -71,6 +71,9 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
@Autowired
|
||||
private SarFileSplitInfoEOService sarFileSplitInfoEOService;
|
||||
|
||||
@Value("${elasticsearch.img}")
|
||||
private String elasticsearchImg;//图片拆分自调地址
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getByPage(SarFileSplitItemsEOPage page) {
|
||||
@@ -468,7 +471,6 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
}else {
|
||||
infoId = UUIDUtils.randomUUID20();
|
||||
}
|
||||
//验证导入数据是否符合规则
|
||||
Map map = validateImportDatas(list,filepath);
|
||||
boolean isOk = (boolean) map.get("result");
|
||||
if (!isOk) {
|
||||
@@ -530,12 +532,13 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(nowfilelist.get(0));
|
||||
if(attFileVo!=null){
|
||||
if (attFileVo != null) {
|
||||
isText = false;
|
||||
String path = "file" + attFileVo.getFilePath()+attFileVo.getFileName();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + path + "\'>";
|
||||
//String path = "E:/data/slrs/file" + attFileVo.getFilePath()+attFileVo.getOldFileName();
|
||||
String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + pathSrc + "\'>";
|
||||
valEO.setType("IMG");
|
||||
valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(imgCon + "<p>" + importDto.getMag() + "<p>");
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -564,12 +567,13 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(nowfilelist.get(0));
|
||||
if(attFileVo!=null){
|
||||
if (attFileVo != null) {
|
||||
isText = false;
|
||||
String path = "file" + attFileVo.getFilePath()+attFileVo.getFileName();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + path + "\'>";
|
||||
//String path = "E:/data/slrs/file" + attFileVo.getFilePath()+attFileVo.getOldFileName();
|
||||
String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + pathSrc + "\'>";
|
||||
valEO.setType("IMG");
|
||||
valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(imgCon + "<p>" + importDto.getMag() + "<p>");
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -600,12 +604,13 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(nowfilelist.get(0));
|
||||
if(attFileVo!=null){
|
||||
if (attFileVo != null) {
|
||||
isText = false;
|
||||
String path = "file" + attFileVo.getFilePath()+attFileVo.getFileName();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + path + "\'>";
|
||||
//String path = "E:/data/slrs/file" + attFileVo.getFilePath()+attFileVo.getOldFileName();
|
||||
String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + pathSrc + "\'>";
|
||||
valEO.setType("IMG");
|
||||
valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(imgCon + "<p>" + importDto.getMag() + "<p>");
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -629,6 +634,7 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
sarFileSplitInfoEO.setValidFlag(0);
|
||||
sarFileSplitInfoEO.setResult("1");
|
||||
sarFileSplitInfoEO.setModifyUser(LoginUserUtil.getUserId());
|
||||
sarFileSplitInfoEO.setStandId(sarFileSplitInfoEO.getStandId());
|
||||
sarFileSplitInfoEOService.insertSelective(sarFileSplitInfoEO);
|
||||
}
|
||||
|
||||
@@ -640,6 +646,14 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
menuPidMap.put("总目录",menuid );
|
||||
}
|
||||
for (SarFileSplitItemsEO itemsEO : addItemsEOList) {
|
||||
List<SarFileSplitItemsValEO> itemValEOList = itemsEO.getItemValEOList();
|
||||
if(itemValEOList!=null){
|
||||
String tupian = "";
|
||||
for (SarFileSplitItemsValEO data : itemValEOList){
|
||||
tupian = tupian+data.getItemContent();
|
||||
}
|
||||
itemsEO.setItermsConditions(tupian);
|
||||
}
|
||||
String menuIdT = createItemsInfo(itemsEO,infoId,countSuccess,menuPidMap);
|
||||
menuPidMap.put(itemsEO.getItemsNum(),menuIdT);
|
||||
countSuccess++;
|
||||
@@ -724,6 +738,11 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
int num = 0; //记录是第几条数据
|
||||
//循环验证数据
|
||||
for (SarFileSplitItemsImportDto dto : datas) {
|
||||
|
||||
if(dto.getItemsNum().contains("模板说明")){
|
||||
continue;
|
||||
}
|
||||
|
||||
i++;
|
||||
int countError = 0; //记录失败数据数量
|
||||
DicTypeEO dic = new DicTypeEO();
|
||||
@@ -755,148 +774,151 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
String saveApplyCode = "";
|
||||
if (StringUtils.isNotEmpty(dto.getApplyArctic())) {
|
||||
dto.setApplyArctic(dto.getApplyArctic().replace(",", ","));
|
||||
String applys[] = dto.getApplyArctic().split(",");
|
||||
if(applys.length>20){
|
||||
errorMsg += "适用车型选项不能超过20个;";
|
||||
countError++;
|
||||
} else if (dto.getApplyArctic().length() > 500) {
|
||||
errorMsg += "适用车型不能超过500个字符;";
|
||||
countError++;
|
||||
} else {
|
||||
Set set = new HashSet();
|
||||
for (int a = 0; a < applys.length; a++) {
|
||||
dic.setDicTypeName(applys[a]);
|
||||
dic.setDicTypeCode("ENERGYTYPES");
|
||||
getDic = dicTypeEODao.getDicTypeByDicTypeName(dic);
|
||||
if (getDic.size() == 1) {
|
||||
saveApplyCode += getDic.get(0).getDicTypeCode() + ",";
|
||||
} else if (getDic.size() > 0) {
|
||||
errorMsg += "适用车型" + applys[a] + "不明确;";
|
||||
countError++;
|
||||
break;
|
||||
} else {
|
||||
errorMsg += "适用车型" + applys[a] + "不存在;";
|
||||
countError++;
|
||||
break;
|
||||
}
|
||||
set.add(applys[a]);
|
||||
if (a==applys.length-1 && applys.length != set.size()){
|
||||
errorMsg += "适用车型存在重复数据;";
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
if (!saveApplyCode.equals("")){
|
||||
dto.setApplyArctic(saveApplyCode.substring(0,saveApplyCode.length()-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!claimStypelist.contains(dto.getClaimType())) {
|
||||
if (StringUtils.isNotEmpty(dto.getClaimType())) {
|
||||
dic.setDicTypeName(dto.getClaimType());
|
||||
dic.setDicTypeCode("REQUESTTYPE");
|
||||
if (dto.getClaimType().length() > 500) {
|
||||
errorMsg += "要求类型不能超过500个字符;";
|
||||
countError++;
|
||||
} else {
|
||||
getDic = dicTypeEODao.getDicTypeByDicTypeName(dic);
|
||||
Set set = new HashSet();
|
||||
if (getDic != null) {
|
||||
if (getDic.size() == 1) {
|
||||
dto.setClaimType(getDic.get(0).getDicTypeCode());
|
||||
claimStypelist.add(getDic.get(0).getDicTypeCode());
|
||||
} else if (getDic.size() > 0) {
|
||||
errorMsg += "要求类型不明确;";
|
||||
countError++;
|
||||
} else {
|
||||
errorMsg += "要求类型不存在;";
|
||||
countError++;
|
||||
}
|
||||
} else {
|
||||
errorMsg += "要求类型不存在;";
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(dto.getItermsConditions())){
|
||||
if(dto.getItermsConditions().length() > 50000){
|
||||
errorMsg += "内容简介不能超过50000个字符;";
|
||||
// String saveApplyCode = "";
|
||||
// if (StringUtils.isNotEmpty(dto.getApplyArctic())) {
|
||||
// dto.setApplyArctic(dto.getApplyArctic().replace(",", ","));
|
||||
// String applys[] = dto.getApplyArctic().split(",");
|
||||
// if(applys.length>20){
|
||||
// errorMsg += "适用车型选项不能超过20个;";
|
||||
// countError++;
|
||||
// } else if (dto.getApplyArctic().length() > 500) {
|
||||
// errorMsg += "适用车型不能超过500个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// Set set = new HashSet();
|
||||
// for (int a = 0; a < applys.length; a++) {
|
||||
// dic.setDicTypeName(applys[a]);
|
||||
// dic.setDicTypeCode("ENERGYTYPES");
|
||||
// getDic = dicTypeEODao.getDicTypeByDicTypeName(dic);
|
||||
// if (getDic.size() == 1) {
|
||||
// saveApplyCode += getDic.get(0).getDicTypeCode() + ",";
|
||||
// } else if (getDic.size() > 0) {
|
||||
// errorMsg += "适用车型" + applys[a] + "不明确;";
|
||||
// countError++;
|
||||
// break;
|
||||
// } else {
|
||||
// errorMsg += "适用车型" + applys[a] + "不存在;";
|
||||
// countError++;
|
||||
// break;
|
||||
// }
|
||||
// set.add(applys[a]);
|
||||
// if (a==applys.length-1 && applys.length != set.size()){
|
||||
// errorMsg += "适用车型存在重复数据;";
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// if (!saveApplyCode.equals("")){
|
||||
// dto.setApplyArctic(saveApplyCode.substring(0,saveApplyCode.length()-1));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(!claimStypelist.contains(dto.getClaimType())) {
|
||||
// if (StringUtils.isNotEmpty(dto.getClaimType())) {
|
||||
// dic.setDicTypeName(dto.getClaimType());
|
||||
// dic.setDicTypeCode("REQUESTTYPE");
|
||||
// if (dto.getClaimType().length() > 500) {
|
||||
// errorMsg += "要求类型不能超过500个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// getDic = dicTypeEODao.getDicTypeByDicTypeName(dic);
|
||||
// Set set = new HashSet();
|
||||
// if (getDic != null) {
|
||||
// if (getDic.size() == 1) {
|
||||
// dto.setClaimType(getDic.get(0).getDicTypeCode());
|
||||
// claimStypelist.add(getDic.get(0).getDicTypeCode());
|
||||
// } else if (getDic.size() > 0) {
|
||||
// errorMsg += "要求类型不明确;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// errorMsg += "要求类型不存在;";
|
||||
// countError++;
|
||||
// }
|
||||
// } else {
|
||||
// errorMsg += "要求类型不存在;";
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (StringUtils.isEmpty(dto.getMag())) {
|
||||
errorMsg += "条款内容不能为空;";
|
||||
countError++;
|
||||
} else {
|
||||
if(dto.getMag().length() > 50000){
|
||||
errorMsg += "条款内容不能超过50000个字符;";
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
if(!foList.contains(dto.getFo())) {
|
||||
if (StringUtils.isNotEmpty(dto.getFo())) {
|
||||
if (dto.getFo().length() > 200) {
|
||||
errorMsg += "FO不能超过200个字符;";
|
||||
countError++;
|
||||
} else {
|
||||
String uname = roleEODao.getIdsByNames(dto.getFo().split(","));
|
||||
if (StringUtils.isNotBlank(uname)) {
|
||||
dto.setFo(uname);
|
||||
foList.addAll(Arrays.asList(uname.split(",")));
|
||||
} else {
|
||||
errorMsg += "FO不存在;";
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!dutyEngineerList.contains(dto.getDutyEngineer())) {
|
||||
if (StringUtils.isNotEmpty(dto.getDutyEngineer())) {
|
||||
if (dto.getDutyEngineer().length() > 100) {
|
||||
errorMsg += "责任工程师不能超过100个字符;";
|
||||
countError++;
|
||||
} else {
|
||||
String emList = roleEODao.getIdsByNames(dto.getDutyEngineer().split(","));
|
||||
if (StringUtils.isNotBlank(emList)) {
|
||||
dto.setDutyEngineer(emList);
|
||||
dutyEngineerList.addAll(Arrays.asList(dto.getDutyEngineer().split(",")));
|
||||
} else {
|
||||
errorMsg += "系统中没有用户:" + dto.getDutyEngineer();
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(dto.getSvpps())){
|
||||
if(dto.getSvpps().length() > 200){
|
||||
errorMsg += "SVPPS不能超过200个字符;";
|
||||
countError++;
|
||||
}else {
|
||||
String svppsShow = sysInfoEOService.getSvppsIdByName(dto.getSvpps());
|
||||
dto.setSvpps(svppsShow);
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(dto.getBusStandCover())){
|
||||
if(dto.getBusStandCover().length() > 200){
|
||||
errorMsg += "企标覆盖关系不能超过200个字符;";
|
||||
countError++;
|
||||
}else {
|
||||
List<DicTypeEO> getDicType = dicTypeEODao.getDicTypeByDicCode("BZFGGXOUIUJ");
|
||||
for (DicTypeEO dicTypeEO:getDicType) {
|
||||
if (dicTypeEO.getDicTypeName().equals(dto.getBusStandCover())){
|
||||
dto.setBusStandCover(dicTypeEO.getDicTypeCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(dto.getResponsibleUnit())){
|
||||
if(dto.getResponsibleUnit().length() > 100){
|
||||
errorMsg += "责任部门不能超过100个字符;";
|
||||
countError++;
|
||||
}else {
|
||||
String id = sysInfoEOService.getOrgIdByName(dto.getResponsibleUnit(),"DEPART");
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
dto.setResponsibleUnit(id);
|
||||
} else {
|
||||
errorMsg += "系统中没有部门"+dto.getResponsibleUnit();
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(!foList.contains(dto.getFo())) {
|
||||
// if (StringUtils.isNotEmpty(dto.getFo())) {
|
||||
// if (dto.getFo().length() > 200) {
|
||||
// errorMsg += "FO不能超过200个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// String uname = roleEODao.getIdsByNames(dto.getFo().split(","));
|
||||
// if (StringUtils.isNotBlank(uname)) {
|
||||
// dto.setFo(uname);
|
||||
// foList.addAll(Arrays.asList(uname.split(",")));
|
||||
// } else {
|
||||
// errorMsg += "FO不存在;";
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(!dutyEngineerList.contains(dto.getDutyEngineer())) {
|
||||
// if (StringUtils.isNotEmpty(dto.getDutyEngineer())) {
|
||||
// if (dto.getDutyEngineer().length() > 100) {
|
||||
// errorMsg += "责任工程师不能超过100个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// String emList = roleEODao.getIdsByNames(dto.getDutyEngineer().split(","));
|
||||
// if (StringUtils.isNotBlank(emList)) {
|
||||
// dto.setDutyEngineer(emList);
|
||||
// dutyEngineerList.addAll(Arrays.asList(dto.getDutyEngineer().split(",")));
|
||||
// } else {
|
||||
// errorMsg += "系统中没有用户:" + dto.getDutyEngineer();
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(StringUtils.isNotEmpty(dto.getSvpps())){
|
||||
// if(dto.getSvpps().length() > 200){
|
||||
// errorMsg += "SVPPS不能超过200个字符;";
|
||||
// countError++;
|
||||
// }else {
|
||||
// String svppsShow = sysInfoEOService.getSvppsIdByName(dto.getSvpps());
|
||||
// dto.setSvpps(svppsShow);
|
||||
// }
|
||||
// }
|
||||
// if(StringUtils.isNotEmpty(dto.getBusStandCover())){
|
||||
// if(dto.getBusStandCover().length() > 200){
|
||||
// errorMsg += "企标覆盖关系不能超过200个字符;";
|
||||
// countError++;
|
||||
// }else {
|
||||
// List<DicTypeEO> getDicType = dicTypeEODao.getDicTypeByDicCode("BZFGGXOUIUJ");
|
||||
// for (DicTypeEO dicTypeEO:getDicType) {
|
||||
// if (dicTypeEO.getDicTypeName().equals(dto.getBusStandCover())){
|
||||
// dto.setBusStandCover(dicTypeEO.getDicTypeCode());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(StringUtils.isNotBlank(dto.getResponsibleUnit())){
|
||||
// if(dto.getResponsibleUnit().length() > 100){
|
||||
// errorMsg += "责任部门不能超过100个字符;";
|
||||
// countError++;
|
||||
// }else {
|
||||
// String id = sysInfoEOService.getOrgIdByName(dto.getResponsibleUnit(),"DEPART");
|
||||
// if(StringUtils.isNotBlank(id)){
|
||||
// dto.setResponsibleUnit(id);
|
||||
// } else {
|
||||
// errorMsg += "系统中没有部门"+dto.getResponsibleUnit();
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (countError > 0) {
|
||||
stringMessage.add(errorMsg);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,18 @@ public class FieldConvertUtil {
|
||||
"在产车实施日期(项目),EOP实施日期(项目),实施说明,认证交付物,认证对象,监管类型,适用车辆类型,责任部门,相关部门,FO,项目评估角色," +
|
||||
"文本说明,标签,要求类型,清单类型,入库模块";
|
||||
|
||||
public static String exportName = "填写说明\n" +
|
||||
"1.导入数据从第三行开始,第一行为填写说明,第二行为表头,第三行是正式数据\n" +
|
||||
"2.所有带*号的字段必须填写\n" +
|
||||
"3.企标类别(例如:BZJ、FT、Q-HD、Q-IOUM、Q/ASB、Q/BFC、Q/BQB等),文本状态(包含:发布、被代替、参考、即将实施、有效、直接上传、作废、待修订-指的其他企业标准),采用标准(包含:IDT等同采用、NEQ非等效采用、MOD修改采用)字段是单选属性,必须和系统中的对应字段选项相匹配\n" +
|
||||
"4.适用车型,能源类型,适用产品线字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文逗号分割\n" +
|
||||
"5.发布日期,企标实施日期字段为年-月-日格式,必须精确到日,例如(2023-04-01)\n" +
|
||||
"6.企标编号,企标名称,企标英文名称字段为文本,填写文本内容\n" +
|
||||
"7.关联模块-乘用车VPPS编码和关联模块--卡车VPPS编码是填写数据库中已有的编码从而带出乘用车VPPS名称和卡车VPPS名称\n" +
|
||||
"8.发布稿,编制说明,历史版本,其他文件,修改单,关联文件为附件文件,需要放在Excel文档同级目录中";
|
||||
|
||||
public static String exportFieldName = "*企标类别,企标编号,*标准年份,*企标名称,企标英文名称,*文本状态,发布日期,企标实施日期,起草部门,起草人,适用车型,能源类型,适用产品线,体系类别,关联模块-乘用车VPPS编码,关联模块--卡车VPPS编码,发布稿,编制说明,历史版本,其他文件,修改单,代替企标编号,采用标准,采标程度,引用标准,关联文件,";
|
||||
|
||||
/***
|
||||
* @Description: Clob类型 转String
|
||||
* @Author: super_liu
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.adc.da.slrs.StandardQA.dao.SarAgenldAcceptButtonDao">
|
||||
</mapper>
|
||||
+9
@@ -1956,5 +1956,14 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询-->
|
||||
<select id="queryByPage" resultMap="BaseResultMap"
|
||||
parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage">
|
||||
SELECT
|
||||
<include refid="Base_Column_List_DIS"/>
|
||||
from SAR_STANDARDS_INFO
|
||||
limit ${page.pager.startIndex-1},${page.pageSize}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
package com.adc.da.att.util;
|
||||
|
||||
import com.adc.da.util.exception.AdcDaBaseException;
|
||||
import com.adc.da.util.utils.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author liyawei
|
||||
* @Create 2021/7/26
|
||||
*/
|
||||
public class CommonExportUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CommonExportUtil.class);
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
* @param columnList 数据库字段名集合
|
||||
* @param headerList 导出表头集合
|
||||
* @param datalist
|
||||
* @param response
|
||||
* @param request
|
||||
* @param exportName
|
||||
* @param tableName
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void exportExcel(List<String> columnList, List<String> headerList, List<Map<String,Object>> datalist, HttpServletResponse response, HttpServletRequest request,
|
||||
String exportName, String tableName) throws Exception{
|
||||
final OutputStream os = response.getOutputStream(); // 获得ServletOutputStream对象
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
//response.setHeader("Content-Disposition","attachment; filename=" + URLEncoder.encode(exportName+".xlsx", "UTF-8") + ';');
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=" + ReadExcel.encodeFileName(exportName+".xlsx", request));
|
||||
//导出excel
|
||||
copyrightContractCount(columnList ,headerList ,datalist ,os ,tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fileName 文件名
|
||||
* @param headers 表头
|
||||
* @param desc 填写说明
|
||||
* @param response
|
||||
* @param request
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void exportTemplate(String fileName , String[] headers , String desc, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
// 声明一个工作薄
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
// 生成一个表格
|
||||
XSSFSheet sheet = workbook.createSheet();
|
||||
//设置表格样式
|
||||
XSSFCellStyle cellStyle = (XSSFCellStyle) generateCommonCellStyle(workbook,true);
|
||||
OutputStream os = response.getOutputStream();
|
||||
try{
|
||||
// 设置表格默认列宽度为15个字节
|
||||
//sheet.setDefaultColumnWidth((short) 18);
|
||||
XSSFRow row = sheet.createRow(0);
|
||||
for (short i = 0; i < headers.length; i++) {
|
||||
XSSFCell cell = row.createCell(i);
|
||||
XSSFRichTextString text = new XSSFRichTextString(headers[i]);
|
||||
cell.setCellValue(text);
|
||||
cell.setCellStyle(cellStyle);
|
||||
|
||||
}
|
||||
|
||||
// 如果填写说明存在,则创建
|
||||
if (StringUtils.isNotEmpty(desc)){
|
||||
XSSFRow descRow = sheet.createRow(1);
|
||||
descRow.setHeightInPoints(80.0F);
|
||||
XSSFCell descCell = descRow.createCell(0);
|
||||
descCell.setCellValue(desc);
|
||||
descCell.setCellStyle(generateDescCellStyle(workbook,true));
|
||||
|
||||
CellRangeAddress region = new CellRangeAddress(1, 1,0,headers.length);
|
||||
sheet.addMergedRegion(region);
|
||||
}
|
||||
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
// response.setContentType("application/force-download");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=" + ReadExcel.encodeFileName(fileName+".xlsx", request));
|
||||
response.flushBuffer();
|
||||
|
||||
workbook.write(os);
|
||||
} catch (IOException e) {
|
||||
logger.error("发生异常,异常信息为:"+e.getMessage(), e);
|
||||
throw new AdcDaBaseException("下载文件失败,请重试");
|
||||
}finally {
|
||||
workbook.close();
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 导出excel
|
||||
* @param columnList
|
||||
* @param headerList
|
||||
* @param dataList
|
||||
* @param os
|
||||
* @param tableName
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void copyrightContractCount(List columnList,List headerList,List dataList ,OutputStream os,String tableName) throws Exception{
|
||||
try{
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
//产生通用单元格样式
|
||||
CellStyle style = generateCommonCellStyle(workbook,false);
|
||||
//创建sheet表单,同时写入标题
|
||||
CellStyle titleStyle = generateCommonCellStyle(workbook,true);
|
||||
Sheet sheet = generateSheet(workbook, tableName, columnList, titleStyle);
|
||||
//写入标题行
|
||||
writeColumnName(sheet ,headerList ,titleStyle);
|
||||
//写入数据行
|
||||
writeDataRow(sheet, columnList, dataList, style);
|
||||
//输入excel文件
|
||||
workbook.write(os);
|
||||
os.close();
|
||||
//os.flush();
|
||||
|
||||
if (workbook != null) {
|
||||
workbook.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("发生异常,异常信息为:"+e.getMessage(), e);
|
||||
throw new AdcDaBaseException("下载文件失败,请重试");
|
||||
}finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格导入数据
|
||||
* @param sheet
|
||||
* @param columnList
|
||||
* @param dataList
|
||||
* @param style
|
||||
*/
|
||||
public static void writeDataRow(Sheet sheet, List columnList, List<Map<String,Object>> dataList, CellStyle style){
|
||||
//columnList 列数
|
||||
int rowIndex = 2;
|
||||
for(int i = 0 ; i<dataList.size() ;i++) {
|
||||
//创建一行
|
||||
Row dataRow = sheet.createRow(rowIndex++);
|
||||
//获取该行数据
|
||||
Map<String,Object> rowDataMap = dataList.get(i);
|
||||
if (columnList != null && columnList.size() > 0) {
|
||||
for (int j = 0; j < columnList.size() ;j++) {
|
||||
//创建单元格
|
||||
Cell dataCell = dataRow.createCell(j);
|
||||
//设置单元格样式
|
||||
dataCell.setCellStyle(style);
|
||||
//从数据map中获取对应列的数据
|
||||
if(rowDataMap.get(columnList.get(j)) == null){
|
||||
continue;
|
||||
}
|
||||
String value = String.valueOf(rowDataMap.get(columnList.get(j)));
|
||||
//将数据写入单元格
|
||||
dataCell.setCellValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 第二行设置导出的列名
|
||||
* @param sheet
|
||||
* @param headerList
|
||||
* @param style
|
||||
*/
|
||||
public static void writeColumnName(Sheet sheet , List<String> headerList , CellStyle style){
|
||||
Row titleRow = sheet.createRow(1);
|
||||
int index = 0;
|
||||
for(int i = 0;i < headerList.size();i ++){
|
||||
Cell titleCell = titleRow.createCell(index);
|
||||
titleCell.setCellStyle(style);
|
||||
titleCell.setCellValue(headerList.get(i));
|
||||
index ++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建sheet表单,第一行合并单元格设置表格名
|
||||
* @param workbook
|
||||
* @param tableName
|
||||
* @param columnList
|
||||
* @param style
|
||||
* @return
|
||||
*/
|
||||
public static Sheet generateSheet(Workbook workbook, String tableName, List columnList, CellStyle style){
|
||||
//创建sheet表单
|
||||
Sheet sheet = workbook.createSheet(tableName);
|
||||
//在表单中创建一行
|
||||
Row tableRow = sheet.createRow(0);
|
||||
//在行中创建单元格
|
||||
for(int i = 0;i < columnList.size();i ++){
|
||||
Cell cell = tableRow.createCell(i);
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
//获取第一个单元格
|
||||
Cell tableCell = tableRow.getCell(0);
|
||||
//给第一个单元格添加数据
|
||||
tableCell.setCellValue(tableName);
|
||||
//合并单元格
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, columnList.size()-1));
|
||||
return sheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置单元格样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle generateCommonCellStyle(Workbook workbook, boolean isBold){
|
||||
//设置表格样式
|
||||
CellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN); //左边框
|
||||
cellStyle.setBorderRight(BorderStyle.THIN); //右边框
|
||||
cellStyle.setBorderTop(BorderStyle.THIN); //上边框
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 上下居中
|
||||
cellStyle.setWrapText(true); // 设置自动换行
|
||||
|
||||
Font headerFont = getFont(workbook, (short) 10,isBold); // 创建字体样式
|
||||
cellStyle.setFont(headerFont); // 为标题样式设置字体样式
|
||||
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置填写说明样式
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
public static CellStyle generateDescCellStyle(Workbook workbook, boolean isBold){
|
||||
//设置表格样式
|
||||
CellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 上下居中
|
||||
cellStyle.setWrapText(true); // 设置自动换行
|
||||
|
||||
Font headerFont = getFont(workbook, (short) 10,isBold); // 创建字体样式
|
||||
cellStyle.setFont(headerFont); // 为标题样式设置字体样式
|
||||
|
||||
return cellStyle;
|
||||
}
|
||||
|
||||
public static Font getFont(Workbook workbook, short size, boolean isBold) {
|
||||
Font font = workbook.createFont();
|
||||
font.setFontName("宋体"); // 字体样式
|
||||
font.setBold(isBold); // 是否加粗
|
||||
font.setFontHeightInPoints(size); // 字体大小
|
||||
return font;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.adc.da.att.util;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* @des : excel信息读取
|
||||
* @author: duyunbao
|
||||
* @email: 1114808306@qq.com
|
||||
* @date 2017/10/27 17:06
|
||||
**/
|
||||
public class ReadExcel {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ReadExcel.class);
|
||||
|
||||
/**
|
||||
* 总行数
|
||||
*/
|
||||
private int totalRows = 0;
|
||||
/**
|
||||
* 总条数
|
||||
*/
|
||||
private int totalCells = 0;
|
||||
/**
|
||||
* 错误信息接收器
|
||||
*/
|
||||
private String errorMsg;
|
||||
|
||||
public ReadExcel() {
|
||||
// 不做操作
|
||||
}
|
||||
|
||||
public int getTotalRows() {
|
||||
return totalRows;
|
||||
}
|
||||
|
||||
public int getTotalCells() {
|
||||
return totalCells;
|
||||
}
|
||||
|
||||
public String getErrorInfo() {//获取错误信息
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method_name: validateExcel
|
||||
* @des : 验证excel格式
|
||||
* @author: duyunbao
|
||||
* @param: [filePath]
|
||||
* @return: boolean
|
||||
* @date: 2017/10/27 17:07
|
||||
**/
|
||||
public boolean validateExcel(String filePath) {
|
||||
if (filePath == null || !(WDWUtil.isExcel2003(filePath) || WDWUtil.isExcel2007(filePath))) {
|
||||
errorMsg = "文件名不是excel格式";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method_name: getExcelInfo
|
||||
* @des : 读EXCEL文件,获取信息集合
|
||||
* @author: duyunbao
|
||||
* @param: [fileName, Mfile]
|
||||
* @return: org.apache.poi.ss.usermodel.Workbook
|
||||
* @date: 2017/10/27 17:08
|
||||
**/
|
||||
public Workbook getExcelInfo(String fileName, MultipartFile Mfile) {
|
||||
Workbook wb = null;
|
||||
//把spring文件上传的MultipartFile转换成CommonsMultipartFile类型
|
||||
CommonsMultipartFile cf = (CommonsMultipartFile) Mfile; //获取本地存储路径
|
||||
//初始化输入流
|
||||
InputStream is = null;
|
||||
try {
|
||||
//根据文件名判断文件是2003版本还是2007版本
|
||||
boolean isExcel2003 = true;
|
||||
if (WDWUtil.isExcel2007(fileName)) {
|
||||
isExcel2003 = false;
|
||||
}
|
||||
is = cf.getInputStream();
|
||||
//根据excel里面的内容读取客户信息
|
||||
wb = getExcelInfo(is, isExcel2003, wb);
|
||||
is.close();
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
is = null;
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return wb;
|
||||
}
|
||||
|
||||
/***
|
||||
* @method_name: getExcelInfo
|
||||
* @des : 判断excel版本
|
||||
* @author: duyunbao
|
||||
* @param: [is, isExcel2003, wb]
|
||||
* @return: org.apache.poi.ss.usermodel.Workbook
|
||||
* @date: 2017/10/27 17:08
|
||||
**/
|
||||
private Workbook getExcelInfo(InputStream is, boolean isExcel2003, Workbook wb) {
|
||||
Workbook workbook =wb;
|
||||
try {
|
||||
/** 根据版本选择创建Workbook的方式 */
|
||||
//当excel是2003时
|
||||
if (isExcel2003) {
|
||||
workbook = new HSSFWorkbook(is);
|
||||
} else {//当excel是2007时
|
||||
workbook = new XSSFWorkbook(is);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
return workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取sheet的名称
|
||||
* @MethodName:getSheetName
|
||||
* @author: 马晓晨
|
||||
* @email: 747052172@qq.com
|
||||
* @date 2017年11月24日 上午9:49:22
|
||||
* @version V1.0
|
||||
* @param filename
|
||||
* @param file
|
||||
* @param sheetIndex
|
||||
* @return
|
||||
*/
|
||||
public String getSheetName(String filename, MultipartFile file, Integer sheetIndex) {
|
||||
Workbook wb = getExcelInfo(filename, file);
|
||||
return wb.getSheetName(sheetIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Title: encodeFileName
|
||||
* @Description: 导出文件转换文件名称编码
|
||||
* @param @param fileNames
|
||||
* @param @param request
|
||||
* @param @return 设定文件
|
||||
* @return String 返回类型
|
||||
* @throws
|
||||
*/
|
||||
public static String encodeFileName(String fileNames , HttpServletRequest request) {
|
||||
try {
|
||||
String agent = request.getHeader("User-Agent");
|
||||
if (agent.contains("Firefox")) {
|
||||
fileNames = new String(fileNames.getBytes("UTF-8"), "ISO8859-1"); // firefox浏览器
|
||||
} else {
|
||||
fileNames = URLEncoder.encode(fileNames, "utf-8");
|
||||
//谷歌中空格变为+问题
|
||||
fileNames = fileNames.replaceAll("\\+","%20");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
return fileNames ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.adc.da.att.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @des : excel版本判断类
|
||||
* @author: duyunbao
|
||||
* @email: 1114808306@qq.com
|
||||
* @date 2017/10/27 16:59
|
||||
**/
|
||||
public class WDWUtil {
|
||||
|
||||
/**
|
||||
* @method_name: isExcel2003
|
||||
* @des :是否是2003的excel,返回true是2003
|
||||
* @author: duyunbao
|
||||
* @param: [filePath]
|
||||
* @return: boolean
|
||||
* @date: 2017/10/27 16:57
|
||||
**/
|
||||
public static boolean isExcel2003(String filePath) {
|
||||
return filePath.matches("^.+\\.(?i)(xls)$");
|
||||
}
|
||||
|
||||
/**
|
||||
* @method_name: isExcel2007
|
||||
* @des : 是否是2007的excel,返回true是2007
|
||||
* @author: duyunbao
|
||||
* @param: [filePath]
|
||||
* @return: boolean
|
||||
* @date: 2017/10/27 16:57
|
||||
**/
|
||||
public static boolean isExcel2007(String filePath) {
|
||||
return filePath.matches("^.+\\.(?i)(xlsx)$");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断字符串是否是整数
|
||||
* @MethodName:isInteger
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/22 18:00
|
||||
*/
|
||||
public static boolean isNumeric(String str){
|
||||
for (int i = str.length();--i>=0;){
|
||||
if (!Character.isDigit(str.charAt(i))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**方法二:推荐,速度最快
|
||||
* 判断是否为整数
|
||||
* @param str 传入的字符串
|
||||
* @return 是整数返回true,否则返回false
|
||||
*/
|
||||
public static boolean isInteger(String str) {
|
||||
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
|
||||
return pattern.matcher(str).matches();
|
||||
}
|
||||
|
||||
/**
|
||||
* 字母或数字
|
||||
*
|
||||
* @MethodName:isLetterDigitOrChinese
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 15:26
|
||||
*/
|
||||
public static boolean isLetterOrNumber(String str) {
|
||||
String regex = "^(\\d|[a-zA-Z])+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、字母、()
|
||||
*
|
||||
* @MethodName:isLetterOrChineseOrChar1
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 15:53
|
||||
*/
|
||||
public static boolean isLetterOrChineseOrChar1(String str) {
|
||||
String regex = "[^\\a-\\z\\A-\\Z\\u4E00-\\u9FA5\\()\\()]";
|
||||
return str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、字母、数字
|
||||
*
|
||||
* @MethodName:isLetterOrChineseOrNumber
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 15:56
|
||||
*/
|
||||
public static boolean isLetterOrChineseOrNumber(String str) {
|
||||
String regex = "^[\\u4E00-\\u9FA5A-Za-z0-9]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、字母、()、-、下划线
|
||||
*
|
||||
* @MethodName:isChineseOrLetterOrUnderlineOrChar1
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:03
|
||||
*/
|
||||
public static boolean isChineseOrLetterOrUnderlineOrChar1(String str) {
|
||||
String regex = "^[\\u4E00-\\u9FA5A-Za-z_\\-\\()\\()]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字
|
||||
*
|
||||
* @MethodName:isNumbee
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:09
|
||||
*/
|
||||
public static boolean isNumber(String str) {
|
||||
String regex = "\\D";
|
||||
return str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字、大写字母、-
|
||||
*
|
||||
* @MethodName:isNumberOrLowerLetterOrChar1
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:41
|
||||
*/
|
||||
public static boolean isNumberOrLowerLetterOrChar1(String str) {
|
||||
String regex = "^[A-Z0-9\\-]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字、数字、字母、()、-、下划线
|
||||
*
|
||||
* @MethodName:isChineseOrNumberOrLetterOrUnderlineOrChar
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/30 16:45
|
||||
*/
|
||||
public static boolean isChineseOrNumberOrLetterOrUnderlineOrChar(String str) {
|
||||
String regex = "^[\\u4E00-\\u9FA5A-Za-z0-9_\\-\\()\\()]+$";
|
||||
return !str.matches(regex);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 去除整数含有小数点
|
||||
* @MethodName:subStr
|
||||
* @author: DuYunbao
|
||||
* @date: 2018/5/31 11:19
|
||||
*/
|
||||
public static String subStr(String text) {
|
||||
if (StringUtils.isNotEmpty(text)) {
|
||||
if(text.contains(".0") && text.substring(text.length()-2,text.length()).equals(".0")) {
|
||||
text = text.substring(0,text.length()-2);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -85,4 +85,9 @@ public interface DicTypeEODao extends BaseMapper<DicTypeEO> {
|
||||
*/
|
||||
public List<DicTypeEO> getDicInfo(@Param("filed") String... filed);
|
||||
|
||||
String selectByPid(@Param("Info") String Info);
|
||||
|
||||
List<DicTypeEO> selectByPidInfo(@Param("pid") String pid);
|
||||
|
||||
List<DicTypeEO> selectPidByCode(@Param("fileType") String fileType);
|
||||
}
|
||||
|
||||
@@ -614,4 +614,30 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectByPid" resultType="java.lang.String">
|
||||
SELECT
|
||||
ID
|
||||
FROM
|
||||
ts_dictionary
|
||||
WHERE
|
||||
DICTIONARY_NAME = #{Info}
|
||||
</select>
|
||||
|
||||
<select id="selectByPidInfo" resultType="com.adc.da.sys.entity.DicTypeEO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ts_dictype
|
||||
WHERE
|
||||
DIC_ID = #{pid}
|
||||
</select>
|
||||
|
||||
<select id="selectPidByCode" resultType="com.adc.da.sys.entity.DicTypeEO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ts_dictype
|
||||
WHERE
|
||||
DIC_TYPE_CODE = #{fileType}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user