diff --git a/adc-da-activiti/src/main/java/com/adc/da/FeignClient/workFlowFeignClient.java b/adc-da-activiti/src/main/java/com/adc/da/FeignClient/workFlowFeignClient.java index e559943a..5a30aed5 100644 --- a/adc-da-activiti/src/main/java/com/adc/da/FeignClient/workFlowFeignClient.java +++ b/adc-da-activiti/src/main/java/com/adc/da/FeignClient/workFlowFeignClient.java @@ -402,4 +402,7 @@ public interface workFlowFeignClient { @RequestMapping(value = "/bat-wkflow/datas/bus-process-new/everyDayTenOlock",method = RequestMethod.GET) List everyDayTenOlock(); + + @RequestMapping(value = "/bat-wkflow/datas/bus-process-new/everyDayTenOlockSAM",method = RequestMethod.GET) + List everyDayTenOlockSAM(); } diff --git a/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java b/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java index cdf348f1..f37f251e 100644 --- a/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java +++ b/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java @@ -11,6 +11,7 @@ import com.adc.da.sys.entity.UserEO; import com.adc.da.sys.service.IUserEOService; import com.adc.da.workFlow.controller.WorkFlowController; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; 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 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 wrapper=workFlowFeignClient.completeTaskByUserId(busMes); + System.out.println("标准化活动会后流程自动发起"); + } + + } + } + } + public static void main(String[]args){ ProcessTimer processTimer = new ProcessTimer(); processTimer.everyDayTenOlockScan(); + processTimer.everyDayTenOlockScanSAM(); } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/Analysis.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/Analysis.java index a9b06720..a9356585 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/Analysis.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/Analysis.java @@ -25,6 +25,9 @@ public class Analysis { private static final Logger logger = LoggerFactory.getLogger(Contrast.class); + private int sortColumn=0; + + public void run(MultipartFile file, MultipartFile sort) throws IOException { InputStream inputStream = file.getInputStream(); @@ -37,20 +40,20 @@ public class Analysis { for (Row row : sheet) { if (row.getCell(1)!=null){ //获取表1的标准号 - String value = row.getCell(1).toString().trim(); + String value = row.getCell(1).toString(); Cell sortCell = row.createCell(11); - Cell sortNumber = row.createCell(12); - Cell sortYear = row.createCell(13); + Cell numberCell = row.createCell(12); + Cell yearCell = row.createCell(13); sortCell.setCellType(CellType.STRING); - sortNumber.setCellType(CellType.STRING); - sortYear.setCellType(CellType.STRING); + numberCell.setCellType(CellType.STRING); + yearCell.setCellType(CellType.STRING); List collect = sortSet.stream() .filter(item ->{ int length = item.length(); if (value.length()>length){ - return value.substring(0, length).contains(item.trim()); + return value.substring(0, length).contains(item); }else return false; }) .collect(Collectors.toList()); @@ -65,8 +68,8 @@ public class Analysis { // pattern.matcher(standId).matches() if (value.length()>=length+5){ sortCell.setCellValue(collect.get(0)); - sortNumber.setCellValue(value.substring(length,value.length()-5)); - sortYear.setCellValue(value.substring(value.length()-4)); + numberCell.setCellValue(value.substring(length,value.length()-5)); + yearCell.setCellValue(value.substring(value.length()-4)); } }else if (collect.size()>1){ String maxLenSort=""; @@ -83,26 +86,37 @@ public class Analysis { sortCell.setCellValue(maxLenSort); - sortNumber.setCellValue(value.substring(length,value.length()-5)); - sortYear.setCellValue(value.substring(value.length()-4)); + numberCell.setCellValue(value.substring(length,value.length()-5)); + yearCell.setCellValue(value.substring(value.length()-4)); } } else { logger.info("-"); sortCell.setCellValue("-"); - sortNumber.setCellValue("-"); - sortYear.setCellValue("-"); + numberCell.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); workbook.write(os); // HashMap map = new HashMap<>(); } + + public void setSortColumn(int sortColumn){ + this.sortColumn=sortColumn; + } + + /** + * 获取标准类别set集合 + * @param file + * @return + * @throws IOException + */ private HashSet getSet(MultipartFile file) throws IOException { InputStream inputStream = file.getInputStream(); XSSFWorkbook workbook = new XSSFWorkbook(inputStream); @@ -114,8 +128,8 @@ public class Analysis { HashSet stringHashSet= new HashSet<>(); for (Row row : sheet) { - if (row.getCell(0)!=null){ - stringHashSet.add(row.getCell(0).toString().trim()); + if (row.getCell(sortColumn)!=null){ + stringHashSet.add(row.getCell(sortColumn).toString()); } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/Contrast.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/Contrast.java new file mode 100644 index 00000000..9002a91f --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/Contrast.java @@ -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 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 map = new HashMap<>(); + + } + + private HashSet getSet(MultipartFile file) throws IOException { + InputStream inputStream = file.getInputStream(); + XSSFWorkbook workbook = new XSSFWorkbook(inputStream); + + XSSFSheet sheet = workbook.getSheetAt(0); + +// int lastNum = sheet.getLastRowNum(); + + HashSet stringHashSet= new HashSet<>(); + + for (Row row : sheet) { + if (row.getCell(1)!=null){ + stringHashSet.add(row.getCell(1).toString().trim()); + } + } + + return stringHashSet; + } + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/PathMatcher.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/PathMatcher.java new file mode 100644 index 00000000..a046b6f5 --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/PathMatcher.java @@ -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 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 getFileMap(MultipartFile excel) throws IOException { + + InputStream inputStream = excel.getInputStream(); + + XSSFWorkbook workbook = new XSSFWorkbook(inputStream); + + XSSFSheet sheet = workbook.getSheetAt(0); + + HashMap 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; + + + } + + + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/StandMatcher.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/StandMatcher.java new file mode 100644 index 00000000..041a0c47 --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/comment/StandMatcher.java @@ -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 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 getMatchSet(MultipartFile excel) throws IOException { + InputStream inputStream = excel.getInputStream(); + XSSFWorkbook workbook = new XSSFWorkbook(inputStream); + + XSSFSheet sheet = workbook.getSheetAt(0); + + Map 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; + } + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/controller/ImportExcelController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/controller/ImportExcelController.java index 61a7187b..ab6ad83d 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/controller/ImportExcelController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/ImportExcelDatas/controller/ImportExcelController.java @@ -2,10 +2,7 @@ package com.adc.da.slrs.ImportExcelDatas.controller; import com.adc.da.base.web.BaseController; import com.adc.da.common.ReadExcel; -import com.adc.da.slrs.ImportExcelDatas.comment.Analysis; -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.comment.*; import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto; import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService; import com.adc.da.util.exception.AdcDaBaseException; @@ -90,7 +87,7 @@ public class ImportExcelController extends BaseController { } - @ApiOperation("从excl分解") + @ApiOperation("从excl分解出标准号") @PostMapping("/analysisExcl") public void analysisExcl(MultipartFile exclFile,MultipartFile standSort, HttpServletResponse response, HttpServletRequest request) throws IOException { /** @@ -139,19 +136,39 @@ public class ImportExcelController extends BaseController { return importExcelService.isExist(exclFile); } - @ApiOperation("对比") + @ApiOperation("对比两个excel表中的标准名称") @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.run(all,excel); + contrast.run(targetExcel,excel); } @ApiOperation("根据标准从excl中分解出标准号,类别,年份") @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.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); + } + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/controller/SapMeetingController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/controller/SapMeetingController.java new file mode 100644 index 00000000..3d5997dc --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/controller/SapMeetingController.java @@ -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; + +/** +*

+ * 流程通过的 标准化活动会议信息表 +standard_activity_pass + 前端控制器 + *

+* +* @author zcr +* @since 2021-11-09 +*/ +@RestController +@Api(description = "|SapMeeting|") +@RequestMapping("/api/sapMeetInfo") +public class SapMeetingController extends BaseController { + + @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 getMeetingsByMonth(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date){ + return sapMeetingService.getMeetingsByMonth(date); + } + + @ApiOperation(value = "获取当月,根据标志位type区分 1标准活动和2政策课题") + @GetMapping("/getMeetingsByMonthType") + public List getMeetingsByMonthType(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date,int type){ + return sapMeetingService.getMeetingsByMonth(date, type); + } + + @ApiOperation(value = "获取当天") + @GetMapping("/getMeetingsByDate") + public List 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); + } +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/dao/SapMeetingDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/dao/SapMeetingDao.java new file mode 100644 index 00000000..f3fd90bb --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/dao/SapMeetingDao.java @@ -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; + +/** + *

+ * 流程通过的 标准化活动会议信息表 +standard_activity_pass + Mapper 接口 + *

+ * + * @author super_liu + * @since 2021-11-09 + */ +@Repository +public interface SapMeetingDao extends BaseMapper { + + int insertMeeting(SapMeeting sapMeeting);//参会流程结束--插入 + + List selectMeetingsByDate(Map map);//根据日期查找-当日所有会议(时间正序) + List selectMeetingsByMonth(Date date);//根据年,月查找 + List selectMeetingsByMonthType(Map map);//根据年,月查找,type标志位 1标准化活动 2政策课题组 + + + SapMeeting selectMeetingById(String id); + + + int deleteById(String id); + + int deleteByDate(Date date); + + int updateMeeting(SapMeeting sapMeeting); + + + + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/entity/SapMeeting.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/entity/SapMeeting.java new file mode 100644 index 00000000..6b273f94 --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/entity/SapMeeting.java @@ -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; + +/** + *

+ * 流程通过的 标准化活动会议信息表 +standard_activity_pass + + *

+ * + * @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 + + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/service/ISapMeetingService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/service/ISapMeetingService.java new file mode 100644 index 00000000..c2b9d42c --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/service/ISapMeetingService.java @@ -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; + +/** + *

+ * 流程通过的 标准化活动会议信息表 +standard_activity_pass + 服务类 + *

+ * + * @author super_liu + * @since 2021-11-09 + */ +public interface ISapMeetingService extends IService { + + int addMeeting(SapMeeting sapMeeting);//参会流程结束--插入 + + List getMeetingsByDate(Date date,int type);//根据日期查找-当日所有会议(时间正序) + List getMeetingsByMonth(Date date);//根据年,月查找 + List 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); + +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/service/impl/SapMeetingServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/service/impl/SapMeetingServiceImpl.java new file mode 100644 index 00000000..7d71da5c --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sapMeetInfo/service/impl/SapMeetingServiceImpl.java @@ -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; + +/** + *

+ * 流程通过的 标准化活动会议信息表 +standard_activity_pass + 服务实现类 + *

+ * + * @author super_liu + * @since 2021-11-09 + */ +@Service +public class SapMeetingServiceImpl extends ServiceImpl implements ISapMeetingService { + + @Autowired + SapMeetingDao sapMeetingDao; + + @Override + public int addMeeting(SapMeeting sapMeeting) { + sapMeeting.setId(UUIDUtils.randomUUID(30)); + return sapMeetingDao.insertMeeting(sapMeeting); + } + + @Override + public List getMeetingsByDate(Date date,int type) { + Map map = new HashMap(); + map.put("date",date); + map.put("type",type); + return sapMeetingDao.selectMeetingsByDate(map); + } + + @Override + public List getMeetingsByMonth(Date date) { + List sapMeetings = sapMeetingDao.selectMeetingsByMonth(date); + return sapMeetings; + } + + @Override + public List 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 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 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; + } +} diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/BusinessDeptIssueController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/BusinessDeptIssueController.java index 2a2c313b..b3f491c0 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/BusinessDeptIssueController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandUnqualified/controller/BusinessDeptIssueController.java @@ -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.BusinessDeptIssueVo; import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService; +import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONObject; 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"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); -// List 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()); - BusinessDeptIssueVo businessDeptIssueVo = JSONObject.toJavaObject(jsonObject, BusinessDeptIssueVo.class); IPage page = iBusinessDeptIssueService.getBusinessDeptIssue(businessDeptIssueVo); diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sapMeetInfo/SapMeetingMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sapMeetInfo/SapMeetingMapper.xml new file mode 100644 index 00000000..533cc110 --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sapMeetInfo/SapMeetingMapper.xml @@ -0,0 +1,77 @@ + + + + + + id,title,date,content,type,attend,files + + + type = #{type} + + + + insert into sap_meeting + + id, + title, + date, + content, + type, + attend, + files, + + values + + #{id}, + #{title}, + #{date}, + #{content}, + #{type}, + #{attend}, + #{files}, + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapAttendeeMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapAttendeeMapper.xml new file mode 100644 index 00000000..9ffa4968 --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapAttendeeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapFilesMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapFilesMapper.xml new file mode 100644 index 00000000..e19264db --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapFilesMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapMeetingMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapMeetingMapper.xml new file mode 100644 index 00000000..586270ef --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/spaMeetInfo/SapMeetingMapper.xml @@ -0,0 +1,5 @@ + + + + +