Merge branch 'develop_master' into develop_migration

This commit is contained in:
super_liu
2021-11-13 22:39:15 +08:00
17 changed files with 861 additions and 27 deletions
@@ -402,4 +402,7 @@ public interface workFlowFeignClient {
@RequestMapping(value = "/bat-wkflow/datas/bus-process-new/everyDayTenOlock",method = RequestMethod.GET) @RequestMapping(value = "/bat-wkflow/datas/bus-process-new/everyDayTenOlock",method = RequestMethod.GET)
List<BusProcessNew> everyDayTenOlock(); List<BusProcessNew> everyDayTenOlock();
@RequestMapping(value = "/bat-wkflow/datas/bus-process-new/everyDayTenOlockSAM",method = RequestMethod.GET)
List<BusProcessNew> everyDayTenOlockSAM();
} }
@@ -11,6 +11,7 @@ import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.service.IUserEOService; import com.adc.da.sys.service.IUserEOService;
import com.adc.da.workFlow.controller.WorkFlowController; import com.adc.da.workFlow.controller.WorkFlowController;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -185,10 +186,39 @@ public class ProcessTimer {
} }
} }
@Scheduled(cron = "0 0 10 * * ? ")//每天十点执行
// @Scheduled(cron = "*/40 * * * * ? ")//20s
public void everyDayTenOlockScanSAM() {
List<BusProcessNew> busProcessNews=new ArrayList<>();
busProcessNews=workFlowFeignClient.everyDayTenOlockSAM();
if (!busProcessNews.isEmpty()){
for (BusProcessNew bus:busProcessNews) {
JSONObject jsonObject= JSON.parseObject(bus.getMesg());
String taskInfo = bus.getTaskInfo();
String result = jsonObject.getJSONObject("roleList").getString("dockUser");
result = result.split(",")[0];
jsonObject.put("member",result);
if(taskInfo.equals("标准化活动参会流程-流程结束")){
jsonObject.put("auto","1");
ResponseMessage responseMessage = workFlowController.startProcessNew("22",result,null);
BusMes busMes=new BusMes();
busMes.setTaskIds(String.valueOf(responseMessage.getData()));
busMes.setJson(jsonObject.toJSONString());
busMes.setUserId(result);
Wrapper<String> wrapper=workFlowFeignClient.completeTaskByUserId(busMes);
System.out.println("标准化活动会后流程自动发起");
}
}
}
}
public static void main(String[]args){ public static void main(String[]args){
ProcessTimer processTimer = new ProcessTimer(); ProcessTimer processTimer = new ProcessTimer();
processTimer.everyDayTenOlockScan(); processTimer.everyDayTenOlockScan();
processTimer.everyDayTenOlockScanSAM();
} }
} }
@@ -25,6 +25,9 @@ public class Analysis {
private static final Logger logger = LoggerFactory.getLogger(Contrast.class); private static final Logger logger = LoggerFactory.getLogger(Contrast.class);
private int sortColumn=0;
public void run(MultipartFile file, MultipartFile sort) throws IOException { public void run(MultipartFile file, MultipartFile sort) throws IOException {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
@@ -37,20 +40,20 @@ public class Analysis {
for (Row row : sheet) { for (Row row : sheet) {
if (row.getCell(1)!=null){ if (row.getCell(1)!=null){
//获取表1的标准号 //获取表1的标准号
String value = row.getCell(1).toString().trim(); String value = row.getCell(1).toString();
Cell sortCell = row.createCell(11); Cell sortCell = row.createCell(11);
Cell sortNumber = row.createCell(12); Cell numberCell = row.createCell(12);
Cell sortYear = row.createCell(13); Cell yearCell = row.createCell(13);
sortCell.setCellType(CellType.STRING); sortCell.setCellType(CellType.STRING);
sortNumber.setCellType(CellType.STRING); numberCell.setCellType(CellType.STRING);
sortYear.setCellType(CellType.STRING); yearCell.setCellType(CellType.STRING);
List<String> collect = sortSet.stream() List<String> collect = sortSet.stream()
.filter(item ->{ .filter(item ->{
int length = item.length(); int length = item.length();
if (value.length()>length){ if (value.length()>length){
return value.substring(0, length).contains(item.trim()); return value.substring(0, length).contains(item);
}else return false; }else return false;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
@@ -65,8 +68,8 @@ public class Analysis {
// pattern.matcher(standId).matches() // pattern.matcher(standId).matches()
if (value.length()>=length+5){ if (value.length()>=length+5){
sortCell.setCellValue(collect.get(0)); sortCell.setCellValue(collect.get(0));
sortNumber.setCellValue(value.substring(length,value.length()-5)); numberCell.setCellValue(value.substring(length,value.length()-5));
sortYear.setCellValue(value.substring(value.length()-4)); yearCell.setCellValue(value.substring(value.length()-4));
} }
}else if (collect.size()>1){ }else if (collect.size()>1){
String maxLenSort=""; String maxLenSort="";
@@ -83,26 +86,37 @@ public class Analysis {
sortCell.setCellValue(maxLenSort); sortCell.setCellValue(maxLenSort);
sortNumber.setCellValue(value.substring(length,value.length()-5)); numberCell.setCellValue(value.substring(length,value.length()-5));
sortYear.setCellValue(value.substring(value.length()-4)); yearCell.setCellValue(value.substring(value.length()-4));
} }
} else { } else {
logger.info("-"); logger.info("-");
sortCell.setCellValue("-"); sortCell.setCellValue("-");
sortNumber.setCellValue("-"); numberCell.setCellValue("-");
sortYear.setCellValue("-"); yearCell.setCellValue("-");
} }
} }
} }
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\拆分标准号-海外.xlsx"); File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\拆分标准号-企标.xlsx");
FileOutputStream os = new FileOutputStream(result); FileOutputStream os = new FileOutputStream(result);
workbook.write(os); workbook.write(os);
// HashMap<String, String> map = new HashMap<>(); // HashMap<String, String> map = new HashMap<>();
} }
public void setSortColumn(int sortColumn){
this.sortColumn=sortColumn;
}
/**
* 获取标准类别set集合
* @param file
* @return
* @throws IOException
*/
private HashSet<String> getSet(MultipartFile file) throws IOException { private HashSet<String> getSet(MultipartFile file) throws IOException {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream); XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
@@ -114,8 +128,8 @@ public class Analysis {
HashSet<String> stringHashSet= new HashSet<>(); HashSet<String> stringHashSet= new HashSet<>();
for (Row row : sheet) { for (Row row : sheet) {
if (row.getCell(0)!=null){ if (row.getCell(sortColumn)!=null){
stringHashSet.add(row.getCell(0).toString().trim()); stringHashSet.add(row.getCell(sortColumn).toString());
} }
} }
@@ -0,0 +1,77 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
@Component
public class Contrast {
private static final Logger logger = LoggerFactory.getLogger(Contrast.class);
public void run(MultipartFile file,MultipartFile sort) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashSet<String> set = getSet(sort);
for (Row row : sheet) {
if (row.getCell(0)!=null){
//获取表1的标准号
String value = row.getCell(0).toString().trim();
Cell cell = row.createCell(11);
//对比在表2中是否存在
if (set.contains(value.trim())){
logger.info("*");
cell.setCellType(CellType.STRING);
cell.setCellValue("1");
}else {
logger.info("-");
cell.setCellType(CellType.STRING);
cell.setCellValue("0");
}
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\海外对比全数据.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
// HashMap<String, String> map = new HashMap<>();
}
private HashSet<String> getSet(MultipartFile file) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// int lastNum = sheet.getLastRowNum();
HashSet<String> stringHashSet= new HashSet<>();
for (Row row : sheet) {
if (row.getCell(1)!=null){
stringHashSet.add(row.getCell(1).toString().trim());
}
}
return stringHashSet;
}
}
@@ -0,0 +1,100 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
public class PathMatcher {
private static final Logger logger = LoggerFactory.getLogger(PathMatcher.class);
public void run(MultipartFile target,MultipartFile attach) throws IOException {
InputStream inputStream = target.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashMap<String, String> fileMap = getFileMap(attach);
for (Row row : sheet) {
String latter = row.getCell(1).getStringCellValue().trim();//标准号
String fileId="";
if (row.getCell(10)!=null){
fileId = row.getCell(10).getStringCellValue().trim();//文档id
}else {
logger.info("+");
continue;
}
StringBuilder builder = new StringBuilder();
builder.append(fileId)
.append(latter);
if (fileMap.containsKey(builder.toString())){
Cell cell = row.createCell(9);
cell.setCellType(CellType.STRING);
cell.setCellValue(fileMap.get(builder.toString()));
logger.info("*");
}else {
logger.info("-");
}
}
File file = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件路径-国内库.xlsx");
FileOutputStream os = new FileOutputStream(file);
workbook.write(os);
}
private HashMap<String,String> getFileMap(MultipartFile excel) throws IOException {
InputStream inputStream = excel.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashMap<String, String> resultMap = new HashMap<>();
for (Row row : sheet) {
String value = row.getCell(0).getStringCellValue();
String[] strArray = value.split(",");
StringBuilder builder = new StringBuilder();
builder.append(strArray[1].trim()) //文档id
.append(strArray[2].trim()); //标准号
String path = strArray[3];
resultMap.put(builder.toString(),path);
}
return resultMap;
}
}
@@ -0,0 +1,186 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static org.apache.poi.ss.usermodel.CellType.NUMERIC;
public class StandMatcher {
private static final Logger logger = LoggerFactory.getLogger(StandMatcher.class);
public void run(MultipartFile target,MultipartFile attach) throws IOException {
InputStream inputStream = target.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Map<String, String> matchSet = getMatchSet(attach);
for (Row row : sheet) {
String letter =convertCellValueToString(row.getCell(1));//标准号
String publish = convertCellValueToString(row.getCell(3));//发布日期
String impl= convertCellValueToString(row.getCell(4));//实施日期
String state = convertCellValueToString(row.getCell(2));//状态
String replace= convertCellValueToString(row.getCell(5));//代替标准号
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(letter)
.append(publish)
.append(impl)
.append(state)
.append(replace);
String str = strBuilder.toString();
if (matchSet.containsKey(str)){
Cell cell = row.createCell(10); //再第10列存放文件id
cell.setCellType(CellType.STRING);
cell.setCellValue(matchSet.get(str));
logger.info("*");
}else {
logger.info("-");
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件id-国内库.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
}
private Map<String,String> getMatchSet(MultipartFile excel) throws IOException {
InputStream inputStream = excel.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Map<String,String> resultSet = new HashMap<>();
for (Row row : sheet) {
String letter =convertCellValueToString(row.getCell(0));//标准号
String publish = convertCellValueToString(row.getCell(3));//发布日期
String impl= convertCellValueToString(row.getCell(4));//实施日期
String state = convertCellValueToString(row.getCell(5));//状态
String replace= convertCellValueToString(row.getCell(6));//代替标准号
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(letter)
.append(publish)
.append(impl)
.append(state)
.append(replace);
if (row.getCell(7).getCellType()== NUMERIC){
String s = row.getCell(7).toString();
String fileId =s.substring(0,s.length()-2);//文件id
resultSet.put(strBuilder.toString(),fileId);
}
}
return resultSet;
}
/**
* 将单元格内容转化为字符串
*/
private static String convertCellValueToString(Cell cell) {
if (null == cell) {
return "";
}
String returnValue = "";
switch (cell.getCellType()) {
case STRING: //字符串
returnValue = cell.getStringCellValue().trim();
break;
case NUMERIC: //数字
if (DateUtil.isCellDateFormatted(cell)) {
Date tempValue = cell.getDateCellValue();
SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
returnValue = simpleFormat.format(tempValue);
}else {
returnValue = String.valueOf(cell.getNumericCellValue());
}
returnValue=cell.toString().trim();
break;
case BOOLEAN: //布尔
boolean booleanCellValue = cell.getBooleanCellValue();
returnValue = Boolean.toString(booleanCellValue).trim();
break;
case BLANK: //空值
break;
case FORMULA: //公式
cell.getCellFormula();
break;
case ERROR: //故障
break;
default:
break;
}
return returnValue;
}
/**
* 判断是否为整数,是返回true,否则返回false.
*/
public static boolean isIntegerForDouble(Double num) {
double eqs = 1e-10; //精度范围
return num - Math.floor(num) < eqs;
}
}
@@ -2,10 +2,7 @@ package com.adc.da.slrs.ImportExcelDatas.controller;
import com.adc.da.base.web.BaseController; import com.adc.da.base.web.BaseController;
import com.adc.da.common.ReadExcel; import com.adc.da.common.ReadExcel;
import com.adc.da.slrs.ImportExcelDatas.comment.Analysis; import com.adc.da.slrs.ImportExcelDatas.comment.*;
import com.adc.da.slrs.ImportExcelDatas.comment.Contrast;
import com.adc.da.slrs.ImportExcelDatas.comment.ExclErrorOut;
import com.adc.da.slrs.ImportExcelDatas.comment.ExclExport;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto; import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService; import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService;
import com.adc.da.util.exception.AdcDaBaseException; import com.adc.da.util.exception.AdcDaBaseException;
@@ -90,7 +87,7 @@ public class ImportExcelController extends BaseController<ImportDto> {
} }
@ApiOperation("从excl分解") @ApiOperation("从excl分解出标准号")
@PostMapping("/analysisExcl") @PostMapping("/analysisExcl")
public void analysisExcl(MultipartFile exclFile,MultipartFile standSort, HttpServletResponse response, HttpServletRequest request) throws IOException { public void analysisExcl(MultipartFile exclFile,MultipartFile standSort, HttpServletResponse response, HttpServletRequest request) throws IOException {
/** /**
@@ -139,19 +136,39 @@ public class ImportExcelController extends BaseController<ImportDto> {
return importExcelService.isExist(exclFile); return importExcelService.isExist(exclFile);
} }
@ApiOperation("对比") @ApiOperation("对比两个excel表中的标准名称")
@PostMapping("/contrast") @PostMapping("/contrast")
public void contrast(MultipartFile all,MultipartFile excel) throws IOException { public void contrast(MultipartFile targetExcel,MultipartFile excel) throws IOException {
Contrast contrast = new Contrast(); Contrast contrast = new Contrast();
contrast.run(all,excel); contrast.run(targetExcel,excel);
} }
@ApiOperation("根据标准从excl中分解出标准号,类别,年份") @ApiOperation("根据标准从excl中分解出标准号,类别,年份")
@PostMapping("/analysis") @PostMapping("/analysis")
public void analysis(MultipartFile exclFile,MultipartFile standSort) throws IOException { public void analysis(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
Analysis analysis = new Analysis(); Analysis analysis = new Analysis();
analysis.run(exclFile,standSort); analysis.setSortColumn(1);
analysis.run(targetExcel,attachExcel);
} }
@ApiOperation("匹配文件id")
@PostMapping("/matching")
public void matching(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
StandMatcher standMatcher = new StandMatcher();
standMatcher.run(targetExcel, attachExcel);
}
@ApiOperation("根据文件id和标准匹配文件路径")
@PostMapping("/matchingPath")
public void matchingPath(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
PathMatcher pathMatcher = new PathMatcher();
pathMatcher.run(targetExcel,attachExcel);
}
} }
@@ -0,0 +1,69 @@
package com.adc.da.slrs.sapMeetInfo.controller;
import com.adc.da.slrs.sapMeetInfo.service.ISapMeetingService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import java.util.Date;
import java.util.List;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
前端控制器
* </p>
*
* @author zcr
* @since 2021-11-09
*/
@RestController
@Api(description = "|SapMeeting|")
@RequestMapping("/api/sapMeetInfo")
public class SapMeetingController extends BaseController<SapMeeting> {
@Autowired
ISapMeetingService sapMeetingService;
@ApiOperation(value = "id查询会议信息")
@GetMapping("/getOneById")
public SapMeeting getOneById(String id){
return sapMeetingService.getMeetingById(id);
}
@ApiOperation(value = "获取日历显示会议信息")
@GetMapping("/getDateMeeting")
public int getDateMeeting(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date, String id,int type){
return sapMeetingService.getDateMeeting(date,id,type);
}
@ApiOperation(value = "获取当月")
@GetMapping("/getMeetingsByMonth")
public List<SapMeeting> getMeetingsByMonth(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date){
return sapMeetingService.getMeetingsByMonth(date);
}
@ApiOperation(value = "获取当月,根据标志位type区分 1标准活动和2政策课题")
@GetMapping("/getMeetingsByMonthType")
public List<SapMeeting> getMeetingsByMonthType(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date,int type){
return sapMeetingService.getMeetingsByMonth(date, type);
}
@ApiOperation(value = "获取当天")
@GetMapping("/getMeetingsByDate")
public List<SapMeeting> getMeetingsByDate(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date,int type){
return sapMeetingService.getMeetingsByDate(date,type);
}
@ApiOperation(value = "插入")
@PostMapping("/addMeeting")
public int addMeeting(@RequestBody SapMeeting sapMeeting){
return sapMeetingService.addMeeting(sapMeeting);
}
}
@@ -0,0 +1,43 @@
package com.adc.da.slrs.sapMeetInfo.dao;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
@Repository
public interface SapMeetingDao extends BaseMapper<SapMeeting> {
int insertMeeting(SapMeeting sapMeeting);//参会流程结束--插入
List<SapMeeting> selectMeetingsByDate(Map map);//根据日期查找-当日所有会议(时间正序)
List<SapMeeting> selectMeetingsByMonth(Date date);//根据年,月查找
List<SapMeeting> selectMeetingsByMonthType(Map map);//根据年,月查找,type标志位 1标准化活动 2政策课题组
SapMeeting selectMeetingById(String id);
int deleteById(String id);
int deleteByDate(Date date);
int updateMeeting(SapMeeting sapMeeting);
}
@@ -0,0 +1,47 @@
package com.adc.da.slrs.sapMeetInfo.entity;
import com.adc.da.base.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
@Data
@Accessors(chain = true)
@ToString
@ApiModel(value="SapMeeting对象", description="流程通过的 标准化活动会议信息表 standard_activity_pass")
public class SapMeeting{
private static final long serialVersionUID = 1L;
private String id;//主键-会议id
private String title;//会议标题
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date date;//会议开始时间
private String content;//会议内容大纲
private int type;//标志位--1标准化活动会议,0政策组会议
private String attend;//参与人 {id,name} json
private String files;//附件 json
}
@@ -0,0 +1,38 @@
package com.adc.da.slrs.sapMeetInfo.service;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Date;
import java.util.List;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
服务类
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
public interface ISapMeetingService extends IService<SapMeeting> {
int addMeeting(SapMeeting sapMeeting);//参会流程结束--插入
List<SapMeeting> getMeetingsByDate(Date date,int type);//根据日期查找-当日所有会议(时间正序)
List<SapMeeting> getMeetingsByMonth(Date date);//根据年,月查找
List<SapMeeting> getMeetingsByMonth(Date date,int type);//根据年,月查找
int getDateMeeting(Date date,String id,int type);
SapMeeting getMeetingById(String id);
int delById(String id);
int delByDate(Date date);
int modMeeting(SapMeeting sapMeeting);
}
@@ -0,0 +1,112 @@
package com.adc.da.slrs.sapMeetInfo.service.impl;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import com.adc.da.slrs.sapMeetInfo.dao.SapMeetingDao;
import com.adc.da.slrs.sapMeetInfo.service.ISapMeetingService;
import com.adc.da.util.UUIDUtils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
服务实现类
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
@Service
public class SapMeetingServiceImpl extends ServiceImpl<SapMeetingDao, SapMeeting> implements ISapMeetingService {
@Autowired
SapMeetingDao sapMeetingDao;
@Override
public int addMeeting(SapMeeting sapMeeting) {
sapMeeting.setId(UUIDUtils.randomUUID(30));
return sapMeetingDao.insertMeeting(sapMeeting);
}
@Override
public List<SapMeeting> getMeetingsByDate(Date date,int type) {
Map map = new HashMap();
map.put("date",date);
map.put("type",type);
return sapMeetingDao.selectMeetingsByDate(map);
}
@Override
public List<SapMeeting> getMeetingsByMonth(Date date) {
List<SapMeeting> sapMeetings = sapMeetingDao.selectMeetingsByMonth(date);
return sapMeetings;
}
@Override
public List<SapMeeting> getMeetingsByMonth(Date date, int type) {
Map map = new HashMap();
map.put("date",date);
map.put("type",type);
return sapMeetingDao.selectMeetingsByMonthType(map);
}
@Override
public int getDateMeeting(Date date,String id,int type) {
Map map = new HashMap();
map.put("type",type);
map.put("date",date);
List<SapMeeting> sapMeetings = sapMeetingDao.selectMeetingsByDate(map);
int rat = 0;//标志位 0无会议;1有会议;2有会议且有自己参会的会议
if(sapMeetings.isEmpty()){
rat = 1;
}else if(hasOwnMeeting(id,sapMeetings)){
rat = 2;
}
return rat;
}
@Override
public SapMeeting getMeetingById(String id) {
return sapMeetingDao.selectMeetingById(id);
}
@Override
public int delById(String id) {
return sapMeetingDao.deleteById(id);
}
@Override
public int delByDate(Date date) {
return sapMeetingDao.deleteByDate(date);
}
@Override
public int modMeeting(SapMeeting sapMeeting) {
return sapMeetingDao.updateMeeting(sapMeeting);
}
boolean hasOwnMeeting(String id,List<SapMeeting> sapMeetings){
for(SapMeeting sapMeeting : sapMeetings){
JSONObject jsonObject = JSONObject.parseObject(sapMeeting.getAttend());
String a = jsonObject.getString("id");
if(a.contains("[") && a.contains("]")){
a.substring(1,a.length()-1);
}
String[] split = a.trim().split(",");
for (String s : split) {
if (s.equals(id)) {
return true;
}
}
}
return false;
}
}
@@ -6,6 +6,7 @@ import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue; import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssueVo; import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssueVo;
import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService; import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -91,10 +92,15 @@ public class BusinessDeptIssueController extends BaseController {
} }
String fileName = URLEncoder.encode(issue.getFileName(), "UTF-8").replaceAll("\\+", "%20"); String fileName = URLEncoder.encode(issue.getFileName(), "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
// List<SarStandUnqualified> data=sarStandUnqualifiedService.getStandUnqualifiedExcelData(standUnqualifiedExcelVO);
/**
* 重写了get方法,无法使用net.sf.json.JSONObject转换对象
*/
// net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(issue.getExportContent());
// BusinessDeptIssueVo businessDeptIssueVo = (BusinessDeptIssueVo) net.sf.json.JSONObject.toBean(jsonObject, BusinessDeptIssueVo.class);
JSONObject jsonObject = JSONObject.parseObject(issue.getExportContent()); JSONObject jsonObject = JSONObject.parseObject(issue.getExportContent());
BusinessDeptIssueVo businessDeptIssueVo = JSONObject.toJavaObject(jsonObject, BusinessDeptIssueVo.class); BusinessDeptIssueVo businessDeptIssueVo = JSONObject.toJavaObject(jsonObject, BusinessDeptIssueVo.class);
IPage<BusinessDeptIssue> page = iBusinessDeptIssueService.getBusinessDeptIssue(businessDeptIssueVo); IPage<BusinessDeptIssue> page = iBusinessDeptIssueService.getBusinessDeptIssue(businessDeptIssueVo);
@@ -0,0 +1,77 @@
<?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.sapMeetInfo.dao.SapMeetingDao">
<sql id="BaseSelect">
id,title,date,content,type,attend,files
</sql>
<sql id="Search">
type = #{type}
</sql>
<insert id="insertMeeting" parameterType="com.adc.da.slrs.sapMeetInfo.entity.SapMeeting">
insert into sap_meeting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="title != null">title,</if>
<if test="date != null">date,</if>
<if test="content != null">content,</if>
<if test="type != null">type,</if>
<if test="attend != null">attend,</if>
<if test="files != null">files,</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="title != null">#{title},</if>
<if test="date != null">#{date},</if>
<if test="content != null">#{content},</if>
<if test="type != null">#{type},</if>
<if test="attend != null">#{attend},</if>
<if test="files != null">#{files},</if>
</trim>
</insert>
<select id="selectMeetingsByDate" resultType="com.adc.da.slrs.sapMeetInfo.entity.SapMeeting" parameterType="java.util.Map">
select <include refid="BaseSelect"></include>
from sap_meeting
where date_format(date,'%Y%m%d') = date_format(#{date},'%Y%m%d')
and <include refid="Search"></include>
order by date
</select>
<select id="selectMeetingsByMonth" resultType="com.adc.da.slrs.sapMeetInfo.entity.SapMeeting" parameterType="java.util.Date">
select <include refid="BaseSelect"></include>
from sap_meeting
where DATE_FORMAT(date,'%Y-%m')=DATE_FORMAT(#{date},'%Y-%m')
and type = 1
</select>
<select id="selectMeetingsByMonthType" resultType="com.adc.da.slrs.sapMeetInfo.entity.SapMeeting" parameterType="java.util.Map">
select <include refid="BaseSelect"></include>
from sap_meeting
where DATE_FORMAT(date,'%Y-%m')=DATE_FORMAT(#{date},'%Y-%m')
and <include refid="Search"></include>
</select>
<select id="selectMeetingById" resultType="com.adc.da.slrs.sapMeetInfo.entity.SapMeeting" parameterType="java.lang.String">
select <include refid="BaseSelect"></include>
from sap_meeting
where id = #{id}
and <include refid="Search"></include>
</select>
<delete id="deleteById">
</delete>
<delete id="deleteByDate">
</delete>
<update id="updateMeeting">
</update>
</mapper>
@@ -0,0 +1,5 @@
<?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.spaMeetInfo.dao.SapAttendeeDao">
</mapper>
@@ -0,0 +1,5 @@
<?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.spaMeetInfo.dao.SapFilesDao">
</mapper>
@@ -0,0 +1,5 @@
<?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.spaMeetInfo.dao.SapMeetingDao">
</mapper>