Merge branch 'dev_20230829_change' into dev_20231201_feizhi

# Conflicts:
#	adc-da-search/src/main/java/com/adc/da/search/service/impl/SearchCenterServiceImpl.java
#	adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java
#	adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java
#	adc-da-slrs/src/main/java/com/adc/da/slrs/sarRole/service/ITsRoleService.java
#	adc-da-slrs/src/main/java/com/adc/da/slrs/sarUser/service/impl/TsUserServiceImpl.java
This commit is contained in:
wxyclub
2023-12-01 18:11:16 +08:00
96 changed files with 3924 additions and 693 deletions
@@ -1484,7 +1484,8 @@ public class WorkFlowController extends BaseController {
String s = "";
if (StringUtils.isBlank(prcName) || StringUtils.isBlank(json) || StringUtils.isBlank(sort)) {
return Result.error("参数为空");
} else {
}
else {
prcName = sort + "-" + prcName + "-计划立项";
}
JSONObject jsonObject = JSON.parseObject(json);
@@ -1515,26 +1516,31 @@ public class WorkFlowController extends BaseController {
}
}
}else {
s = workFlowFeignClient.endPrcName(prcName, esId);
String[] split = s.split("-");
List<String> asList = Arrays.asList(split);
if(split[0].equals("成功")){
if(asList.size()>1){
if ("4".equals(jsonObject.getString("type")) || "3".equals(jsonObject.getString("type"))) {
s = workFlowFeignClient.endPrcName(prcName, esId);
if (StringUtils.isBlank(s)) {
return Result.error();
}
String[] split = s.split("-");
List<String> asList = Arrays.asList(split);
if(split[0].equals("成功")){
if(asList.size()>1){
EndPrcName endPrcName = new EndPrcName();
Map<String, String> objectObjectMap = new HashMap<>();
objectObjectMap.put("ids",split[1]);
objectObjectMap.put("prcCreateUser","xxx");
String s1 = JSONObject.toJSONString(objectObjectMap);
endPrcName.setIds(s1);
endPrcName.setIsNot("1");
return Result.success(endPrcName);
}
EndPrcName endPrcName = new EndPrcName();
Map<String, String> objectObjectMap = new HashMap<>();
objectObjectMap.put("ids",split[1]);
objectObjectMap.put("prcCreateUser","xxx");
String s1 = JSONObject.toJSONString(objectObjectMap);
endPrcName.setIds(s1);
endPrcName.setIsNot("1");
endPrcName.setIsNot("2");
endPrcName.setIds("xxx");
return Result.success(endPrcName);
}else {
return Result.error();
}
EndPrcName endPrcName = new EndPrcName();
endPrcName.setIsNot("2");
endPrcName.setIds("xxx");
return Result.success(endPrcName);
}else {
return Result.error();
}
}
return Result.success();
@@ -39,8 +39,9 @@ public class ActSarLawsInformationEOService {
}else {
createAndApproveBy = applyUserId + "," + approverId;
}
sarLawsInformation.setDownloadableBy(createAndApproveBy);
sarLawsInformation.setViewableBy(createAndApproveBy);
// sarLawsInformation.setDownloadableBy(createAndApproveBy);
// sarLawsInformation.setViewableBy(createAndApproveBy);
sarLawsInformation.setCreateAndApproveBy(createAndApproveBy);
logger.info("政策法规资料入库:" + sarLawsInformation);
informationService.addLawsInformation(sarLawsInformation);
}
@@ -142,10 +142,10 @@ public class LoginRestController {
if(userEO.getDisableFlag()==1){
return Result.error("r0011", "帐号已禁用");
}
String position = userService.selectPositionByUserId(account);
if(StringUtils.isBlank(position)){
return Result.error("r0011", "无配置岗位");
}
// String position = userService.selectPositionByUserId(account);
// if(StringUtils.isBlank(position)){
// return Result.error("r0011", "无配置岗位");
// }
String token = jwtUtils.generateToken(userEO.getUsid());
userEO.setToken(token);
// 加密重要信息
@@ -212,10 +212,10 @@ public class LoginRestController {
if(userEO.getDisableFlag()==1){
return Result.error("r0011", "帐号已禁用");
}
String position = userService.selectPositionByUserId(account);
if(StringUtils.isBlank(position)){
return Result.error("r0011", "无配置岗位");
}
// String position = userService.selectPositionByUserId(account);
// if(StringUtils.isBlank(position)){
// return Result.error("r0011", "无配置岗位");
// }
String token = jwtUtils.generateToken(userEO.getUsid());
userEO.setToken(token);
// 加密重要信息
@@ -154,6 +154,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
addInterceptor.excludePathPatterns("/api/OtConvert/convertFileToFileId");
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFileForSarNew");
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFileForSarNewOnlyOffice");
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFileForSarWaterMarkNew");
addInterceptor.excludePathPatterns("/api/att/attFile/uploadNew");
addInterceptor.excludePathPatterns("/api/lawss/sarBussionessStand/importSarBussionessStandFile");
@@ -216,14 +217,23 @@ public class WebMvcConfig implements WebMvcConfigurer {
// 内外部会议模板下载
addInterceptor.excludePathPatterns("/api/lawss/insideOutsideMeeting/exportTemplateFile");
// 内外部会议导入
addInterceptor.excludePathPatterns("/api/lawss/insideOutsideMeeting/importMeetingInfo");
// 政策课题模板下载
addInterceptor.excludePathPatterns("/api/lawss/sarLawsTopic/exportTemplateFile");
// 政策课题导入
addInterceptor.excludePathPatterns("/api/lawss/sarLawsTopic/importLawsTopicInfo");
// 政策资料模板下载
addInterceptor.excludePathPatterns("/api/lawss/sarLawsInformation/exportTemplateFile");
// 政策法规资料导入
addInterceptor.excludePathPatterns("/api/lawss/sarLawsInformation/importLawsInformationInfo");
// // 添加自定义拦截器,并拦截对应 url
// 标准体系列表导出
addInterceptor.excludePathPatterns("/api/lawss/sarMenuStandardLimit/standardSystemListExport");
// 添加自定义拦截器,并拦截对应 url
addInterceptor.addPathPatterns("/**");
}
}
@@ -15,4 +15,5 @@ public interface SarStandardInfoDao{
public int updateStandardInfo(@Param("id")String id, @Param("textStatus") String textStatus);
int deleteStandSystem(@Param("menuName") String menuName);
}
@@ -11,8 +11,7 @@ import com.adc.da.exception.AdcDaBaseException;
import com.adc.da.http.PageInfo;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeeting;
import com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeetingVO;
import com.adc.da.slrs.InsideOntSideMeeting.entity.*;
import com.adc.da.slrs.InsideOntSideMeeting.service.InsideOutsideMeetingService;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.FieldConvertUtil;
@@ -27,6 +26,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -122,11 +123,26 @@ public class InsideOutSideMeetingController extends BaseController<InsideOutside
// 导出所有数据
datas = meetingService.queryAllMeeting(insideOutsideMeetingVO);
}
List<InsideOutsideMeetingExport> dataExportList = new ArrayList<>();
for (InsideOutsideMeetingVO data : datas) {
InsideOutsideMeetingExport dataExport = new InsideOutsideMeetingExport();
BeanUtils.copyProperties(data, dataExport);
if (data.getMeetingTopicList()!= null) {
List<MeetingTopicExport> topicExportList = new ArrayList<>();
for (MeetingTopic meetingTopic : data.getMeetingTopicList()) {
MeetingTopicExport topicExport = new MeetingTopicExport();
BeanUtils.copyProperties(meetingTopic, topicExport);
topicExportList.add(topicExport);
}
dataExport.setMeetingTopicList(topicExportList);
}
dataExportList.add(dataExport);
}
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setSheetName(insideOutsideMeetingVO.getExportName());
// workbook = InsideOutsideMeetingExportUtil.exportDatas(datas);
workbook = ExcelExportUtil.exportExcel(exportParams, InsideOutsideMeetingVO.class, datas);
workbook = ExcelExportUtil.exportExcel(exportParams, InsideOutsideMeetingExport.class, dataExportList);
os = response.getOutputStream();
workbook.write(os);
os.flush();
@@ -169,11 +185,11 @@ public class InsideOutSideMeetingController extends BaseController<InsideOutside
nowFile.mkdirs();
String fileName2 = "导入模板.xls";
HSSFSheet sheetItems = workbook.createSheet("模板");
sheetItems.setDefaultColumnWidth(13);
sheetItems.setDefaultColumnWidth(14);
Row rowHeader = sheetItems.createRow(1);//开始创建标题行
sheetItems.addMergedRegion(new CellRangeAddress(0, 0, 0, 13));
sheetItems.addMergedRegion(new CellRangeAddress(0, 0, 0, 14));
Row row2 = sheetItems.createRow(0);//开始创建填写说明
String exportFieldName = FieldConvertUtil.exportFieldNamesInsideOutsideMeeting + FieldConvertUtil.exportFieldNamesMeetingTopic;
String exportFieldName = FieldConvertUtil.exportFieldNamesInsideOutsideMeeting + "," + FieldConvertUtil.exportFieldNamesMeetingTopic;
if (StringUtils.isNotBlank(exportFieldName)) {
String[] headerArr = exportFieldName.split(",");
for (int i=0;i < headerArr.length; i++) {
@@ -16,7 +16,7 @@ import java.util.List;
@Mapper
public interface InsideOutsideMeetingDao extends BaseMapper<InsideOutsideMeeting> {
List<Integer> queryByPageCount(InsideOutsideMeetingVO page);
Integer queryByPageCount(InsideOutsideMeetingVO page);
List<InsideOutsideMeetingVO> queryByPage(InsideOutsideMeetingVO page);
@@ -2,6 +2,7 @@ package com.adc.da.slrs.InsideOntSideMeeting.entity;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.base.entity.BaseEntity;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -35,6 +36,7 @@ public class InsideOutsideMeeting extends BaseEntity {
@TableId(value = "ID", type = IdType.ID_WORKER_STR)
private String id;
@CompareField(fieldName = "会议名称")
@ApiModelProperty(value = "会议名称")
@TableField("MEETING_NAME")
private String meetingName;
@@ -42,27 +44,33 @@ public class InsideOutsideMeeting extends BaseEntity {
/**
* 课题名称,可通过调取功能从政策课题模块中获取
*/
@CompareField(fieldName = "课题名称")
@ApiModelProperty(value = "课题名称")
@TableField("TOPIC_NAME")
private String topicName;
@CompareField(fieldName = "会议主办单位")
@ApiModelProperty(value = "会议主办单位")
@TableField("MEETING_ORGANIZER")
private String meetingOrganizer;
@CompareField(fieldName = "会议时间")
@ApiModelProperty(value = "会议时间")
@TableField("MEETING_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private Date meetingTime;
@CompareField(fieldName = "会议地点")
@ApiModelProperty(value = "会议地点")
@TableField("MEETING_ADDRESS")
private String meetingAddress;
@CompareField(fieldName = "参会人员")
@ApiModelProperty(value = "参会人员")
@TableField("PARTICIPANTS")
private String participants;
@CompareField(fieldName = "会议纪要")
@ApiModelProperty(value = "会议纪要")
@TableField("MEETING_MINUTES")
private String meetingMinutes;
@@ -71,26 +79,30 @@ public class InsideOutsideMeeting extends BaseEntity {
@TableField(exist = false)
private List<AttFileEO> meetingMinutesList;
@CompareField(fieldName = "会议主要内容")
@ApiModelProperty(value = "会议主要内容")
@TableField("MEETING_CONTENT")
private String meetingContent;
@ApiModelProperty(value = "1级会议类")
@CompareField(fieldName = "1级会议")
@ApiModelProperty(value = "1级会议分类")
@TableField("FIRST_MEETING_TYPE")
private String firstMeetingType;
@ApiModelProperty(value = "1级会议类名称")
@ApiModelProperty(value = "1级会议类名称")
@TableField(exist = false)
private String firstMeetingTypeName;
@ApiModelProperty(value = "2级会议类")
@CompareField(fieldName = "2级会议")
@ApiModelProperty(value = "2级会议分类")
@TableField("SECOND_MEETING_TYPE")
private String secondMeetingType;
@ApiModelProperty(value = "2级会议类名称")
@ApiModelProperty(value = "2级会议类名称")
@TableField(exist = false)
private String secondMeetingTypeName;
@CompareField(fieldName = "会议议题")
@ApiModelProperty(value = "会议议题")
@TableField(exist = false)
private List<MeetingTopic> meetingTopicList;
@@ -0,0 +1,51 @@
package com.adc.da.slrs.InsideOntSideMeeting.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.adc.da.att.entity.AttFileEO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author tjzdw
* @description
* @date 2023/11/23
*/
@Data
public class InsideOutsideMeetingExport {
private String id;
@Excel(name = "会议名称", needMerge = true)
private String meetingName;
@Excel(name = "课题名称", needMerge = true)
private String topicName;
@Excel(name = "会议主办单位", needMerge = true)
private String meetingOrganizer;
@Excel(name = "会议时间", exportFormat = "yyyy-MM-dd", needMerge = true)
private Date meetingTime;
@Excel(name = "会议地点", needMerge = true)
private String meetingAddress;
@Excel(name = "参会人员", needMerge = true)
private String participants;
@Excel(name = "会议主要内容", needMerge = true)
private String meetingContent;
@Excel(name = "1级会议分类", needMerge = true)
private String firstMeetingTypeName;
@Excel(name = "2级会议分类", needMerge = true)
private String secondMeetingTypeName;
@ExcelCollection(name = "会议议题")
private List<MeetingTopicExport> meetingTopicList;
}
@@ -24,41 +24,42 @@ public class InsideOutsideMeetingVO extends BasePage {
private String id;
@Excel(name = "会议名称", needMerge = true)
@Excel(name = "*会议名称", needMerge = true)
private String meetingName;
@Excel(name = "课题名称", needMerge = true)
private String topicName;
@Excel(name = "会议主办单位", needMerge = true)
@Excel(name = "*会议主办单位", needMerge = true)
private String meetingOrganizer;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@Excel(name = "会议时间", exportFormat = "yyyy-MM-dd", needMerge = true)
@Excel(name = "*会议时间", exportFormat = "yyyy-MM-dd", needMerge = true)
private Date meetingTime;
@Excel(name = "会议地点", needMerge = true)
@Excel(name = "*会议地点", needMerge = true)
private String meetingAddress;
@Excel(name = "参会人员", needMerge = true)
private String agendaNameStr;
@Excel(name = "*参会人员", needMerge = true)
private String participants;
private List<String> participantsList;
private String meetingMinutes;
private List<AttFileEO> meetingMinutesList;
@Excel(name = "会议主要内容", needMerge = true)
@Excel(name = "*会议主要内容", needMerge = true)
private String meetingContent;
private String firstMeetingType;
@Excel(name = "1级会议类", needMerge = true)
@Excel(name = "*1级会议", needMerge = true)
private String firstMeetingTypeName;
private String secondMeetingType;
@Excel(name = "2级会议类", needMerge = true)
@Excel(name = "*2级会议", needMerge = true)
private String secondMeetingTypeName;
@ExcelCollection(name = "会议议题")
@@ -82,13 +83,13 @@ public class InsideOutsideMeetingVO extends BasePage {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
private String sortField = "ID";
private String sortField = "meetingTime";
private String sortMode = "asc";
private String sortMode = "desc";
// 会议时间查询字段
private Date meetingTimeBegin;
private Date meetingTimeEnd;
private String meetingTimeBegin;
private String meetingTimeEnd;
// 导出使用字段
// 被前端选中的记录的ids
@@ -1,6 +1,7 @@
package com.adc.da.slrs.InsideOntSideMeeting.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -11,6 +12,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
import java.util.List;
/**
* @author tjzdw
@@ -34,25 +39,46 @@ public class MeetingTopic extends BaseEntity {
@ApiModelProperty(value = "议题名称")
@TableField("AGENDA_NAME")
@Excel(name = "议题名称")
@Excel(name = "*议题名称")
private String agendaName;
@ApiModelProperty(value = "议题材料")
@TableField("AGENDA_MATERIALS")
private String agendaMaterials;
@TableField(exist = false)
private List<AttFileEO> agendaMaterialsList;
@ApiModelProperty(value = "汇报人")
@TableField("REPORTER")
@Excel(name = "汇报人")
@Excel(name = "*汇报人")
private String reporter;
@ApiModelProperty(value = "汇报单位")
@TableField("REPORTING_UNIT")
@Excel(name = "汇报单位")
@Excel(name = "*汇报单位")
private String reportingUnit;
@ApiModelProperty(value = "议题主要内容")
@TableField("AGENDA_CONTENT")
@Excel(name = "议题主要内容")
@Excel(name = "*议题主要内容")
private String agendaContent;
@ApiModelProperty(value = "创建时间")
@TableField("CREATE_TIME")
private Date createTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
private Date modifyTime;
public static MeetingTopic emptyValueProcess(MeetingTopic meetingTopic) {
if (StringUtils.isBlank(meetingTopic.getAgendaName()) &&
StringUtils.isBlank(meetingTopic.getAgendaMaterials()) &&
StringUtils.isBlank(meetingTopic.getReporter()) &&
StringUtils.isBlank(meetingTopic.getReportingUnit()) &&
StringUtils.isBlank(meetingTopic.getAgendaContent())) {
return null;
}
return meetingTopic;
}
}
@@ -0,0 +1,34 @@
package com.adc.da.slrs.InsideOntSideMeeting.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.adc.da.att.entity.AttFileEO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author tjzdw
* @description
* @date 2023/11/23
*/
@Data
public class MeetingTopicExport {
private String id;
@Excel(name = "议题名称")
private String agendaName;
@Excel(name = "汇报人")
private String reporter;
@Excel(name = "汇报单位")
private String reportingUnit;
@Excel(name = "议题主要内容")
private String agendaContent;
}
@@ -2,6 +2,7 @@ package com.adc.da.slrs.InsideOntSideMeeting.service.impl;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.common.FileUnZip;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
@@ -11,18 +12,19 @@ import com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeetingVO;
import com.adc.da.slrs.InsideOntSideMeeting.entity.MeetingTopic;
import com.adc.da.slrs.InsideOntSideMeeting.service.InsideOutsideMeetingService;
import com.adc.da.slrs.InsideOntSideMeeting.service.MeetingTopicService;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.tsDictionaryType.entity.TsDicType;
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.annotation.CompareField;
import com.adc.da.utils.util.FieldConvertUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.annotations.ApiModelProperty;
import lombok.Cleanup;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
@@ -34,7 +36,9 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -72,7 +76,9 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
List<AttFileEO> meetingMinutesList = new ArrayList<>();
for (String attId : insideOutsideMeeting.getMeetingMinutes().split(",")) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
meetingMinutesList.add(fileInfo);
if (fileInfo != null) {
meetingMinutesList.add(fileInfo);
}
}
insideOutsideMeeting.setMeetingMinutesList(meetingMinutesList);
}
@@ -81,7 +87,18 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
// 获取会议课题列表
LambdaQueryWrapper<MeetingTopic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MeetingTopic::getMeetingId, meetingId);
wrapper.orderByAsc(MeetingTopic::getCreateTime);
List<MeetingTopic> meetingTopicList = meetingTopicService.list(wrapper);
for (MeetingTopic meetingTopic : meetingTopicList) {
if (StringUtils.isNotBlank(meetingTopic.getAgendaMaterials())) {
List<AttFileEO> agendaMaterialsList = new ArrayList<>();
for (String attId : meetingTopic.getAgendaMaterials().split(",")) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
agendaMaterialsList.add(fileInfo);
}
meetingTopic.setAgendaMaterialsList(agendaMaterialsList);
}
}
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
}
return insideOutsideMeeting;
@@ -108,7 +125,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
if (StringUtils.isBlank(insideOutsideMeeting.getId())) {
return false;
}
InsideOutsideMeeting insideOutsideMeetingDB = this.baseMapper.selectById(insideOutsideMeeting.getId());
InsideOutsideMeeting insideOutsideMeetingDB = getMeetingInfo(insideOutsideMeeting.getId());
List<String> diffList = compareInsideOutsideMeeting(insideOutsideMeetingDB, insideOutsideMeeting);
if (diffList.size() > 0) {
insideOutsideMeeting.setModifyTime(new Date());
@@ -175,19 +192,16 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
@Override
public List<InsideOutsideMeetingVO> queryByPage(InsideOutsideMeetingVO page){
if (StringUtils.isNotBlank(page.getParticipants())) {
page.setParticipantsList(Arrays.asList(page.getParticipants().split(",")));
}
// 设置排序字段
if (StringUtils.isNotBlank(page.getSortField())) {
// 小驼峰变成 ABC_DEF
String sortField = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(page.getSortField()),"_").toUpperCase();
page.setSortField(sortField);
} else {
page.setSortField("ID");
page.setSortMode("asc");
page.setSortField("MEETING_TIME");
page.setSortMode("desc");
}
int rowCount = this.baseMapper.queryByPageCount(page).size();
int rowCount = this.baseMapper.queryByPageCount(page);
page.getPager().setRowCount(rowCount);
List<InsideOutsideMeetingVO> insideOutsideMeetingVOList = this.baseMapper.queryByPage(page);
for (InsideOutsideMeetingVO insideOutsideMeeting : insideOutsideMeetingVOList) {
@@ -233,6 +247,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
try {
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + "/" + fileNameStr));
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件存储失败!");
}
//解压缩
@@ -241,43 +256,68 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
FileUnZip.delete(new File(path + "/" + fileNameStr));
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件解压失败");
}
//获取文件信息
List<File> fileList = readImpExcelFile(zipEntryName);
//判断获取到的文件数量
if (fileList.size() != 1) {
return Result.error("上传的文件只能有一个");
if (fileList.size() < 1) {
return Result.error("上传的文件不能为空");
}
File importFile = fileList.get(0);
if (!importFile.getName().contains(".xls") && !importFile.getName().contains(".xlsx")) {
return Result.error("文件必须是EXCEL文件");
File excelFile = null;
int excelCount = 0;
// 将文件转换为Map,文件名为建,文件为值
Map<String, File> fileMap = new HashMap<>();
for (File file1 : fileList) {
fileMap.put(file1.getName(), file1);
if (file1.getName().toLowerCase().contains(".xls") || file1.getName().toLowerCase().contains(".xlsx")) {
excelFile = file1;
excelCount ++;
}
}
if (excelCount > 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("导入了多个Excel文件");
}
if (excelCount < 1){
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件必须包含一个EXCEL文件");
}
Workbook workbook = null;
InputStream inputStream = null;
try {
workbook = WorkbookFactory.create(importFile);
inputStream = new FileInputStream(excelFile);
workbook = WorkbookFactory.create(inputStream);
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("导入失败,需要导入的数据有问题或导入的企标标号和企标名称已存在");
return Result.error("导入失败,需要导入的数据有问题");
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Sheet sheet = workbook.getSheetAt(0);
if (sheet == null) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("工作表为空");
}
StringBuilder sb = new StringBuilder();
List<String> headerList = new ArrayList<>();
// 获取excel表头
Row headerRow = sheet.getRow(1);
for (int i = 0; i <= 12; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
try {
for (int i = 0; i <= 14; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
}
} catch (Exception e) {
return Result.error("表头读取失败,请严格按照模板文件导入数据");
} finally {
FileUnZip.deleteDir(saveDirectory);
}
// 判断表头字段是否相同
if (!String.join(",",headerList).equals(FieldConvertUtil.exportFieldNamesInsideOutsideMeeting + "," + FieldConvertUtil.exportFieldNamesMeetingTopic)) {
try {
workbook.close();
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件关闭出错");
}
//删除原上传文件
@@ -294,7 +334,7 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
// 用于存储每行的键值对数据,对应一条数据
Map<String, String> rowMap = new LinkedHashMap<>();
// 总列数
int columnNum = 13;
int columnNum = 15;
// 遍历每个单元格
for (int columnIndex = 0; columnIndex < columnNum; columnIndex++) {
// 获取单元格
@@ -305,14 +345,16 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
Date d = cell.getDateCellValue();
if (d.before(sdf.parse("1900-01-01")) || d.after(sdf.parse("2500-01-01"))) {
return Result.error("输入的日期异常,请按照实际日期填写");
FileUnZip.deleteDir(saveDirectory);
return Result.error(""+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
}
// 将单元格数据存入Map中
rowMap.put(headerCell.getStringCellValue(), sdf.format(d));
} else {
cell.setCellType(CellType.STRING);
if (cell.getStringCellValue().length() > 500) {
return Result.error("单元格输入过长");
FileUnZip.deleteDir(saveDirectory);
return Result.error(""+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入过长");
}
rowMap.put(headerCell.getStringCellValue(), cell.getStringCellValue());
}
@@ -322,6 +364,21 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
}
importDataList.add(rowMap);
}
if (importDataList.size() < 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("您输入的数据为空");
}
try {
workbook.close();
inputStream.close();
FileUnZip.deleteDir(excelFile);
} catch (IOException e) {
return Result.error("关闭失败");
}finally {
FileUnZip.deleteDir(saveDirectory);
}
FileUnZip.delete(excelFile);
// 获取需要校验的字段
List<TsDicType> firstMeetingTypeList = dicTypeService.selectAllDicTypeNameByDicCode("firstMeetingType");
@@ -333,70 +390,150 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
// InsideOutsideMeeting insideOutsideMeetingDB = null;
InsideOutsideMeeting insideOutsideMeeting = new InsideOutsideMeeting();
List<MeetingTopic> meetingTopicList = new ArrayList<>();
for (Map<String, String> dataMap : importDataList) {
String meetingName = dataMap.get("会议名称");
// 如果会议名称为空,则表示该行为会议课题行,是之前会议的会议课题,不提交之前的会议信息。不为空则进入
if (StringUtils.isNotBlank(meetingName)) {
// 如果计数器大于0,表示进入了新的会议信息中,提交之前的会议信息
if (count > 0) {
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
addMeetingInfo(insideOutsideMeeting);
// 初始化会议课题列表
meetingTopicList.clear();
// 初始化会议对象
insideOutsideMeeting = new InsideOutsideMeeting();
// 计数器归零
count = 0;
}
insideOutsideMeeting.setMeetingName(meetingName);
insideOutsideMeeting.setTopicName(dataMap.get("课题名称"));
insideOutsideMeeting.setMeetingOrganizer(dataMap.get("会议主办单位"));
insideOutsideMeeting.setMeetingTime(sdf.parse(dataMap.get("会议时间")));
insideOutsideMeeting.setMeetingAddress(dataMap.get("会议地点"));
insideOutsideMeeting.setParticipants(dataMap.get("参会人员"));
insideOutsideMeeting.setMeetingContent(dataMap.get("会议主要内容"));
if (StringUtils.isNotBlank(dataMap.get("一级会议类别"))) {
if (!firstMeetingTypeNameSet.contains(dataMap.get("一级会议类别"))){
return Result.error("一级会议类别不符合输入要求");
try {
for (Map<String, String> dataMap : importDataList) {
String meetingName = dataMap.get("*会议名称");
// 如果会议名称为空,则表示该行为会议课题行,是之前会议的会议课题,不提交之前的会议信息。不为空则进入
if (StringUtils.isNotBlank(meetingName)) {
// 如果计数器大于0,表示进入了新的会议信息中,提交之前的会议信息
if (count > 0) {
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
addMeetingInfo(insideOutsideMeeting);
// 初始化会议课题列表
meetingTopicList.clear();
// 初始化会议对象
insideOutsideMeeting = new InsideOutsideMeeting();
// 计数器归零
count = 0;
}
for (TsDicType tsDicType : firstMeetingTypeList) {
if (dataMap.get("一级会议类别").equals(tsDicType.getDicTypeName())) {
insideOutsideMeeting.setFirstMeetingType(tsDicType.getDicTypeCode());
insideOutsideMeeting.setMeetingName(meetingName);
insideOutsideMeeting.setTopicName(dataMap.get("课题名称"));
if (StringUtils.isNotBlank(dataMap.get("*会议主办单位"))) {
insideOutsideMeeting.setMeetingOrganizer(dataMap.get("*会议主办单位"));
} else {
return Result.error(""+ (count+1) +"行会议主办单位不能为空");
}
if (StringUtils.isNotBlank(dataMap.get("*会议时间"))) {
Date meetingTime = null;
try {
meetingTime = sdf.parse(dataMap.get("*会议时间"));
insideOutsideMeeting.setMeetingTime(meetingTime);
} catch (ParseException e) {
return Result.error(""+ (count+1) +"行会议时间格式必须为年-月-日");
}
} else {
return Result.error(""+ (count+1) +"行会议时间不能为空");
}
}
if (StringUtils.isNotBlank(dataMap.get("二级会议类别"))) {
if (!secondMeetingTypeNameSet.contains(dataMap.get("二级会议类别"))){
return Result.error("二级会议类别不符合输入要求");
if (StringUtils.isNotBlank(dataMap.get("*会议地点"))) {
insideOutsideMeeting.setMeetingAddress(dataMap.get("*会议地点"));
} else {
return Result.error(""+ (count+1) +"行会议地点不能为空");
}
for (TsDicType tsDicType : secondMeetingTypeList) {
if (dataMap.get("二级会议类别").equals(tsDicType.getDicTypeName())) {
insideOutsideMeeting.setSecondMeetingType(tsDicType.getDicTypeCode());
if (StringUtils.isNotBlank(dataMap.get("*参会人员"))) {
insideOutsideMeeting.setParticipants(dataMap.get("*参会人员"));
} else {
return Result.error(""+ (count+1) +"行参会人员不能为空");
}
String meetingMinutesFileNameStr = dataMap.get("会议纪要");
String meetingMinutesFileAtt = null;
try {
meetingMinutesFileAtt = getFileAtt("会议纪要",meetingMinutesFileNameStr, fileMap, count);
} catch (Exception e) {
return Result.error(e.getMessage());
}
if (StringUtils.isNotBlank(meetingMinutesFileAtt)) {
insideOutsideMeeting.setMeetingMinutes(meetingMinutesFileAtt);
}
if (StringUtils.isNotBlank(dataMap.get("*会议主要内容"))) {
insideOutsideMeeting.setMeetingContent(dataMap.get("*会议主要内容"));
}else {
return Result.error(""+ (count+1) +"行会议主要内容不能为空");
}
if (StringUtils.isNotBlank(dataMap.get("*一级会议分类"))) {
if (!firstMeetingTypeNameSet.contains(dataMap.get("*一级会议分类"))){
return Result.error("一级会议分类不符合输入要求");
}
for (TsDicType tsDicType : firstMeetingTypeList) {
if (dataMap.get("*一级会议分类").equals(tsDicType.getDicTypeName())) {
insideOutsideMeeting.setFirstMeetingType(tsDicType.getDicTypeCode());
}
}
}else {
return Result.error(""+ (count+1) +"行一级会议分类不能为空");
}
if (StringUtils.isNotBlank(dataMap.get("*二级会议分类"))) {
if (!secondMeetingTypeNameSet.contains(dataMap.get("*二级会议分类"))){
return Result.error("二级会议分类不符合输入要求");
}
for (TsDicType tsDicType : secondMeetingTypeList) {
if (dataMap.get("*二级会议分类").equals(tsDicType.getDicTypeName())) {
insideOutsideMeeting.setSecondMeetingType(tsDicType.getDicTypeCode());
}
}
}else {
return Result.error(""+ (count+1) +"行二级会议分类不能为空");
}
// 会议课题信息
MeetingTopic meetingTopic = new MeetingTopic();
if (StringUtils.isNotBlank(dataMap.get("*议题名称"))) {
meetingTopic.setAgendaName(dataMap.get("*议题名称"));
} else {
return Result.error(""+ (count+1) +"行议题名称不能为空");
}
String agendaMaterialsFileNameStr = dataMap.get("议题材料");
String agendaMaterialsFileNameAtt = null;
try {
agendaMaterialsFileNameAtt = getFileAtt("议题材料",agendaMaterialsFileNameStr, fileMap, count);
} catch (Exception e) {
return Result.error(e.getMessage());
}
if (StringUtils.isNotBlank(agendaMaterialsFileNameAtt)) {
meetingTopic.setAgendaMaterials(agendaMaterialsFileNameAtt);
}
if (StringUtils.isNotBlank(dataMap.get("*汇报人"))) {
meetingTopic.setReporter(dataMap.get("*汇报人"));
} else {
return Result.error(""+ (count+1) +"行汇报人不能为空");
}
if (StringUtils.isNotBlank(dataMap.get("*汇报单位"))) {
meetingTopic.setReportingUnit(dataMap.get("*汇报单位"));
} else {
return Result.error(""+ (count+1) +"行汇报单位不能为空");
}
if (StringUtils.isNotBlank(dataMap.get("*议题主要内容"))) {
meetingTopic.setAgendaContent(dataMap.get("*议题主要内容"));
} else {
return Result.error(""+ (count+1) +"行议题主要内容不能为空");
}
meetingTopicList.add(meetingTopic);
count++;
} else {
// 进入else 表示该行是会议课题行
MeetingTopic meetingTopic = new MeetingTopic();
meetingTopic.setAgendaName(dataMap.get("议题名称"));
String agendaMaterialsFileNameStr = dataMap.get("议题材料");
String agendaMaterialsFileNameAtt = null;
try {
agendaMaterialsFileNameAtt = getFileAtt("议题材料",agendaMaterialsFileNameStr, fileMap, count);
} catch (Exception e) {
return Result.error(e.getMessage());
}
if (StringUtils.isNotBlank(agendaMaterialsFileNameAtt)) {
meetingTopic.setAgendaMaterials(agendaMaterialsFileNameAtt);
}
meetingTopic.setReporter(dataMap.get("*汇报人"));
meetingTopic.setReportingUnit(dataMap.get("*汇报单位"));
meetingTopic.setAgendaContent(dataMap.get("*议题主要内容"));
meetingTopicList.add(meetingTopic);
count++;
}
// 会议课题信息
MeetingTopic meetingTopic = new MeetingTopic();
meetingTopic.setAgendaName(dataMap.get("议题名称"));
meetingTopic.setReporter(dataMap.get("汇报人"));
meetingTopic.setReportingUnit(dataMap.get("汇报单位"));
meetingTopic.setAgendaContent(dataMap.get("议题主要内容"));
meetingTopicList.add(meetingTopic);
count++;
} else {
// 进入else 表示该行是会议课题行
MeetingTopic meetingTopic = new MeetingTopic();
meetingTopic.setAgendaName(dataMap.get("议题名称"));
meetingTopic.setReporter(dataMap.get("汇报人"));
meetingTopic.setReportingUnit(dataMap.get("汇报单位"));
meetingTopic.setAgendaContent(dataMap.get("议题主要内容"));
meetingTopicList.add(meetingTopic);
count++;
}
// 插入最后一条记录
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
addMeetingInfo(insideOutsideMeeting);
} finally {
FileUnZip.deleteDir(saveDirectory);
}
// 插入最后一条记录
insideOutsideMeeting.setMeetingTopicList(meetingTopicList);
addMeetingInfo(insideOutsideMeeting);
return Result.success("导入完成");
}
@@ -425,34 +562,43 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
* @return 差异
*/
public List<String> compareInsideOutsideMeeting(InsideOutsideMeeting oldMeeting, InsideOutsideMeeting newMeeting) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<String> changes = new ArrayList<>();
// 不需要比较的字段
String[] ignoreFields = {"id","validFlag","createTime","modifyTime", "firstMeetingTypeName", "secondMeetingTypeName"};
List<String> ignoreFieldList = Arrays.asList(ignoreFields);
// 获取SarLawsInformation类的所有字段
Field[] fields = InsideOutsideMeeting.class.getDeclaredFields();
for (Field field : fields) {
if (!ignoreFieldList.contains(field.getName())) {
boolean annotationPresent = field.isAnnotationPresent(CompareField.class);
if (annotationPresent) {
try {
field.setAccessible(true);
String oldValue = String.valueOf(field.get(oldMeeting));
String newValue = String.valueOf(field.get(newMeeting));
Object oldValue = field.get(oldMeeting);
Object newValue = field.get(newMeeting);
if (oldValue instanceof Date){
oldValue = sdf.format((Date)oldValue);
}
if( newValue instanceof Date) {
newValue = sdf.format((Date)newValue);
}
if (!Objects.equals(oldValue, newValue)) {
if ("firstMeetingType".equals(field.getName()) || "secondMeetingType".equals(field.getName())) {
String oldValueStr = String.valueOf(oldValue);
String newValueStr = String.valueOf(newValue);
String typeName = "";
if (StringUtils.isNotBlank(newValue)) {
typeName = dicTypeService.getDicTypeNameByDicCode(newValue);
if (StringUtils.isNotBlank(newValueStr)) {
typeName = dicTypeService.getDicTypeNameByDicCode(newValueStr);
}
// 获取资料类型名称
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = InsideOutsideMeeting.class.getMethod("get" + fieldName + "Name");
Object oldTypeName = method.invoke(oldMeeting);
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldTypeName + "\"改为\"" + typeName + "\"");
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "\"" + Optional.ofNullable(oldTypeName).orElse("") + "\"改为\"" + Optional.ofNullable(typeName).orElse("") + "\"");
} else if ("meetingMinutes".equals(field.getName())) {
String oldValueStr = String.valueOf(oldValue);
String newValueStr = String.valueOf(newValue);
List<String> fileNameList = new ArrayList<>();
if (StringUtils.isNotBlank(newValue)) {
String[] split = newValue.split(",");
if (StringUtils.isNotBlank(newValueStr)) {
String[] split = newValueStr.split(",");
for (String attId : split) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileNameList.add(fileInfo.getOldFileName());
@@ -469,17 +615,33 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
oldFileNameList.add(oldFile1.getOldFileName());
}
}
if (StringUtils.isBlank(String.join(",",oldFileNameList))) {
oldValue = "";
}else {
oldValue = String.join(",",oldFileNameList);
}
if (StringUtils.isBlank(String.join(",",fileNameList))) {
newValue = "";
}else {
newValue = String.join(",",fileNameList);
}
// 获取字段名称
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + String.join(",",oldFileNameList) + "\"改为\"" + String.join(",",fileNameList) + "\"");
}
else if ("meetingTopicList".equals(field.getName())) {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "被变更");
}
else {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
} else if ("meetingTopicList".equals(field.getName())) {
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = InsideOutsideMeeting.class.getMethod("get" + fieldName);
Object oldInvoke = method.invoke(oldMeeting);
Object newInvoke = method.invoke(newMeeting);
List<?> oldList = (List<?>) oldInvoke;
List<?> newList = (List<?>) newInvoke;
if (!isListEqual(oldList, newList)) {
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "被变更");
}
} else {
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "\"" + Optional.ofNullable(oldValue).orElse("") + "\"改为\"" + Optional.ofNullable(newValue).orElse("") + "\"");
}
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
@@ -509,4 +671,64 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl<InsideOutsideMe
meeting.setSecondMeetingTypeName(dicTypeService.getDicTypeNameByDicCode(meeting.getSecondMeetingType()));
}
}
public String getFileAtt(String fieldName, String fileNameStr, Map<String, File> fileMap, int count) throws Exception {
if (fileNameStr != null) {
List<String> fileAttList = new ArrayList<>();
for (String meetingMinutesFileName : fileNameStr.split(",")) {
int lastIndexOf = meetingMinutesFileName.lastIndexOf(".");
if (meetingMinutesFileName.lastIndexOf(".") != -1) {
String lastName = meetingMinutesFileName.substring(lastIndexOf + 1).toLowerCase();
if (lastName.equals("pdf") || lastName.equals("ppt") || lastName.equals("pptx") || lastName.equals("doc") || lastName.equals("docx")) {
File file1 = fileMap.get(meetingMinutesFileName);
if (file1 == null) {
throw new Exception(fieldName + "中第" + (count+1) +"" + meetingMinutesFileName + "文件不存在,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
AttFileVo attFileVo = attFileEOService.saveFileInfo(file1);
if (StringUtils.isNotBlank(attFileVo.getId())) {
fileAttList.add(attFileVo.getAttId());
}
} else {
throw new Exception(fieldName + "中第" + (count+1) +"" + meetingMinutesFileName + "格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
} else {
throw new Exception(fieldName + "中第" + (count+1) +"" + meetingMinutesFileName + "格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
}
return String.join(",", fileAttList);
}
return null;
}
public boolean isListEqual(List l0, List l1){
if (l0 == l1)
return true;
if (l0 == null && l1 == null)
return true;
if (l0 == null || l1 == null)
return false;
if (l1.size() > 0) {
Iterator iterator = l1.iterator();
while(iterator.hasNext()) {
Object iterato = iterator.next();
MeetingTopic meetingTopic = (MeetingTopic) iterato;
MeetingTopic meetingTopic1 = MeetingTopic.emptyValueProcess(meetingTopic);
if (meetingTopic1 == null) {
iterator.remove();
}
}
}
if (l0.size() != l1.size())
return false;
for (Object o : l0) {
if (!l1.contains(o))
return false;
}
for (Object o : l1) {
if (!l0.contains(o))
return false;
}
return true;
}
}
@@ -5,12 +5,12 @@ import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial;
import com.adc.da.slrs.fileMaterialCenter.dao.FileMaterialDao;
import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage;
import com.adc.da.slrs.fileMaterialCenter.service.IFileMaterialService;
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarUser.dao.TsUserDao;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.tsRoleMeunData.entity.TsRoleMenuData;
import com.adc.da.slrs.tsRoleMeunData.service.ITsRoleMenuDataService;
import com.adc.da.slrs.zlTree.service.IZlTreeService;
import com.adc.da.sys.service.IUserRoleEOService;
import com.adc.da.util.LoginUserUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.management.Query;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -44,12 +45,11 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
@Autowired
private TsUserDao tsUserDao;
@Autowired
private ITsPositionService tsPositionService;
@Autowired
private ITsRoleMenuDataService iTsRoleMenuDataService;
@Autowired
private IZlTreeService zlTreeService;
@Resource
private IUserRoleEOService userRoleEOService;
@Override
public IPage<FileMaterial> getFileMaterial(FileMaterialPage queryPage) {
@@ -63,8 +63,9 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
// 获取当前登录人
String loginUserId = LoginUserUtil.getUserId();
List<String> positionIds = tsUserDao.selectPositionIds(loginUserId);
List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds = tsUserDao.selectPositionIds(loginUserId);
// List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(loginUserId);
QueryWrapper<TsRoleMenuData> wrapper = new QueryWrapper<>();
wrapper.in("ROLE_ID", roleIds);
List<TsRoleMenuData> tsRoleMenuData = iTsRoleMenuDataService.list(wrapper);
@@ -105,8 +106,9 @@ public class FileMaterialServiceImpl extends ServiceImpl<FileMaterialDao, FileMa
userId = LoginUserUtil.getUserId();
}
List<String> positionIds = tsUserDao.selectPositionIds(userId);
List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds = tsUserDao.selectPositionIds(userId);
// List<String> roleIds = tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
QueryWrapper<TsRoleMenuData> wrapper = new QueryWrapper<>();
wrapper.in("ROLE_ID", roleIds);
List<TsRoleMenuData> tsRoleMenuData = iTsRoleMenuDataService.list(wrapper);
@@ -0,0 +1,34 @@
package com.adc.da.slrs.roleReplacePosition.controller;
import com.adc.da.slrs.roleReplacePosition.service.UserPositionService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author: Mzaxd
* @Date: 2023/11/14 13:46
*/
@RestController
@Api(tags = "福田标准法规--角色替换岗位")
@RequestMapping("/api/roleReplacePosition")
public class RoleReplacePositionController {
@Resource
private UserPositionService userPositionService;
/**
* 角色替换岗位
*
* @return
*/
@GetMapping("/start")
public void roleReplacePosition() {
userPositionService.roleReplacePosition();
}
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.roleReplacePosition.dao;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @author ThinkBook
* @description 针对表【ts_position_role】的数据库操作Mapper
* @createDate 2023-11-14 13:53:47
* @Entity com.adc.da.slrs.roleReplacePosition.domain.PositionRole
*/
@Repository
public interface PositionRoleMapper extends BaseMapper<PositionRole> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.roleReplacePosition.dao;
import com.adc.da.slrs.roleReplacePosition.domain.UserPosition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @author ThinkBook
* @description 针对表【ts_user_position】的数据库操作Mapper
* @createDate 2023-11-14 13:49:37
* @Entity com.adc.da.slrs.roleReplacePosition.domain.UserPosition
*/
@Repository
public interface UserPositionMapper extends BaseMapper<UserPosition> {
}
@@ -0,0 +1,95 @@
package com.adc.da.slrs.roleReplacePosition.domain;
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 java.io.Serializable;
/**
*
* @TableName ts_position_role
*/
@TableName(value ="ts_position_role")
public class PositionRole implements Serializable {
/**
* 角色ID
*/
@TableId
private String roleId;
/**
* 岗位ID
*/
@TableId
private String positionId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
public String getRoleId() {
return roleId;
}
/**
* 角色ID
*/
public void setRoleId(String roleId) {
this.roleId = roleId;
}
/**
* 岗位ID
*/
public String getPositionId() {
return positionId;
}
/**
* 岗位ID
*/
public void setPositionId(String positionId) {
this.positionId = positionId;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
PositionRole other = (PositionRole) that;
return (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
&& (this.getPositionId() == null ? other.getPositionId() == null : this.getPositionId().equals(other.getPositionId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
result = prime * result + ((getPositionId() == null) ? 0 : getPositionId().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", roleId=").append(roleId);
sb.append(", positionId=").append(positionId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
@@ -0,0 +1,93 @@
package com.adc.da.slrs.roleReplacePosition.domain;
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 java.io.Serializable;
/**
*
* @TableName ts_user_position
*/
@TableName(value ="ts_user_position")
public class UserPosition implements Serializable {
/**
* 用户ID
*/
private String userId;
/**
* 岗位ID
*/
private String positionId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
public String getUserId() {
return userId;
}
/**
* 用户ID
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 岗位ID
*/
public String getPositionId() {
return positionId;
}
/**
* 岗位ID
*/
public void setPositionId(String positionId) {
this.positionId = positionId;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UserPosition other = (UserPosition) that;
return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getPositionId() == null ? other.getPositionId() == null : this.getPositionId().equals(other.getPositionId()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getPositionId() == null) ? 0 : getPositionId().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", userId=").append(userId);
sb.append(", positionId=").append(positionId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
@@ -0,0 +1,13 @@
package com.adc.da.slrs.roleReplacePosition.service;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author ThinkBook
* @description 针对表【ts_position_role】的数据库操作Service
* @createDate 2023-11-14 13:53:47
*/
public interface PositionRoleService extends IService<PositionRole> {
}
@@ -0,0 +1,14 @@
package com.adc.da.slrs.roleReplacePosition.service;
import com.adc.da.slrs.roleReplacePosition.domain.UserPosition;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author ThinkBook
* @description 针对表【ts_user_position】的数据库操作Service
* @createDate 2023-11-14 13:49:37
*/
public interface UserPositionService extends IService<UserPosition> {
void roleReplacePosition();
}
@@ -0,0 +1,22 @@
package com.adc.da.slrs.roleReplacePosition.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.adc.da.slrs.roleReplacePosition.service.PositionRoleService;
import com.adc.da.slrs.roleReplacePosition.dao.PositionRoleMapper;
import org.springframework.stereotype.Service;
/**
* @author ThinkBook
* @description 针对表【ts_position_role】的数据库操作Service实现
* @createDate 2023-11-14 13:53:47
*/
@Service
public class PositionRoleServiceImpl extends ServiceImpl<PositionRoleMapper, PositionRole>
implements PositionRoleService{
}
@@ -0,0 +1,68 @@
package com.adc.da.slrs.roleReplacePosition.service.impl;
import com.adc.da.slrs.roleReplacePosition.domain.PositionRole;
import com.adc.da.slrs.roleReplacePosition.service.PositionRoleService;
import com.adc.da.sys.entity.UserRoleEO;
import com.adc.da.sys.service.IUserRoleEOService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.roleReplacePosition.domain.UserPosition;
import com.adc.da.slrs.roleReplacePosition.service.UserPositionService;
import com.adc.da.slrs.roleReplacePosition.dao.UserPositionMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ThinkBook
* @description 针对表【ts_user_position】的数据库操作Service实现
* @createDate 2023-11-14 13:49:37
*/
@Service
public class UserPositionServiceImpl extends ServiceImpl<UserPositionMapper, UserPosition>
implements UserPositionService{
@Resource
private PositionRoleService positionRoleService;
@Resource
private IUserRoleEOService userRoleEOService;
@Override
public void roleReplacePosition() {
// 找到所有对应关系
List<UserPosition> userPositions = this.list();
// 转换对应关系
Map<String, List<PositionRole>> positionRoleMap = positionRoleService.list().stream()
.collect(Collectors.groupingBy(PositionRole::getPositionId));
Set<UserRoleEO> userRoleEOSet = new HashSet<>();
for (UserPosition userPosition : userPositions) {
// 去除空指针异常
if (positionRoleMap.get(userPosition.getPositionId()) == null) {
continue;
}
List<String> roleIds = positionRoleMap.get(userPosition.getPositionId()).stream()
.map(PositionRole::getRoleId).collect(Collectors.toList());
for (String roleId : roleIds) {
UserRoleEO userRoleEO = new UserRoleEO();
userRoleEO.setUserId(userPosition.getUserId());
userRoleEO.setRoleId(roleId);
userRoleEOSet.add(userRoleEO);
}
}
// 保存对应关系
// 先找出所有用户角色,然后和构建好的用户角色去重后再进行添加,避免出现多条重复数据
List<UserRoleEO> userRoleEOList = userRoleEOService.list();
userRoleEOList.forEach(userRoleEOSet::remove);
userRoleEOService.saveBatch(userRoleEOSet, userRoleEOSet.size());
}
}
@@ -43,7 +43,7 @@ public class SarBussStandAttrInfoExecl extends BaseEntity {
@ApiModelProperty(value = "修改时间")
private Date modifyTime;
@ApiModelProperty(value = "体系类别")
@ApiModelProperty(value = "标准体系")
private String txlbbuss;
private String glwj;
@@ -37,4 +37,5 @@ public interface SarBussStandMenuDao extends BaseMapper<SarBussStandMenu> {
int updateMenuidByMenuid (@Param("oldMenuid") String oldMenuid ,@Param("newMenuid") String newMenuid);
List<SarBussStandMenu> getESStandMenu();
}
@@ -18,4 +18,8 @@ public interface ISarBussStandMenuService extends IService<SarBussStandMenu> {
List<SarBussStandMenu> selectAllMenuByStandId(SarBussStandMenu sarStandMenuEO);
int deleteByMenuId (SarBussStandMenu sarStandMenuEO);
void deleteStandSystemByStandId(String id);
void addStandSystemRelation(String standSystemId, String id);
}
@@ -1,17 +1,25 @@
package com.adc.da.slrs.sarBussStandMenu.service.impl;
import com.adc.da.exception.AdcDaBaseException;
import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu;
import com.adc.da.slrs.sarBussStandMenu.dao.SarBussStandMenuDao;
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.adc.da.sys.sarMenuStandard.service.ISarMenuStandardService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>
@@ -30,6 +38,7 @@ public class SarBussStandMenuServiceImpl extends ServiceImpl<SarBussStandMenuDao
@Autowired
private ISarMenuStandardService iSarMenuStandardService;
public int deleteByMenuId (SarBussStandMenu sarStandMenuEO){
String treeType = sarStandMenuEO.getTreeType();
List<String> menuIds = new ArrayList<>();
@@ -42,6 +51,42 @@ public class SarBussStandMenuServiceImpl extends ServiceImpl<SarBussStandMenuDao
return this.baseMapper.deleteByMenuId(sarStandMenuEO);
}
@Override
public void deleteStandSystemByStandId(String id) {
LambdaQueryWrapper<SarBussStandMenu> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarBussStandMenu::getBussStandId, id);
List<SarBussStandMenu> list = list(wrapper);
Set<String> collect = list.stream().map(SarBussStandMenu::getMenuId).collect(Collectors.toSet());
List<String> menuIds = new ArrayList<>();
for (String menuId : collect) {
SarMenuStandard menuStand = iSarMenuStandardService.getById(menuId);
if (menuStand != null) {
menuIds.add(menuStand.getId());
}
}
if (menuIds.size() > 0) {
LambdaUpdateWrapper<SarBussStandMenu> sarStandMenuWrapper = new LambdaUpdateWrapper<>();
sarStandMenuWrapper.eq(SarBussStandMenu::getBussStandId, id);
sarStandMenuWrapper.in(SarBussStandMenu::getMenuId,menuIds);
remove(sarStandMenuWrapper);
}
}
@Override
public void addStandSystemRelation(String standSystem, String id) {
// 校验standSystem是否有效
SarMenuStandard standMenu = iSarMenuStandardService.getById(standSystem);
if (standMenu == null) {
throw new AdcDaBaseException("无效的标准体系");
}
SarBussStandMenu sarBussStandMenu = new SarBussStandMenu();
// 生成不带横杠的UUID
sarBussStandMenu.setId(java.util.UUID.randomUUID().toString().replaceAll("-", ""));
sarBussStandMenu.setBussStandId(id).setMenuId(standSystem).setValidFlag(0);
save(sarBussStandMenu);
}
@Override
public List<SarBussStandMenu> selectAllMenuByStandId(SarBussStandMenu sarStandMenuEO){
return this.baseMapper.selectAllMenuByStandId(sarStandMenuEO);
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarBussionessStand.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import com.adc.da.Log.BusinessType;
import com.adc.da.Log.EpcLog;
@@ -11,6 +12,7 @@ import com.adc.da.person.service.IPersonCollectEOService;
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlanInfo;
import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao;
import com.adc.da.slrs.sarBussStandAttrInfo.entity.SarBussStandAttrInfo;
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport;
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarLawsInfo.service.ISarLawsInfoService;
@@ -52,6 +54,7 @@ import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
@@ -105,6 +108,9 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
@Autowired
private AttFileEOServiceImpl attFileEOService;
@Resource
private ISarBussStandMenuService sarBussStandMenuService;
/**
* 根据计划库制定状态查询企标编号
*
@@ -229,6 +235,12 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
//401问题2021-03-31暂时注释掉 liuhuiwen
// @RequiresPermissions("lawss:sarBussionessStand:updateSarBussionessStand")
public ResponseMessage<SarBussionessStand> updateSarBussionessStand(@RequestBody SarBussionessStand sarBussionessStandEO) throws Exception {
// 标准体系
String standSystemId = sarBussionessStandEO.getTxlbId();
sarBussStandMenuService.deleteStandSystemByStandId(sarBussionessStandEO.getId());
if (StrUtil.isNotBlank(standSystemId)) {
sarBussStandMenuService.addStandSystemRelation(standSystemId, sarBussionessStandEO.getId());
}
//校验编号和名称是否存在
QueryWrapper<SarBussionessStand> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(null!=sarBussionessStandEO.getStandCode(),"STAND_CODE",sarBussionessStandEO.getStandCode())
@@ -725,8 +737,8 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
@ApiOperation(value = "企业标准 废止流程 立即废止(或者现行有效)")
@GetMapping("/repeal")
public ResponseMessage repeal(String id,String type){
return sarBussionessStandEOService.repeal(id,type);
public ResponseMessage repeal(String id,String type,String prcNum){
return sarBussionessStandEOService.repeal(id,type,prcNum);
}
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarBussionessStand.dao;
import com.adc.da.slrs.sarBussionessStand.entity.OldSystem;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
@@ -138,5 +139,9 @@ public interface SarBussionessStandDao extends BaseMapper<SarBussionessStand> {
List<SarBussionessStand> selectAllStandStatus();
String selectMaxStandSn(String standSort);
List<StandSystemDTO> getESSystemData(@Param("param") StandSystemDTO standSystemDTO);
void deleteStandSystem(@Param("menuName") String menuName);
}
@@ -69,7 +69,7 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
ResponseMessage cleaningDataReview();
ResponseMessage repeal(String id, String type);
ResponseMessage repeal(String id, String type,String prcNum);
String selectMaxStandSn(String standSort);
@@ -49,10 +49,12 @@ import com.adc.da.slrs.sarBussionessStandState.entity.SarBussionessStandState;
import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarAdvanceSearchVO;
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sarUser.dao.TsUserDao;
import com.adc.da.slrs.sarUser.service.ITsUserService;
@@ -1390,6 +1392,8 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
if (sarBussionessStandEO.getAttrInfoMap() != null) {
Object txlbbuss = sarBussionessStandEO.getAttrInfoMap().get("TXLBBUSS");
if (txlbbuss != null && !Objects.equals(txlbbuss.toString(), "")) {
List<String> list = Arrays.asList(txlbbuss.toString().split("/"));
txlbbuss = list.get(list.size() - 1);
// 配置体系类别
String txlbBussLevel = getParentNodePathRecursive((String) txlbbuss);
sarBussionessStandEO.getAttrInfoCaseMap().put("txlbbuss",txlbBussLevel);
@@ -1417,6 +1421,23 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
newStandList.add(sarBussionessStandlist.get(0));
attrInfo(newStandList);
sarBussionessStandEO = newStandList.get(0);
// 处理标准体系字段
Object txlbbuss = sarBussionessStandEO.getAttrInfoMap().get("TXLBBUSS");
if (txlbbuss != null && !Objects.equals(txlbbuss.toString(), "")) {
LambdaQueryWrapper<SarMenuStandard> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarMenuStandard::getMenuName, String.valueOf(txlbbuss));
wrapper.eq(SarMenuStandard::getDicId, "9m4qqqaansxmox5e82zm");
List<SarMenuStandard> list1 = sarMenuStandardService.list(wrapper);
if (list1.size() > 0) {
sarBussionessStandEO.setTxlbId(list1.get(0).getId());
}
List<String> list = Arrays.asList(txlbbuss.toString().split("/"));
txlbbuss = list.get(list.size() - 1);
// 配置体系类别
String txlbBussLevel = getParentNodePathRecursive((String) txlbbuss);
sarBussionessStandEO.getAttrInfoCaseMap().put("txlbbuss",txlbBussLevel);
sarBussionessStandEO.getAttrInfoMap().put("TXLBBUSS",txlbBussLevel);
}
}
return sarBussionessStandEO;
}
@@ -2154,7 +2175,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
@Override
public ResponseMessage<String> importSarBussionessStandFile(MultipartFile file,String menuId,String userId)throws Exception {
//给出头部信息
String[] headerExcel = {"*企标类别,*企标编号,*标准年份,*企标名称,企标英文名称,*文本状态,发布日期,企标实施日期,起草部门,起草人,适用车型,能源类型,适用产品线,体系类别,关联模块-乘用车VPPS编码,关联模块--卡车VPPS编码,发布稿,编制说明,历史版本,其他文件,修改单,代替企标编号,采用标准,采标程度,引用标准,关联文件,"};
String[] headerExcel = {"*企标类别,*企标编号,*标准年份,*企标名称,企标英文名称,*文本状态,发布日期,企标实施日期,起草部门,起草人,适用车型,能源类型,适用产品线,标准体系,关联模块-乘用车VPPS编码,关联模块--卡车VPPS编码,发布稿,编制说明,历史版本,其他文件,修改单,代替企标编号,采用标准,采标程度,引用标准,关联文件,"};
//获取文件全称
String fileNameStr = file.getOriginalFilename();
@@ -2612,8 +2633,20 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
String txlbbuss = rowList.get("体系类别");
sarBussStandAttrInfo.setTxlbbuss(txlbbuss);
String txlbbuss = rowList.get("标准体系");
if (StringUtils.isNotBlank(txlbbuss)) {
LambdaQueryWrapper<SarMenuStandard> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarMenuStandard::getValidFlag, "0");
wrapper.eq(SarMenuStandard::getDicId, "9m4qqqaansxmox5e82zm");
wrapper.eq(SarMenuStandard::getMenuName, txlbbuss);
List<SarMenuStandard> list = sarMenuStandardService.list(wrapper);
if (list.size() > 0) {
sarBussStandAttrInfo.setTxlbbuss(list.get(0).getMenuName());
}else {
return Result.error(""+ count +"行请输入正确的标准体系");
}
}
//关联模块-乘用车VPPS编码 23
String cycvppsbmbuss = rowList.get("关联模块-乘用车VPPS编码");
@@ -2640,7 +2673,11 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
// sarBussStandAttrInfo.setDymcbuss(dymcbuss);
String dtqbbhbuss = rowList.get("代替企标编号");
sarBussStandAttrInfo.setDtqbbhbuss(dtqbbhbuss);
if (StringUtils.isNotBlank(dtqbbhbuss)) {
sarBussStandAttrInfo.setDtqbbhbuss(dtqbbhbuss);
}else {
sarBussStandAttrInfo.setDtqbbhbuss(null);
}
//被代替企标编号
// String bdtqbbhbuss = sarBussionessStandEODao.setDtqbbhbuss(dtqbbhbuss);
@@ -4715,12 +4752,45 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
@Override
public ResponseMessage repeal(String id, String type) {
public ResponseMessage repeal(String id, String type,String prcNum) {
if(type.equals("废止")){
SarBussionessStand sarBussionessStand = new SarBussionessStand();
sarBussionessStand.setId(id);
sarBussionessStand.setTextStatusBuss("3lqnlgmgcn");
baseMapper.updateById(sarBussionessStand);
SarBussionessStand sarBussionessStandDB = baseMapper.selectByPrimaryKey(id);
Map<String, Object> map = sarBussStandAttrInfoEODao.selectStandFieldAndData("XGLC", id);
String content = "";
if(map!=null){
Object xglc = map.get("XGLC");
String xglcStr = Optional.ofNullable(xglc).orElse("").toString();
String newXglcStr = "";
if (StringUtils.isNotBlank(xglcStr)) {
newXglcStr = xglcStr + ","+ prcNum;
} else {
newXglcStr = prcNum;
}
sarBussStandAttrInfoEODao.updateStandInfo(id,"XGLC",newXglcStr);
try {
content = "标准号:" + sarBussionessStandDB.getStandCode() + ""+ sarBussionessStandDB.getStandName() + "" + "关联流程由\""+ xglcStr +"\"变为\""+ newXglcStr +"\"";
sarUpdLogEOService.createBaseLog(id,"BUSINESS",content);
} catch (Exception e) {
throw new AdcDaBaseException("日志添加失败");
}
}
List<DicTypeEO> dicTypeEOS = new ArrayList<>();
// 添加删除记录
if (StringUtils.isNotBlank(sarBussionessStandDB.getTextStatusBuss())) {
dicTypeEOS = dicTypeEODao.getDicEOByDicTypeCode(sarBussionessStandDB.getTextStatusBuss());
}
if (dicTypeEOS.size()>0) {
content = "标准号:" + sarBussionessStandDB.getStandCode() + ""+ sarBussionessStandDB.getStandName() + "" + "文本状态由\""+ dicTypeEOS.get(0).getDicTypeName() +"\"变为\"废止\"";
}
try {
sarUpdLogEOService.createBaseLog(id,"BUSINESS",content);
} catch (Exception e) {
throw new AdcDaBaseException("日志添加失败");
}
}else {
//有效
SarBussionessStand sarBussionessStand = new SarBussionessStand();
@@ -4918,6 +4988,25 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
int insertresult = this.baseMapper.insert(sarBussionessStandEO);
String sarStandAttrEOStr1 = sarBussionessStandEO.getSarStandAttrEOStr();
if (sarStandAttrEOStr1 != null) {
Map<String, String> attrInfoMap = JSON.parseObject(sarStandAttrEOStr1, Map.class);
LambdaQueryWrapper<SarMenuStandard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SarMenuStandard::getMenuName, attrInfoMap.get("TXLBBUSS"));
queryWrapper.eq(SarMenuStandard::getValidFlag, "0");
queryWrapper.eq(SarMenuStandard::getDicId, "9m4qqqaansxmox5e82zm");
List<SarMenuStandard> list = sarMenuStandardService.list(queryWrapper);
if (list.size() > 0) {
if (StringUtils.isNotBlank(attrInfoMap.get("TXLBBUSS"))) {
SarBussStandMenu sarBussStandMenuEO = new SarBussStandMenu();
sarBussStandMenuEO.setBussStandId(sarBussionessStandEO.getId());
sarBussStandMenuEO.setMenuId(list.get(0).getId());
sarBussStandMenuEO.setValidFlag(ValueStateEnum.VALUE_TRUE.getValue());
sarBussStandMenuEO.setId(UUIDUtils.randomUUID20());
sarBussStandMenuEODao.insert(sarBussStandMenuEO);
}
}
}
if (insertresult >= 1) {
// 根据代替标准号 修改代替标准号标准中的被代替标准号
updateReplaceConnect(sarBussionessStandEO);
@@ -131,7 +131,11 @@ public class SarLawsDetailedListController extends BaseController<SarLawsDetaile
}else if (null!=list.get(a).getFileIds()){
AttFileEO attFileEO = attFileEOController.getAttFileInfo(list.get(a).getFileIds()).getData();
FindFileNameDto fileNameDto = list1.get(a);
fileNameDto.setFileName(attFileEO.getOldFileName());
if (attFileEO==null){
fileNameDto.setFileName("");
} else {
fileNameDto.setFileName(attFileEO.getOldFileName());
}
list1.set(a,fileNameDto);
}
}
@@ -12,6 +12,7 @@ import com.adc.da.http.PageInfo;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformationExport;
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.FieldConvertUtil;
@@ -26,6 +27,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -35,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -104,7 +107,7 @@ public class SarLawsInformationController extends BaseController<SarLawsInformat
@ApiOperation("导出政策法规资料信息")
@GetMapping("/exportLawsInformationInfo")
public ResponseMessage<?> exportLawsInformationInfo(SarLawsInformation sarLawsInformation, HttpServletResponse response,
public ResponseMessage<?> exportLawsInformationInfo(SarLawsInformation sarLawsInformation, String userId, HttpServletResponse response,
HttpServletRequest request) {
OutputStream os = null;
Workbook workbook = null;
@@ -116,18 +119,27 @@ public class SarLawsInformationController extends BaseController<SarLawsInformat
response.setHeader("Content-Disposition",
"attachment; filename=" + ReadExcel.encodeFileName(sarLawsInformation.getExportName()+".xlsx",
request));
if (StringUtils.isBlank(userId)) {
return Result.error("导出失败,用户ID为空");
}
// 导出数据,若指定了值则使用ids字段条件导出,否则根据条件导出
if (StrUtil.isNotBlank(sarLawsInformation.getExportIds())) {
List<String> idList = Arrays.asList(sarLawsInformation.getExportIds().split(","));
datas = informationService.getLawsInformationByIds(idList);
} else {
// 导出所有数据
datas = informationService.getAllLawsInformation(sarLawsInformation);
datas = informationService.getAllLawsInformation(sarLawsInformation, userId);
}
List<SarLawsInformationExport> datasExport = new ArrayList<>();
for (SarLawsInformation data : datas) {
SarLawsInformationExport dataExport = new SarLawsInformationExport();
BeanUtils.copyProperties(data,dataExport);
datasExport.add(dataExport);
}
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setSheetName(sarLawsInformation.getExportName());
workbook = ExcelExportUtil.exportExcel(exportParams,SarLawsInformation.class,datas);
workbook = ExcelExportUtil.exportExcel(exportParams, SarLawsInformationExport.class,datasExport);
os = response.getOutputStream();
workbook.write(os);
os.flush();
@@ -170,7 +182,7 @@ public class SarLawsInformationController extends BaseController<SarLawsInformat
nowFile.mkdirs();
String fileName2 = "导入模板.xls";
HSSFSheet sheetItems = workbook.createSheet("模板");
sheetItems.setDefaultColumnWidth(13);
sheetItems.setDefaultColumnWidth(12);
Row rowHeader = sheetItems.createRow(1);//开始创建标题行
sheetItems.addMergedRegion(new CellRangeAddress(0, 0, 0, 8));
Row row2 = sheetItems.createRow(0);//开始创建填写说明
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarLawsInformation.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.base.page.BasePage;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -37,6 +38,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 一级资料类别
*/
@CompareField(fieldName = "1级资料分类")
@ApiModelProperty("1级资料分类")
@TableField(value = "FIRST_TYPE")
private String firstType;
@@ -44,75 +46,81 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 一级资料类别名称
*/
@ApiModelProperty(value = "级资料类名称")
@ApiModelProperty(value = "1级资料类名称")
// @TableField(exist = false)
@Excel(name = "1级资料分类", orderNum = "0")
@Excel(name = "*1级资料分类", orderNum = "0")
private String firstTypeName;
/**
* 二级资料类别
*/
@ApiModelProperty(value = "级资料类")
@CompareField(fieldName = "2级资料")
@ApiModelProperty(value = "2级资料分类")
@TableField(value = "SECOND_TYPE")
private String secondType;
/**
* 二级资料类别名称
*/
@ApiModelProperty(value = "级资料类名称")
@ApiModelProperty(value = "2级资料类名称")
// @TableField(exist = false)
@Excel(name = "2级资料分类", orderNum = "1")
@Excel(name = "*2级资料分类", orderNum = "1")
private String secondTypeName;
/**
* 三级资料类别
*/
@ApiModelProperty(value = "级资料类")
@CompareField(fieldName = "3级资料")
@ApiModelProperty(value = "3级资料分类")
@TableField(value = "THIRD_TYPE")
private String thirdType;
/**
* 三级资料类别名称
*/
@ApiModelProperty(value = "级资料类名称")
@ApiModelProperty(value = "3级资料类名称")
// @TableField(exist = false)
@Excel(name = "3级资料分类", orderNum = "2")
@Excel(name = "*3级资料分类", orderNum = "2")
private String thirdTypeName;
/**
* 四级资料类别
*/
@ApiModelProperty(value = "级资料类")
@CompareField(fieldName = "4级资料")
@ApiModelProperty(value = "4级资料分类")
@TableField(value = "FOURTH_TYPE")
private String fourthType;
/**
* 四级资料类别名称
*/
@ApiModelProperty(value = "四级资料类名称")
@ApiModelProperty(value = "四级资料类名称")
// @TableField(exist = false)
@Excel(name = "4级资料分类", orderNum = "3")
@Excel(name = "*4级资料分类", orderNum = "3")
private String fourthTypeName;
/**
* 资料名称
*/
@CompareField(fieldName = "资料名称")
@ApiModelProperty(value = "资料名称")
@TableField(value = "NAME")
@Excel(name = "资料名称", orderNum = "4")
@Excel(name = "*资料名称", orderNum = "4")
private String name;
/**
* 资料归属部门
*/
@CompareField(fieldName = "资料归属部门")
@ApiModelProperty(value = "资料归属部门")
@TableField(value = "DEPARTMENT")
@Excel(name = "资料归属部门", orderNum = "5")
@Excel(name = "*资料归属部门", orderNum = "5")
private String department;
/**
* 作者
*/
@CompareField(fieldName = "作者")
@ApiModelProperty(value = "作者")
@TableField(value = "AUTHOR")
@Excel(name = "作者", orderNum = "6")
@@ -121,6 +129,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 上传时间
*/
@CompareField(fieldName = "上传时间")
@ApiModelProperty(value = "上传时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@@ -131,6 +140,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 资料说明
*/
@CompareField(fieldName = "资料说明")
@ApiModelProperty(value = "资料说明")
@TableField(value = "DESCRIPTION")
@Excel(name = "资料说明", orderNum = "8")
@@ -139,8 +149,10 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 资料文件
*/
@CompareField(fieldName = "资料文件")
@ApiModelProperty(value = "资料文件")
@TableField(value = "INFORMATION_FILE")
@Excel(name = "资料文件", orderNum = "9")
private String informationFile;
/**
@@ -153,6 +165,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 可查看者,若设置为空则所有用户均可查看,若设置人员后,仅有可查看者可以查看文件信息。
*/
@CompareField(fieldName = "可查看者")
@ApiModelProperty(value = "可查看者")
@TableField(exist = false)
private String viewableBy;
@@ -160,6 +173,7 @@ public class SarLawsInformation extends BasePage implements Serializable {
/**
* 可下载者,若设置为空则仅有上传人和审批人可以查看,若设置人员后,仅有可下载者可下载文件信息。
*/
@CompareField(fieldName = "可下载者")
@ApiModelProperty(value = "可下载者")
@TableField(exist = false)
private String downloadableBy;
@@ -215,14 +229,14 @@ public class SarLawsInformation extends BasePage implements Serializable {
*/
@ApiModelProperty(value = "排序字段")
@TableField(exist = false)
private String sortField = "ID";
private String sortField = "uploadTime";
/**
* 排序方式
*/
@ApiModelProperty(value = "排序方式")
@TableField(exist = false)
private String sortMode = "asc";
private String sortMode = "desc";
/**
* 收藏ID
@@ -0,0 +1,102 @@
package com.adc.da.slrs.sarLawsInformation.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.util.Date;
/**
* @author tjzdw
* @description
* @date 2023/11/23
*/
@Data
public class SarLawsInformationExport {
/**
* 主键
*/
@TableId(value = "ID", type = IdType.ID_WORKER_STR)
private String id;
/**
* 一级资料类别
*/
@TableField(value = "FIRST_TYPE")
private String firstType;
/**
* 一级资料类别名称
*/
@Excel(name = "1级资料分类", orderNum = "0")
private String firstTypeName;
/**
* 二级资料类别
*/
@TableField(value = "SECOND_TYPE")
private String secondType;
/**
* 二级资料类别名称
*/
@Excel(name = "2级资料分类", orderNum = "1")
private String secondTypeName;
/**
* 三级资料类别
*/
@TableField(value = "THIRD_TYPE")
private String thirdType;
/**
* 三级资料类别名称
*/
@Excel(name = "3级资料分类", orderNum = "2")
private String thirdTypeName;
/**
* 四级资料类别
*/
@TableField(value = "FOURTH_TYPE")
private String fourthType;
/**
* 四级资料类别名称
*/
@Excel(name = "4级资料分类", orderNum = "3")
private String fourthTypeName;
/**
* 资料名称
*/
@Excel(name = "资料名称", orderNum = "4")
private String name;
/**
* 资料归属部门
*/
@Excel(name = "资料归属部门", orderNum = "5")
private String department;
/**
* 作者
*/
@Excel(name = "作者", orderNum = "6")
private String author;
/**
* 上传时间
*/
@Excel(name = "上传时间", orderNum = "7", exportFormat = "yyyy-MM-dd")
private Date uploadTime;
/**
* 资料说明
*/
@Excel(name = "资料说明", orderNum = "8")
private String description;
}
@@ -36,7 +36,7 @@ public interface SarLawsInformationService extends IService<SarLawsInformation>
* @param sarLawsInformation 法规资料对象,用于查询
* @return 法规资料列表
*/
List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation);
List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation, String userId);
ResponseMessage<?> importLawsInformationInfo(MultipartFile file);
}
@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.common.FileUnZip;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
@@ -20,6 +21,7 @@ import com.adc.da.slrs.tsDictionaryType.entity.TsDicType;
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.annotation.CompareField;
import com.adc.da.utils.util.FieldConvertUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -27,20 +29,21 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService;
import com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationDao;
import io.swagger.annotations.ApiModelProperty;
import lombok.Cleanup;
import lombok.SneakyThrows;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -87,7 +90,9 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
List<AttFileEO> fileNameList = new ArrayList<>();
for (String attId : split) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileNameList.add(fileInfo);
if (fileInfo != null) {
fileNameList.add(fileInfo);
}
}
sarLawsInformation.setInformationFileList(fileNameList);
}
@@ -135,8 +140,6 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
}
});
sarLawsInformation.setDownloadableBy(String.join(",", downloadableBy));
} else {
sarLawsInformation.setDownloadable(true);
}
LambdaQueryWrapper<SarLawsInformationAuth> wrapper3 = new LambdaQueryWrapper<>();
wrapper3.eq(SarLawsInformationAuth::getLawsInformationId, sarLawsInformation.getId());
@@ -158,8 +161,9 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
// 查询有权限的资料ID
LambdaQueryWrapper<SarLawsInformationAuth> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationAuth::getUserId, userId);
wrapper.eq(SarLawsInformationAuth::getAuthType, "viewableBy");
wrapper.or().eq(SarLawsInformationAuth::getAuthType, "createAndApproveBy");
wrapper.and(each -> each.eq(SarLawsInformationAuth::getAuthType, "viewableBy")
.or().eq(SarLawsInformationAuth::getAuthType, "createAndApproveBy")
.or().eq(SarLawsInformationAuth::getAuthType, "downloadableBy"));
wrapper.select(SarLawsInformationAuth::getLawsInformationId);
List<SarLawsInformationAuth> informationAuthList = authService.list(wrapper);
if (informationAuthList.size() > 0) {
@@ -175,8 +179,8 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
String sortField = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(page.getSortField()),"_").toUpperCase();
page.setSortField(sortField);
} else {
page.setSortField("ID");
page.setSortMode("asc");
page.setSortField("UPLOAD_TIME");
page.setSortMode("desc");
}
// 查询树节点及其子节点
if (StringUtils.isNotBlank(page.getTreeNodeId())) {
@@ -198,7 +202,9 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
List<AttFileEO> fileNameList = new ArrayList<>();
for (String attId : split) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileNameList.add(fileInfo);
if (fileInfo!= null) {
fileNameList.add(fileInfo);
}
}
sarLawsInformation.setInformationFileList(fileNameList);
}
@@ -230,9 +236,6 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
// 设置可见人和下载人
if (StringUtils.isNotBlank(sarLawsInformation.getViewableBy())) {
List<String> viewableByList = extractContentInParentheses(sarLawsInformation.getViewableBy());
if (!viewableByList.contains(userId)) {
viewableByList.add(userId);
}
viewableByList.forEach(viewableBy -> {
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(sarLawsInformation.getId());
@@ -243,14 +246,11 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
}
if (StringUtils.isNotBlank(sarLawsInformation.getDownloadableBy())) {
List<String> downloadableByList = extractContentInParentheses(sarLawsInformation.getDownloadableBy());
if (!downloadableByList.contains(userId)) {
downloadableByList.add(userId);
}
downloadableByList.forEach(viewableBy -> {
downloadableByList.forEach(downloadableBy -> {
SarLawsInformationAuth auth = new SarLawsInformationAuth();
auth.setLawsInformationId(sarLawsInformation.getId());
auth.setAuthType("downloadableBy");
auth.setUserId(viewableBy);
auth.setUserId(downloadableBy);
authService.save(auth);
});
}
@@ -348,21 +348,21 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
LambdaQueryWrapper<SarLawsInformation> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SarLawsInformation::getId, idList);
List<SarLawsInformation> sarLawsInformationList = this.baseMapper.selectList(wrapper);
// for (SarLawsInformation sarLawsInformation : sarLawsInformationList) {
// // 将字典编号变更为字典值
// convertCodeToName(sarLawsInformation);
// }
for (SarLawsInformation sarLawsInformation : sarLawsInformationList) {
// 将字典编号变更为字典值
convertCodeToName(sarLawsInformation);
}
return sarLawsInformationList;
}
@Override
public List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation) {
String userId = LoginUserUtil.getUserId();
public List<SarLawsInformation> getAllLawsInformation(SarLawsInformation sarLawsInformation, String userId) {
// 查询有权限的资料ID
LambdaQueryWrapper<SarLawsInformationAuth> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarLawsInformationAuth::getUserId, userId);
wrapper.eq(SarLawsInformationAuth::getAuthType, "viewableBy");
wrapper.or().eq(SarLawsInformationAuth::getAuthType, "createAndApproveBy");
wrapper.and(each -> each.eq(SarLawsInformationAuth::getAuthType, "viewableBy")
.or().eq(SarLawsInformationAuth::getAuthType, "createAndApproveBy")
.or().eq(SarLawsInformationAuth::getAuthType, "downloadableBy"));
wrapper.select(SarLawsInformationAuth::getLawsInformationId);
List<SarLawsInformationAuth> informationAuthList = authService.list(wrapper);
if (informationAuthList.size() > 0) {
@@ -372,7 +372,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
List<SarLawsInformation> sarLawsInformationList = this.baseMapper.getAllLawsInformation(sarLawsInformation);
for (SarLawsInformation lawsInformation : sarLawsInformationList) {
// 将字典编号变更为字典值
// convertCodeToName(lawsInformation);
convertCodeToName(lawsInformation);
// 查询文件信息
if (StringUtils.isNotBlank(lawsInformation.getInformationFile())) {
String[] split = lawsInformation.getInformationFile().split(",");
@@ -387,6 +387,7 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
return sarLawsInformationList;
}
@SneakyThrows
@Override
public ResponseMessage<?> importLawsInformationInfo(MultipartFile file) {
//获取文件全称
@@ -422,24 +423,41 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
FileUnZip.delete(new File(path + "/" + fileNameStr));
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件解压失败");
}
//获取文件信息
List<File> fileList = readImpExcelFile(zipEntryName);
//判断获取到的文件数量
if (fileList.size() != 1) {
return Result.error("上传的文件只能有一个");
if (fileList.size() < 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("上传的文件不能为空");
}
File importFile = fileList.get(0);
if (!importFile.getName().contains(".xls") && !importFile.getName().contains(".xlsx")) {
return Result.error("文件必须是EXCEL文件");
File excelFile = null;
int excelCount = 0;
// 将文件转换为Map,文件名为建,文件为值
Map<String, File> fileMap = new HashMap<>();
for (File file1 : fileList) {
fileMap.put(file1.getName(), file1);
if (file1.getName().toLowerCase().contains(".xls") || file1.getName().toLowerCase().contains(".xlsx")) {
excelFile = file1;
excelCount ++;
}
}
if (excelCount > 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("导入了多个Excel文件");
}
if (excelCount < 1){
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件必须包含一个EXCEL文件");
}
Workbook workbook = null;
try {
workbook = WorkbookFactory.create(importFile);
workbook = WorkbookFactory.create(excelFile);
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("导入失败,需要导入的数据有问题或导入的企标标号和企标名称已存在");
return Result.error("导入失败,需要导入的数据有问题");
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Sheet sheet = workbook.getSheetAt(0);
@@ -450,8 +468,14 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
List<String> headerList = new ArrayList<>();
// 获取excel表头
Row headerRow = sheet.getRow(1);
for (int i = 0; i < 8; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
try {
for (int i = 0; i < 9; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
}
} catch (Exception e) {
return Result.error("表头读取失败,请严格按照模板文件导入数据");
} finally {
FileUnZip.deleteDir(saveDirectory);
}
// 判断表头字段是否相同
@@ -465,10 +489,57 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
FileUnZip.deleteDir(saveDirectory);
return Result.error("fail", "读取失败,请严格按照模板文件导入数据");
}
// 获取总行数
int rowNum = sheet.getPhysicalNumberOfRows();
List<Map<String,String>> importDataList = new ArrayList<>();
for (int rowIndex = 2; rowIndex < rowNum; rowIndex++) {
// 获取每一行
Row row = sheet.getRow(rowIndex);
// 用于存储每行的键值对数据,对应一条数据
Map<String, String> rowMap = new LinkedHashMap<>();
// 总列数
int columnNum = 9;
// 遍历每个单元格
for (int columnIndex = 0; columnIndex < columnNum; columnIndex++) {
// 获取单元格
Cell cell = row.getCell(columnIndex);
// 获取表头单元格
Cell headerCell = headerRow.getCell(columnIndex);
if (cell != null) {
if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
Date d = cell.getDateCellValue();
if (d.before(sdf.parse("1900-01-01")) || d.after(sdf.parse("2500-01-01"))) {
FileUnZip.deleteDir(saveDirectory);
return Result.error(""+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
}
// 将单元格数据存入Map中
rowMap.put(headerCell.getStringCellValue(), sdf.format(d));
} else {
cell.setCellType(CellType.STRING);
if (cell.getStringCellValue().length() > 500) {
FileUnZip.deleteDir(saveDirectory);
return Result.error(""+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入过长");
}
rowMap.put(headerCell.getStringCellValue(), cell.getStringCellValue());
}
} else {
rowMap.put(headerCell.getStringCellValue(), "");
}
}
importDataList.add(rowMap);
}
if (importDataList.size() < 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("您输入的数据为空");
}
ImportParams importParams = new ImportParams();
importParams.setTitleRows(1);
List<SarLawsInformation> sarLawsInformationList = ExcelImportUtil.importExcel(readImpExcelFile(zipEntryName).get(0), SarLawsInformation.class, importParams);
// @Cleanup
InputStream inputStream = new FileInputStream(excelFile);
List<SarLawsInformation> sarLawsInformationList = ExcelImportUtil.importExcel(inputStream, SarLawsInformation.class, importParams);
workbook.close();
inputStream.close();
FileUnZip.delete(excelFile);
// 获取需要校验的字段
List<TsDicType> firstMaterialTypeList = dicTypeService.selectAllDicTypeNameByDicCode("firstMaterialType");
Set<String> firstMaterialTypeNameSet = firstMaterialTypeList.stream().map(TsDicType::getDicTypeName).collect(Collectors.toSet());
@@ -487,68 +558,94 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
sarLawsInformationListNew.add(sarLawsInformation);
}
}
for (SarLawsInformation sarLawsInformation : sarLawsInformationListNew){
// 把excel表中的类别名转换为类别编号,并对类别名做检测
if (StringUtils.isNotBlank(sarLawsInformation.getFirstTypeName())) {
List<String> firstTypeCodeList = new ArrayList<>();
for (String firstTypeName : sarLawsInformation.getFirstTypeName().split(",")) {
if (!firstMaterialTypeNameSet.contains(firstTypeName)){
return Result.error("" + index + "条记录的一级会议类别不符合输入要求");
}
for (TsDicType tsDicType : firstMaterialTypeList) {
if (firstTypeName.equals(tsDicType.getDicTypeName())) {
firstTypeCodeList.add(tsDicType.getDicTypeCode());
if (sarLawsInformationListNew.size() < 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("您输入的数据为空");
}
try {
for (SarLawsInformation sarLawsInformation : sarLawsInformationListNew){
if (StringUtils.isBlank(sarLawsInformation.getDepartment())) {
return Result.error("" + index + "条记录的资料归属部门不能为空");
}
// 把excel表中的类别名转换为类别编号,并对类别名做检测
if (StringUtils.isNotBlank(sarLawsInformation.getFirstTypeName())) {
List<String> firstTypeCodeList = new ArrayList<>();
for (String firstTypeName : sarLawsInformation.getFirstTypeName().split(",")) {
if (!firstMaterialTypeNameSet.contains(firstTypeName)){
return Result.error("" + index + "条记录的一级会议类别不符合输入要求");
}
for (TsDicType tsDicType : firstMaterialTypeList) {
if (firstTypeName.equals(tsDicType.getDicTypeName())) {
firstTypeCodeList.add(tsDicType.getDicTypeCode());
}
}
}
sarLawsInformation.setFirstType(String.join(",", firstTypeCodeList));
}else {
return Result.error("" + index + "条记录的1级资料分类不能为空");
}
sarLawsInformation.setFirstType(String.join(",", firstTypeCodeList));
}
if (StringUtils.isNotBlank(sarLawsInformation.getSecondTypeName())) {
List<String> secondTypeCodeList = new ArrayList<>();
for (String secondTypeName : sarLawsInformation.getSecondTypeName().split(",")) {
if (!secondMaterialTypeNameSet.contains(secondTypeName)){
return Result.error("" + index + "条记录的二级会议类别不符合输入要求");
}
for (TsDicType tsDicType : secondMaterialTypeList) {
if (secondTypeName.equals(tsDicType.getDicTypeName())) {
secondTypeCodeList.add(tsDicType.getDicTypeCode());
if (StringUtils.isNotBlank(sarLawsInformation.getSecondTypeName())) {
List<String> secondTypeCodeList = new ArrayList<>();
for (String secondTypeName : sarLawsInformation.getSecondTypeName().split(",")) {
if (!secondMaterialTypeNameSet.contains(secondTypeName)){
return Result.error("" + index + "条记录的二级会议类别不符合输入要求");
}
for (TsDicType tsDicType : secondMaterialTypeList) {
if (secondTypeName.equals(tsDicType.getDicTypeName())) {
secondTypeCodeList.add(tsDicType.getDicTypeCode());
}
}
}
sarLawsInformation.setSecondType(String.join(",", secondTypeCodeList));
}else {
return Result.error("" + index + "条记录的2级资料分类不能为空");
}
sarLawsInformation.setSecondType(String.join(",", secondTypeCodeList));
}
if (StringUtils.isNotBlank(sarLawsInformation.getThirdTypeName())) {
List<String> thirdTypeCodeList = new ArrayList<>();
for (String thirdTypeName : sarLawsInformation.getThirdTypeName().split(",")) {
if (!thirdMaterialTypeNameSet.contains(thirdTypeName)){
return Result.error("" + index + "条记录的三级会议类别不符合输入要求");
}
for (TsDicType tsDicType : thirdMaterialTypeList) {
if (thirdTypeName.equals(tsDicType.getDicTypeName())) {
thirdTypeCodeList.add(tsDicType.getDicTypeCode());
if (StringUtils.isNotBlank(sarLawsInformation.getThirdTypeName())) {
List<String> thirdTypeCodeList = new ArrayList<>();
for (String thirdTypeName : sarLawsInformation.getThirdTypeName().split(",")) {
if (!thirdMaterialTypeNameSet.contains(thirdTypeName)){
return Result.error("" + index + "条记录的三级会议类别不符合输入要求");
}
for (TsDicType tsDicType : thirdMaterialTypeList) {
if (thirdTypeName.equals(tsDicType.getDicTypeName())) {
thirdTypeCodeList.add(tsDicType.getDicTypeCode());
}
}
}
sarLawsInformation.setThirdType(String.join(",", thirdTypeCodeList));
}else {
return Result.error("" + index + "条记录的3级资料分类不能为空");
}
sarLawsInformation.setThirdType(String.join(",", thirdTypeCodeList));
}
if (StringUtils.isNotBlank(sarLawsInformation.getFourthTypeName())) {
List<String> fourthTypeCodeList = new ArrayList<>();
for (String fourthTypeName : sarLawsInformation.getFourthTypeName().split(",")) {
if (!fourthMaterialTypeNameSet.contains(fourthTypeName)){
return Result.error("" + index + "条记录的四级会议类别不符合输入要求");
}
for (TsDicType tsDicType : fourthMaterialTypeList) {
if (fourthTypeName.equals(tsDicType.getDicTypeName())) {
fourthTypeCodeList.add(tsDicType.getDicTypeCode());
if (StringUtils.isNotBlank(sarLawsInformation.getFourthTypeName())) {
List<String> fourthTypeCodeList = new ArrayList<>();
for (String fourthTypeName : sarLawsInformation.getFourthTypeName().split(",")) {
if (!fourthMaterialTypeNameSet.contains(fourthTypeName)){
return Result.error("" + index + "条记录的四级会议类别不符合输入要求");
}
for (TsDicType tsDicType : fourthMaterialTypeList) {
if (fourthTypeName.equals(tsDicType.getDicTypeName())) {
fourthTypeCodeList.add(tsDicType.getDicTypeCode());
}
}
}
sarLawsInformation.setFourthType(String.join(",", fourthTypeCodeList));
} else {
return Result.error("" + index + "条记录的4级资料分类不能为空");
}
sarLawsInformation.setFourthType(String.join(",", fourthTypeCodeList));
String informationFileAtt = null;
try {
informationFileAtt = getFileAtt("资料文件",sarLawsInformation.getInformationFile(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsInformation.setInformationFile(informationFileAtt);
// 索引 +1
index++;
// 存入数据库
addLawsInformation(sarLawsInformation);
}
// 索引 +1
index++;
// 存入数据库
addLawsInformation(sarLawsInformation);
} finally {
FileUnZip.deleteDir(saveDirectory);
}
return Result.success("导入成功");
}
@@ -591,45 +688,33 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
* @return 差异
*/
public List<String> compareSarLawsInformation(SarLawsInformation oldInfo, SarLawsInformation newInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<String> changes = new ArrayList<>();
// 需要比较的字段
String[] fieldArr = {"firstType","secondType","thirdType","fourthType","name",
"department","author","description","informationFile","treeNodeId","viewableBy","downloadableBy"};
List<String> fieldList = Arrays.asList(fieldArr);
// 获取SarLawsInformation类的所有字段
Field[] fields = SarLawsInformation.class.getDeclaredFields();
for (Field field : fields) {
if (fieldList.contains(field.getName())) {
boolean annotationPresent = field.isAnnotationPresent(CompareField.class);
if (annotationPresent) {
try {
field.setAccessible(true);
String oldValue = String.valueOf(field.get(oldInfo));
String newValue = String.valueOf(field.get(newInfo));
// String oldValue = String.valueOf(field.get(oldInfo));
// String newValue = String.valueOf(field.get(newInfo));
Object oldValue = field.get(oldInfo);
Object newValue = field.get(newInfo);
if (oldValue instanceof Date){
oldValue = sdf.format((Date)oldValue);
}
if( newValue instanceof Date) {
newValue = sdf.format((Date)newValue);
}
if (!Objects.equals(oldValue, newValue)) {
switch (field.getName()) {
// case "firstType":
// case "secondType":
// case "thirdType":
// case "fourthType": {
// List<String> typeNameList = new ArrayList<>();
// if (StringUtils.isNotBlank(newValue)) {
// for (String type : newValue.split(",")) {
// if (StringUtils.isNotBlank(type)) {
// typeNameList.add(dicTypeService.getDicTypeNameByDicCode(type));
// }
// }
// }
// // 获取资料类型名称
// String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
// Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name");
// Object oldTypeName = method.invoke(oldInfo);
// ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
// changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + String.join(",", typeNameList) + "\"");
// break;
// }
case "informationFile": {
List<String> fileNameList = new ArrayList<>();
if (StringUtils.isNotBlank(newValue)) {
String[] split = newValue.split(",");
String oldValueStr = String.valueOf(field.get(oldInfo));
String newValueStr = String.valueOf(field.get(newInfo));
if (StringUtils.isNotBlank(newValueStr)) {
String[] split = newValueStr.split(",");
for (String attId : split) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileNameList.add(fileInfo.getOldFileName());
@@ -646,14 +731,24 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
oldFileNameList.add(oldFile1.getOldFileName());
}
}
if (StringUtils.isBlank(String.join(",",oldFileNameList))) {
oldValue = "";
}else {
oldValue = String.join(",",oldFileNameList);
}
if (StringUtils.isBlank(String.join(",",fileNameList))) {
newValue = "";
}else {
newValue = String.join(",",fileNameList);
}
// 获取字段名称
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + String.join(",", oldFileNameList) + "\"改为\"" + String.join(",", fileNameList) + "\"");
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
break;
}
default: {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "\"" + Optional.ofNullable(oldValue).orElse("") + "\"改为\"" + Optional.ofNullable(newValue).orElse("") + "\"");
break;
}
}
@@ -698,6 +793,34 @@ public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformatio
}
return results;
}
public String getFileAtt(String fieldName,String fileNameStr, Map<String, File> fileMap, int count) throws Exception {
if (fileNameStr != null) {
List<String> fileAttList = new ArrayList<>();
for (String fileName : fileNameStr.split(",")) {
int lastIndexOf = fileName.lastIndexOf(".");
if (fileName.lastIndexOf(".") != -1) {
String lastName = fileName.substring(lastIndexOf + 1).toLowerCase();
if (lastName.equals("pdf") || lastName.equals("ppt") || lastName.equals("pptx") || lastName.equals("doc") || lastName.equals("docx")) {
File file1 = fileMap.get(fileName);
if (file1 == null) {
throw new Exception(fieldName + "中第" + (count+1) +"" + fileName + "文件不存在,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
AttFileVo attFileVo = attFileEOService.saveFileInfo(file1);
if (StringUtils.isNotBlank(attFileVo.getId())) {
fileAttList.add(attFileVo.getAttId());
}
} else {
throw new Exception(fieldName + "中第" + (count+1) +"" + fileName + "格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
} else {
throw new Exception(fieldName + "中第" + (count+1) +"" + fileName + "格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
}
return String.join(",", fileAttList);
}
return null;
}
}
@@ -77,7 +77,7 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
case "issueTime":
page.setOrderByA("SAR_LAWS_STAND_INFO.ISSUE_TIME");//发布日期
break;
case "SSRQLAWS":
case "ssrqlaws":
page.setOrderByA("SSRQLAWS");
break;
case "LAWSSYCX":
@@ -103,6 +103,9 @@ public class SarLawsStandInfoController extends BaseController<SarLawsStandInfo>
break;
}
}
} else {
page.setOrderByA("SAR_LAWS_STAND_INFO.LAWS_NAME");
page.setOrder1("asc");
}
@@ -242,6 +242,28 @@ public class SarLawsStandInfoServiceImpl extends ServiceImpl<SarLawsStandInfoDao
newStandList.add(sarLawsStandInfoList.get(0));
attrInfoShowDetails(newStandList);
sarLawsStandInfo = newStandList.get(0);
String levelName = "";
List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(sarLawsStandInfo.getLawsTypeFirstLevel())) {
list = Arrays.asList(sarLawsStandInfo.getLawsTypeFirstLevel().split(","));
levelName = dicTypeEODao.getDicNamesByCodes(list, "xf1g55oztafkxisxie1i");
sarLawsStandInfo.setLawTypeFirstLevelName(levelName);
}
if (StringUtils.isNotBlank(sarLawsStandInfo.getLawsTypeSecondLevel())) {
list = Arrays.asList(sarLawsStandInfo.getLawsTypeSecondLevel().split(","));
levelName = dicTypeEODao.getDicNamesByCodes(list, "r09bcearrmv0qoqoc8w4");
sarLawsStandInfo.setLawTypeSecondLevelName(levelName);
}
if (StringUtils.isNotBlank(sarLawsStandInfo.getLawsTypeThirdLevel())) {
list = Arrays.asList(sarLawsStandInfo.getLawsTypeThirdLevel().split(","));
levelName = dicTypeEODao.getDicNamesByCodes(list, "h05q1gegpth2jbp9k447");
sarLawsStandInfo.setLawTypeThirdLevelName(levelName);
}
if (StringUtils.isNotBlank(sarLawsStandInfo.getLawsTypeFourthLevel())) {
list = Arrays.asList(sarLawsStandInfo.getLawsTypeFourthLevel().split(","));
levelName = dicTypeEODao.getDicNamesByCodes(list, "5pl1o1zufypbyiqapssf");
sarLawsStandInfo.setLawTypeFourthLevelName(levelName);
}
}
return sarLawsStandInfo;
}
@@ -13,6 +13,7 @@ import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopic;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicExport;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicVO;
import com.adc.da.slrs.sarLawsTopic.service.SarLawsTopicService;
import com.adc.da.util.UUIDUtils;
@@ -27,6 +28,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -36,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -123,10 +126,16 @@ public class SarLawsTopicController extends BaseController<SarLawsTopicVO> {
// 导出所有数据
datas = lawsTopicService.getAllLawsTopic(sarLawsTopicVO);
}
List<SarLawsTopicExport> dataExportList = new ArrayList<>();
for (SarLawsTopicVO data : datas) {
SarLawsTopicExport dataExport = new SarLawsTopicExport();
BeanUtils.copyProperties(data, dataExport);
dataExportList.add(dataExport);
}
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setSheetName(sarLawsTopicVO.getExportName());
workbook = ExcelExportUtil.exportExcel(exportParams, SarLawsTopicVO.class, datas);
workbook = ExcelExportUtil.exportExcel(exportParams, SarLawsTopicExport.class, dataExportList);
os = response.getOutputStream();
workbook.write(os);
os.flush();
@@ -141,7 +150,7 @@ public class SarLawsTopicController extends BaseController<SarLawsTopicVO> {
@ApiOperation("Excel文件导入政策资料信息")
@PostMapping("/importLawsTopicInfo")
public ResponseMessage<?> importLawsTopicInfo(@RequestParam(value = "file",required = false) MultipartFile file) throws ParseException {
public ResponseMessage<?> importLawsTopicInfo(@RequestParam(value = "file",required = false) MultipartFile file) throws Exception {
if (file == null) {
return Result.error("文件为空,请重新上传");
}
@@ -171,14 +180,14 @@ public class SarLawsTopicController extends BaseController<SarLawsTopicVO> {
HSSFSheet sheetItems = workbook.createSheet("模板");
sheetItems.setDefaultColumnWidth(13);
Row rowHeader = sheetItems.createRow(1);//开始创建标题行
sheetItems.addMergedRegion(new CellRangeAddress(0, 0, 0, 21));
sheetItems.addMergedRegion(new CellRangeAddress(0, 0, 0, 31));
Row row2 = sheetItems.createRow(0);//开始创建填写说明
// 表头样式
HSSFCellStyle cellStyle1 = workbook.createCellStyle();
cellStyle1.setAlignment(HorizontalAlignment.CENTER);
cellStyle1.setVerticalAlignment(VerticalAlignment.CENTER);
String exportFieldName = "课题名称,课题承办单位,课题指导单位,课题参与单位,启动时间,结题时间,课题费用(万元)";
String exportFieldName = "*课题名称,*课题承办单位,课题指导单位,课题参与单位,*启动时间,结题时间,课题费用(万元),协议";
String[] headerArr = exportFieldName.split(",");
for (int i=0;i < headerArr.length; i++) {
Cell cell = rowHeader.createCell(i);
@@ -186,33 +195,54 @@ public class SarLawsTopicController extends BaseController<SarLawsTopicVO> {
sheetItems.addMergedRegion(new CellRangeAddress(1,2,i,i));
cell.setCellStyle(cellStyle1);
}
String exportFieldListName = "课题组会议列表,课题组联系方式,内部联系方式";
String[] headerListArr = exportFieldListName.split(",");
for (int i=0;i < headerListArr.length; i++) {
Cell cell = rowHeader.createCell(7 + (i * 5));
cell.setCellValue(headerListArr[i]);
sheetItems.addMergedRegion(new CellRangeAddress(1,1,7+(i*5),7+(i*5)+4));
cell.setCellStyle(cellStyle1);
}
HSSFRow rowHeader2 = sheetItems.createRow(2);
Cell cell = rowHeader.createCell(8);
cell.setCellValue("课题组会议");
sheetItems.addMergedRegion(new CellRangeAddress(1,1,8,12));
cell.setCellStyle(cellStyle1);
String exportFieldMeetingName = "会议名称,会议时间,会议地点,参会人员(内部),会议主要内容";
String[] headerMeetingListArr = exportFieldMeetingName.split(",");
HSSFRow rowHeader2 = sheetItems.createRow(2);
for (int i=0;i < headerMeetingListArr.length; i++) {
Cell cell = rowHeader2.createCell(7 + i);
cell.setCellValue(headerMeetingListArr[i]);
cell.setCellStyle(cellStyle1);
}
String exportFieldContactName = "姓名,单位,电话,邮箱,身份";
String[] headerContactListArr = exportFieldContactName.split(",");
for (int i=0;i < headerContactListArr.length; i++) {
Cell cell1 = rowHeader2.createCell(12 + i);
cell1.setCellValue(headerContactListArr[i]);
cell1.setCellStyle(cellStyle1);
Cell cell2 = rowHeader2.createCell(17 + i);
cell2.setCellValue(headerContactListArr[i]);
Cell cell2 = rowHeader2.createCell(8 + i);
cell2.setCellValue(headerMeetingListArr[i]);
cell2.setCellStyle(cellStyle1);
}
String topicGroupFieldName = "课题组研究方案,课题组研究成果,课题组其他,课题组会议资料";
headerArr = topicGroupFieldName.split(",");
for (int i=0;i < headerArr.length; i++) {
Cell cell2 = rowHeader.createCell(13+i);
cell2.setCellValue(headerArr[i]);
sheetItems.addMergedRegion(new CellRangeAddress(1,2,i+13,i+13));
cell2.setCellStyle(cellStyle1);
}
Cell cell3 = rowHeader.createCell(17);
cell3.setCellValue("课题组联系方式");
sheetItems.addMergedRegion(new CellRangeAddress(1,1,17,21));
cell3.setCellStyle(cellStyle1);
String exportFieldContactName = "姓名,单位,电话,邮箱,身份";
headerMeetingListArr = exportFieldContactName.split(",");
for (int i=0;i < headerMeetingListArr.length; i++) {
Cell cell4 = rowHeader2.createCell(17 + i);
cell4.setCellValue(headerMeetingListArr[i]);
cell4.setCellStyle(cellStyle1);
}
String insideFieldName = "内部立项报告,内部研究方案,内部会议资料,内部研究成果,内部其他";
headerArr = insideFieldName.split(",");
for (int i=0;i < headerArr.length; i++) {
Cell cell5 = rowHeader.createCell(22+i);
cell5.setCellValue(headerArr[i]);
sheetItems.addMergedRegion(new CellRangeAddress(1,2,i+22,i+22));
cell5.setCellStyle(cellStyle1);
}
Cell cell6 = rowHeader.createCell(27);
cell6.setCellValue("内部联系方式");
sheetItems.addMergedRegion(new CellRangeAddress(1,1,27,31));
cell6.setCellStyle(cellStyle1);
for (int i=0;i < headerMeetingListArr.length; i++) {
Cell cell7 = rowHeader2.createCell(27 + i);
cell7.setCellValue(headerMeetingListArr[i]);
cell7.setCellStyle(cellStyle1);
}
Cell cellA2 = row2.createCell(0);
cellA2.setCellValue(FieldConvertUtil.exportLawsTopicDesc);
//sheetItems.setColumnWidth(0, 20 * 150);
@@ -17,7 +17,7 @@ import java.util.List;
@Mapper
public interface SarLawsTopicMapper extends BaseMapper<SarLawsTopic> {
List<Integer> queryByPageCount(SarLawsTopicVO page);
Integer queryByPageCount(SarLawsTopicVO page);
List<SarLawsTopicVO> queryByPage(SarLawsTopicVO page);
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
/**
* 政策课题组联系方式
@@ -70,4 +71,16 @@ public class SarLawsContactInformation implements Serializable {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
public static SarLawsContactInformation emptyValueProcess(SarLawsContactInformation sarLawsContactInformation) {
if (StringUtils.isBlank(sarLawsContactInformation.getName()) &&
StringUtils.isBlank(sarLawsContactInformation.getGroupType()) &&
StringUtils.isBlank(sarLawsContactInformation.getDepartment()) &&
StringUtils.isBlank(sarLawsContactInformation.getEmail()) &&
StringUtils.isBlank(sarLawsContactInformation.getPhone()) &&
StringUtils.isBlank(sarLawsContactInformation.getIdentity())) {
return null;
}
return sarLawsContactInformation;
}
}
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarLawsTopic.entity;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -30,6 +31,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题名称
*/
@CompareField(fieldName = "课题名称")
@ApiModelProperty(value = "课题名称")
@TableField(value = "TOPIC_NAME")
private String topicName;
@@ -37,6 +39,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题承办单位
*/
@CompareField(fieldName = "课题承办单位")
@ApiModelProperty(value = "课题承办单位")
@TableField(value = "ORGANIZER")
private String organizer;
@@ -44,6 +47,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题指导单位
*/
@CompareField(fieldName = "课题指导单位")
@ApiModelProperty(value = "课题指导单位")
@TableField(value = "GUIDANCE_UNIT")
private String guidanceUnit;
@@ -51,6 +55,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题参与单位
*/
@CompareField(fieldName = "课题参与单位")
@ApiModelProperty(value = "课题参与单位")
@TableField(value = "PARTICIPATING_UNIT")
private String participatingUnit;
@@ -58,6 +63,7 @@ public class SarLawsTopic implements Serializable {
/**
* 开始时间
*/
@CompareField(fieldName = "启动时间")
@ApiModelProperty(value = "启动时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@TableField(value = "START_TIME")
@@ -66,6 +72,7 @@ public class SarLawsTopic implements Serializable {
/**
* 结题时间
*/
@CompareField(fieldName = "结题时间")
@ApiModelProperty(value = "结题时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@TableField(value = "CLOSE_TIME")
@@ -74,6 +81,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题状态
*/
@CompareField(fieldName = "课题状态")
@ApiModelProperty(value = "课题状态")
@TableField(value = "TOPIC_STATUS")
private String topicStatus;
@@ -81,6 +89,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题费用(万元)
*/
@CompareField(fieldName = "课题费用")
@ApiModelProperty(value = "课题费用")
@TableField(value = "TOPIC_COST")
private String topicCost;
@@ -88,6 +97,7 @@ public class SarLawsTopic implements Serializable {
/**
* 协议
*/
@CompareField(fieldName = "协议文件")
@ApiModelProperty("协议文件")
@TableField(value = "AGREEMENT")
private String agreement;
@@ -99,6 +109,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题组会议列表
*/
@CompareField(fieldName = "课题组会议列表")
@ApiModelProperty(value = "课题组会议列表")
@TableField(exist = false)
private List<SarLawsTopicMeeting> meetingList;
@@ -106,6 +117,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题组研究方案
*/
@CompareField(fieldName = "课题研究方案")
@ApiModelProperty(value = "课题研究方案")
@TableField(value = "RESEARCH_PLAN")
private String researchPlan;
@@ -117,6 +129,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题组研究成果
*/
@CompareField(fieldName = "课题组研究成果")
@ApiModelProperty(value = "课题组研究成果")
@TableField(value = "RESEARCH_FINDINGS")
private String researchFindings;
@@ -131,6 +144,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题组其他
*/
@CompareField(fieldName = "课题组其他文件")
@ApiModelProperty(value = "课题组其他文件")
@TableField(value = "RESEARCH_GROUP_OTHER")
private String researchGroupOther;
@@ -142,6 +156,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题组会议资料
*/
@CompareField(fieldName = "课题组会议资料")
@ApiModelProperty(value = "课题组会议资料")
@TableField(value = "CONFERENCE_MATERIALS")
private String conferenceMaterials;
@@ -153,6 +168,7 @@ public class SarLawsTopic implements Serializable {
/**
* 课题组联系方式
*/
@CompareField(fieldName = "课题组联系方式")
@ApiModelProperty(value = "课题组联系方式列表")
@TableField(exist = false)
private List<SarLawsContactInformation> topicContactInformationList;
@@ -160,6 +176,7 @@ public class SarLawsTopic implements Serializable {
/**
* 内部资料立项报告
*/
@CompareField(fieldName = "内部资料立项报告")
@ApiModelProperty(value = "内部资料立项报告")
@TableField(value = "INSIDE_PROJECT_PROPOSAL_REPORT")
private String insideProjectProposalRepost;
@@ -171,6 +188,7 @@ public class SarLawsTopic implements Serializable {
/**
* 内部资料研究方案
*/
@CompareField(fieldName = "内部资料研究方案")
@ApiModelProperty(value = "内部资料研究方案")
@TableField(value = "INSIDE_RESEARCH_PLAN")
private String insideResearchPlan;
@@ -182,6 +200,7 @@ public class SarLawsTopic implements Serializable {
/**
* 内部资料会议资料
*/
@CompareField(fieldName = "内部资料会议资料")
@ApiModelProperty(value = "内部资料会议资料")
@TableField(value = "INSIDE_CONFERENCE_MATERIALS")
private String insideConferenceMaterials;
@@ -193,6 +212,7 @@ public class SarLawsTopic implements Serializable {
/**
* 内部会议研究成果
*/
@CompareField(fieldName = "内部会议研究成果")
@ApiModelProperty(value = "内部会议研究成果")
@TableField(value = "INSIDE_RESEARCH_FINDINGS")
private String insideResearchFindings;
@@ -204,6 +224,7 @@ public class SarLawsTopic implements Serializable {
/**
* 内部会议其他
*/
@CompareField(fieldName = "内部会议其他文件")
@ApiModelProperty(value = "内部会议其他文件")
@TableField(value = "INSIDE_OTHER")
private String insideOther;
@@ -215,6 +236,7 @@ public class SarLawsTopic implements Serializable {
/**
* 内部联系方式
*/
@CompareField(fieldName = "内部联系方式列表")
@ApiModelProperty(value = "内部联系方式列表")
@TableField(exist = false)
private List<SarLawsContactInformation> insideContactInformationList;
@@ -0,0 +1,87 @@
package com.adc.da.slrs.sarLawsTopic.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author tjzdw
* @description
* @date 2023/11/23
*/
@Data
public class SarLawsTopicExport {
/**
* 主键
*/
private String id;
/**
* 课题名称
*/
@Excel(name = "课题名称", orderNum = "0", type = 1, needMerge = true)
private String topicName;
/**
* 课题承办单位
*/
@Excel(name = "课题承办单位", orderNum = "1",type = 1, needMerge = true)
private String organizer;
/**
* 课题指导单位
*/
@Excel(name = "课题指导单位", orderNum = "2", type = 1, needMerge = true)
private String guidanceUnit;
/**
* 课题参与单位
*/
@Excel(name = "课题参与单位", orderNum = "3", type = 1, needMerge = true)
private String participatingUnit;
/**
* 开始时间
*/
@Excel(name = "启动时间", orderNum = "4", exportFormat = "yyyy-MM-dd", needMerge = true)
private Date startTime;
/**
* 结题时间
*/
@Excel(name = "结题时间", orderNum = "5", exportFormat = "yyyy-MM-dd", needMerge = true)
private Date closeTime;
/**
* 课题状态
*/
@Excel(name = "课题状态", orderNum = "6", type = 1, needMerge = true)
private String topicStatus;
/**
* 课题费用(万元)
*/
@Excel(name = "课题费用(万元)", orderNum = "7", type = 1, needMerge = true)
private String topicCost;
/**
* 课题组会议列表
*/
@ExcelCollection(name = "课题组会议列表", orderNum = "8")
private List<SarLawsTopicMeeting> meetingList;
/**
* 课题组联系方式
*/
@ExcelCollection(name = "课题组联系方式", orderNum = "9")
private List<SarLawsContactInformation> topicContactInformationList;
/**
* 内部联系方式
*/
@ExcelCollection(name = "内部联系方式", orderNum = "10")
private List<SarLawsContactInformation> insideContactInformationList;
}
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarLawsTopic.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
/**
* 政策课题组会议
@@ -31,6 +33,7 @@ public class SarLawsTopicMeeting implements Serializable {
/**
* 会议名称
*/
@CompareField(fieldName = "会议名称")
@TableField(value = "MEETING_NAME")
@Excel(name = "会议名称", orderNum = "0", type = 1)
private String meetingName;
@@ -38,6 +41,7 @@ public class SarLawsTopicMeeting implements Serializable {
/**
* 会议时间
*/
@CompareField(fieldName = "会议时间")
@TableField(value = "MEETING_TIME")
@Excel(name = "会议时间", orderNum = "1", type = 1)
private String meetingTime;
@@ -45,6 +49,7 @@ public class SarLawsTopicMeeting implements Serializable {
/**
* 会议地点
*/
@CompareField(fieldName = "会议地点")
@TableField(value = "MEETING_ADDRESS")
@Excel(name = "会议地点", orderNum = "2", type = 1)
private String meetingAddress;
@@ -52,6 +57,7 @@ public class SarLawsTopicMeeting implements Serializable {
/**
* 参会人员(内部)
*/
@CompareField(fieldName = "参会人员(内部)")
@TableField(value = "PARTICIPANTS")
@Excel(name = "参会人员(内部)", orderNum = "3", type = 1)
private String participants;
@@ -59,10 +65,22 @@ public class SarLawsTopicMeeting implements Serializable {
/**
* 会议主要内容
*/
@CompareField(fieldName = "会议主要内容")
@TableField(value = "MEETING_CONTENT")
@Excel(name = "会议主要内容", orderNum = "4", type = 1)
private String meetingContent;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
public static SarLawsTopicMeeting emptyValueProcess(SarLawsTopicMeeting sarLawsTopicMeeting) {
if (StringUtils.isBlank(sarLawsTopicMeeting.getMeetingName()) &&
StringUtils.isBlank(sarLawsTopicMeeting.getMeetingTime()) &&
StringUtils.isBlank(sarLawsTopicMeeting.getMeetingAddress()) &&
StringUtils.isBlank(sarLawsTopicMeeting.getParticipants()) &&
StringUtils.isBlank(sarLawsTopicMeeting.getMeetingContent())) {
return null;
}
return sarLawsTopicMeeting;
}
}
@@ -30,13 +30,13 @@ public class SarLawsTopicVO extends BasePage {
/**
* 课题名称
*/
@Excel(name = "课题名称", orderNum = "0", type = 1, needMerge = true)
@Excel(name = "*课题名称", orderNum = "0", type = 1, needMerge = true)
private String topicName;
/**
* 课题承办单位
*/
@Excel(name = "课题承办单位", orderNum = "1",type = 1, needMerge = true)
@Excel(name = "*课题承办单位", orderNum = "1",type = 1, needMerge = true)
private String organizer;
/**
@@ -56,7 +56,7 @@ public class SarLawsTopicVO extends BasePage {
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "启动时间", orderNum = "4", exportFormat = "yyyy-MM-dd", needMerge = true)
@Excel(name = "*启动时间", orderNum = "4", exportFormat = "yyyy-MM-dd", needMerge = true)
private Date startTime;
/**
@@ -82,6 +82,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 协议
*/
@Excel(name = "协议", orderNum = "8", type = 1, needMerge = true)
private String agreement;
private List<AttFileEO> agreementList;
@@ -89,7 +90,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 课题组会议列表
*/
@ExcelCollection(name = "课题组会议列表", orderNum = "8")
@ExcelCollection(name = "课题组会议列表", orderNum = "9")
private List<SarLawsTopicMeeting> meetingList;
/**
@@ -123,6 +124,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 课题组研究方案
*/
@Excel(name = "课题组研究方案", orderNum = "10",type = 1, needMerge = true)
private String researchPlan;
private List<AttFileEO> researchPlanList;
@@ -130,6 +132,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 课题组研究成果
*/
@Excel(name = "课题组研究成果", orderNum = "11",type = 1, needMerge = true)
private String researchFindings;
private List<AttFileEO> researchFindingsList;
@@ -137,6 +140,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 课题组其他
*/
@Excel(name = "课题组其他", orderNum = "12",type = 1, needMerge = true)
private String researchGroupOther;
private List<AttFileEO> researchGroupOtherList;
@@ -144,6 +148,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 课题组会议资料
*/
@Excel(name = "课题组会议资料", orderNum = "13",type = 1, needMerge = true)
private String conferenceMaterials;
private List<AttFileEO> conferenceMaterialsList;
@@ -151,7 +156,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 课题组联系方式
*/
@ExcelCollection(name = "课题组联系方式", orderNum = "9")
@ExcelCollection(name = "课题组联系方式", orderNum = "14")
private List<SarLawsContactInformation> topicContactInformationList;
// 课题组用户名称
@@ -168,6 +173,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 内部资料立项报告
*/
@Excel(name = "内部立项报告", orderNum = "15", needMerge = true)
private String insideProjectProposalRepost;
private List<AttFileEO> insideProjectProposalRepostList;
@@ -175,6 +181,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 内部资料研究方案
*/
@Excel(name = "内部研究方案", orderNum = "16", needMerge = true)
private String insideResearchPlan;
private List<AttFileEO> insideResearchPlanList;
@@ -182,6 +189,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 内部资料会议资料
*/
@Excel(name = "内部会议资料", orderNum = "17", needMerge = true)
private String insideConferenceMaterials;
private List<AttFileEO> insideConferenceMaterialsList;
@@ -189,6 +197,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 内部会议研究成果
*/
@Excel(name = "内部研究成果", orderNum = "18", needMerge = true)
private String insideResearchFindings;
private List<AttFileEO> insideResearchFindingsList;
@@ -196,6 +205,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 内部会议其他
*/
@Excel(name = "内部其他", orderNum = "19", needMerge = true)
private String insideOther;
private List<AttFileEO> insideOtherList;
@@ -203,7 +213,7 @@ public class SarLawsTopicVO extends BasePage {
/**
* 内部联系方式
*/
@ExcelCollection(name = "内部联系方式", orderNum = "10")
@ExcelCollection(name = "内部联系方式", orderNum = "20")
private List<SarLawsContactInformation> insideContactInformationList;
// 内部人员名称
@@ -234,13 +244,13 @@ public class SarLawsTopicVO extends BasePage {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
private String sortField = "ID";
private String sortField = "startTime";
private String sortMode = "asc";
private String sortMode = "desc";
// 排序字段
private Date startTimeBegin;
private Date startTimeEnd;
private String startTimeBegin;
private String startTimeEnd;
// 导出使用的属性
// 导出文件名
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarLawsTopic.service;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicMeeting;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @author tjzdw
* @description 针对表【sar_laws_topic_meeting(政策课题组会议)】的数据库操作Service
@@ -10,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface SarLawsTopicMeetingService extends IService<SarLawsTopicMeeting> {
public List<String> compareTopicMeeting(SarLawsTopicMeeting oldTopicMeeting, SarLawsTopicMeeting newTopicMeeting);
}
@@ -1,7 +1,6 @@
package com.adc.da.slrs.sarLawsTopic.service;
import com.adc.da.http.ResponseMessage;
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopic;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicVO;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -30,5 +29,5 @@ public interface SarLawsTopicService extends IService<SarLawsTopic> {
List<SarLawsTopicVO> getAllLawsTopic(SarLawsTopicVO sarLawsTopicVO);
ResponseMessage<?> importLawsTopicInfo(MultipartFile file);
ResponseMessage<?> importLawsTopicInfo(MultipartFile file) throws Exception;
}
@@ -1,11 +1,17 @@
package com.adc.da.slrs.sarLawsTopic.service.impl;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopic;
import com.adc.da.utils.annotation.CompareField;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicMeeting;
import com.adc.da.slrs.sarLawsTopic.service.SarLawsTopicMeetingService;
import com.adc.da.slrs.sarLawsTopic.dao.SarLawsTopicMeetingMapper;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author tjzdw
* @description 针对表【sar_laws_topic_meeting(政策课题组会议)】的数据库操作Service实现
@@ -15,6 +21,35 @@ import org.springframework.stereotype.Service;
public class SarLawsTopicMeetingServiceImpl extends ServiceImpl<SarLawsTopicMeetingMapper, SarLawsTopicMeeting>
implements SarLawsTopicMeetingService{
public List<String> compareTopicMeeting(SarLawsTopicMeeting oldTopicMeeting, SarLawsTopicMeeting newTopicMeeting) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<String> changes = new ArrayList<>();
// 获取TopicMeeting类的所有字段
Field[] fields = SarLawsTopic.class.getDeclaredFields();
for (Field field : fields) {
boolean annotationPresent = field.isAnnotationPresent(CompareField.class);
if (annotationPresent) {
try {
field.setAccessible(true);
Object oldValue = field.get(oldTopicMeeting);
Object newValue = field.get(newTopicMeeting);
if (oldValue instanceof Date && newValue instanceof Date) {
oldValue = sdf.format((Date)oldValue);
newValue = sdf.format((Date)newValue);
}
if (!Objects.equals(oldValue, newValue)) {
// 对比其他字段
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
}
} catch (IllegalAccessException e) {
// 处理异常
e.printStackTrace();
}
}
}
return changes;
}
}
@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.impl.AttFileEOServiceImpl;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.common.FileUnZip;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
@@ -16,6 +17,7 @@ import com.adc.da.slrs.sarUpdLog.entity.SarUpdLog;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.util.LoginUserUtil;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.annotation.CompareField;
import com.adc.da.utils.util.FieldConvertUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -24,12 +26,11 @@ import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopic;
import com.adc.da.slrs.sarLawsTopic.service.SarLawsTopicService;
import com.adc.da.slrs.sarLawsTopic.dao.SarLawsTopicMapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Cleanup;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -37,11 +38,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -149,6 +150,7 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
@Transactional
@Override
public Boolean updateLawsTopicInfo(SarLawsTopic lawsTopic) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (StringUtils.isBlank(lawsTopic.getId())) {
return false;
}
@@ -214,10 +216,10 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
String sortField = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(page.getSortField()),"_").toUpperCase();
page.setSortField(sortField);
} else {
page.setSortField("ID");
page.setSortMode("asc");
page.setSortField("START_TIME");
page.setSortMode("desc");
}
int rowCount = this.baseMapper.queryByPageCount(page).size();
int rowCount = this.baseMapper.queryByPageCount(page);
page.getPager().setRowCount(rowCount);
List<SarLawsTopicVO> sarLawsTopicVOList = this.baseMapper.queryByPage(page);
for (SarLawsTopicVO lawsTopicVO : sarLawsTopicVOList) {
@@ -237,7 +239,7 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
}
@Override
public ResponseMessage<?> importLawsTopicInfo(MultipartFile file) {
public ResponseMessage<?> importLawsTopicInfo(MultipartFile file) throws Exception {
//获取文件全称
String fileNameStr = file.getOriginalFilename();
//获取最后.的位置
@@ -263,6 +265,7 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
try {
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + "/" + fileNameStr));
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件存储失败!");
}
//解压缩
@@ -271,47 +274,83 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
FileUnZip.delete(new File(path + "/" + fileNameStr));
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件解压失败");
}
//获取文件信息
List<File> fileList = readImpExcelFile(zipEntryName);
//判断获取到的文件数量
if (fileList.size() != 1) {
return Result.error("上传的文件只能有一个");
if (fileList.size() < 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("上传的文件不能为空");
}
File importFile = fileList.get(0);
if (!importFile.getName().contains(".xls") && !importFile.getName().contains(".xlsx")) {
return Result.error("文件必须是EXCEL文件");
File excelFile = null;
int excelCount = 0;
// 将文件转换为Map,文件名为建,文件为值
Map<String, File> fileMap = new HashMap<>();
for (File file1 : fileList) {
fileMap.put(file1.getName(), file1);
if (file1.getName().toLowerCase().contains(".xls") || file1.getName().toLowerCase().contains(".xlsx")) {
excelFile = file1;
excelCount ++;
}
}
if (excelCount > 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("导入了多个Excel文件");
}
if (excelCount < 1){
FileUnZip.deleteDir(saveDirectory);
return Result.error("文件必须包含一个EXCEL文件");
}
Workbook workbook = null;
try {
workbook = WorkbookFactory.create(importFile);
workbook = WorkbookFactory.create(excelFile);
} catch (IOException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("导入失败,需要导入的数据有问题或导入的企标标号和企标名称已存在");
return Result.error("导入失败,需要导入的数据有问题");
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Sheet sheet = workbook.getSheetAt(0);
if (sheet == null) {
return Result.error("工作表为空");
}
StringBuilder sb = new StringBuilder();
// 获取excel表头
List<String> headerList = new ArrayList<>();
Row headerRow = sheet.getRow(1);
for (int i = 0; i < 22; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
}
// 获取关联表表头
Row relationRow = sheet.getRow(2);
List<String> relationList = new ArrayList<>();
for (int i = 7; i < 22; i++) {
relationList.add(relationRow.getCell(i).getStringCellValue());
List<String> relationList = null;
try {
for (int i = 0; i < 8; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
}
for (int i = 13; i < 17; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
}
for (int i = 22; i < 27; i++) {
headerList.add(headerRow.getCell(i).getStringCellValue());
}
// 获取关联表表头
Row relationRow = sheet.getRow(2);
relationList = new ArrayList<>();
for (int i = 8; i < 13; i++) {
relationList.add(relationRow.getCell(i).getStringCellValue());
}
for (int i = 17; i < 22; i++) {
relationList.add(relationRow.getCell(i).getStringCellValue());
}
for (int i = 27; i < 32; i++) {
relationList.add(relationRow.getCell(i).getStringCellValue());
}
} catch (Exception e) {
return Result.error("表头读取失败,请严格按照模板文件导入数据");
}finally {
FileUnZip.deleteDir(saveDirectory);
}
// 判断表头字段是否相同
if (!String.join(",",headerList).equals(FieldConvertUtil.exportFieldLawsTopic)
&& !String.join(",",relationList).equals(FieldConvertUtil.exportFieldLawsTopicRelation)) {
|| !String.join(",",relationList).equals(FieldConvertUtil.exportFieldLawsTopicRelation)) {
try {
workbook.close();
} catch (IOException e) {
@@ -322,23 +361,159 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
return Result.error("fail", "读取失败,请严格按照模板文件导入数据");
}
// 获取总行数
int rowNum = sheet.getPhysicalNumberOfRows();
List<Map<String,String>> importDataList = new ArrayList<>();
for (int rowIndex = 3; rowIndex < rowNum; rowIndex++) {
// 获取每一行
Row row = sheet.getRow(rowIndex);
// 用于存储每行的键值对数据,对应一条数据
Map<String, String> rowMap = new LinkedHashMap<>();
// 总列数
int columnNum = 32;
// 遍历每个单元格
for (int columnIndex = 0; columnIndex < columnNum; columnIndex++) {
// 获取单元格
Cell cell = row.getCell(columnIndex);
// 获取表头单元格
Cell headerCell = headerRow.getCell(columnIndex);
if (cell != null) {
if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
Date d = cell.getDateCellValue();
try {
if (d.before(sdf.parse("1900-01-01")) || d.after(sdf.parse("2500-01-01"))) {
FileUnZip.deleteDir(saveDirectory);
return Result.error(""+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
}
} catch (ParseException e) {
FileUnZip.deleteDir(saveDirectory);
return Result.error(""+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入的日期异常,请按照实际日期填写");
}
// 将单元格数据存入Map中
rowMap.put(headerCell.getStringCellValue(), sdf.format(d));
} else {
cell.setCellType(CellType.STRING);
if (cell.getStringCellValue().length() > 500) {
FileUnZip.deleteDir(saveDirectory);
return Result.error(""+(rowIndex-1)+"行第"+(columnIndex + 1)+"个单元格输入过长");
}
rowMap.put(headerCell.getStringCellValue(), cell.getStringCellValue());
}
} else {
rowMap.put(headerCell.getStringCellValue(), "");
}
}
importDataList.add(rowMap);
}
if (importDataList.size() < 1) {
FileUnZip.deleteDir(saveDirectory);
return Result.error("您输入的数据为空");
}
ImportParams importParams = new ImportParams();
importParams.setTitleRows(1);
importParams.setHeadRows(2);
List<SarLawsTopicVO> lawsTopicVOList = ExcelImportUtil.importExcel(readImpExcelFile(zipEntryName).get(0), SarLawsTopicVO.class, importParams);
// 去除空数据
for (SarLawsTopicVO lawsTopicVO : lawsTopicVOList) {
if (StringUtils.isNotBlank(lawsTopicVO.getTopicName())) {
// 存入数据库
SarLawsTopic sarLawsTopic = new SarLawsTopic();
BeanUtils.copyProperties(lawsTopicVO,sarLawsTopic);
if (sarLawsTopic.getStartTime() != null && sarLawsTopic.getCloseTime() != null) {
sarLawsTopic.setTopicStatus("已结题");
} else {
sarLawsTopic.setTopicStatus("进行中");
// @Cleanup
InputStream inputStream = new FileInputStream(excelFile);
List<SarLawsTopicVO> lawsTopicVOList = ExcelImportUtil.importExcel(inputStream, SarLawsTopicVO.class, importParams);
workbook.close();
inputStream.close();
FileUnZip.delete(excelFile);
try{
// 去除空数据
int index = 1;
for (SarLawsTopicVO lawsTopicVO : lawsTopicVOList) {
if (StringUtils.isNotBlank(lawsTopicVO.getTopicName())) {
// 存入数据库
SarLawsTopic sarLawsTopic = new SarLawsTopic();
BeanUtils.copyProperties(lawsTopicVO,sarLawsTopic);
if (StringUtils.isBlank(sarLawsTopic.getOrganizer())) {
return Result.error("" + index + "条记录的课题承办单位不能为空");
}
if (sarLawsTopic.getStartTime() == null) {
return Result.error("" + index + "条记录的启动时间不能为空");
}
if (sarLawsTopic.getStartTime() != null && sarLawsTopic.getCloseTime() != null) {
sarLawsTopic.setTopicStatus("已结题");
} else {
sarLawsTopic.setTopicStatus("进行中");
}
String agreementFileAtt = null;
try {
agreementFileAtt = getFileAtt("协议",sarLawsTopic.getAgreement(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setAgreement(agreementFileAtt);
String researchPlanFileAtt = null;
try {
researchPlanFileAtt = getFileAtt("课题组研究方案",sarLawsTopic.getResearchPlan(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setResearchPlan(researchPlanFileAtt);
String researchFindingsFileAtt = null;
try {
researchFindingsFileAtt = getFileAtt("课题组研究成果",sarLawsTopic.getResearchFindings(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setResearchFindings(researchFindingsFileAtt);
String researchGroupOtherFileAtt = null;
try {
researchGroupOtherFileAtt = getFileAtt("课题组其他",sarLawsTopic.getResearchGroupOther(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setResearchGroupOther(researchGroupOtherFileAtt);
String conferenceMaterialsFileAtt = null;
try {
conferenceMaterialsFileAtt = getFileAtt("课题组会议资料",sarLawsTopic.getConferenceMaterials(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setConferenceMaterials(conferenceMaterialsFileAtt);
String insideProjectProposalRepostFileAtt = null;
try {
insideProjectProposalRepostFileAtt = getFileAtt("内部立项报告",sarLawsTopic.getInsideProjectProposalRepost(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setInsideProjectProposalRepost(insideProjectProposalRepostFileAtt);
String insideResearchPlanFileAtt = null;
try {
insideResearchPlanFileAtt = getFileAtt("内部研究方案",sarLawsTopic.getInsideResearchPlan(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setInsideResearchPlan(insideResearchPlanFileAtt);
String insideConferenceMaterialsFileAtt = null;
try {
insideConferenceMaterialsFileAtt = getFileAtt("内部会议资料",sarLawsTopic.getInsideConferenceMaterials(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setInsideConferenceMaterials(insideConferenceMaterialsFileAtt);
String insideResearchFindingsFileAtt = null;
try {
insideResearchFindingsFileAtt = getFileAtt("内部研究成果",sarLawsTopic.getInsideResearchFindings(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setInsideResearchFindings(insideResearchFindingsFileAtt);
String insideOtherFileAtt = null;
try {
insideOtherFileAtt = getFileAtt("内部其他",sarLawsTopic.getInsideOther(), fileMap, index);
} catch (Exception e) {
return Result.error(e.getMessage());
}
sarLawsTopic.setInsideOther(insideOtherFileAtt);
addLawsTopicInfo(sarLawsTopic);
}
addLawsTopicInfo(sarLawsTopic);
index++;
}
}finally {
FileUnZip.deleteDir(saveDirectory);
}
return Result.success("导入成功");
}
@@ -356,7 +531,9 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
List<AttFileEO> fileList = new ArrayList<>();
for (String attId : fileAttId.split(",")) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileList.add(fileInfo);
if (fileInfo != null) {
fileList.add(fileInfo);
}
}
String setMethod = "set" + StringUtils.capitalize(field) + "List";
method = SarLawsTopic.class.getMethod(setMethod, List.class);
@@ -380,7 +557,9 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
List<AttFileEO> fileList = new ArrayList<>();
for (String attId : fileAttId.split(",")) {
AttFileEO fileInfo = attFileEOService.getFileInfo(attId);
fileList.add(fileInfo);
if (fileInfo != null) {
fileList.add(fileInfo);
}
}
String setMethod = "set" + StringUtils.capitalize(field) + "List";
method = SarLawsTopicVO.class.getMethod(setMethod, List.class);
@@ -399,23 +578,27 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
* @return 差异
*/
public List<String> compareLawsTopic(SarLawsTopic oldLawsTopic, SarLawsTopic newLawsTopic) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<String> changes = new ArrayList<>();
// 不需要比较的字段
String[] ignoreFields = {"id","validFlag","createTime","modifyTime","agreementList","researchPlanList",
"researchFindingsList","researchGroupOtherList","conferenceMaterialsList","insideProjectProposalRepostList",
"insideResearchPlanList","insideConferenceMaterialsList","insideResearchFindingsList","insideOtherList","serialVersionUID"};
// 文件字段
String[] fileAttIdFields = {"agreement","researchPlan","researchFindings","researchGroupOther","conferenceMaterials",
"insideProjectProposalRepost","insideResearchPlan","insideConferenceMaterials","insideResearchFindings","insideOther"};
List<String> ignoreFieldList = Arrays.asList(ignoreFields);
List<String> fileAttIdFieldList = Arrays.asList(fileAttIdFields);
// 获取SarLawsTopic类的所有字段
Field[] fields = SarLawsTopic.class.getDeclaredFields();
for (Field field : fields) {
if (!ignoreFieldList.contains(field.getName())) {
boolean annotationPresent = field.isAnnotationPresent(CompareField.class);
if (annotationPresent) {
try {
field.setAccessible(true);
Object oldValue = field.get(oldLawsTopic);
Object newValue = field.get(newLawsTopic);
if (oldValue instanceof Date){
oldValue = sdf.format((Date)oldValue);
}
if( newValue instanceof Date) {
newValue = sdf.format((Date)newValue);
}
if (!Objects.equals(oldValue, newValue)) {
// 对比文件字段
if (fileAttIdFieldList.contains(field.getName())) {
@@ -442,31 +625,34 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
}
}
// 获取字段名称
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + String.join(",",oldFileNameList) + "\"改为\"" + String.join(",",fileNameList) + "\"");
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
if (StringUtils.isBlank(String.join(",",oldFileNameList))) {
oldValue = "";
}else {
oldValue = String.join(",",oldFileNameList);
}
if (StringUtils.isBlank(String.join(",",fileNameList))) {
newValue = "";
}else {
newValue = String.join(",",fileNameList);
}
changes.add(annotationsByType.fieldName() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
// 对比列表字段
} else if ("meetingList".equals(field.getName()) || "topicContactInformationList".equals(field.getName())
|| "insideContactInformationList".equals(field.getName())) {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "被变更");
} else if ("startTime".equals(field.getName()) || "closeTime".equals(field.getName())) {
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String oldDateStr = null;
String newDateStr = null;
if (newValue != null) {
Date oldDate = (Date) newValue;
oldDateStr = sdf.format(oldDate);
} else if ("meetingList".equals(field.getName())|| "topicContactInformationList".equals(field.getName()) || "insideContactInformationList".equals(field.getName())) {
String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1);
Method method = SarLawsTopic.class.getMethod("get" + fieldName);
Object oldInvoke = method.invoke(oldLawsTopic);
Object newInvoke = method.invoke(newLawsTopic);
List<?> oldList = (List<?>) oldInvoke;
List<?> newList = (List<?>) newInvoke;
if (!isListEqual(oldList, newList)) {
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "被变更");
}
if (oldValue!= null) {
Date newDate = (Date) oldValue;
newDateStr = sdf.format(newDate);
}
changes.add(annotationsByType.value() + "\"" + oldDateStr + "\"改为\"" + newDateStr + "\"");
}else {
} else {
// 对比其他字段
ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0];
changes.add(annotationsByType.value() + "\"" + oldValue + "\"改为\"" + newValue + "\"");
CompareField annotationsByType = field.getAnnotationsByType(CompareField.class)[0];
changes.add(annotationsByType.fieldName() + "\"" + Optional.ofNullable(oldValue).orElse("") + "\"改为\"" + Optional.ofNullable(newValue).orElse("") + "\"");
}
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
@@ -494,6 +680,75 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
}
return resultlist;
}
public String getFileAtt(String fieldName,String fileNameStr, Map<String, File> fileMap, int count) throws Exception {
if (fileNameStr != null) {
List<String> fileAttList = new ArrayList<>();
for (String fileName : fileNameStr.split(",")) {
int lastIndexOf = fileName.lastIndexOf(".");
if (fileName.lastIndexOf(".") != -1) {
String lastName = fileName.substring(lastIndexOf + 1).toLowerCase();
if (lastName.equals("pdf") || lastName.equals("ppt") || lastName.equals("pptx") || lastName.equals("doc") || lastName.equals("docx")) {
File file1 = fileMap.get(fileName);
if (file1 == null) {
throw new Exception(fieldName + "中第" + (count+1) +"" + fileName + "文件不存在,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
AttFileVo attFileVo = attFileEOService.saveFileInfo(file1);
if (StringUtils.isNotBlank(attFileVo.getId())) {
fileAttList.add(attFileVo.getAttId());
}
} else {
throw new Exception(fieldName + "中第" + (count+1) +"" + fileName + "文件格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
} else {
throw new Exception(fieldName + "中第" + (count+1) +"" + fileName + "文件格式不正确,请上传pdf/ppt/pptx/doc/docx格式的附件");
}
}
return String.join(",", fileAttList);
}
return null;
}
public boolean isListEqual(List l0, List l1){
if (l0 == l1)
return true;
if (l0 == null && l1 == null)
return true;
if (l0 == null || l1 == null)
return false;
if (l1.size() > 0) {
Iterator iterator = l1.iterator();
while(iterator.hasNext()) {
Object iterato = iterator.next();
if (iterato instanceof SarLawsTopicMeeting) {
SarLawsTopicMeeting oldMeeting = (SarLawsTopicMeeting) iterato;
SarLawsTopicMeeting meeting = SarLawsTopicMeeting.emptyValueProcess(oldMeeting);
if (meeting == null) {
iterator.remove();
}
}
if (iterato instanceof SarLawsContactInformation) {
SarLawsContactInformation oldContactInformation = (SarLawsContactInformation) iterato;
SarLawsContactInformation information = SarLawsContactInformation.emptyValueProcess(oldContactInformation);
if (information == null) {
iterator.remove();
}
}
}
}
if (l0.size() != l1.size())
return false;
for (Object o : l0) {
if (!l1.contains(o))
return false;
}
for (Object o : l1) {
if (!l0.contains(o))
return false;
}
return true;
}
}
@@ -1,34 +1,38 @@
package com.adc.da.slrs.sarMenuStandard.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.adc.da.util.LoginUserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-07-07
*/
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-07-07
*/
@RestController
@Api(tags = "福田标准法规--标准法规库-菜单标准体系")
@RequestMapping("/${restPath}/lawss/sarMenuStandardLimit")
@Slf4j
public class SarMenuStandardNewController extends BaseController<SarMenuStandardNew> {
@Autowired
@@ -39,16 +43,16 @@ public class SarMenuStandardNewController extends BaseController<SarMenuStandard
@ApiOperation("查询当前节点所有关联上级")
@GetMapping("/getTopMenu")
public ResponseMessage<String> getTopMenu(SarMenuStandardNew sarMenuStandardNew){
String tsResources= iSarMenuStandardNewService.getTopMenu(sarMenuStandardNew);
public ResponseMessage<String> getTopMenu(SarMenuStandardNew sarMenuStandardNew) {
String tsResources = iSarMenuStandardNewService.getTopMenu(sarMenuStandardNew);
return Result.success(tsResources);
}
@ApiOperation("查询有权限资源")
@GetMapping("/getListStandLimit")
public ResponseMessage<List<SarMenuStandard>> getListStandLimit(SarMenuStandardNew sarMenuStandardNew){
public ResponseMessage<List<SarMenuStandard>> getListStandLimit(SarMenuStandardNew sarMenuStandardNew) {
List<String> access = tsUserService.getResourceUserId(LoginUserUtil.getUserId());
List<SarMenuStandard> tsResources= iSarMenuStandardNewService.getListStandLimit(sarMenuStandardNew,access);
List<SarMenuStandard> tsResources = iSarMenuStandardNewService.getListStandLimit(sarMenuStandardNew, access);
return Result.success(tsResources);
}
@@ -64,7 +68,7 @@ public class SarMenuStandardNewController extends BaseController<SarMenuStandard
@ApiOperation("根据菜单ID查询菜单")
@GetMapping("/getMenuStandardById")
public ResponseMessage<SarMenuStandard> getMenuStandardById(@RequestParam String menuId){
public ResponseMessage<SarMenuStandard> getMenuStandardById(@RequestParam String menuId) {
if (StringUtils.isBlank(menuId)) {
return Result.error("获取失败,菜单ID为空");
}
@@ -86,6 +90,27 @@ public class SarMenuStandardNewController extends BaseController<SarMenuStandard
if (StringUtils.isBlank(menuId)) {
return Result.error("删除失败,菜单ID为空");
}
return Result.success(iSarMenuStandardNewService.deleteMenuStandard(menuId));
iSarMenuStandardNewService.deleteMenuStandard(menuId);
return Result.success();
}
@ApiOperation("体系搜索三层树")
@GetMapping("/standardSystemTree")
public ResponseMessage<?> standardSystemTree() {
return Result.success(iSarMenuStandardNewService.standardSystemTree());
}
@ApiOperation("法规弹窗列表")
@PostMapping("/standardSystemList")
public ResponseMessage<?> standardSystemList(@RequestBody StandSystemDTO standSystemDTO) {
return Result.success(iSarMenuStandardNewService.standardSystemList(standSystemDTO));
}
@ApiOperation("法规列表弹窗Excel导出")
@GetMapping("/standardSystemListExport")
public ResponseMessage<?> standardSystemListExport(StandSystemDTO standSystemDTO,
HttpServletResponse response, HttpServletRequest request) {
iSarMenuStandardNewService.standardSystemListExport(standSystemDTO, response, request);
return Result.success();
}
}
@@ -7,6 +7,7 @@ import com.adc.da.sys.utils.treetool.annotation.TreeNodeParentId;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -30,6 +31,7 @@ import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarMenuStandard对象", description="")
@TableName("sar_menu_standard")
public class SarMenuStandardNew extends BaseEntity {
public interface update{
}
@@ -0,0 +1,85 @@
package com.adc.da.slrs.sarMenuStandard.entity;
import com.adc.da.exception.AdcDaBaseException;
/**
* @author: Mzaxd
* @Date: 2023/11/15 17:36
*/
public enum StandCategoryEnum {
// INLAND 类型的枚举实例
INLAND_GB("INLAND", "GB", 0),
INLAND_GBT("INLAND", "GB/T", 1),
INLAND_QCT("INLAND", "QC/T", 2),
INLAND_JT("INLAND", "JT", 3),
INLAND_JB("INLAND", "JB", 4),
INLAND_GA("INLAND", "GA", 5),
INLAND_GJB("INLAND", "GJB", 6),
INLAND_HJ("INLAND", "HJ", 7),
// FOREIGN 类型的枚举实例
FOREIGN_ECE("FOREIGN", "ECE", 0),
FOREIGN_EU("FOREIGN", "EU", 1),
FOREIGN_EC("FOREIGN", "EC", 2),
FOREIGN_EEC("FOREIGN", "EEC", 3),
FOREIGN_ISO("FOREIGN", "ISO", 4),
FOREIGN_IEC("FOREIGN", "IEC", 5),
FOREIGN_GTR("FOREIGN", "GTR", 6),
FOREIGN_CFR("FOREIGN", "CFR", 7),
FOREIGN_JASO("FOREIGN", "JASO", 8),
FOREIGN_JIS("FOREIGN", "JIS", 9),
FOREIGN_GSO("FOREIGN", "GSO", 10),
FOREIGN_GOST("FOREIGN", "GOST", 11),
FOREIGN_ΓOCT("FOREIGN", "ΓOCT", 12),
FOREIGN_TP("FOREIGN", "TP", 13),
FOREIGN_SASO("FOREIGN", "SASO", 14),
FOREIGN_UAE("FOREIGN", "UAE", 15),
FOREIGN_CONTRAN("FOREIGN", "CONTRAN", 16),
FOREIGN_DENATRAN("FOREIGN", "DENATRAN", 17),
FOREIGN_ABNT_NBR("FOREIGN", "ABNT NBR", 18),
FOREIGN_NBR("FOREIGN", "NBR", 19),
FOREIGN_INMETRO("FOREIGN", "INMETRO", 20),
FOREIGN_CONAMA("FOREIGN", "CONAMA", 21),
FOREIGN_Normative_Instruction("FOREIGN", "Normative Instruction", 22),
FOREIGN_ADR("FOREIGN", "ADR", 23),
;
private final String standType;
private final String standSort;
private final int sortValue;
StandCategoryEnum(String standType, String standSort, int sortValue) {
this.standType = standType;
this.standSort = standSort;
this.sortValue = sortValue;
}
// 根据 standSort 返回 value 的静态方法
public static int getSortByStandType(String standType, String standSort) {
for (StandCategoryEnum category : StandCategoryEnum.values()) {
if (category.getStandType().equals(standType) && category.getStandSort().equals(standSort)) {
return category.getSortValue();
}
// 给国标 外标默认值
if (category.getStandType().equals("INLAND")) {
return 8;
} else if (category.getStandType().equals("FOREIGN")) {
return 24;
}
}
throw new AdcDaBaseException("标准类型错误");
}
// Getter 方法
public String getStandType() {
return standType;
}
public String getStandSort() {
return standSort;
}
public int getSortValue() {
return sortValue;
}
}
@@ -0,0 +1,202 @@
package com.adc.da.slrs.sarMenuStandard.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author: Mzaxd
* @Date: 2023/11/14 17:20
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class StandSystemDTO {
@ApiModelProperty(value = "节点Id")
private String menuId;
@Excel(name = "体系结构", width = 40, orderNum = "1")
@ApiModelProperty(value = "体系结构")
private String standSystem;
@ApiModelProperty(value = "体系结构ID(树状结构选取)")
private String standSystemId;
@ApiModelProperty(value = "体系结构IDList(树状结构选取)")
private List<String> standSystemIdList;
@ApiModelProperty(value = "标准Id")
private String standId;
@Excel(name = "标准编号", width = 25, orderNum = "2")
@ApiModelProperty(value = "标准编号")
private String standNo;
@Excel(name = "标准名称", width = 25, orderNum = "3")
@ApiModelProperty(value = "标准名称")
private String standName;
@ApiModelProperty(value = "标准状态")
private String standState;
@ApiModelProperty(value = "文本状态")
private String textStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "开始发布日期")
private Date startReleaseDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "开始发布日期字符串")
private String startReleaseDateString;
@Excel(name = "发布日期", width = 25, orderNum = "4", exportFormat = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "发布日期")
private Date releaseDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "结束发布日期")
private Date endReleaseDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "结束发布日期字符串")
private String endReleaseDateString;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "开始实施日期")
private Date startImplementDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "开始实施日期")
private String startImplementDateString;
@Excel(name = "实施日期", width = 25, orderNum = "5")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "实施日期")
private String implementDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "结束实施日期")
private Date endImplementDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "结束实施日期")
private String endImplementDateString;
@Excel(name = "代替标准", width = 25, orderNum = "5")
@ApiModelProperty(value = "代替标准")
private String replaceStandardNo;
@Excel(name = "编制单位", width = 25, orderNum = "5")
@ApiModelProperty(value = "编制单位")
private String dept;
@Excel(name = "起草人", width = 25, orderNum = "5")
@ApiModelProperty(value = "起草人")
private String draftUserName;
@Excel(name = "数据来源", width = 25, orderNum = "5")
@ApiModelProperty(value = "数据来源")
private String dataSource;
@ApiModelProperty(value = "排序字段")
private String sortField;
@ApiModelProperty(value = "排序规则")
private String sortMode;
@ApiModelProperty(value = "标准类型(数据排序用)")
private String standSort;
private String selectIds;
private List<String> selectIdList;
@ApiModelProperty(value = "页码")
private int page;
@ApiModelProperty(value = "每页数量")
private int pageSize;
@ApiModelProperty(value = "体系排序顺序号")
private int systemSort;
@ApiModelProperty(value = "国标外表企标排序号")
private int standTypeSort;
@ApiModelProperty(value = "标准类别排序号")
private int standCategorySort;
@ApiModelProperty(value = "相关联的节点ID列表(数据库查询用)")
private List<String> menuIdList;
@ApiModelProperty(value = "导出文件名称")
private String exportName;
public void setSelectIds(String selectIds) {
this.selectIds = selectIds;
this.selectIdList = java.util.Arrays.asList(selectIds.split(","));
}
public void setStartReleaseDate(Date startReleaseDate) {
this.startReleaseDate = startReleaseDate;
if (startReleaseDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.startReleaseDateString = sdf.format(startReleaseDate);
}
}
public void setEndReleaseDate(Date endReleaseDate) {
this.endReleaseDate = endReleaseDate;
if (endReleaseDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.endReleaseDateString = sdf.format(endReleaseDate);
}
}
public void setStartImplementDate(Date startImplementDate) {
this.startImplementDate = startImplementDate;
if (startImplementDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.startImplementDateString = sdf.format(startImplementDate);
}
}
public void setEndImplementDate(Date endImplementDate) {
this.endImplementDate = endImplementDate;
if (endImplementDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
this.endImplementDateString = sdf.format(endImplementDate);
}
}
public void setStandSystemId(String standSystemId) {
this.standSystemId = standSystemId;
if (StrUtil.isNotBlank(standSystemId)) {
this.standSystemIdList = java.util.Arrays.asList(standSystemId.split(","));
}
}
}
@@ -1,9 +1,13 @@
package com.adc.da.slrs.sarMenuStandard.service;
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -26,7 +30,13 @@ public interface ISarMenuStandardNewService extends IService<SarMenuStandardNew>
Integer updateMenuStandard(SarMenuStandardNew sarMenuStandardNew);
Integer deleteMenuStandard(String menuId);
void deleteMenuStandard(String menuId);
SarMenuStandard getMenuStandardById(String menuId);
List<SarMenuStandard> standardSystemTree();
IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO);
void standardSystemListExport(StandSystemDTO standSystemDTO, HttpServletResponse response, HttpServletRequest request);
}
@@ -1,33 +1,70 @@
package com.adc.da.slrs.sarMenuStandard.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.core.util.StrUtil;
import com.adc.da.common.ReadExcel;
import com.adc.da.exception.AdcDaBaseException;
import com.adc.da.scheduled.dao.SarStandardInfoDao;
import com.adc.da.slrs.sarBussStandMenu.dao.SarBussStandMenuDao;
import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu;
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicVO;
import com.adc.da.slrs.sarMenuStandard.dao.SarMenuStandardNewDao;
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
import com.adc.da.slrs.sarMenuStandard.entity.StandCategoryEnum;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
import com.adc.da.slrs.sarRole.dao.TsRoleDao;
import com.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.slrs.sarStandMenu.service.ISarStandMenuService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.tsDictionaryType.entity.TsDicType;
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
import com.adc.da.slrs.tsRoleMeunData.dao.TsRoleMenuDataDao;
import com.adc.da.slrs.tsRoleMeunData.service.ITsRoleMenuDataService;
import com.adc.da.sys.sarMenuStandard.dao.SarMenuStandardDao;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.adc.da.sys.sarMenuStandard.entity.StandMenuRelation;
import com.adc.da.sys.util.BeanCopyUtils;
import com.adc.da.util.LoginUserUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-07-07
*/
@Slf4j
@Service
public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandardNewDao, SarMenuStandardNew> implements ISarMenuStandardNewService {
@@ -37,30 +74,48 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
private TsRoleDao tsRoleDao;
@Resource
private TsResourceDao resourceDao;
@Resource
private ISarStandMenuService sarStandMenuService;
@Resource
private ISarBussStandMenuService sarBussStandMenuService;
@Resource
private SarStandMenuDao sarStandMenuDao;
@Resource
private SarStandardInfoDao sarStandardInfoDao;
@Resource
private SarBussionessStandDao sarBussionessStandDao;
@Resource
private ITsDicTypeService dicItemService;
@Resource
private SarBussStandMenuDao sarBussStandMenuDao;
@Resource
private TsRoleMenuDataDao roleMenuDataDao;
@Override
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew){
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew) {
QueryWrapper qw = new QueryWrapper();
if(StringUtils.isNotBlank(sarMenuStandardNew.getId())){
qw.eq("ID",sarMenuStandardNew.getId());
if (StringUtils.isNotBlank(sarMenuStandardNew.getId())) {
qw.eq("ID", sarMenuStandardNew.getId());
}
if(StringUtils.isNotBlank(sarMenuStandardNew.getMenuName())){
qw.eq("MENU_NAME",sarMenuStandardNew.getMenuName());
if (StringUtils.isNotBlank(sarMenuStandardNew.getMenuName())) {
qw.eq("MENU_NAME", sarMenuStandardNew.getMenuName());
}
List<SarMenuStandard> list = dao.selectList(qw);
if(!list.isEmpty()){
if(StringUtils.isNotBlank(list.get(0).getParentIds())){
if (!list.isEmpty()) {
if (StringUtils.isNotBlank(list.get(0).getParentIds())) {
List<String> topIdList = Arrays.stream(list.get(0).getParentIds().split(",")).map(String::trim).collect(Collectors.toList());
QueryWrapper wrapper = new QueryWrapper();
wrapper.in("ID",topIdList);
List<SarMenuStandard> topList = dao.selectTopList(wrapper,list.get(0).getParentIds());
wrapper.in("ID", topIdList);
List<SarMenuStandard> topList = dao.selectTopList(wrapper, list.get(0).getParentIds());
List<String> filterList = topList.stream().map(SarMenuStandard::getMenuName).collect(Collectors.toList());
if(!filterList.isEmpty()){
return StringUtils.join(filterList, "/")+'/'+list.get(0).getMenuName();
if (!filterList.isEmpty()) {
return StringUtils.join(filterList, "/") + '/' + list.get(0).getMenuName();
}
}else {
} else {
return list.get(0).getMenuName();
}
@@ -73,7 +128,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
@Override
public void addMenuStandard(SarMenuStandardNew sarMenuStandardNew) {
SarMenuStandard sarMenuStandard = new SarMenuStandard();
BeanUtils.copyProperties(sarMenuStandardNew,sarMenuStandard);
BeanUtils.copyProperties(sarMenuStandardNew, sarMenuStandard);
String parentId = sarMenuStandardNew.getParentId();
if (StringUtils.isNotBlank(parentId)) {
SarMenuStandard sarMenuStandard1 = dao.selectById(parentId);
@@ -91,20 +146,23 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
List<String> roleIdList = tsRoleDao.getRoleByUserId(LoginUserUtil.getUserId());
for (String roleId : roleIdList) {
HashMap<String, Object> map = new HashMap<>();
map.put("resourceId",sarMenuStandard.getId());
map.put("roleId",roleId);
map.put("resourceId", sarMenuStandard.getId());
map.put("roleId", roleId);
map.put("menuId", sarMenuStandard.getId());
resourceDao.insertTsRoleResource(map);
// 添加权限
roleMenuDataDao.insertResourceMenuData(map);
}
}
@Override
public SarMenuStandard getMenuStandardById(String menuId) {
SarMenuStandard sarMenuStandard = dao.selectById(menuId);
if(sarMenuStandard != null && StringUtils.isNotBlank(sarMenuStandard.getParentIds())){
if (sarMenuStandard != null && StringUtils.isNotBlank(sarMenuStandard.getParentIds())) {
LambdaQueryWrapper<SarMenuStandard> wrapper = new LambdaQueryWrapper<>();
wrapper.in(SarMenuStandard::getId,Arrays.asList(sarMenuStandard.getParentIds().split(",")));
wrapper.in(SarMenuStandard::getId, Arrays.asList(sarMenuStandard.getParentIds().split(",")));
List<SarMenuStandard> menuStandards = dao.selectList(wrapper);
if(!menuStandards.isEmpty()){
if (!menuStandards.isEmpty()) {
String parentIdsName = menuStandards.stream().map(SarMenuStandard::getMenuName).collect(Collectors.joining(","));
sarMenuStandard.setParentIdsName(parentIdsName);
}
@@ -112,6 +170,240 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
return sarMenuStandard;
}
@Override
public List<SarMenuStandard> standardSystemTree() {
// 构造树
List<SarMenuStandard> TsResources;
QueryWrapper<SarMenuStandard> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("DIC_ID", "9m4qqqaansxmox5e82zm");
queryWrapper.eq("VALID_FLAG", 0);
queryWrapper.isNull("PARENT_ID");
queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources = dao.selectList(queryWrapper);
for (SarMenuStandard resource : TsResources) {
resource.setTreeType("sarMs");
QueryWrapper<SarMenuStandard> TsResourceQueryWrapper = new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS", resource.getId());
TsResourceQueryWrapper.eq("VALID_FLAG", 0);
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<SarMenuStandard> children = dao.selectList(TsResourceQueryWrapper);
resource.setChildren(recursionGetListChildrenStand((resource), (children)));
}
// 把所有关联表中的数据拉出来
// 国标
List<SarStandMenu> gbStandMenu = sarStandMenuDao.getGBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());
List<StandMenuRelation> gbRelations = BeanCopyUtils.copyBeanList(gbStandMenu, StandMenuRelation.class);
// 外标
List<SarStandMenu> fbStandMenu = sarStandMenuDao.getFBStandMenu().stream().filter(item -> item.getStandId() != null).collect(Collectors.toList());
;
List<StandMenuRelation> fbRelations = BeanCopyUtils.copyBeanList(fbStandMenu, StandMenuRelation.class);
// 企标
List<SarBussStandMenu> esStandMenu = sarBussStandMenuDao.getESStandMenu().stream().filter(item -> item.getBussStandId() != null).collect(Collectors.toList());
List<StandMenuRelation> esRelations = new ArrayList<>();
for (SarBussStandMenu s : esStandMenu) {
StandMenuRelation standMenuRelation = new StandMenuRelation(s.getBussStandId(), s.getMenuId());
esRelations.add(standMenuRelation);
}
// 计算每个节点的数值
if (!TsResources.isEmpty()) {
TsResources.get(0).calculateAndSetCounts(gbRelations, fbRelations, esRelations, 0);
}
// 拼接返回
return TsResources;
}
@Override
public IPage<StandSystemDTO> standardSystemList(StandSystemDTO standSystemDTO) {
boolean timeSort = StrUtil.isNotBlank(standSystemDTO.getSortField());
boolean select = standSystemDTO.getSelectIdList() != null;
String menuId = standSystemDTO.getMenuId();
// 校验menuId不能为空
if (StringUtils.isBlank(menuId)) {
throw new AdcDaBaseException("menuId不能为空");
}
// 体系树
SarMenuStandard sarMenuStandard = this.standardSystemTree().get(0);
// 找到menuId对应的节点
SarMenuStandard targetNode = SarMenuStandard.findNodeById(sarMenuStandard, menuId);
// 收集目标节点及其所有子节点的ID
List<String> childIds = new ArrayList<>();
targetNode.collectChildIds(childIds);
standSystemDTO.setMenuIdList(childIds);
// 找到standSystemId对应的节点
String standSystemId = standSystemDTO.getStandSystemId();
if (StrUtil.isNotBlank(standSystemId)) {
SarMenuStandard findNode = SarMenuStandard.findNodeById(sarMenuStandard, standSystemDTO.getStandSystemId());
// 收集目标节点及其所有子节点的ID
List<String> standSystemChildIds = new ArrayList<>();
findNode.collectChildIds(standSystemChildIds);
standSystemDTO.setStandSystemIdList(standSystemChildIds);
}
if (!select) {
standSystemDTO.setSelectIdList(targetNode.getGbStandIdList());
}
// 查国标
Set<StandSystemDTO> gbList = new HashSet<>(sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "INLAND"));
if (!select) {
standSystemDTO.setSelectIdList(targetNode.getFbStandIdList());
}
// 查外标
Set<StandSystemDTO> fbList = new HashSet<>(sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "FOREIGN"));
if (!select) {
standSystemDTO.setSelectIdList(targetNode.getEsStandIdList());
}
// 查企标
Set<StandSystemDTO> esList = new HashSet<>(sarBussionessStandDao.getESSystemData(standSystemDTO));
// 数据转换后整合
List<StandSystemDTO> resultList = new ArrayList<>();
resultList.addAll(gbList);
resultList.addAll(fbList);
resultList.addAll(esList);
// 默认排序
// 构造体系路径映射
Map<String, String> pathMap = new HashMap<>();
sarMenuStandard.buildPathMap(pathMap, "");
// 为树设置systemSort
// SarMenuStandard.setSystemSort(sarMenuStandard, "");
AtomicInteger currentNumber = new AtomicInteger(1);
SarMenuStandard.setSystemSortDFS(sarMenuStandard, currentNumber);
// 国标外标标准状态字典
// List<TsDicType> gbStateDictList = dicItemService.selectAllDicTypeNameByDicCode("STANDSTATE");
// 国标外标标准文本状态
List<TsDicType> gbTextStateDictList = dicItemService.selectAllDicTypeNameByDicCode("WBZTCLASS");
// 企标标准状态字典
List<TsDicType> esStateDictList = dicItemService.selectAllDicTypeNameByDicCode("TEXTSTATUSBUSS");
// 构造体系路径 && 设置标准内部类别排序号 && 翻译
for (StandSystemDTO dto : resultList) {
String fullPath = pathMap.get(dto.getMenuId());
dto.setStandSystem(fullPath);
dto.setStandCategorySort(StandCategoryEnum.getSortByStandType(dto.getDataSource(), dto.getStandSort()));
// 设置体系排序号
SarMenuStandard node = SarMenuStandard.findNodeById(targetNode, dto.getMenuId());
dto.setSystemSort(node.getSystemSort());
// 翻译
// this.translateStandardSystemDTO(dto, gbStateDictList, esStateDictList);
this.translateStandardSystemDTO(dto, gbTextStateDictList, esStateDictList);
}
// 两个时间排序
if (timeSort) {
// 时间排序
String sortField = standSystemDTO.getSortField();
String sortMode = standSystemDTO.getSortMode();
Comparator<StandSystemDTO> comparatorReleaseDate = Comparator.comparing(StandSystemDTO::getReleaseDate
, Comparator.nullsLast(Comparator.naturalOrder()));
if (sortField.equals("releaseDate")) {
if (sortMode.equals("desc")) {
resultList.sort(comparatorReleaseDate.reversed());
} else {
resultList.sort(comparatorReleaseDate);
}
}
Comparator<StandSystemDTO> comparatorImplementDate = Comparator.comparing(StandSystemDTO::getImplementDate
, Comparator.nullsLast(Comparator.naturalOrder()));
if (sortField.equals("implementDate")) {
if (sortMode.equals("desc")) {
resultList.sort(comparatorImplementDate.reversed());
} else {
resultList.sort(comparatorImplementDate);
}
}
} else {
// 根据排序字段对 resultList 进行排序
// 按照标准体系排序
// 体系内部按照国内/海外/企业排序
// 每个类别的标准内部按照类别排序
resultList.sort(Comparator.comparingInt(StandSystemDTO::getSystemSort)
.thenComparingInt(StandSystemDTO::getStandTypeSort)
.thenComparingInt(StandSystemDTO::getStandCategorySort));
}
// 手动分页
int pageNum = standSystemDTO.getPage();
int pageSize = standSystemDTO.getPageSize();
// 计算总页数
int total = resultList.size();
int totalPages = (total + pageSize - 1) / pageSize;
// 计算当前页应该显示的数据的起始和结束索引
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, total);
// 获取当前页面的数据
List<StandSystemDTO> pageList = resultList.subList(start, end);
// 使用MyBatis Plus的Page类来构造分页对象
Page<StandSystemDTO> page = new Page<>(pageNum, pageSize, total);
page.setRecords(pageList); // 设置当前页面的记录
page.setTotal(total); // 设置总记录数
page.setPages(totalPages); // 设置总页数
return page;
}
private void translateStandardSystemDTO(StandSystemDTO dto, List<TsDicType> gbTextStateDictList, List<TsDicType> esStateDictList) {
// 翻译数据来源、标准状态
switch (dto.getDataSource()) {
case "INLAND":
dto.setDataSource("国内标准库");
dto.setStandState(gbTextStateDictList.stream()
.filter(dict -> dict.getDicTypeCode().equals(dto.getTextStatus()))
.findFirst().orElse(new TsDicType()).getDicTypeName());
break;
case "FOREIGN":
dto.setDataSource("海外标准库");
dto.setStandState(gbTextStateDictList.stream()
.filter(dict -> dict.getDicTypeCode().equals(dto.getTextStatus()))
.findFirst().orElse(new TsDicType()).getDicTypeName());
break;
case "ENTERPRISE":
dto.setDataSource("企业标准库");
dto.setStandState(esStateDictList.stream()
.filter(dict -> dict.getDicTypeCode().equals(dto.getStandState()))
.findFirst().orElse(new TsDicType()).getDicTypeName());
break;
}
}
@Override
public void standardSystemListExport(StandSystemDTO standSystemDTO, HttpServletResponse response, HttpServletRequest request) {
OutputStream os = null;
Workbook workbook;
List<StandSystemDTO> dataList;
standSystemDTO.setPage(1);
standSystemDTO.setPageSize(Integer.MAX_VALUE);
try {
response.setHeader("Content-Disposition",
"attachment; filename=" + ReadExcel.encodeFileName(standSystemDTO.getExportName() + ".xlsx",
request));
// 导出数据,若指定了值则使用ids字段条件导出,否则根据条件导出
IPage<StandSystemDTO> page = this.standardSystemList(standSystemDTO);
dataList = page.getRecords();
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setSheetName(standSystemDTO.getExportName());
workbook = ExcelExportUtil.exportExcel(exportParams, StandSystemDTO.class, dataList);
os = response.getOutputStream();
workbook.write(os);
os.flush();
} catch (IOException e) {
log.error(e.getMessage(), e);
throw new AdcDaBaseException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(os);
}
}
@Override
public Integer updateMenuStandard(SarMenuStandardNew sarMenuStandardNew) {
SarMenuStandard menuStandarddb = dao.selectById(sarMenuStandardNew.getId());
@@ -122,49 +414,68 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
return dao.updateById(menuStandarddb);
}
@Transactional(rollbackFor = Exception.class)
@Override
public Integer deleteMenuStandard(String menuId) {
SarMenuStandard menuStandard = new SarMenuStandard();
menuStandard.setId(menuId);
menuStandard.setValidFlag(1);
return dao.updateById(menuStandard);
public void deleteMenuStandard(String menuId) {
// 先找到节点的名字
String menuName = getById(menuId).getMenuName();
// 删除主表中的节点
LambdaUpdateWrapper<SarMenuStandard> menuUpdateWrapper = new LambdaUpdateWrapper<>();
menuUpdateWrapper.eq(SarMenuStandard::getId, menuId);
this.dao.delete(menuUpdateWrapper);
log.info("删除主表中的节点成功");
// 删除国标外标体系关联关系
LambdaUpdateWrapper<SarStandMenu> gbWrapper = new LambdaUpdateWrapper<>();
gbWrapper.eq(SarStandMenu::getMenuId, menuId);
sarStandMenuService.remove(gbWrapper);
log.info("删除国标外标主表中的相应字段成功");
// 删除企标体系关联关系
// 企标的不用删 删了标准法规库里面就搜不到这条企标了
// LambdaUpdateWrapper<SarBussStandMenu> esWrapper = new LambdaUpdateWrapper<>();
// esWrapper.eq(SarBussStandMenu::getMenuId, menuId);
// sarBussStandMenuService.remove(esWrapper);
log.info("删除企标主表中的相应字段成功");
// 删除国标外标企标主表中的中文字段
sarStandardInfoDao.deleteStandSystem(menuName);
sarBussionessStandDao.deleteStandSystem(menuName);
}
/**
* 查询有权限菜单
*
* @param sarMenuStandardNew
*/
@Override
public List<SarMenuStandard> getListStandLimit(SarMenuStandardNew sarMenuStandardNew, List<String> access) {
List<SarMenuStandard> TsResources = new ArrayList<>();
QueryWrapper<SarMenuStandard> queryWrapper =new QueryWrapper<>();
if(sarMenuStandardNew.getSorDivide()!=null){
QueryWrapper<SarMenuStandard> queryWrapper = new QueryWrapper<>();
if (sarMenuStandardNew.getSorDivide() != null) {
queryWrapper.eq("sor_divide", sarMenuStandardNew.getSorDivide());
}
if(sarMenuStandardNew.getDicId()!=null){
if (sarMenuStandardNew.getDicId() != null) {
queryWrapper.eq("DIC_ID", sarMenuStandardNew.getDicId());
}
if(access!=null && !access.isEmpty()){
queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
if (access != null && !access.isEmpty()) {
queryWrapper.in(null != access && !access.isEmpty(), "ID", access);
}
queryWrapper.eq("VALID_FLAG",0);
queryWrapper.eq("VALID_FLAG", 0);
queryWrapper.isNull("PARENT_ID");
queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources=dao.selectList(queryWrapper);
TsResources = dao.selectList(queryWrapper);
for(SarMenuStandard resource:TsResources){
for (SarMenuStandard resource : TsResources) {
resource.setTreeType("sarMs");
QueryWrapper<SarMenuStandard> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS",resource.getId());
if(access!=null && !access.isEmpty()){
TsResourceQueryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
QueryWrapper<SarMenuStandard> TsResourceQueryWrapper = new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS", resource.getId());
if (access != null && !access.isEmpty()) {
TsResourceQueryWrapper.in(null != access && !access.isEmpty(), "ID", access);
}
TsResourceQueryWrapper.eq("VALID_FLAG",0);
TsResourceQueryWrapper.eq("VALID_FLAG", 0);
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<SarMenuStandard> children=dao.selectList(TsResourceQueryWrapper);
resource.setChildren(recursionGetListChildrenStand((resource),(children)));
List<SarMenuStandard> children = dao.selectList(TsResourceQueryWrapper);
resource.setChildren(recursionGetListChildrenStand((resource), (children)));
}
return TsResources;
@@ -172,18 +483,23 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
/**
* 递归调用获取子节点
*
* @return List<TsResource>
*/
private List<SarMenuStandard> recursionGetListChildrenStand(SarMenuStandard resource, List<SarMenuStandard> children){
private List<SarMenuStandard> recursionGetListChildrenStand(SarMenuStandard resource, List<SarMenuStandard> children) {
List<SarMenuStandard> tsResources = children.stream()
.filter(resource1 -> resource1.getParentId().equals(resource.getId()))
.collect(Collectors.toList());
if(!tsResources.isEmpty()){
tsResources = tsResources.stream().sorted(Comparator.comparing(resource1 -> resource1.getDisplaySeq())).collect(Collectors.toList());
tsResources.forEach(resource1 -> {
resource1.setTreeType("sarMs");
resource1.setChildren(recursionGetListChildrenStand((resource1),(children)));
});
if (!tsResources.isEmpty()) {
try {
tsResources = tsResources.stream().sorted(Comparator.comparing(resource1 -> resource1.getDisplaySeq())).collect(Collectors.toList());
tsResources.forEach(resource1 -> {
resource1.setTreeType("sarMs");
resource1.setChildren(recursionGetListChildrenStand((resource1), (children)));
});
} catch (Exception e) {
log.error("异常");
}
}
return tsResources;
}
@@ -72,20 +72,20 @@ public interface TsPositionDao extends BaseMapper<TsPosition> {
Integer countPositionAndRole(TsPosition tsPosition);
/**
* 通过岗位列表查询绑定的角色列表
* @param positionIds:岗位列表
* @return List<String>
*/
List<String> getRoleIdsByPositionIds(List<String> positionIds);
// /**
// * 通过岗位列表查询绑定的角色列表
// * @param positionIds:岗位列表
// * @return List<String>
// */
// List<String> getRoleIdsByPositionIds(List<String> positionIds);
long pageTotal();
/**
* 通过roleId查询岗位ID列表
* @param roleId:角色ID
* @return List<String>
*/
@Select("select position_id from ts_position_role where role_id=#{roleId}")
List<String> getPositionIdsByRoleId(String roleId);
// /**
// * 通过roleId查询岗位ID列表
// * @param roleId:角色ID
// * @return List<String>
// */
// @Select("select position_id from ts_position_role where role_id=#{roleId}")
// List<String> getPositionIdsByRoleId(String roleId);
}
@@ -67,17 +67,17 @@ public interface ITsPositionService extends IService<TsPosition> {
*/
ResponseMessage<Object> deletePosition(String positionId);
/**
* 通过岗位列表查询绑定的角色列表
* @param positionIds:岗位列表
* @return List<String>
*/
List<String> getRoleIdsByPositionIds(List<String> positionIds);
/**
* 通过roleId查询岗位ID列表
* @param roleId:角色ID
* @return List<String>
*/
List<String> getPositionIdsByRoleId(String roleId);
// /**
// * 通过岗位列表查询绑定的角色列表
// * @param positionIds:岗位列表
// * @return List<String>
// */
// List<String> getRoleIdsByPositionIds(List<String> positionIds);
//
// /**
// * 通过roleId查询岗位ID列表
// * @param roleId:角色ID
// * @return List<String>
// */
// List<String> getPositionIdsByRoleId(String roleId);
}
@@ -195,26 +195,26 @@ public class TsPositionServiceImpl extends ServiceImpl<TsPositionDao, TsPosition
return Result.success();
}
/**
* 通过岗位列表查询绑定的角色列表
* @param positionIds:岗位列表
* @return List<String>
*/
@Override
public List<String> getRoleIdsByPositionIds(List<String> positionIds) {
if(positionIds!=null&&positionIds.size()>0){
return tsPositionDao.getRoleIdsByPositionIds(positionIds);
}
return null;
}
// /**
// * 通过岗位列表查询绑定的角色列表
// * @param positionIds:岗位列表
// * @return List<String>
// */
// @Override
// public List<String> getRoleIdsByPositionIds(List<String> positionIds) {
// if(positionIds!=null&&positionIds.size()>0){
// return tsPositionDao.getRoleIdsByPositionIds(positionIds);
// }
// return null;
// }
/**
* 通过roleId查询岗位ID列表
* @param roleId:角色ID
* @return List<String>
*/
@Override
public List<String> getPositionIdsByRoleId(String roleId) {
return tsPositionDao.getPositionIdsByRoleId(roleId);
}
// /**
// * 通过roleId查询岗位ID列表
// * @param roleId:角色ID
// * @return List<String>
// */
// @Override
// public List<String> getPositionIdsByRoleId(String roleId) {
// return tsPositionDao.getPositionIdsByRoleId(roleId);
// }
}
@@ -6,14 +6,21 @@ import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.login.util.UserUtils;
import com.adc.da.slrs.sarMenu.entity.SarMenu;
import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarRole.dao.TsRoleDao;
import com.adc.da.slrs.sarRole.entity.TsRoleMenuVO;
import com.adc.da.slrs.sarRole.entity.TsRoleResourceVO;
import com.adc.da.slrs.sarRole.service.ITsRoleService;
import com.adc.da.slrs.sarUser.entity.UserPositionBatchVO;
import com.adc.da.slrs.sarUser.entity.UserPositionVO;
import com.adc.da.slrs.sarUser.entity.UserRoleBatchVO;
import com.adc.da.slrs.sarUser.entity.UserRoleVO;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.sys.entity.UserEO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.ibatis.annotations.Delete;
@@ -24,6 +31,7 @@ import com.adc.da.slrs.sarRole.entity.TsRole;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
@@ -43,6 +51,8 @@ public class TsRoleController extends BaseController<TsRole> {
private ITsRoleService tsRoleService;
@Autowired
private TsRoleDao tsRoleDao;
@Resource
private ITsUserService tsUserService;
@ApiOperation("查询所有角色")
@GetMapping
@@ -51,6 +61,17 @@ public class TsRoleController extends BaseController<TsRole> {
return Result.success(tsRoles);
}
/**
* 查询角色(可通过name筛选)
* @param tsRole:筛选信息
*/
@ApiOperation("查询角色")
@GetMapping("/allPage")
public ResponseMessage<IPage<TsRole>> getPosition(TsRole tsRole){
IPage<TsRole> roles = tsRoleService.getRole(tsRole);
return Result.success(roles);
}
@ApiOperation("根据角色名筛选角色")
@GetMapping("/name")
public ResponseMessage<List<TsRole>> getByName(String name){
@@ -123,5 +123,14 @@ public class TsRole extends BaseEntity {
@TableField(exist = false)
private String parent;
@TableField(exist = false)
private Integer current;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private Integer total;
}
@@ -4,6 +4,7 @@ import com.adc.da.http.ResponseMessage;
import com.adc.da.slrs.sarRole.entity.TsRole;
import com.adc.da.slrs.sarRole.entity.TsRoleMenuVO;
import com.adc.da.slrs.sarRole.entity.TsRoleResourceVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
@@ -88,4 +89,12 @@ public interface ITsRoleService extends IService<TsRole> {
List<String> getRootMenuIdsByRoleIds(List<String> roleIds);
List<TsRole> getRoleDataByUserId(String userId);
/**
* 分页获取所有角色
* @param tsRole
* @return
*/
IPage<TsRole> getRole(TsRole tsRole);
}
@@ -1,11 +1,13 @@
package com.adc.da.slrs.sarRole.service.impl;
import cn.hutool.core.util.StrUtil;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarMenu.dao.SarMenuDao;
import com.adc.da.slrs.sarMenu.entity.SarMenu;
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserPersonalMenuService;
import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarRole.entity.TsRole;
import com.adc.da.slrs.sarRole.dao.TsRoleDao;
@@ -17,7 +19,10 @@ import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.zlTree.dao.ZlTreeDao;
import com.adc.da.slrs.zlTree.entity.ZlTree;
import com.adc.da.utils.util.ListUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@@ -164,10 +169,10 @@ public class TsRoleServiceImpl extends ServiceImpl<TsRoleDao, TsRole> implements
if(childrenRole!=null&&childrenRole.size()>0){
return Result.error("该角色有下属角色,无法删除");
}
List<String> positionIds=tsRoleDao.getPositionIds(roleId);
if(positionIds!=null&&positionIds.size()>0){
return Result.error("该角色已绑定岗位,无法删除");
}
// List<String> positionIds=tsRoleDao.getPositionIds(roleId);
// if(positionIds!=null&&positionIds.size()>0){
// return Result.error("该角色已绑定岗位,无法删除");
// }
tsRoleDao.deleteById(roleId);
return Result.success();
}
@@ -299,4 +304,28 @@ public class TsRoleServiceImpl extends ServiceImpl<TsRoleDao, TsRole> implements
}
@Override
public List<TsRole> getRoleDataByUserId(String userId) {
if(StringUtils.isNotBlank(userId)){
return tsRoleDao.getRoleDataByUserId(userId);
}
return null;
}
@Override
public IPage<TsRole> getRole(TsRole tsRole) {
IPage<TsRole> page = new Page<>(tsRole.getCurrent(), tsRole.getPageSize());
LambdaQueryWrapper<TsRole> roleWrapper = new LambdaQueryWrapper<>();
roleWrapper.like(StrUtil.isNotBlank(tsRole.getName()), TsRole::getName, tsRole.getName());
IPage<TsRole> tsRoleIPage = baseMapper.selectPage(page, roleWrapper);
List<TsRole> records = tsRoleIPage.getRecords();
page.setRecords(records);
page.setTotal(page.getTotal());
page.setCurrent(tsRole.getCurrent());
page.setSize(tsRole.getPageSize());
System.out.println(page.getTotal());
return page;
}
}
@@ -1,7 +1,9 @@
package com.adc.da.slrs.sarStandMenu.dao;
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import javax.annotation.Resource;
import java.util.List;
@@ -31,4 +33,9 @@ public interface SarStandMenuDao extends BaseMapper<SarStandMenu> {
List<SarStandMenu> getMenuByStandId(SarStandMenu sarStandMenu);
List<SarStandMenu> getGBStandMenu();
List<SarStandMenu> getFBStandMenu();
List<StandSystemDTO> getStandInfoSystemData(@Param("param") StandSystemDTO standSystemDTO, @Param("dataSource") String dataSource);
}
@@ -19,4 +19,7 @@ public interface ISarStandMenuService extends IService<SarStandMenu> {
List<SarStandMenu> selectAllMenuByStandId(SarStandMenu sarStandMenuEO);
void deleteStandSystemByStandId(String id);
void addStandSystemRelation(String standSystem, String id);
}
@@ -1,15 +1,23 @@
package com.adc.da.slrs.sarStandMenu.service.impl;
import com.adc.da.exception.AdcDaBaseException;
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
import com.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao;
import com.adc.da.slrs.sarStandMenu.service.ISarStandMenuService;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.adc.da.sys.sarMenuStandard.service.ISarMenuStandardService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>
@@ -28,6 +36,9 @@ public class SarStandMenuServiceImpl extends ServiceImpl<SarStandMenuDao, SarSta
@Autowired
private ITsResourceService sarMenuEOService;
@Autowired
private ISarMenuStandardService iSarMenuStandardService;
@Override
public int deleteByMenuId (SarStandMenu sarStandMenuEO){
List<String> menuIds = sarMenuEOService.getChildMenuList(sarStandMenuEO.getOldMenuId());
@@ -40,4 +51,39 @@ public class SarStandMenuServiceImpl extends ServiceImpl<SarStandMenuDao, SarSta
return dao.selectAllMenuByStandId(sarStandMenuEO);
}
@Override
public void deleteStandSystemByStandId(String id) {
LambdaQueryWrapper<SarStandMenu> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarStandMenu::getStandId, id);
List<SarStandMenu> list = list(wrapper);
Set<String> collect = list.stream().map(SarStandMenu::getMenuId).collect(Collectors.toSet());
List<String> menuIds = new ArrayList<>();
for (String menuId : collect) {
SarMenuStandard menuStand = iSarMenuStandardService.getById(menuId);
if (menuStand != null) {
menuIds.add(menuStand.getId());
}
}
if (menuIds.size() > 0) {
LambdaUpdateWrapper<SarStandMenu> sarStandMenuWrapper = new LambdaUpdateWrapper<>();
sarStandMenuWrapper.eq(SarStandMenu::getStandId, id);
sarStandMenuWrapper.in(SarStandMenu::getMenuId,menuIds);
remove(sarStandMenuWrapper);
}
}
@Override
public void addStandSystemRelation(String standSystem, String id) {
// 校验standSystem是否有效
SarMenuStandard standMenu = iSarMenuStandardService.getById(standSystem);
if (standMenu == null) {
throw new AdcDaBaseException("无效的标准体系");
}
SarStandMenu sarStandMenu = new SarStandMenu();
// 生成不带横杠的UUID
sarStandMenu.setId(java.util.UUID.randomUUID().toString().replaceAll("-", ""));
sarStandMenu.setStandId(id).setMenuId(standSystem).setValidFlag(0);
save(sarStandMenu);
}
}
@@ -243,6 +243,8 @@ public class SarStandardsInfo extends BaseEntity {
@TableField(exist = false)
private String standSystemName;
@TableField(exist = false)
private String standSystemId;
public static long getSerialVersionUID() {
return serialVersionUID;
@@ -17,7 +17,7 @@ import com.adc.da.slrs.sarBussionessStand.entity.OldSystem;
import com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao;
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarFindDto;
import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
//import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarStandFile.service.ISarStandFileService;
import com.adc.da.slrs.sarStandWarning.entity.WarningDate;
import com.adc.da.slrs.sarStandWarning.service.Impl.WarningDateServiceImpl;
@@ -87,6 +87,7 @@ import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
@@ -114,6 +115,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -150,8 +152,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
@Autowired
WarningDateServiceImpl warningDateService;
@Autowired
private ITsPositionService iTsPositionService;
// @Autowired
// private ITsPositionService iTsPositionService;
@Autowired
private SarStandardsInfoDao dao;
@@ -816,7 +818,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
// 查询属性表数据
if (StringUtils.isNotBlank(fieldInfo)) {
Map<String, Object> getAttrMap = sarStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
if(getAttrMap.get("FBGBJBD")!=null){
if(getAttrMap!= null && getAttrMap.get("FBGBJBD")!=null){
if(StringUtils.isNotBlank(getAttrMap.get("FBGBJBD").toString())){
String[] split = getAttrMap.get("FBGBJBD").toString().split(",");
String fileId = "";
@@ -1083,15 +1085,15 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
value = String.join(",", stringList.isEmpty() ? valArr : stringList);
break;
}
//通过id绑定责任部门师名称
case "ZRBM": {
QueryWrapper<TsPosition> tsPositionQW = new QueryWrapper<>();
tsPositionQW.select("name")
.in("id", valArr);
List<String> stringList = iTsPositionService.listObjs(tsPositionQW, o -> o.toString());
value = String.join(",", stringList.isEmpty() ? valArr : stringList);
break;
}
// //通过id绑定责任部门师名称
// case "ZRBM": {
// QueryWrapper<TsPosition> tsPositionQW = new QueryWrapper<>();
// tsPositionQW.select("name")
// .in("id", valArr);
// List<String> stringList = iTsPositionService.listObjs(tsPositionQW, o -> o.toString());
// value = String.join(",", stringList.isEmpty() ? valArr : stringList);
// break;
// }
default:
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
}
@@ -1307,6 +1309,14 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
sarStandMenuEO.setId(UUIDUtils.randomUUID20());
sarStandMenuEODao.insert(sarStandMenuEO);
}
if (StringUtils.isNotEmpty(sarStandardsInfoEO.getStandSystemId())) {
SarStandMenu sarStandMenuEO = new SarStandMenu();
sarStandMenuEO.setStandId(sarStandardsInfoEO.getId());
sarStandMenuEO.setMenuId(sarStandardsInfoEO.getStandSystemId());
sarStandMenuEO.setValidFlag(ValueStateEnum.VALUE_TRUE.getValue());
sarStandMenuEO.setId(UUIDUtils.randomUUID20());
sarStandMenuEODao.insert(sarStandMenuEO);
}
// 根据其他字段生成标准状态
updateStandState(sarStandardsInfoEO, null);
int insertResult = dao.insertSelective(sarStandardsInfoEO);
@@ -2052,6 +2062,11 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
* @Return: com.adc.da.util.http.ResponseMessage<com.adc.da.lawss.entity.SarStandardsInfoEO>
*/
public int updateSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception {
// 标准体系
sarStandMenuService.deleteStandSystemByStandId(sarStandardsInfoEO.getId());
if (StringUtils.isNotEmpty(sarStandardsInfoEO.getStandSystemId())) {
sarStandMenuService.addStandSystemRelation(sarStandardsInfoEO.getStandSystemId(), sarStandardsInfoEO.getId());
}
/**
* 加入对应"国家/地区"的清单列表
@@ -3233,34 +3248,45 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}
String accessCountry = sarSarAccessEOService.getCountryByRes(sarStandardsInfoEO.getId(), sarStandardsInfoEO.getStandType() + "_STAND");
sarStandardsInfoEO.setAccessCountry(accessCountry);
}
QueryWrapper<SarMenuStandard> wrapper=new QueryWrapper<>();
wrapper.in("MENU_NAME",sarStandardsInfoEO.getStandSystem());
wrapper.eq("DIC_ID","9m4qqqaansxmox5e82zm");
wrapper.orderByDesc("length(PARENT_IDS)");
List<SarMenuStandard> standards=iSarMenuStandardService.list(wrapper);
if (null!=standards && standards.size() == 1) {
List<String> ids=new ArrayList<>();
if (StringUtils.isNotBlank(standards.get(0).getParentIds())){
if (standards.get(0).getParentIds().contains(",")){
ids=new ArrayList<>(Arrays.asList(standards.get(0).getParentIds().split(",")));
}else {
ids.add(standards.get(0).getParentIds());
}
QueryWrapper<SarMenuStandard> wrapper1 = new QueryWrapper<>();
wrapper1.in("id", ids);
List<SarMenuStandard> res = iSarMenuStandardService.list(wrapper1);
if (null!=res && res.size()>0){
Map<String,String> map=new HashMap<>();
res.forEach(sarMenuStandard -> {map.put(sarMenuStandard.getId(),sarMenuStandard.getMenuName());});
String result="";
for (String s:ids) {
result +="/"+map.get(s);
}
sarStandardsInfoEO.setStandSystem(result.substring(1,result.length()));
}
// 处理标准体系字段
String standSystem = sarStandardsInfoEO.getStandSystem();
if (StringUtils.isNotBlank(standSystem)) {
List<String> list = Arrays.asList(standSystem.split("/"));
standSystem = list.get(list.size() - 1);
// 配置体系类别
String txlbBussLevel = getParentNodePathRecursive(standSystem);
sarStandardsInfoEO.setStandSystem(txlbBussLevel);
}
}
// 之前的处理有问题
// QueryWrapper<SarMenuStandard> wrapper=new QueryWrapper<>();
// wrapper.in("MENU_NAME",sarStandardsInfoEO.getStandSystem());
// wrapper.eq("DIC_ID","9m4qqqaansxmox5e82zm");
// wrapper.orderByDesc("length(PARENT_IDS)");
// List<SarMenuStandard> standards=iSarMenuStandardService.list(wrapper);
// if (null!=standards && standards.size() == 1) {
// List<String> ids=new ArrayList<>();
// if (StringUtils.isNotBlank(standards.get(0).getParentIds())){
// if (standards.get(0).getParentIds().contains(",")){
// ids=new ArrayList<>(Arrays.asList(standards.get(0).getParentIds().split(",")));
// }else {
// ids.add(standards.get(0).getParentIds());
// }
// QueryWrapper<SarMenuStandard> wrapper1 = new QueryWrapper<>();
// wrapper1.in("id", ids);
// List<SarMenuStandard> res = iSarMenuStandardService.list(wrapper1);
// if (null!=res && res.size()>0){
// Map<String,String> map=new HashMap<>();
// res.forEach(sarMenuStandard -> {map.put(sarMenuStandard.getId(),sarMenuStandard.getMenuName());});
// String result="";
// for (String s:ids) {
// result +="/"+map.get(s);
// }
// sarStandardsInfoEO.setStandSystem(result.substring(1,result.length()));
// }
// }
// }
return sarStandardsInfoEO;
@@ -3286,6 +3312,22 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}
String accessCountry = sarSarAccessEOService.getCountryByRes(sarStandardsInfoEO.getId(), sarStandardsInfoEO.getStandType() + "_STAND");
sarStandardsInfoEO.setAccessCountry(accessCountry);
// 处理标准体系字段
String standSystem = sarStandardsInfoEO.getStandSystem();
if (StringUtils.isNotBlank(standSystem)) {
List<String> list = Arrays.asList(standSystem.split("/"));
standSystem = list.get(list.size() - 1);
LambdaQueryWrapper<SarMenuStandard> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarMenuStandard::getMenuName, standSystem);
wrapper.eq(SarMenuStandard::getDicId, "9m4qqqaansxmox5e82zm");
List<SarMenuStandard> list1 = sarMenuStandardService.list(wrapper);
if (list1.size() > 0) {
sarStandardsInfoEO.setStandSystemId(list1.get(0).getId());
}
// 配置体系类别
String txlbBussLevel = getParentNodePathRecursive(standSystem);
sarStandardsInfoEO.setStandSystem(txlbBussLevel);
}
}
return sarStandardsInfoEO;
}
@@ -3984,5 +4026,29 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return sarlist;
}
/**
* 查询标准体系
* @param nodeName 标准体系节点名称
* @return
*/
public String getParentNodePathRecursive(String nodeName) {
LambdaQueryWrapper<SarMenuStandard> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SarMenuStandard::getMenuName, nodeName);
SarMenuStandard node = sarMenuStandardService.list(wrapper).get(0); // 根据 txlbBuss 查询节点
if (node == null) {
return nodeName; // 未找到节点返回空路径
}
if (org.apache.commons.lang.StringUtils.isBlank(node.getParentId())) {
return nodeName;
}
SarMenuStandard sarMenuStandard = sarMenuStandardService.selectMenuById(node.getParentId());
String parentNodePath = getParentNodePathRecursive(sarMenuStandard.getMenuName()); // 递归获取父节点路径
if (parentNodePath.isEmpty()) {
return nodeName; // 如果父节点路径为空直接返回当前节点的 txlbBuss
} else {
return parentNodePath + "/" + nodeName; // 否则拼接当前节点的 txlbBuss 到父节点路径
}
}
}
@@ -71,6 +71,25 @@ public class TsUserController extends BaseController<TsUser> {
return tsUserService.setPositionBatchByOrgId(userPositionVO);
}
@ApiOperation("配置角色")
@PostMapping("/role")
public ResponseMessage<Object> setPosition(@Valid @RequestBody UserRoleVO userRoleVO){
return tsUserService.setRole(userRoleVO);
}
@ApiOperation("配置角色")
@PostMapping("/roleBatch")
public ResponseMessage<Object> setPositionBatch(@Valid @RequestBody UserRoleBatchVO userRoleVO){
return tsUserService.setRoleBatch(userRoleVO);
}
@ApiOperation("配置角色")
@PostMapping("/roleBatchByOrgId")
public ResponseMessage<Object> setPositionBatchByOrgId(@Valid @RequestBody UserRoleBatchVO userRoleVO){
return tsUserService.setRoleBatchByOrgId(userRoleVO);
}
@ApiOperation("查询当前登录用户权限")
@GetMapping("/menu")
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarUser.entity;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author: Mzaxd
* @Date: 2023/11/22 22:50
*/
@Data
public class UserRoleBatchVO {
@NotNull(message = "userId不能为空")
private List<String> userId;
@NotNull(message = "roleIds不能为空")
private List<String> roleIds;
@NotNull(message = "orgId不能为空")
private String orgId;
}
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarUser.entity;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author: Mzaxd
* @Date: 2023/11/22 22:50
*/
@Data
public class UserRoleVO {
@NotNull(message = "userId不能为空")
private String userId;
@NotNull(message = "roleIds不能为空")
private List<String> roleIds;
}
@@ -3,10 +3,7 @@ package com.adc.da.slrs.sarUser.service;
import com.adc.da.http.ResponseMessage;
import com.adc.da.slrs.sarMenu.entity.SarMenu;
import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarUser.entity.TsUser;
import com.adc.da.slrs.sarUser.entity.UpDTO;
import com.adc.da.slrs.sarUser.entity.UserPositionBatchVO;
import com.adc.da.slrs.sarUser.entity.UserPositionVO;
import com.adc.da.slrs.sarUser.entity.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -92,4 +89,10 @@ public interface ITsUserService extends IService<TsUser> {
IPage<TsUser> getAllUsers(TsUser tsUser);
String userIdByName(String userId);
ResponseMessage<Object> setRole(UserRoleVO userRoleVO);
ResponseMessage<Object> setRoleBatch(UserRoleBatchVO userRoleVO);
ResponseMessage<Object> setRoleBatchByOrgId(UserRoleBatchVO userRoleVO);
}
@@ -7,9 +7,9 @@ import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
import com.adc.da.slrs.sarMenu.entity.SarMenu;
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
import com.adc.da.slrs.sarPosition.dao.TsPositionDao;
//import com.adc.da.slrs.sarPosition.dao.TsPositionDao;
import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarPosition.service.ITsPositionService;
//import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.slrs.sarRole.entity.TsRole;
@@ -21,10 +21,13 @@ import com.adc.da.slrs.tsRoleMeunData.entity.TsRoleMenuData;
import com.adc.da.slrs.tsRoleMeunData.service.ITsRoleMenuDataService;
import com.adc.da.sync.service.SyncUserService;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.entity.UserRoleEO;
import com.adc.da.sys.service.IUserRoleEOService;
import com.adc.da.utils.util.ListUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -35,6 +38,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -55,8 +59,8 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
private TsUserDao tsUserDao;
@Autowired
private ITsUserService tsUserService;
@Autowired
private ITsPositionService tsPositionService;
// @Autowired
// private ITsPositionService tsPositionService;
@Autowired
@Lazy
private ITsRoleService tsRoleService;
@@ -66,12 +70,14 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
private ITsResourceService tsResourceService;
@Autowired
private SyncUserService syncUserService;
@Autowired
private TsPositionDao tsPositionDao;
// @Autowired
// private TsPositionDao tsPositionDao;
@Autowired
private ITsInstitutionService tsInstitutionService;
@Autowired
ITsRoleMenuDataService iTsRoleMenuDataService;
@Resource
private IUserRoleEOService userRoleEOService;
public void deleteUser(){
@@ -290,16 +296,17 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
public List<SarMenu> getMenu() {
UserEO userEO=UserUtils.getUser();
String userId= userEO.getUsid();
List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
/**
* 当用户没有所属岗位默认给一个other岗位适用于特定权限外的其他用户
* 用户同步时需要将用户配置的系统内的岗位保留
*/
if(positionIds == null || positionIds.isEmpty()){
positionIds = Arrays.asList(new String[]{"other"});
}
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// if(positionIds == null || positionIds.isEmpty()){
// positionIds = Arrays.asList(new String[]{"other"});
// }
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> menuIds=tsRoleService.getMenuIdsByRoleIds(roleIds);
return sarMenuService.getMenuByIds(menuIds);
}
@@ -314,8 +321,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
UserEO userEO=UserUtils.getUser();
String userId= userEO.getUsid();
System.out.println(userId);
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> resourceIds=tsRoleService.getResourceIdsByRoleIds(roleIds);
return tsResourceService.getResourceByIds(resourceIds,tsResource.getSorDivide());
}
@@ -327,8 +335,16 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<String> getUserIdsByRoleId(String roleId) {
List<String> positionIds=tsPositionService.getPositionIdsByRoleId(roleId);
return tsUserDao.getUserIdsByPositionIds(positionIds);
LambdaQueryWrapper<UserRoleEO> userRoleEOLambdaQueryWrapper = new LambdaQueryWrapper<>();
userRoleEOLambdaQueryWrapper.eq(UserRoleEO::getRoleId,roleId);
// 根据角色ID查询用户ID
List<UserRoleEO> list = userRoleEOService.list(userRoleEOLambdaQueryWrapper);
// 判空
if (list == null || list.isEmpty()) {
return null;
}
// 获取用户ID
return list.stream().map(UserRoleEO::getUserId).collect(Collectors.toList());
}
/**
@@ -338,8 +354,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<SarMenu> getMenusByUserId(String userId){
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> menuIds=tsRoleService.getMenuIdsByRoleIds(roleIds);
return sarMenuService.getMenuByIds(menuIds);
}
@@ -354,8 +371,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
UserEO userEO=UserUtils.getUser();
String userId= userEO.getUsid();
System.out.println(userId);
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
return tsRoleService.getResourceIdsByRoleIds(roleIds);
}
@@ -366,8 +384,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<String> getResourceUserId(String userId) {
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
return tsRoleService.getResourceIdsByRoleIds(roleIds);
}
@@ -377,8 +396,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
*/
@Override
public List<String> getResourceDataUserId(String userId) {
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
QueryWrapper<TsRoleMenuData> wrapper=new QueryWrapper<>();
wrapper.select("MENU_ID");
wrapper.in("ROLE_ID",roleIds);
@@ -421,15 +441,15 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
for(SyncUser syncUser:syncUsers){
QueryWrapper<TsPosition> positionQueryWrapper=new QueryWrapper<>();
positionQueryWrapper.eq("name",syncUser.getTitle());
TsPosition tsPosition=tsPositionDao.selectOne(positionQueryWrapper);
if(tsPosition==null){
tsPosition=new TsPosition();
tsPosition.setName(syncUser.getTitle());
tsPosition.setType("1");
tsPositionDao.insert(tsPosition);
}
// TsPosition tsPosition=tsPositionDao.selectOne(positionQueryWrapper);
// if(tsPosition==null){
// tsPosition=new TsPosition();
// tsPosition.setName(syncUser.getTitle());
// tsPosition.setType("1");
// tsPositionDao.insert(tsPosition);
// }
TsUser tsUser=SyncUser.toUser(syncUser);
tsUser.setPositionId(tsPosition.getId());
// tsUser.setPositionId(tsPosition.getId());
tsUserDao.insert(tsUser);
}
@@ -437,8 +457,9 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
@Override
public List<SarMenu> getSecondMenusByUserId(String userId) {
List<String> positionIds=tsUserDao.selectPositionIds(userId);
List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
// List<String> positionIds=tsUserDao.selectPositionIds(userId);
// List<String> roleIds=tsPositionService.getRoleIdsByPositionIds(positionIds);
List<String> roleIds = userRoleEOService.getRoleIdsByUserId(userId);
List<String> menuIds=tsRoleService.getMenuIdsByRoleIds(roleIds);
return sarMenuService.getSecondMenuByIds(menuIds);
}
@@ -507,19 +528,19 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
}
ids.removeIf(s -> null==s);
List<TsUser> tsUsers = tsUserDao.userUnderInstitution((tsUser.getCurrent() - 1) * tsUser.getSize(), tsUser.getSize(), tsUser, ids);
if(tsUsers!=null && !tsUsers.isEmpty()){
for (TsUser user:tsUsers) {
List<TsPosition> positionList = tsPositionService.getPositionDataByUserId(user.getUserId());
user.setPositions(positionList);
}
}
// if(tsUsers!=null && !tsUsers.isEmpty()){
// for (TsUser user:tsUsers) {
// List<TsPosition> positionList = tsPositionService.getPositionDataByUserId(user.getUserId());
// user.setPositions(positionList);
// }
// }
if(tsUsers!=null &&!tsUsers.isEmpty()){
for (TsUser user:tsUsers) {
List<TsRole> roleList = tsRoleService.getRoleDataByUserId(user.getUserId());
user.setRoles(roleList);
}
}
Page<TsUser> tsUserPage = new Page<>();
tsUserPage.setCurrent(tsUser.getCurrent());
tsUserPage.setSize(tsUser.getSize());
@@ -535,5 +556,90 @@ public class TsUserServiceImpl extends ServiceImpl<TsUserDao, TsUser> implements
return userName;
}
@Override
public ResponseMessage<Object> setRole(UserRoleVO userRoleVO) {
TsUser tsUser=tsUserDao.selectById(userRoleVO.getUserId());
if(tsUser==null){
return Result.error("该用户不存在");
}
// 删除原来的角色关联
QueryWrapper<UserRoleEO> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("USER_ID",userRoleVO.getUserId());
userRoleEOService.remove(queryWrapper);
// 设置新的角色关联
List<UserRoleEO> userRoleEOList=new ArrayList<>();
userRoleVO.getRoleIds().forEach(roleId -> {
UserRoleEO userRoleEO=new UserRoleEO();
userRoleEO.setUserId(userRoleVO.getUserId());
userRoleEO.setRoleId(roleId);
userRoleEOList.add(userRoleEO);
});
userRoleEOService.saveBatch(userRoleEOList);
return Result.success();
}
@Override
public ResponseMessage<Object> setRoleBatch(UserRoleBatchVO userRoleVO) {
// 删除原来的角色关联
QueryWrapper<UserRoleEO> queryWrapper=new QueryWrapper<>();
queryWrapper.in("USER_ID",userRoleVO.getUserId());
userRoleEOService.remove(queryWrapper);
// 设置新的角色关联
List<UserRoleEO> userRoleEOList=new ArrayList<>();
userRoleVO.getUserId().forEach(userId -> {
userRoleVO.getRoleIds().forEach(roleId -> {
UserRoleEO userRoleEO=new UserRoleEO();
userRoleEO.setUserId(userId);
userRoleEO.setRoleId(roleId);
userRoleEOList.add(userRoleEO);
});
});
userRoleEOService.saveBatch(userRoleEOList);
return Result.success();
}
@Override
public ResponseMessage<Object> setRoleBatchByOrgId(UserRoleBatchVO userRoleVO) {
//首先将所有用户查出来
List<String> orgIds=new ArrayList<>();
orgIds.add(userRoleVO.getOrgId());
List<String> middle=new ArrayList<>();
middle.addAll(orgIds);
boolean Orgflag=true;
while (Orgflag){
QueryWrapper<TsInstitution> queryWrapper=new QueryWrapper<>();
queryWrapper.in("parent_id",middle);
List<TsInstitution> tsmiddle=tsInstitutionService.list(queryWrapper);
if (tsmiddle.size()>0){
tsmiddle.forEach(tsInstitution -> {
middle.add(tsInstitution.getId());
});
middle.removeAll(orgIds);
orgIds.addAll(middle);
}else {
tsmiddle.forEach(tsInstitution -> {
middle.add(tsInstitution.getId());
});
middle.removeAll(orgIds);
orgIds.addAll(middle);
Orgflag=false;
}
}
orgIds.removeIf(s -> null==s);
List<UserRoleEO> userRoleEOList=new ArrayList<>();
List<TsUser> allUsers = tsUserDao.getUserUnderInstitutionAll(orgIds);
for (TsUser tsUser : allUsers){
String userId = tsUser.getUserId();
// 设置新的角色关联
userRoleVO.getRoleIds().forEach(roleId -> {
UserRoleEO userRoleEO=new UserRoleEO();
userRoleEO.setUserId(userId);
userRoleEO.setRoleId(roleId);
userRoleEOList.add(userRoleEO);
});
}
userRoleEOService.saveBatch(userRoleEOList);
return Result.success();
}
}
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
/**
* <p>
* Mapper 接口
@@ -17,4 +19,6 @@ public interface TsRoleMenuDataDao extends BaseMapper<TsRoleMenuData> {
@Insert("insert into ts_role_menu_data (role_id,menu_id) values (#{roleId},#{id})")
void save(@Param("roleId") String roleId,@Param("id") String id);
void insertResourceMenuData(HashMap<String, Object> map);
}
@@ -0,0 +1,13 @@
package com.adc.da.utils.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface CompareField {
String fieldName() default "";
}
@@ -65,15 +65,15 @@ public class FieldConvertUtil {
public static String exportFieldNamesEsRevisePlan = "企标类别,企标编号,企标名称,计划状态,制修订类型,起草人,内部评审责任人,技术委员会评审负责人,计划标准初稿完成时间,计划标准发布时间,起草责任单位,实际标准发布时间,质量评分";
// 内外部会议 表头
public static String exportFieldNamesInsideOutsideMeeting = "会议名称,课题名称,会议主办单位,会议时间,会议地点,参会人员,会议主要内容,一级会议类别,二级会议类";
public static String exportFieldNamesInsideOutsideMeeting = "*会议名称,课题名称,*会议主办单位,*会议时间,*会议地点,*参会人员,会议纪要,*会议主要内容,*一级会议分类,*二级会议";
// 内外部会议关联表 表头
public static String exportFieldNamesMeetingTopic = "议题名称,汇报人,汇报单位,议题主要内容";
public static String exportFieldNamesMeetingTopic = "*议题名称,议题材料,*汇报人,*汇报单位,*议题主要内容";
// 政策法规资料 表头
public static String exportFieldLawsInformation = "1级资料分类,2级资料分类,3级资料分类,4级资料分类,资料名称,资料归属部门,作者,资料说明";
public static String exportFieldLawsInformation = "*1级资料分类,*2级资料分类,*3级资料分类,*4级资料分类,*资料名称,*资料归属部门,作者,资料说明,资料文件";
// 政策课题 表头
public static String exportFieldLawsTopic = "课题名称,课题承办单位,课题指导单位,课题参与单位,开始时间,结题时间,课题费用(万元),课题组会议列表,课题组联系方式,内部联系方式";
public static String exportFieldLawsTopic = "*课题名称,*课题承办单位,课题指导单位,课题参与单位,*启动时间,结题时间,课题费用(万元),协议,课题组会议,课题组研究方案,课题组研究成果,课题组其他,课题组会议资料,课题组联系方式,内部立项报告,内部研究方案,内部会议资料,内部研究成果,内部其他,内部联系方式";
// 政策课题关联表 表头
public static String exportFieldLawsTopicRelation = "会议名称,会议时间,会议地点,参会人员(内部),会议主要内容,姓名,单位,电话,邮箱,身份,姓名,单位,电话,邮箱,身份";
@@ -92,7 +92,7 @@ public class FieldConvertUtil {
public static String exportName = "填写说明\n" +
"1.导入数据从第三行开始,第一行为填写说明,第二行为表头,第三行是正式数据\n" +
"2.所有带*号的字段必须填写\n" +
"3.企标类别(例如:Q/FD),文本状态(包含:发布、被代替、参考、即将实施、有效、直接上传、作废、待修订-指的其他企业标准),采用标准(包含:IDT等同采用、NEQ非等效采用、MOD修改采用)字段是单选属性,必须和系统中的对应字段选项相匹配,起草人因为涉及到同名问题只能填写账号例如(zhangsan3),如果有多个起草人需要使用英文逗号进行区分\n" +
"3.企标类别(例如:Q/FD),文本状态(包含:发布、被代替、参考、即将实施、有效、直接上传、作废、待修订-指的其他企业标准),采用标准(包含:IDT等同采用、NEQ非等效采用、MOD修改采用)字段,标准体系(例如:物理集成)是单选属性,必须和系统中的对应字段选项相匹配,起草人因为涉及到同名问题只能填写账号例如(zhangsan3),如果有多个起草人需要使用英文逗号进行区分\n" +
"4.适用车型,能源类型,适用产品线字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文逗号分割\n" +
"5.发布日期,企标实施日期字段为年-月-日格式,必须精确到日,例如(2023-04-01)\n" +
"6.企标编号,企标名称,企标英文名称字段为文本,填写文本内容\n" +
@@ -101,18 +101,26 @@ public class FieldConvertUtil {
public static String exportInsideOutsideMeetingDesc ="填写说明\n" +
"1.导入数据从第三行开始,第一行为填写说明,第二行为表头,第三行是正式数据\n" +
"2.会议分类按照系统下拉菜单中的分类填写\n" +
"3.会议议题如果存在多条,则在下面以此填写,新的内外部会议另起一行填写";
"2.所有带*号的字段必须填写\n" +
"3.会议分类按照系统中的分类填写\n" +
"4.发布日期,企标实施日期字段为年-月-日格式,必须精确到日,例如(2023-04-01)\n" +
"5.会议议题如果存在多条,则在对应列下依次填写,新的内外部会议另起一行填写 \n" +
"6.会议纪要,议题材料为附件文件,需要放在Excel文档同级目录中";
public static String exportLawsInformationDesc = "填写说明\n" +
"1.导入数据从第三行开始,第一行为填写说明,第二行为表头,第三行是正式数据\n" +
"2.资料分类按照系统下拉菜单中的分类填写\n";
"2.所有带*号的字段必须填写\n" +
"3.资料分类按照系统中的分类填写\n" +
"4.资料文件为附件文件,需要放在Excel文档同级目录中";
public static String exportLawsTopicDesc = "填写说明\n" +
"1.导入数据从第三行开始,第一行为填写说明,第二行为表头,第三行是正式数据\n" +
"2.课题组会议、课题组联系方式、内部联系方式如果存在多条,则在下面一次填写,新的课题组会议、课题组联系方式、内部联系方式在下面依次填写";
"2.所有带*号的字段必须填写 \n" +
"3.启动时间,结题时间字段为年-月-日格式,必须精确到日,例如(2023-12-01)\n" +
"4.课题组会议、课题组联系方式、内部联系方式如果存在多条,则在对应列下依次填写,新的课题组会议、课题组联系方式、内部联系方式在下面依次填写 \n" +
"5.协议,研究方案,研究成果,其他,会议资料等为附件文件,需要放在Excel文档同级目录中";
public static String exportFieldName = "*企标类别,*企标编号,*标准年份,*企标名称,企标英文名称,*文本状态,发布日期,企标实施日期,起草部门,起草人,适用车型,能源类型,适用产品线,体系类别,关联模块-乘用车VPPS编码,关联模块--卡车VPPS编码,发布稿,编制说明,历史版本,其他文件,修改单,代替企标编号,采用标准,采标程度,引用标准,关联文件,";
public static String exportFieldName = "*企标类别,*企标编号,*标准年份,*企标名称,企标英文名称,*文本状态,发布日期,企标实施日期,起草部门,起草人,适用车型,能源类型,适用产品线,标准体系,关联模块-乘用车VPPS编码,关联模块--卡车VPPS编码,发布稿,编制说明,历史版本,其他文件,修改单,代替企标编号,采用标准,采标程度,引用标准,关联文件,";
/***
* @Description: Clob类型 转String
@@ -10,6 +10,7 @@
<result column="MEETING_ORGANIZER" property="meetingOrganizer" />
<result column="MEETING_TIME" property="meetingTime" />
<result column="MEETING_ADDRESS" property="meetingAddress" />
<result column="AGENDA_NAME_STR" property="agendaNameStr" />
<result column="PARTICIPANTS" property="participants" />
<result column="MEETING_MINUTES" property="meetingMinutes" />
<result column="MEETING_CONTENT" property="meetingContent" />
@@ -26,6 +27,8 @@
<result column="REPORTER" property="reporter" />
<result column="REPORTING_UNIT" property="reportingUnit" />
<result column="AGENDA_CONTENT" property="agendaContent" />
<result column="CREATE_TIME" property="createTime" />
<result column="MODIFY_TIME" property="modifyTime" />
</collection>
</resultMap>
<sql id="Base_Column_List">
@@ -37,7 +40,8 @@
iom.PARTICIPANTS,iom.MEETING_MINUTES,iom.MEETING_CONTENT,iom.FIRST_MEETING_TYPE,iom.SECOND_MEETING_TYPE,
mt.ID as mtId,mt.MEETING_ID,mt.AGENDA_NAME,mt.AGENDA_MATERIALS,mt.REPORTER,mt.REPORTING_UNIT,
mt.AGENDA_CONTENT,
iom.VALID_FLAG,iom.CREATE_TIME,iom.MODIFY_TIME
iom.VALID_FLAG,iom.CREATE_TIME,iom.MODIFY_TIME,
iom.AGENDA_NAME_STR
</sql>
<sql id="Base_Where_Clause">
<trim suffixOverrides="," >
@@ -50,17 +54,20 @@
<if test="meetingOrganizer != null and meetingOrganizer != ''" >
and MEETING_ORGANIZER like concat('%',#{meetingOrganizer},'%')
</if>
<if test="meetingTimeBegin!= null and meetingTimeEnd == null">
and MEETING_TIME &gt;= DATE_FORMAT(#{meetingTimeBegin}, '%Y-%m-%d')
</if>
<if test="meetingTimeBegin == null and meetingTimeEnd != null">
and MEETING_TIME &lt;= DATE_FORMAT(#{meetingTimeEnd}, '%Y-%m-%d')
</if>
<if test="meetingTimeBegin != null and meetingTimeEnd != null">
and MEETING_TIME between #{meetingTimeBegin} and #{meetingTimeEnd}
and MEETING_TIME between DATE_FORMAT(#{meetingTimeBegin}, '%Y-%m-%d') and DATE_FORMAT(#{meetingTimeEnd}, '%Y-%m-%d')
</if>
<if test="meetingAddress != null and meetingAddress != ''" >
and MEETING_ADDRESS like concat('%',#{meetingAddress},'%')
</if>
<if test="participantsList != null and participantsList.size() > 0" >
and PARTICIPANTS in
<foreach collection="participantsList" separator="," open="(" close=")" item="participant">
#{participant}
</foreach>
<if test="participants != null and participants != ''">
and PARTICIPANTS like concat('%',#{participants},'%')
</if>
<if test="meetingContent != null" >
and MEETING_CONTENT like concat('%',#{meetingContent},'%')
@@ -88,44 +95,63 @@
</if>
</sql>
<select id="queryByPageCount" resultType="java.lang.Integer">
select count(iom.ID) from inside_outside_meeting iom join meeting_topic mt on iom.ID = mt.MEETING_ID
where iom.VALID_FLAG = 0
<include refid="Base_Where_Clause"/>
<include refid="MeetingTopic_where" />
group by iom.ID
select count(1) from (
select count(1)
from (select * from inside_outside_meeting where VALID_FLAG = 0 <include refid="Base_Where_Clause" /> ) iom
left join meeting_topic mt on iom.ID = mt.MEETING_ID
where iom.VALID_FLAG = 0
<include refid="MeetingTopic_where" />
group by iom.ID
) a
</select>
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeetingVO">
select <include refid="Base_Column_Join_MeetingTopic_List" />
from inside_outside_meeting iom join meeting_topic mt on iom.ID = mt.MEETING_ID
from (select <include refid="Base_Column_List" />,(
select GROUP_CONCAT(AGENDA_NAME SEPARATOR ',') from meeting_topic where inside_outside_meeting.ID = meeting_topic.MEETING_ID
) as AGENDA_NAME_STR from inside_outside_meeting where VALID_FLAG = 0 <include refid="Base_Where_Clause"/>
<if test="sortField != 'AGENDA_NAME'">
order by ${sortField} ${sortMode}
</if>
limit ${pager.startIndex-1},${pageSize}) iom left join meeting_topic mt on iom.ID = mt.MEETING_ID
where iom.VALID_FLAG = 0
<include refid="Base_Where_Clause" />
<include refid="MeetingTopic_where" />
order by
<choose>
<when test="sortField == 'AGENDA_NAME'">
mt.${sortField} ${sortMode}
mt.${sortField} ${sortMode},
mt.CREATE_TIME asc
</when>
<otherwise>
iom.${sortField} ${sortMode}
iom.${sortField} ${sortMode},
mt.CREATE_TIME asc
</otherwise>
</choose>
limit ${pager.startIndex-1},${pageSize}
</select>
<select id="queryMeetingById" resultMap="BaseResultMap">
select <include refid="Base_Column_Join_MeetingTopic_List" />
select
iom.ID,iom.MEETING_NAME,iom.TOPIC_NAME,iom.MEETING_ORGANIZER,iom.MEETING_TIME,iom.MEETING_ADDRESS,
iom.PARTICIPANTS,iom.MEETING_MINUTES,iom.MEETING_CONTENT,iom.FIRST_MEETING_TYPE,iom.SECOND_MEETING_TYPE,
mt.ID as mtId,mt.MEETING_ID,mt.AGENDA_NAME,mt.AGENDA_MATERIALS,mt.REPORTER,mt.REPORTING_UNIT,
mt.AGENDA_CONTENT,
iom.VALID_FLAG,iom.CREATE_TIME,iom.MODIFY_TIME
from inside_outside_meeting iom join meeting_topic mt on iom.ID = mt.MEETING_ID
where iom.VALID_FLAG = 0 and iom.ID in
<foreach collection="exportIdList" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
order by iom.MEETING_NAME
order by iom.MEETING_TIME desc
</select>
<select id="queryAllMeeting" resultMap="BaseResultMap">
select <include refid="Base_Column_Join_MeetingTopic_List" />
select
iom.ID,iom.MEETING_NAME,iom.TOPIC_NAME,iom.MEETING_ORGANIZER,iom.MEETING_TIME,iom.MEETING_ADDRESS,
iom.PARTICIPANTS,iom.MEETING_MINUTES,iom.MEETING_CONTENT,iom.FIRST_MEETING_TYPE,iom.SECOND_MEETING_TYPE,
mt.ID as mtId,mt.MEETING_ID,mt.AGENDA_NAME,mt.AGENDA_MATERIALS,mt.REPORTER,mt.REPORTING_UNIT,
mt.AGENDA_CONTENT,
iom.VALID_FLAG,iom.CREATE_TIME,iom.MODIFY_TIME
from inside_outside_meeting iom join meeting_topic mt on iom.ID = mt.MEETING_ID
where iom.VALID_FLAG = 0
<include refid="Base_Where_Clause" />
<include refid="MeetingTopic_where" />
order by iom.MEETING_NAME
order by iom.MEETING_TIME desc
</select>
</mapper>
@@ -144,5 +144,135 @@
</select>
<select id="getGBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
select
DISTINCT
sms.ID AS menuId,
stand.ID as standId
from SAR_STAND_MENU AS sm
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID AND stand.VALID_FLAG = '0'
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
where stand.STAND_TYPE = 'INLAND'
AND sms.MENU_NAME IS NOT NULL
AND LENGTH(sm.MENU_ID) > 30
AND sm.VALID_FLAG = '0'
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
</select>
<select id="getFBStandMenu" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
select
DISTINCT
sms.ID AS menuId,
stand.ID as standId
from SAR_STAND_MENU AS sm
LEFT JOIN sar_standards_info AS stand ON sm.STAND_ID = stand.ID AND stand.VALID_FLAG = '0'
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
where stand.STAND_TYPE = 'FOREIGN'
AND sms.MENU_NAME IS NOT NULL
AND LENGTH(sm.MENU_ID) > 30
AND sm.VALID_FLAG = '0'
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
</select>
<select id="getStandInfoSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
SELECT
gb.ID AS standId,
CONCAT(gb.STAND_SORT, ' ', ifnull(gb.STAND_NUMBER,''),
case when gb.STAND_YEAR is not null and gb.STAND_YEAR!= '' then concat('-',gb.STAND_YEAR) else '' end) AS standNo,
gb.STAND_NAME AS standName,
gb.STAND_STATE AS standState,
gb.TEXT_STATUS AS textStatus,
CASE
WHEN gb.ISSUE_TIME = '' THEN NULL
ELSE gb.ISSUE_TIME
END AS releaseDate,
CASE
WHEN gba.SSRQ = '' THEN NULL
ELSE gba.SSRQ
END AS implementDate,
gb.REPLACE_STAND_NUM AS replaceStandardNo,
gba.QCDW AS dept,
gba.WSSMR AS draftUserName,
gb.STAND_TYPE AS dataSource,
gb.STAND_SORT AS standSort,
CASE
WHEN gb.STAND_TYPE = 'INLAND' THEN 1
WHEN gb.STAND_TYPE = 'FOREIGN' THEN 2
END AS standTypeSort,
sms.ID AS menuId
FROM
`sar_standards_info` AS gb
LEFT JOIN `sar_stand_attr_info` AS gba ON gb.ID = gba.STAND_ID
LEFT JOIN `sar_stand_menu` AS m ON gb.ID = m.STAND_ID AND LENGTH(m.MENU_ID) > 30
LEFT JOIN sar_menu_standard sms on m.MENU_ID = sms.ID
WHERE gb.VALID_FLAG = '0'
AND sms.id in (select id from sar_menu_standard where valid_flag = 0 )
<!--国标/外标-->
<if test="param.standNo != null and param.standNo != ''">
AND gb.STAND_TYPE = #{dataSource}
</if>
<!--关联的节点IDList-->
<if test="param.menuIdList != null and param.menuIdList.size() > 0">
AND m.MENU_ID IN
<foreach item="item" index="index" collection="param.menuIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!--标准编号-->
<if test="param.standNo != null and param.standNo != ''">
AND gb.STAND_NUMBER LIKE CONCAT('%',#{param.standNo},'%')
</if>
<!--标准名称-->
<if test="param.standName != null and param.standName != ''">
AND gb.STAND_NAME LIKE CONCAT('%',#{param.standName},'%')
</if>
<!-- 发布时间 -->
<if test="param.startReleaseDateString != null and param.startReleaseDateString != ''">
AND gb.ISSUE_TIME >= #{param.startReleaseDateString}
</if>
<if test="param.endReleaseDateString != null and param.endReleaseDateString != ''">
AND gb.ISSUE_TIME &lt;= CONCAT(#{param.endReleaseDateString}, ' 23:59:59')
</if>
<!-- 实施日期 -->
<if test="param.startImplementDateString != null and param.startImplementDateString != ''">
AND gba.SSRQ >= #{param.startImplementDateString}
</if>
<if test="param.endImplementDateString != null and param.endImplementDateString != '' ">
AND gba.SSRQ &lt;= CONCAT(#{param.endImplementDateString}, ' 23:59:59')
</if>
<!--代替标准-->
<if test="param.replaceStandardNo != null and param.replaceStandardNo != ''">
AND gb.REPLACE_STAND_NUM LIKE CONCAT('%',#{param.replaceStandardNo},'%')
</if>
<!--编制单位-->
<if test="param.dept != null and param.dept != ''">
AND gba.QCDW LIKE CONCAT('%',#{param.dept},'%')
</if>
<!--起草人-->
<if test="param.draftUserName != null and param.draftUserName != ''">
AND gba.WSSMR LIKE CONCAT('%',#{param.draftUserName},'%')
</if>
<!--搜索条件数据来源-->
<if test="param.dataSource != null and param.dataSource != ''">
AND gb.STAND_TYPE = #{param.dataSource}
</if>
<!--SQL复用数据来源-->
<if test="dataSource != null and dataSource != ''">
AND gb.STAND_TYPE = #{dataSource}
</if>
<!--体系结构树搜索-->
<if test="param.standSystemIdList != null and param.standSystemIdList.size() > 0">
AND m.MENU_ID IN
<foreach item="item" index="index" collection="param.standSystemIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.selectIdList != null and param.selectIdList.size() > 0">
AND gb.ID IN
<foreach item="item" index="index" collection="param.selectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
@@ -0,0 +1,15 @@
<?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.roleReplacePosition.mapper.PositionRoleMapper">
<resultMap id="BaseResultMap" type="com.adc.da.slrs.roleReplacePosition.domain.PositionRole">
<id property="roleId" column="role_id" jdbcType="VARCHAR"/>
<id property="positionId" column="position_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
role_id,position_id
</sql>
</mapper>
@@ -203,6 +203,23 @@
where buss_stand_id = #{bussStandId} and valid_flag=0
</select>
<select id="getESStandMenu" resultType="com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu">
select
DISTINCT
sms.ID AS menuId,
stand.ID AS bussStandId
from sar_buss_stand_menu AS sm
LEFT JOIN sar_bussioness_stand AS stand
ON sm.BUSS_STAND_ID = stand.ID AND
stand.VALID_FLAG = 0
LEFT JOIN sar_menu_standard sms on sm.MENU_ID = sms.ID
where LENGTH(sm.MENU_ID) > 30
AND sms.MENU_NAME IS NOT NULL
AND sm.VALID_FLAG = 0
AND sm.TREE_TYPE is null
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
</select>
<delete id="deleteByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu">
delete from SAR_BUSS_STAND_MENU
where buss_stand_id = #{bussStandId, jdbcType=VARCHAR} and MENU_ID = #{menuId, jdbcType=VARCHAR}
@@ -362,6 +362,11 @@
where id = #{value}
</delete>
<update id="deleteStandSystem">
update sar_buss_stand_attr_info
set TXLBBUSS = null
where TXLBBUSS like #{menuName}
</update>
<!-- SAR_BUSSIONESS_STAND 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
@@ -1267,4 +1272,108 @@
where id = #{attfId}
</update>
<select id="getESSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
SELECT
DISTINCT
es.ID AS standId,
es.STAND_CODE AS standNo,
es.STAND_NAME AS standName,
es.TEXT_STATUS_BUSS AS standState,
es.ISSUE_TIME AS releaseDate,
es.PUT_TIME AS implementDate,
es.REPLACE_STAND_NUM AS replaceStandardNo,
esa.QCDW AS dept,
esa.QCRBUSS AS draftUserName,
'ENTERPRISE' AS dataSource,
sms.ID AS menuId,
3 AS standTypeSort,
CASE
when es.stand_code like concat('%', 'Q/FT A', '%') THEN 0
when es.stand_code like concat('%', 'Q/FT B', '%') THEN 1
when es.stand_code like concat('%', 'Q/FT E', '%') THEN 2
when es.stand_code like concat('%', 'Q/FT F', '%') THEN 3
when es.stand_code like concat('%', 'Q/FT G', '%') THEN 4
when es.stand_code like concat('%', 'Q/FT M', '%') THEN 5
when es.stand_code like concat('%', 'Q/FT Q', '%') THEN 6
when es.stand_code like concat('%', 'Q/FT R', '%') THEN 7
when es.stand_code like concat('%', 'Q/FT S', '%') THEN 8
when es.stand_code like concat('%', 'Q/FT T', '%') THEN 9
when es.stand_code like concat('%', 'Q/FT V', '%') THEN 10
when es.stand_code like concat('%', 'Q/FT X', '%') THEN 11
when es.stand_code like concat('%', 'Q/FT Y', '%') THEN 12
when es.stand_code like concat('%', 'Q/FT Z', '%') THEN 13
when es.stand_code like concat('%', 'Q/QCBFC', '%') THEN 14
when es.stand_code like concat('%', '雷萨企标Q/FL', '%') THEN 15
when es.stand_code like concat('%', 'Q/QCFLC', '%') THEN 16
ELSE 17
END AS standCategorySort
FROM
`sar_bussioness_stand` AS es
LEFT JOIN `sar_buss_stand_attr_info` AS esa ON es.ID = esa.STAND_ID
LEFT JOIN `sar_buss_stand_menu` AS m ON es.ID = m.BUSS_STAND_ID
AND LENGTH(m.MENU_ID) > 30
AND m.TREE_TYPE is null
AND m.VALID_FLAG = 0
LEFT JOIN sar_menu_standard sms on m.MENU_ID = sms.ID
WHERE 1 = 1
AND sms.id in (select id from sar_menu_standard where valid_flag = 0)
<!--标准编号-->
<if test="param.standNo != null and param.standNo != ''">
AND es.STAND_CODE LIKE CONCAT('%',#{param.standNo},'%')
</if>
<!--关联的节点IDList-->
<if test="param.menuIdList != null and param.menuIdList.size() > 0">
AND m.MENU_ID IN
<foreach item="item" index="index" collection="param.menuIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!--标准名称-->
<if test="param.standName != null and param.standName != ''">
AND es.STAND_NAME LIKE CONCAT('%',#{param.standName},'%')
</if>
<!--发布时间-->
<if test="param.startReleaseDate != null">
AND es.ISSUE_TIME >= #{param.startReleaseDateString}
</if>
<if test="param.endReleaseDate != null">
AND es.ISSUE_TIME &lt;= CONCAT(#{param.endReleaseDateString}, ' 23:59:59')
</if>
<!-- 实施日期 -->
<if test="param.startImplementDate != null">
AND es.PUT_TIME >= #{param.startImplementDate}
</if>
<if test="param.endImplementDate != null">
AND es.PUT_TIME &lt;= CONCAT(#{param.endImplementDate}, ' 23:59:59')
</if>
<!--代替标准-->
<if test="param.replaceStandardNo != null and param.replaceStandardNo != ''">
AND es.REPLACE_STAND_NUM LIKE CONCAT('%',#{param.replaceStandardNo},'%')
</if>
<!--编制单位-->
<if test="param.dept != null and param.dept != ''">
AND esa.QCDW LIKE CONCAT('%',#{param.dept},'%')
</if>
<!--起草人-->
<if test="param.draftUserName != null and param.draftUserName != ''">
AND esa.QCRBUSS LIKE CONCAT('%',#{param.draftUserName},'%')
</if>
<!--数据来源-->
<if test="param.dataSource != null and param.dataSource != ''">
AND 'ENTERPRISE' = #{param.dataSource}
</if>
<!--体系结构树搜索-->
<if test="param.standSystemIdList != null and param.standSystemIdList.size() > 0">
AND m.MENU_ID IN
<foreach item="item" index="index" collection="param.standSystemIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.selectIdList != null and param.selectIdList.size() > 0">
AND es.ID IN
<foreach item="item" index="index" collection="param.selectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
@@ -52,8 +52,14 @@
<if test="name != null and name != ''">
and `NAME` like concat('%',#{name},'%')
</if>
<if test="uploadTimeBegin != null and uploadTimeEnd == null">
and UPLOAD_TIME &gt;= DATE_FORMAT(#{uploadTimeBegin}, '%Y-%m-%d')
</if>
<if test="uploadTimeBegin == null and uploadTimeEnd!= null">
and UPLOAD_TIME &lt;= DATE_FORMAT(#{uploadTimeEnd}, '%Y-%m-%d')
</if>
<if test="uploadTimeBegin != null and uploadTimeEnd != null">
and UPLOAD_TIME between DATE_FORMAT(#{uploadTimeBegin}, '%Y-%m-%d') and DATE_FORMAT(${uploadTimeEnd}, '%Y-%m-%d')
and UPLOAD_TIME between DATE_FORMAT(#{uploadTimeBegin}, '%Y-%m-%d') and DATE_FORMAT(#{uploadTimeEnd}, '%Y-%m-%d')
</if>
<if test="treeNodeIdList != null and treeNodeIdList.size() &gt; 0">
and TREE_NODE_ID in
@@ -88,6 +94,6 @@
from sar_laws_information
where VALID_FLAG = 0
<include refid="Base_Where_Clause" />
order by ID asc
order by UPLOAD_TIME desc
</select>
</mapper>
@@ -466,7 +466,7 @@
</when>
<otherwise>
<if test='orderByA != null and orderByA != "" and order1 != null and order1 != ""'>
${orderByA} ${order1},
${orderByA} is null desc, ${orderByA} ${order1},
</if>
</otherwise>
</choose>
@@ -114,8 +114,14 @@
<if test="participatingUnit != null and participatingUnit != ''" >
and PARTICIPATING_UNIT like concat('%',#{participatingUnit},'%')
</if>
<if test="startTimeBegin!= null and startTimeEnd == null">
and START_TIME &gt;= DATE_FORMAT(#{startTimeBegin}, '%Y-%m-%d')
</if>
<if test="startTimeBegin == null and startTimeEnd != null" >
and START_TIME &lt;= DATE_FORMAT(#{startTimeEnd}, '%Y-%m-%d')
</if>
<if test="startTimeBegin != null and startTimeEnd != null">
and START_TIME between #{startTimeBegin} and ${startTimeEnd}
and START_TIME between DATE_FORMAT(#{startTimeBegin}, '%Y-%m-%d') and DATE_FORMAT(#{startTimeEnd}, '%Y-%m-%d')
</if>
<if test="topicStatus != null and topicStatus != ''" >
and TOPIC_STATUS = #{topicStatus}
@@ -135,12 +141,6 @@
<if test="meetingAddress != null and meetingAddress != ''">
and sltm.MEETING_ADDRESS like concat('%',#{meetingAddress},'%')
</if>
<!-- <if test="participantsList != null and participantsList.size() > 0" >-->
<!-- and PARTICIPANTS in-->
<!-- <foreach collection="participantsList" separator="," open="(" close=")" item="participant">-->
<!-- #{participant}-->
<!-- </foreach>-->
<!-- </if>-->
<if test="participants != null and participants != ''">
and sltm.PARTICIPANTS like concat('%',#{participants},'%')
</if>
@@ -182,26 +182,28 @@
</sql>
<select id="queryByPageCount" resultType="java.lang.Integer">
select count(slt.ID) from sar_laws_topic slt left join sar_laws_topic_meeting sltm on slt.ID = sltm.LAWS_TOPIC_ID
left join sar_laws_contact_information slci1 on slt.ID = slci1.LAWS_TOPIC_ID and slci1.GROUP_TYPE = 'topicGroup'
left join sar_laws_contact_information slci2 on slt.ID = slci2.LAWS_TOPIC_ID and slci2.GROUP_TYPE = 'inside'
where slt.VALID_FLAG = 0
<include refid="Base_Where_Clause"/>
<include refid="TopicMeeting_where" />
<include refid="ContactInformation_where" />
group by slt.ID
select count(1) from (
select count(slt.ID) from (select * from sar_laws_topic where VALID_FLAG = 0 <include refid="Base_Where_Clause"/>) slt
left join sar_laws_topic_meeting sltm on slt.ID = sltm.LAWS_TOPIC_ID
left join sar_laws_contact_information slci1 on slt.ID = slci1.LAWS_TOPIC_ID and slci1.GROUP_TYPE = 'topicGroup'
left join sar_laws_contact_information slci2 on slt.ID = slci2.LAWS_TOPIC_ID and slci2.GROUP_TYPE = 'inside'
where slt.VALID_FLAG = 0
<include refid="TopicMeeting_where" />
<include refid="ContactInformation_where" />
group by slt.ID
) a
</select>
<select id="queryByPage" resultMap="BaseResultMap">
select <include refid="Base_Join_Column_List" />
from sar_laws_topic slt left join sar_laws_topic_meeting sltm on slt.ID = sltm.LAWS_TOPIC_ID
from (select <include refid="Base_Column_List" /> from sar_laws_topic where VALID_FLAG = 0 <include refid="Base_Where_Clause"/>
order by ${sortField} ${sortMode} limit ${pager.startIndex-1},${pageSize}) slt
left join sar_laws_topic_meeting sltm on slt.ID = sltm.LAWS_TOPIC_ID
left join sar_laws_contact_information slci1 on slt.ID = slci1.LAWS_TOPIC_ID and slci1.GROUP_TYPE = 'topicGroup'
left join sar_laws_contact_information slci2 on slt.ID = slci2.LAWS_TOPIC_ID and slci2.GROUP_TYPE = 'inside'
where slt.VALID_FLAG = 0
<include refid="Base_Where_Clause"/>
<include refid="TopicMeeting_where" />
<include refid="ContactInformation_where" />
order by slt.${sortField} ${sortMode}
limit ${pager.startIndex-1},${pageSize}
</select>
<select id="getLawsTopicByIds" resultMap="BaseResultMap">
select <include refid="Base_Join_Column_List" />
@@ -212,7 +214,7 @@
<foreach collection="idList" open="(" close=")" separator="," item="id">
#{id}
</foreach>
order by slt.ID asc
order by slt.START_TIME desc
</select>
<select id="getAllLawsTopic" resultMap="BaseResultMap">
select <include refid="Base_Join_Column_List" />
@@ -223,6 +225,6 @@
<include refid="Base_Where_Clause"/>
<include refid="TopicMeeting_where" />
<include refid="ContactInformation_where" />
order by slt.ID asc
order by slt.START_TIME desc
</select>
</mapper>
@@ -35,4 +35,8 @@
select * from ts_role where ID in ( SELECT ROLE_ID FROM `ts_user_role` where USER_ID = #{userId})
</select>
<select id="getRoleDataByUserId" resultType="com.adc.da.slrs.sarRole.entity.TsRole">
select * from ts_role where ID in ( SELECT ROLE_ID FROM `ts_user_role` where USER_ID = #{userId})
</select>
</mapper>
@@ -48,5 +48,11 @@
where ID=#{id}
</update>
<update id="deleteStandSystem">
update sar_standards_info
set STAND_SYSTEM = null
where STAND_SYSTEM like #{menuName}
</update>
</mapper>
@@ -152,10 +152,10 @@
<select id="selectUserByRole" resultType="java.lang.Integer">
SELECT count(ts_user.USID) from ts_user
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
LEFT JOIN ts_user_position on ts_user.USID = ts_user_position.user_id
WHERE ts_user_position.position_id in (
SELECT ts_position_role.position_id from ts_position_role
WHERE ts_position_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
LEFT JOIN ts_user_role on ts_user.USID = ts_user_role.user_id
WHERE ts_user_role.role_id in (
SELECT ts_user_role.role_id from ts_user_role
WHERE ts_user_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
<if test="null != role.userId and role.userId != ''">
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
</if>
@@ -174,10 +174,10 @@
<select id="selectUserByRoleByPage" resultMap="UserPosition">
SELECT ts_user.UNAME,ts_user.USID,ts_user.INSTITUTION_ID , ts_institution.name as institution_name from ts_user
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
LEFT JOIN ts_user_position on ts_user.USID = ts_user_position.user_id
WHERE ts_user_position.position_id in (
SELECT ts_position_role.position_id from ts_position_role
WHERE ts_position_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
LEFT JOIN ts_user_role on ts_user.USID = ts_user_role.user_id
WHERE ts_user_role.role_id in (
SELECT ts_user_role.role_id from ts_user_role
WHERE ts_user_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
<if test="null != role.userId and role.userId != ''">
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
</if>
@@ -2,4 +2,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.tsRoleMeunData.dao.TsRoleMenuDataDao">
<insert id="insertResourceMenuData">
INSERT INTO ts_role_menu_data
VALUES(#{roleId},#{menuId} )
</insert>
</mapper>
@@ -0,0 +1,15 @@
<?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.roleReplacePosition.mapper.UserPositionMapper">
<resultMap id="BaseResultMap" type="com.adc.da.slrs.roleReplacePosition.domain.UserPosition">
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="positionId" column="position_id" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
user_id,position_id
</sql>
</mapper>
@@ -1,6 +1,10 @@
package com.adc.da.sys.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
/**
@@ -9,9 +13,17 @@ import com.adc.da.base.entity.BaseEntity;
* <b>日期</b> 2018-09-03 <br>
* <b>版权所有<b>版权归北京卡达克数据技术中心所有<br>
*/
@EqualsAndHashCode(callSuper = true)
@Getter
@TableName("TS_USER_ROLE")
@Data
public class UserRoleEO extends BaseEntity {
/**
*/
private String roleId;
/**
*/
private String userId;
/**
@@ -43,22 +55,12 @@ public class UserRoleEO extends BaseEntity {
default: return null;
}
}
/** **/
public String getRoleId() {
return this.roleId;
}
/** **/
public void setRoleId(String roleId) {
this.roleId = roleId;
}
/** **/
public String getUserId() {
return this.userId;
}
/** **/
public void setUserId(String userId) {
this.userId = userId;
@@ -15,8 +15,11 @@ import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
/**
* <p>
@@ -60,10 +63,18 @@ public class SarMenuStandard extends BaseEntity {
@TableField("PARENT_IDS")
private String parentIds;
@TableField(exist = false)
@ApiModelProperty(value = "级联菜单显示")
private String menuNames;
@ApiModelProperty(value = "排序序号")
@TableField("DISPLAY_SEQ")
private Integer displaySeq;
@ApiModelProperty(value = "排序")
@TableField(exist = false)
private Integer systemSort;
@ApiModelProperty(value = "路径")
@TableField("HREF")
private String href;
@@ -107,4 +118,122 @@ public class SarMenuStandard extends BaseEntity {
@TableField(exist = false)
private String treeType;
@ApiModelProperty(value = "树层级")
@TableField(exist = false)
private Integer level;
@TableField(exist = false)
private Integer gbStandCount;
@TableField(exist = false)
private Integer fbStandCount;
@TableField(exist = false)
private Integer esStandCount;
@TableField(exist = false)
private List<String> gbStandIdList;
@TableField(exist = false)
private List<String> fbStandIdList;
@TableField(exist = false)
private List<String> esStandIdList;
// 添加用于计算和设置关联关系数量的方法
// 添加用于计算和设置关联关系数量的方法
public void calculateAndSetCounts(List<StandMenuRelation> gbStandMenu, List<StandMenuRelation> fbStandMenu, List<StandMenuRelation> esStandMenu, Integer curLevel) {
this.gbStandIdList = new ArrayList<>();
this.fbStandIdList = new ArrayList<>();
this.esStandIdList = new ArrayList<>();
this.level = curLevel;
this.gbStandCount = countMatches(gbStandMenu, this.id, gbStandIdList);
this.fbStandCount = countMatches(fbStandMenu, this.id, fbStandIdList);
this.esStandCount = countMatches(esStandMenu, this.id, esStandIdList);
if (children != null && !children.isEmpty()) {
for (SarMenuStandard child : children) {
child.calculateAndSetCounts(gbStandMenu, fbStandMenu, esStandMenu, curLevel + 1);
this.gbStandCount += child.gbStandCount;
this.gbStandIdList.addAll(child.gbStandIdList);
this.fbStandCount += child.fbStandCount;
this.fbStandIdList.addAll(child.fbStandIdList);
this.esStandCount += child.esStandCount;
this.esStandIdList.addAll(child.esStandIdList);
}
}
}
private int countMatches(List<StandMenuRelation> standMenuList, String menuId, List<String> standIdList) {
int count = 0;
// 计算与menuId匹配的项的数量
for (StandMenuRelation standMenu : standMenuList) {
if (standMenu.getMenuId().equals(menuId)) {
count++;
standIdList.add(standMenu.getStandId());
}
}
return count;
}
// 添加用于构建映射的方法
public void buildPathMap(Map<String, String> pathMap, String parentPath) {
String currentPath = parentPath.isEmpty() ? this.menuName : parentPath + "/" + this.menuName;
pathMap.put(this.id, currentPath);
for (SarMenuStandard child : children) {
child.buildPathMap(pathMap, currentPath);
}
}
// 添加用于收集子节点ID的方法
public void collectChildIds(List<String> childIds) {
childIds.add(this.id);
for (SarMenuStandard child : children) {
child.collectChildIds(childIds);
}
}
public static SarMenuStandard findNodeById(SarMenuStandard node, String menuId) {
if (node == null) {
return null;
}
// 检查当前节点的ID是否匹配
if (menuId.equals(node.getId())) {
return node;
}
// 在子节点中递归搜索
for (SarMenuStandard child : node.getChildren()) {
SarMenuStandard found = findNodeById(child, menuId);
if (found != null) {
return found;
}
}
// 如果在当前节点及其子节点中都没有找到返回null
return null;
}
// 递归方法来设置每个节点的 systemSort
public static void setSystemSort(SarMenuStandard node, String parentSort) {
// 计算当前节点的 systemSort
String currentSort = parentSort.isEmpty() ? String.valueOf(node.getDisplaySeq()) : parentSort + node.getDisplaySeq();
// 设置当前节点的 systemSort
node.setSystemSort(Integer.parseInt(currentSort));
// 递归设置子节点的 systemSort
for (SarMenuStandard child : node.getChildren()) {
setSystemSort(child, currentSort);
}
}
// 新增的深度优先遍历方法
public static void setSystemSortDFS(SarMenuStandard node, AtomicInteger currentNumber) {
if (node == null) {
return;
}
node.setSystemSort(currentNumber.getAndIncrement());
for (SarMenuStandard child : node.getChildren()) {
setSystemSortDFS(child, currentNumber);
}
}
}
@@ -0,0 +1,20 @@
package com.adc.da.sys.sarMenuStandard.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author: Mzaxd
* @Date: 2023/11/14 16:31
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StandMenuRelation {
private String standId;
private String menuId;
}
@@ -119,6 +119,7 @@ public class SarMenuStandardServiceImpl extends ServiceImpl<SarMenuStandardDao,
List<SarMenuStandard> remove=new ArrayList<>();
for (SarMenuStandard sarMenuStandard:sarMenus) {
if (null==sarMenuStandard.getParentId() ){
sarMenuStandard.setMenuNames(sarMenuStandard.getMenuName());
dtas.add(sarMenuStandard);
remove.add(sarMenuStandard);
}
@@ -135,6 +136,7 @@ public class SarMenuStandardServiceImpl extends ServiceImpl<SarMenuStandardDao,
List<SarMenuStandard> children=new ArrayList<>();
sarMenuStandards.forEach(sarMenuStandard -> {
if (Menu.getId().equals(sarMenuStandard.getParentId())){
sarMenuStandard.setMenuNames(Menu.getMenuNames()+"/"+sarMenuStandard.getMenuName());
children.add(sarMenuStandard);
}
});
@@ -3,5 +3,9 @@ package com.adc.da.sys.service;
import com.adc.da.sys.entity.UserRoleEO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface IUserRoleEOService extends IService<UserRoleEO> {
List<String> getRoleIdsByUserId(String userId);
}
@@ -3,11 +3,16 @@ package com.adc.da.sys.service.impl;
import com.adc.da.sys.dao.UserRoleEODao;
import com.adc.da.sys.entity.UserRoleEO;
import com.adc.da.sys.service.IUserRoleEOService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
*
@@ -21,4 +26,10 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class UserRoleEOServiceImpl extends ServiceImpl<UserRoleEODao, UserRoleEO> implements IUserRoleEOService {
@Override
public List<String> getRoleIdsByUserId(String userId) {
return this.list(new LambdaQueryWrapper<UserRoleEO>()
.eq(UserRoleEO::getUserId, userId))
.stream().map(UserRoleEO::getRoleId).distinct().collect(Collectors.toList());
}
}
@@ -0,0 +1,36 @@
package com.adc.da.sys.util;
import org.springframework.beans.BeanUtils;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Mzaxd
* @since 2022-11-22 15:36
*/
public class BeanCopyUtils {
private BeanCopyUtils() {
}
public static <V> V copyBean(Object source, Class<V> clazz){
V result = null;
//创建目标对象
try {
result = clazz.newInstance();
//实现属性copy
BeanUtils.copyProperties(source, result);
} catch (Exception e) {
e.printStackTrace();
}
//返回结果
return result;
}
public static <O,V> List<V> copyBeanList(List<O> list, Class<V> clazz) {
return list.stream()
.map(o -> copyBean(o, clazz))
.collect(Collectors.toList());
}
}