Merge remote-tracking branch 'origin/develop_master' into FOTON_RELEASE

# Conflicts:
#	adc-da-main/src/main/resources/application-dev.properties
This commit is contained in:
2510220824
2021-11-19 11:24:00 +08:00
308 changed files with 19621 additions and 1204 deletions
@@ -399,4 +399,10 @@ public interface workFlowFeignClient {
// @RequestMapping(value = "/bat-wkflow/findProcessNameByPrcNum",method = RequestMethod.POST)
// List<BusProcessName> findProcessNameByPrcNum(@RequestBody String taskId);
@RequestMapping(value = "/bat-wkflow/datas/bus-process-new/everyDayTenOlock",method = RequestMethod.GET)
List<BusProcessNew> everyDayTenOlock();
@RequestMapping(value = "/bat-wkflow/datas/bus-process-new/everyDayTenOlockSAM",method = RequestMethod.GET)
List<BusProcessNew> everyDayTenOlockSAM();
}
@@ -1,10 +1,19 @@
package com.adc.da.Timer;
import com.adc.da.FeignClient.workFlowFeignClient;
import com.adc.da.common.BusMes;
import com.adc.da.common.BusProcessName;
import com.adc.da.common.BusProcessNew;
import com.adc.da.common.Wrapper;
import com.adc.da.http.ResponseMessage;
import com.adc.da.sys.common.EmailUtils;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.service.IUserEOService;
import com.adc.da.workFlow.controller.WorkFlowController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -13,6 +22,7 @@ import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -23,6 +33,7 @@ import java.util.List;
*/
@Component
@EnableScheduling
@Slf4j
public class ProcessTimer {
@Autowired
@@ -34,6 +45,9 @@ public class ProcessTimer {
@Autowired
private IUserEOService userEOService;
@Autowired
private WorkFlowController workFlowController;
/***
* @Description: 自动催办,任务截至时间前3天开始每天催办
* @Author: yangxuenan
@@ -46,14 +60,14 @@ public class ProcessTimer {
// @Scheduled(cron = "0/20 * * * * ?")
public void urging() {
List<BusProcessName> busProcessNames = workFlowFeignClient.queryBusProcessNameForEnd(null);
if(null != busProcessNames && 0 < busProcessNames.size()){
for (BusProcessName busProcessName : busProcessNames){
if (null != busProcessNames && 0 < busProcessNames.size()) {
for (BusProcessName busProcessName : busProcessNames) {
String type = busProcessName.getPrcType();
Integer typeInt = 99;
if (StringUtils.isNotEmpty(type)){
if (StringUtils.isNotEmpty(type)) {
typeInt = Integer.valueOf(type);
}
type = chooseType(typeInt,type);
type = chooseType(typeInt, type);
UserEO userEO = userEOService.selectByPrimaryKey(busProcessName.getCreatUserName());
String[] array = userEO.getEmail().split(",");
@@ -64,30 +78,30 @@ public class ProcessTimer {
try {
dateTime = simpleDateFormat.parse(overTime);
Date now = new Date();
long daysBetween = (dateTime.getTime()-now.getTime()+1000000)/(60*60*24*1000);
long daysBetween = (dateTime.getTime() - now.getTime() + 1000000) / (60 * 60 * 24 * 1000);
num = Integer.valueOf(String.valueOf(daysBetween));
} catch (ParseException e) {
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
try {
dateTime = simpleDateFormat1.parse(overTime);
Date now = new Date();
long daysBetween = (dateTime.getTime()-now.getTime()+1000000)/(60*60*24*1000);
long daysBetween = (dateTime.getTime() - now.getTime() + 1000000) / (60 * 60 * 24 * 1000);
num = Integer.valueOf(String.valueOf(daysBetween));
} catch (ParseException e1) {
e.getMessage();
}
}
String msg = "您好,["+ busProcessName.getPrcNum() +"]-["+ busProcessName.getPrcName() +"] 您有待办任务未及时办理,距离截至日期还有["+ String.valueOf(num) +"]天 请及时办理,请登录全球标准法规管理系统 ( http://39.98.140.126:10005/#/login ) 办理:链接 ( http://39.98.140.126:10005/#/processCenter?tabsName=ProcessCenter ) 。\n" +
String msg = "您好,[" + busProcessName.getPrcNum() + "]-[" + busProcessName.getPrcName() + "] 您有待办任务未及时办理,距离截至日期还有[" + String.valueOf(num) + "]天 请及时办理,请登录全球标准法规管理系统 ( http://39.98.140.126:10005/#/login ) 办理:链接 ( http://39.98.140.126:10005/#/processCenter?tabsName=ProcessCenter ) 。\n" +
" ——来自 全球标准法规管理系统";
String title = "GSRM——【待办任务】["+ type +"] 您有未完成的待办任务";
mailUtil.sendMsgFeign(array,title,msg);
String title = "GSRM——【待办任务】[" + type + "] 您有未完成的待办任务";
mailUtil.sendMsgFeign(array, title, msg);
}
}
}
public String chooseType(Integer typeInt,String type) {
public String chooseType(Integer typeInt, String type) {
switch (typeInt) {
case 1:
type = "法规入库及评估流程";
@@ -151,4 +165,60 @@ public class ProcessTimer {
}
return type;
}
@Scheduled(cron = "0 0 10 * * ? ")//每天十点执行
// @Scheduled(cron = "*/20 * * * * ? ")//每天十点执行
public void everyDayTenOlockScan() {
List<BusProcessNew> busProcessNews=new ArrayList<>();
busProcessNews=workFlowFeignClient.everyDayTenOlock();
if (!busProcessNews.isEmpty()){
for (BusProcessNew bus:busProcessNews) {
JSONObject jsonObject= JSON.parseObject(bus.getMesg());
jsonObject.put("auto","1");
ResponseMessage responseMessage = workFlowController.startProcessNew("19",jsonObject.getString("revisionId"),null);
BusMes busMes=new BusMes();
busMes.setTaskIds(String.valueOf(responseMessage.getData()));
busMes.setJson(jsonObject.toJSONString());
busMes.setUserId(jsonObject.getString("revisionId"));
Wrapper<String> wrapper=workFlowFeignClient.completeTaskByUserId(busMes);
log.info("政策课题组会后流程已发起");
}
}
}
@Scheduled(cron = "0 0 10 * * ? ")//每天十点执行
// @Scheduled(cron = "*/40 * * * * ? ")//20s
public void everyDayTenOlockScanSAM() {
List<BusProcessNew> busProcessNews=new ArrayList<>();
busProcessNews=workFlowFeignClient.everyDayTenOlockSAM();
if (!busProcessNews.isEmpty()){
for (BusProcessNew bus:busProcessNews) {
JSONObject jsonObject= JSON.parseObject(bus.getMesg());
String taskInfo = bus.getTaskInfo();
String result = jsonObject.getJSONObject("roleList").getString("dockUser");
result = result.split(",")[0];
jsonObject.put("member",result);
if(taskInfo.equals("标准化活动参会流程-流程结束")){
jsonObject.put("auto","1");
ResponseMessage responseMessage = workFlowController.startProcessNew("22",result,null);
BusMes busMes=new BusMes();
busMes.setTaskIds(String.valueOf(responseMessage.getData()));
busMes.setJson(jsonObject.toJSONString());
busMes.setUserId(result);
Wrapper<String> wrapper=workFlowFeignClient.completeTaskByUserId(busMes);
System.out.println("标准化活动会后流程自动发起");
}
}
}
}
public static void main(String[]args){
ProcessTimer processTimer = new ProcessTimer();
processTimer.everyDayTenOlockScan();
processTimer.everyDayTenOlockScanSAM();
}
}
@@ -25,6 +25,32 @@ public class ActDefineStartMap {
map.put("8","nonConformanceRectificationKey");
map.put("9","standardReadWkflow");
map.put("10","itemlistvalidationprocessKey");
// 政策入库
map.put("laws1","lawsLibraryWkflow");
//政策征求意见, 认证重点法规/政策 流程
map.put("laws2","PolicyCommentProcessWorkFlow");
map.put("laws3","KCSTPReviewProcessWorkFlow");
//张超然
map.put("20","StandardApplyMeetProcess");
map.put("21","StandardMeetProcess");
map.put("22","StandardAfterMeetProcess");
//李奥
map.put("14","ParticipateRevisionFiling");
map.put("15","JoinStandardFiling");
map.put("16","RecommendedApprovalleo");
//孔维一
map.put("17","policyResearchGroupEnrollment");
map.put("18","policyResearchGroupAttendMeeting");
map.put("19","policyResearchGroupAfterMeeting");
//企标复审流程
map.put("23","enterpriseBidReviewProcess");
map.put("24","Aboliish");
map.put("25","enterpriseStandardSystemRevisionPlan");
return map.get(type);
}
}
@@ -0,0 +1,99 @@
package com.adc.da.workFlow.common;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import sun.awt.SunHints;
import java.util.List;
import java.util.Map;
public class ExportExcel<T> {
private String header;
private static String[] property;
Workbook workbook=new XSSFWorkbook();
public void setProperty(String property){
this.property=property.split(",");
}
public void setHeader(String header){
this.header=header;
}
public Workbook getWorkBook(T dataJson) throws Exception {
JSONArray dataArray = JSONObject.parseArray(dataJson.toString());
CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象
cellStyle.setAlignment(HorizontalAlignment.CENTER);
Sheet sheet = workbook.createSheet();
sheet.setDefaultColumnWidth(25);
createHeader(sheet,header);
createData(sheet,dataArray);
return workbook;
}
public static void createHeader(Sheet sheet, String header){
Row rowHeader = sheet.createRow(0);//开始创建标题行
if (StringUtils.isNotBlank(header)) {
String[] headerArr = header.split(",");
for (int i=0;i < headerArr.length; i++) {
rowHeader.createCell(i).setCellValue(headerArr[i]);
}
}
}
public static void createData(Sheet sheet, List<?> data) throws Exception{
if (data != null && !data.isEmpty()) {
for (int i=0;i < data.size(); i++) {
Row row = sheet.createRow(i+1);
int sheetNum = 0;
JSONObject datumJson =(JSONObject)data.get(i);
/**
* 遍历jsonObject值填入一行的单元格中
*/
for (String s : property) {
String value = datumJson.getString(s);
row.createCell(sheetNum).setCellValue(value);
sheetNum++;
}
// Class cls = importDto.getClass();
// Field[] fields = cls.getDeclaredFields();
// for (Field field : fields) {
// field.setAccessible(true);
// if (field.get(importDto)!=null){
// String value = field.get(importDto).toString();
// row.createCell(sheetNum).setCellValue(value);
// }else {
// row.createCell(sheetNum).setCellValue("");
// }
// sheetNum++;
// }
}
}
}
}
@@ -0,0 +1,39 @@
package com.adc.da.workFlow.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.sarStandardsInfo.entity.ActSarItemsEO;
import com.adc.da.workFlow.service.ActSarItemsEOService;
import com.adc.da.workFlow.service.ActSarItemsLawsEOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/${restPath}/lawss/actSarItemsLaws")
@Api(description = "|ActSarItemsEO|")
public class ActSarItemsLawsEOController extends BaseController<ActSarItemsEO> {
@Autowired
private ActSarItemsLawsEOService actSarItemsEOService;
// private static final Logger logger = LoggerFactory.getLogger(AttFileEOController.class);
@ApiOperation(value = "|SarLawsStandInfo|政策入库流程")
@PostMapping("/processCreateLaws")
public ResponseMessage processCreateLaws(String infoJson) throws Exception {
if (StringUtils.isNotBlank(infoJson)) {
actSarItemsEOService.processCreateLaws(infoJson);
return Result.success("入库成功");
} else {
return Result.error("传入数据json不能为空");
}
}
}
@@ -0,0 +1,69 @@
package com.adc.da.workFlow.controller;
import com.adc.da.common.ReadExcel;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.workFlow.common.ExportExcel;
import com.adc.da.workFlow.service.PolicyWorkFlowService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/${restPath}/policy/activiti")
@Api(tags = "政策征求意见和重点法规或政策认证流程")
public class PolicyWorkFlowController {
/**
* 政策征求意见导出
*/
@PostMapping("/exportExcel")
@ApiOperation("导出政策征求意见为excel")
public void exportExcel(@RequestBody String dataJson, HttpServletResponse response, HttpServletRequest request) throws Exception {
JSONObject data = JSONObject.parseObject(dataJson);
JSONArray info = data.getJSONArray("dataList");
ExportExcel exportExcel = new ExportExcel();
exportExcel.setHeader("章节编号,章节名称,修改前,修改后,修改理由,原因,提出部门,提出人");
exportExcel.setProperty("chapterNumber,chapterName,oldText,newText,changeReason,reason,department,responUserName");
Workbook workbook=exportExcel.getWorkBook(info);
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment; filename=" + ReadExcel.encodeFileName("政策征求意见"+".xlsx",request));
// response.setContentType("application/force-download");
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.flush();
}
@Autowired
private PolicyWorkFlowService policyWorkFlowService;
/**
* 政策征求意见导出
*/
@PostMapping("/enterIssue")
@ApiOperation("纳入重点问题管控")
public ResponseMessage enterIssue(@RequestBody String json){
boolean result = policyWorkFlowService.enterIssue(json);
return Result.success(result);
}
}
@@ -122,6 +122,16 @@ public class WorkFlowController {
}
}
@ApiOperation(value = "定时任务启动流程-以流程定义id")
@GetMapping("/startProcessNew")
public ResponseMessage startProcessNew(@RequestParam("type") String type, @RequestParam(value="userId",required = false) String userId, @RequestParam(value="id",required = false) String id){
if(StringUtils.isNotBlank(type)){
return this.activiti_define_start(ActDefineStartMap.actDefineStartMap(type), userId,id);
}else {
return null;
}
}
@ApiOperation(value = "待办任务详情")
@GetMapping("/todotask")
public PageInfo<BusProcessNew> todotask(@RequestParam("userId") String userId, @RequestParam("pId") String pId){
@@ -514,13 +524,22 @@ public class WorkFlowController {
map.put("flag","未完成");
}
if(map.get("comment")!=null && !map.get("comment").toString().equals("")){
if(map.get("comment").toString().equals("0")){
map.put("comment","同意");
}else if(map.get("comment").toString().equals("1")){
map.put("comment","同意");
}else{
map.put("comment",map.get("commentText").toString());
String comment = map.get("comment").toString();
switch (comment){
case "0":
map.put("comment","同意");
break;
case "1":
map.put("comment","不同意");
break;
default:
String commentText="";
map.put("comment",comment+map.get("commentText"));
}
}else if (map.get("commentText")!=null && !"".equals(map.get("commentText"))){
map.put("comment",map.get("commentText").toString());
}
ProcessDetailExport user = JSON.parseObject(JSON.toJSONString(map), ProcessDetailExport.class);
exportDatas.add(user);
@@ -1,9 +1,11 @@
package com.adc.da.workFlow.dao;
import com.adc.da.slrs.sarStandardsInfo.entity.ActSarItemsEO;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ActSarItemsEODao {
List<ActSarItemsEO> queryByPage(ActSarItemsEO actSarItemsEO);
@@ -0,0 +1,918 @@
package com.adc.da.workFlow.service;
import com.adc.da.common.PropertyTypeEnum;
import com.adc.da.common.SarConformStateEnum;
import com.adc.da.common.SarStateColorEnum;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.login.util.UserUtils;
import com.adc.da.slrs.SarCompResAssess.entity.SarCompResAssess;
import com.adc.da.slrs.SarCompResAssess.service.ISarCompResAssessService;
import com.adc.da.slrs.SarCompStatusInfo.dao.SarCompStatusInfoDao;
import com.adc.da.slrs.SarCompStatusInfo.entity.SarCompStatusInfo;
import com.adc.da.slrs.SarFileSplitItems.entity.SarFileSplitItems;
import com.adc.da.slrs.SarFileSplitItems.service.ISarFileSplitItemsService;
import com.adc.da.slrs.SarStandItemVal.dao.SarStandItemValDao;
import com.adc.da.slrs.SarStandItemVal.entity.SarStandItemVal;
import com.adc.da.slrs.sarLawsAttrInfo.dao.SarLawsAttrInfoDao;
import com.adc.da.slrs.sarLawsAttrInfo.service.ISarLawsAttrInfoService;
import com.adc.da.slrs.sarLawsItemVal.dao.SarLawsItemValDao;
import com.adc.da.slrs.sarLawsItems.dao.SarLawsItemsDao;
import com.adc.da.slrs.sarLawsItems.entity.SarLawsItems;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
import com.adc.da.slrs.sarLawsStandInfo.service.ISarLawsStandInfoService;
import com.adc.da.slrs.sarStandAttrInfo.service.ISarStandAttrInfoService;
import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao;
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.sys.constant.ValueStateEnum;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.adc.da.workFlow.dao.ActSarItemsEODao;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
@Service("actSarItemsLawsEOService")
@Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class ActSarItemsLawsEOService {
private static final Logger logger = LoggerFactory.getLogger(ActSarItemsLawsEOService.class);
@Autowired
private ActSarItemsEODao actSarItemsEODao;
@Autowired
private SarLawsItemsDao sarLawsItemsDao;
@Autowired
private SysInfoEOService sysInfoEOService;
@Autowired
private ISarLawsStandInfoService sarLawsStandInfoService;
@Autowired
private ISarLawsAttrInfoService iSarLawsAttrInfoService;
@Autowired
private ISarUpdLogService sarUpdLogEOService;
@Autowired
private SarCompStatusInfoDao sarCompStatusInfoEODao;
@Autowired
private ISarCompResAssessService sarCompResAssessEOService;
@Autowired
private ISarFileSplitItemsService sarFileSplitItemsEOService;
@Autowired
private SarLawsItemValDao sarLawsItemValDao;
@Value("${elas.flag}")
private boolean elasflag;
/**
* 标准解读流程入库"
* @param standJson
* @throws Exception
*/
public void createStandardRead(String standJson) throws Exception{
JSONObject object = JSONObject.parseObject(standJson);
String fileName = object.getString("fileName");
String fileType = object.getString("fileType");
String creationTime = object.getString("creationTime");
String creationUser = object.getString("creationUser");
String standId = object.getString("standId");
//数组去重
JSONArray responUserList1 = object.getJSONArray("itemList");
for (Object obj:responUserList1) {
JSONObject object1 = (JSONObject) obj;
JSONArray preResponUserList = object1.getJSONArray("zxUserId");
String oldNumber = object1.getString("oldNumber");
String itemsNum = object1.getString("itemsNum");
String itemsName = object1.getString("itemsName");
String itemsTitle = object1.getString("itemsTitle");
String applyArcticId = object1.getString("applyArcticId");
String applyArctic = object1.getString("applyArctic");
String changePoint = object1.getString("changePoint");
String technicalRequir = object1.getString("technicalRequir");
String onlineData = object1.getString("onlineData");
String newData = object1.getString("newData");
String complianceRequir = object1.getString("complianceRequir");
String complianceState = object1.getString("complianceState");
}
}
/***
* @Description: 国内外标准流程入库"
* @Author: yangxuenan
* @Date: 2020/12/7 13:48
* @Param: [standJson]
* @Return: void
*/
public void processCreateLaws(String standJson) throws Exception{
Map<String,Object> standMap = new HashMap();
standMap = JSONObject.parseObject(standJson);
if (standMap != null && !standMap.isEmpty()) {
String prcNum = String.valueOf(standMap.get("prcNum"));
String prcName = String.valueOf(standMap.get("prcName"));
String standType = String.valueOf(standMap.get("standType"));
// String isJudge = String.valueOf(standMap.get("ifIn")); //是否经过技术评估
SarLawsStandInfo sarLawsStandInfo = new SarLawsStandInfo();
// if(standMap.containsKey("standId")) {
// if (standMap.get("standId") != null && !standMap.get("standId").toString().equals("")) {
// String resId = standMap.get("standId").toString();
// //此处说明是带入的形式
// sarStandardsInfoEO.setId(resId);
// SarCompResAssess assessInfoByResId = sarCompResAssessEOService.ssessInfoByResId(resId);
// if (assessInfoByResId != null) {
// assessInfoByResId.setProcessState("2");
// sarCompResAssessEOService.updateByPrimaryKeySelective(assessInfoByResId);
// }
// }
// }
Map<String,Object> attInfoMap = new HashMap<>();
List<String> jsonArray = new ArrayList<>();
Object breakVal = null;
Object itemList = null;
for (Map.Entry<String,Object> entry : standMap.entrySet()) {
String field = entry.getKey().toUpperCase();
Object value = entry.getValue();
if (InitStandAttrUtil.queryFieldListLaws.contains(field)) {
if (value != null && value instanceof JSONArray) {
String valStr = String.valueOf(value);
List<String> valueArr = JSONArray.parseArray(valStr,String.class);
if (valueArr != null && !valueArr.isEmpty()) {
String newValue = "";
for (String val : valueArr) {
newValue += val + ",";
}
newValue = newValue.substring(0,newValue.length()-1);
value = newValue;
}
}
attInfoMap.put(field,value);
} else {
createStandBaseField(sarLawsStandInfo,entry.getKey(),value);
}
}
//处理文件
//此处需要处理之前的文件信息,防止文件丢失
// attInfoMap = saveFileMsg(attInfoMap,sarStandardsInfoEO.getFileIds(),sarStandardsInfoEO.getTextStatus());
String resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
sarLawsStandInfo.setSarStandAttrEOStr(resData);
// 根据标准号判断数据是否已存在
//2021年4月9日 此处检查当前是否存在standId
String lawsNumber = "";
if(StringUtils.isNotBlank(sarLawsStandInfo.getLawsNumber()) && !"null".equals(sarLawsStandInfo.getLawsNumber())){
lawsNumber = sarLawsStandInfo.getLawsNumber();
}
List<SarLawsStandInfo> lawsList = sarLawsStandInfoService.selectStandardsByStandNumber(lawsNumber);
// if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "INLAND".equals(sarStandardsInfoEO.getStandType())) {
// sarStandardsInfoEO.setMenuId("64df1d5522bb49c09af2");
// sarStandardsInfoEO.setCountry("CN");
// } else if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "FOREIGN".equals(sarStandardsInfoEO.getStandType())) {
// sarStandardsInfoEO.setMenuId("22179d54d4e640098e29");
// }
//此处判断是否是带入的标准
if(StringUtils.isNotBlank(sarLawsStandInfo.getId())) {
SarLawsStandInfo query = new SarLawsStandInfo();
query.setId(sarLawsStandInfo.getId());
sarLawsStandInfoService.attrInfoDetails(query);
Map<String, Object> attrInfoMap = query.getAttrInfoMap();
if(attInfoMap!=null && !attInfoMap.isEmpty()){
updateStandFileFieldData(attInfoMap,attrInfoMap);
resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
sarLawsStandInfo.setSarStandAttrEOStr(resData);
}
// 查询原相关流程
String relatePro = iSarLawsAttrInfoService.selectFieldValByLawsId("XGLC",sarLawsStandInfo.getId());
if (StringUtils.isNotBlank(relatePro)) {
String[] processSplit = relatePro.split(",");
Set<String> processSet = new HashSet<>();
for(String sData:processSplit){
processSet.add(sData);
}
processSet.add(prcNum);
relatePro = StringUtils.join(processSet.toArray(), ",");
} else {
relatePro = prcNum;
}
// 编辑标准
sarLawsStandInfoService.updateSarLawsStandInfo(sarLawsStandInfo);
// 编辑相关流程
iSarLawsAttrInfoService.updateLawsInfo(sarLawsStandInfo.getId(),"XGLC",relatePro);
String content = "新增一条相关流程:" +prcName+" "+prcNum;
sarUpdLogEOService.createBaseLog(sarLawsStandInfo.getId(),standType+"_STAND",content);
}else if (lawsList != null && !lawsList.isEmpty()) {//Id不存在,但是标准号存在的情况
String standId = lawsList.get(0).getId();
SarLawsStandInfo query = new SarLawsStandInfo();
query.setId(standId);
sarLawsStandInfoService.attrInfoDetails(query);
Map<String, Object> attrInfoMap = query.getAttrInfoMap();
if(attInfoMap!=null && !attInfoMap.isEmpty()){
updateStandFileFieldData(attInfoMap,attrInfoMap);
resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
sarLawsStandInfo.setSarStandAttrEOStr(resData);
}
// 查询原相关流程
String relatePro = iSarLawsAttrInfoService.selectFieldValByLawsId("XGLC",standId);
if (StringUtils.isNotBlank(relatePro)) {
String[] processSplit = relatePro.split(",");
Set<String> processSet = new HashSet<>();
for(String sData:processSplit){
processSet.add(sData);
}
processSet.add(prcNum);
relatePro = StringUtils.join(processSet.toArray(), ",");
} else {
relatePro = prcNum;
}
// 编辑标准
sarLawsStandInfo.setId(standId);
sarLawsStandInfoService.updateSarLawsStandInfo(sarLawsStandInfo);
// 编辑相关流程
iSarLawsAttrInfoService.updateLawsInfo(standId,"XGLC",relatePro);
String content = "新增一条相关流程:" +prcName+" "+prcNum;
sarUpdLogEOService.createBaseLog(standId,standType+"_STAND",content);
} else {//标准号、ID都不存在的情况
// 新增方法
sarLawsStandInfoService.createSarStandardsInfo(sarLawsStandInfo);
// 编辑相关流程
iSarLawsAttrInfoService.updateLawsInfo(sarLawsStandInfo.getId(),"XGLC",prcNum);
}
List<SarStandItems> allItems = new ArrayList<>();
//开始处理条款数据,从去重后的结果中直接处理即可
// if(itemData!=null && !itemData.isEmpty()){
// // allItems =
// saveStandItemsData(itemData, sarStandardsInfoEO);
// }
//技术评估结果入库 重构技术评估结果入库内容
// if ("0".equals(isJudge)) {
// saveCompStatusInfo(sarStandardsInfoEO,breakVal,allItems,prcNum);
// }
}
}
/***
* 标准法规入库流程中技术评估结果入库归档操作
* @param sarStandardsInfoEO
* @param allItems
* @param prcNum
*/
public void saveCompStatusInfo (SarStandardsInfo sarStandardsInfoEO,Object taskBreak,List<SarStandItems> allItems,String prcNum) throws Exception {
//首先将入库的标准条款通过之前的拆分库ID转换成入库后的条款的对应关系
Map<String,String> itemConvertDataMap = new HashMap<>();
if(allItems!=null && !allItems.isEmpty()){
for(SarStandItems itemsEO:allItems){
itemConvertDataMap.put(itemsEO.getOldId(),itemsEO.getId());
}
}
//获取本次入库的标准ID和类型
String standId = sarStandardsInfoEO.getId();//标准ID
//主要时区分国内、国外
String sarType = sarStandardsInfoEO.getStandType()+"_STAND";
//判断填写表单是哦服存在
if(taskBreak!=null){
List<SarCompStatusInfo> compStatusInfoEOS = new ArrayList<>();
//解析表单数据
String compResultStr = String.valueOf(taskBreak);
List<String> jsonArray = JSONArray.parseArray(compResultStr, String.class);
//判断数据是否正常
if (jsonArray != null && !jsonArray.isEmpty()) {
//当入库时只有标准时 itemList是空的
for (String jsonStr : jsonArray) {
if (StringUtils.isNotBlank(jsonStr)) {
Map<String, Object> jsonMap = JSONObject.parseObject(jsonStr);
if(jsonMap.containsKey("itemsList")){//开始读取条款集合数据处理结果
String itemsList = jsonMap.get("itemsList").toString();
//获取条款级别的评估集合列表
List<String> itemCompStrList = JSONArray.parseArray(itemsList, String.class);
if(itemCompStrList!=null && !itemCompStrList.isEmpty()){
for(String itemCompDataStr : itemCompStrList){
//解析每个人填写的具体评估结果
Map<String, Object> itemDataMap = JSONObject.parseObject(itemCompDataStr);
if(itemDataMap.containsKey("pgForm")){
String pgResult = itemDataMap.get("pgForm").toString();
//新旧条款ID转换
String oldItemId = itemDataMap.containsKey("id")?itemDataMap.get("id").toString():null;
//获取到评估表单
SarCompStatusInfo sarCompStatusInfoEO = JSONObject.parseObject(pgResult,SarCompStatusInfo.class);
sarCompStatusInfoEO.setId(UUIDUtils.randomUUID(32));
sarCompStatusInfoEO.setSarType(sarType);
sarCompStatusInfoEO.setSarId(standId);
//评估结果
sarCompStatusInfoEO.setSarState(itemDataMap.containsKey("jspg")?itemDataMap.get("jspg").toString():null);
//新旧条款号转换存储
if(StringUtils.isNotBlank(oldItemId)){
sarCompStatusInfoEO.setSarItemId(itemConvertDataMap.get(oldItemId));
sarCompStatusInfoEO.setSarItemState(sarCompStatusInfoEO.getSarState());
}
sarCompStatusInfoEO.setPrcNum(prcNum);
sarCompStatusInfoEO.setColor(convertColorByState(sarCompStatusInfoEO.getSarState()));//此处需要处理
sarCompStatusInfoEO.setPrcState(null);//技术评估不需要状态
sarCompStatusInfoEO.setCreationTime(new Date());
//评估人处理
sarCompStatusInfoEO.setCompPerson(itemDataMap.containsKey("foFillUser")?itemDataMap.get("foFillUser").toString():null);
sarCompStatusInfoEO.setCompTime(new Date());
compStatusInfoEOS.add(sarCompStatusInfoEO);
}
}
}else{
if(jsonMap.containsKey("pgForm")){
String pgResult = jsonMap.get("pgForm").toString();
//获取到评估表单
SarCompStatusInfo sarCompStatusInfoEO = JSONObject.parseObject(pgResult,SarCompStatusInfo.class);
sarCompStatusInfoEO.setId(UUIDUtils.randomUUID(32));
sarCompStatusInfoEO.setSarType(sarType);
sarCompStatusInfoEO.setSarId(standId);
sarCompStatusInfoEO.setSarState(jsonMap.containsKey("jspg")?jsonMap.get("jspg").toString():null);
sarCompStatusInfoEO.setPrcNum(prcNum);
sarCompStatusInfoEO.setColor(convertColorByState(sarCompStatusInfoEO.getSarState()));//此处需要处理
sarCompStatusInfoEO.setPrcState(null);//技术评估不需要状态
sarCompStatusInfoEO.setCreationTime(new Date());
sarCompStatusInfoEO.setCompPerson(jsonMap.containsKey("foFillUser")?jsonMap.get("foFillUser").toString():null);
sarCompStatusInfoEO.setCompTime(new Date());
compStatusInfoEOS.add(sarCompStatusInfoEO);
}
}
}else{//只有标准的情况下
//获取
if(jsonMap.containsKey("pgForm")){
String pgResult = jsonMap.get("pgForm").toString();
//获取到评估表单
SarCompStatusInfo sarCompStatusInfoEO = JSONObject.parseObject(pgResult,SarCompStatusInfo.class);
sarCompStatusInfoEO.setId(UUIDUtils.randomUUID(32));
sarCompStatusInfoEO.setSarType(sarType);
sarCompStatusInfoEO.setSarId(standId);
sarCompStatusInfoEO.setSarState(jsonMap.containsKey("jspg")?jsonMap.get("jspg").toString():null);
sarCompStatusInfoEO.setPrcNum(prcNum);
sarCompStatusInfoEO.setColor(convertColorByState(sarCompStatusInfoEO.getSarState()));//此处需要处理
sarCompStatusInfoEO.setPrcState(null);//技术评估不需要状态
sarCompStatusInfoEO.setCreationTime(new Date());
sarCompStatusInfoEO.setCompPerson(jsonMap.containsKey("foFillUser")?jsonMap.get("foFillUser").toString():null);
sarCompStatusInfoEO.setCompTime(new Date());
compStatusInfoEOS.add(sarCompStatusInfoEO);
}
}
}
}
}
//最后开始将评估结果入库同时将评估结果汇总后给出标准的评估结果
saveJSPGResultDataList(compStatusInfoEOS);
}
}
/**
* 入库技术评估结果
* @param compResultData
*/
private void saveJSPGResultDataList(List<SarCompStatusInfo> compResultData) throws Exception {
if(compResultData!=null && !compResultData.isEmpty()){
//1、将数据存储到记录表中
//2、汇总本次评估的结果 更新所有清单中的状态 此处有坑,如果标准评估后又在新的清单中添加的时候状态可能就是空的,
// 此时就会显示空,所以需要更换实现方法
//需要中间需要增加一层技术评估的结果,但是代价太大,2021年3月21日 无法在今天修改完,需要于2021年3月22日 整体想下这块,
// 目前的实现思路时有问题的
//正确逻辑时: 现将当前的评估结果记录到所有的技术评估结果中,然后汇总本次的评估结果内容到当前标准的技术评估汇总表中
//汇总后形成最新的评估内容,此时有2种做法 1、不记录上一次的状态 直接更新 2、记录上一次状态,新增一条整体评估结果记录
//在清单查询的时候 查询当前标准的最新一次评估结果,将评估结果不再清单中直接显示,而是在汇总表中的信息进行修改,这样能够达到
//单一标准不论在任何时间添加到清单的时候都可以查看,同时在标准的技术评估状态的时候也可以直接调用即可。不用每次评估完都需要更新
//技术清单的逻辑
/**
* 整体表关系如下:
* 基础库: 国内标准库 海外标准库 政策库
* 技术评估汇总表 资源的汇总结果记录
* 详细评估内容记录表 资源本身每次评估的详细记录
* 清单: 根据标准号到资源的汇总记录表中查询汇总结果 直接展现即可
* 目前缺少的就是资源的汇总结果记录缺失,导致查询的时候可能汇总结果会有问题
*/
//开始汇总数据以及状态变更
//首先先检查当前标准在汇总表中是否存在
Map<String,Map<String,Integer>> assessMap = new HashMap<>();
Map<String, SarCompResAssess> compResAssessEOMap = new HashMap<>();
for(SarCompStatusInfo data : compResultData){
//评估结果转换
String state = sysInfoEOService.changeCompStatus(data.getSarState());
String itemSate = sysInfoEOService.changeCompStatus(data.getSarItemState());
data.setSarState(state);
data.setSarItemState(itemSate);
if(StringUtils.equals("INLAND",data.getSarType())){
data.setSarType(SarTypeEnum.INLAND_STAND.getValue());
}else if(StringUtils.equals("FOREIGN",data.getSarType())){
data.setSarType(SarTypeEnum.FOREIGN_STAND.getValue());
}
SarCompResAssess info =null;
if(assessMap.containsKey(data.getSarId())){
info = compResAssessEOMap.get(data.getSarId());
}else{
info= sarCompResAssessEOService.getAssessInfoByResId(data.getSarId());
if(info==null){
info = new SarCompResAssess();
info.setId(UUIDUtils.randomUUID(32));
info.setAssessTime(new Date());
info.setCreatedTime(new Date());
info.setModifyTime(new Date());
info.setProcessNum(data.getPrcNum());
info.setResId(data.getSarId());
info.setResType(data.getSarType());
sarCompResAssessEOService.save(info);
}
compResAssessEOMap.put(data.getSarId(),info);
}
//汇总结果
if(!assessMap.containsKey(info.getResId())){
Map<String,Integer> accessData = new HashMap<>();
accessData.put(state,1);
assessMap.put(info.getResId(),accessData);
}else{
Map<String, Integer> accessData = assessMap.get(info.getResId());
if(accessData.containsKey(state)){
Integer stateNum = accessData.get(state);
accessData.put(state,stateNum+1);
assessMap.put(info.getResId(),accessData);
}else{
accessData.put(state,1);
assessMap.put(info.getResId(),accessData);
}
}
//入库操作
sarCompStatusInfoEODao.insert(data);
}
//开始遍历状态集合
for (Map.Entry entry : compResAssessEOMap.entrySet()) {
String compId = entry.getKey().toString();//汇总ID
SarCompResAssess compResAssessEO = (SarCompResAssess) entry.getValue();
Map<String, Integer> stringIntegerMap = assessMap.get(compId);
if(stringIntegerMap!=null){
if(stringIntegerMap.containsKey(SarConformStateEnum.UNFIT.getValue()+"")){//只要包含不符合的就是不符合
compResAssessEO.setAssessResult(SarConformStateEnum.UNFIT.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
}else if(stringIntegerMap.size() ==1){//只有一种情况的
if(stringIntegerMap.containsKey(SarConformStateEnum.FIT.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.FIT.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.GREEN.getValue());
}else if(stringIntegerMap.containsKey(SarConformStateEnum.CHECK.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.CHECK.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
}else if(stringIntegerMap.containsKey(SarConformStateEnum.NOT_INVOLVE.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.NOT_INVOLVE.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.NA.getValue());
}
}else if(stringIntegerMap.containsKey(SarConformStateEnum.CHECK.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.CHECK.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
}else if(stringIntegerMap.containsKey(SarConformStateEnum.NOT_INVOLVE.getValue()+"")){
compResAssessEO.setAssessResult(SarConformStateEnum.NOT_INVOLVE.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.NA.getValue());
}else{
compResAssessEO.setAssessResult(SarConformStateEnum.FIT.getValue());
compResAssessEO.setAssessColor(SarStateColorEnum.GREEN.getValue());
}
// else {//不包含不符合的并且单一情况并不存在的也就是说是 部分符合或者待确认的
// if(stringIntegerMap.containsKey(SarConformStateEnum.FIT.getValue()+"")){
// compResAssessEO.setAssessResult(SarConformStateEnum.PART_FIT.getValue());
// compResAssessEO.setAssessColor(SarStateColorEnum.YELLOW.getValue());
// }else{
// compResAssessEO.setAssessResult(SarConformStateEnum.CHECK.getValue());
// compResAssessEO.setAssessColor(SarStateColorEnum.NA.getValue());
// }
// }
}
compResAssessEO.setProcessState("2");
compResAssessEO.setModifyTime(new Date());
if(StringUtils.equals("INLAND",compResAssessEO.getResType())){
compResAssessEO.setResType(SarTypeEnum.INLAND_STAND.getValue());
}else if(StringUtils.equals("FOREIGN",compResAssessEO.getResType())){
compResAssessEO.setResType(SarTypeEnum.FOREIGN_STAND.getValue());
}
//更新汇总后的结果
sarCompResAssessEOService.updateById(compResAssessEO);
}
}
}
private String convertColorByState(String stateStr){
String colorStr = "";
switch (stateStr){
case "1":
colorStr = SarStateColorEnum.GREEN.getValue();
break;
case "2":
colorStr = SarStateColorEnum.YELLOW.getValue();
break;
case "3":
colorStr = SarStateColorEnum.YELLOW.getValue();
case "4":
colorStr = SarStateColorEnum.NA.getValue();
}
return colorStr;
}
public String changeStatus (String textStatus) {
String status = "";
switch (textStatus) {
case "草稿": status="CA";break;
case "征求意见稿": status="ZQYJG";break;
case "报批稿": status="BPG";break;
case "送审稿": status="SSG";break;
case "发布稿(必读)": status="FBGBJBD";break;
}
return status;
}
/**
* 处理条款信息转换
* @param itemsEO
* @param field
* @param value
* @throws Exception
*/
public void createItemsBaseField (SarLawsItems itemsEO,String field,Object value) throws Exception{
String valueStr = "";
if (value != null) {
valueStr = String.valueOf(value);
}
switch (field) {
case "itemsName": itemsEO.setItemsName(valueStr); break;
case "FO":
List<String> jsonArray = JSONArray.parseArray(valueStr,String.class);
String fo = "";
if (jsonArray != null && !jsonArray.isEmpty()) {
for (String json : jsonArray) {
fo += json + ",";
}
fo = fo.substring(0,fo.length()-1);
itemsEO.setFoUser(fo);
}
break;
case "itemsNum": itemsEO.setItemsNum(valueStr); break;
case "termsConditions": itemsEO.setTermsConditions(valueStr); break;
case "svpps": itemsEO.setSvpps(valueStr); break;
case "role": itemsEO.setDutyEngineer(valueStr); break;
case "parts": itemsEO.setResponsibleUnit(valueStr); break;
case "FORoleId": itemsEO.setFo(valueStr); break;
case "id": itemsEO.setOldId(valueStr); break;
case "jspg": itemsEO.setJspg(valueStr); break;
case "pgForm":
if (StringUtils.isNotBlank(valueStr)) {
SarCompStatusInfo list = JSONObject.parseObject(valueStr,SarCompStatusInfo.class);
itemsEO.setPgForm(list);
};
break;
default: break;
}
}
/**
* 处理保存标准条款信息数据
* @return
*/
// private List<SarLawsItems> saveStandItemsData(List<Map<String,Object>> itemDataList,SarLawsStandInfo sarStandardsInfoEO) throws Exception {
// String standId = sarStandardsInfoEO.getId();
// String fileType = changeStatus(sarStandardsInfoEO.getLawsTextState());
// List<SarLawsItems> itemsEOList = new ArrayList<>();//添加的条款信息
// List<SarLawsItems> upItemsEOList = new ArrayList<>();//更新的条款数据
// List<String> delValItemIds = new ArrayList<>();//需要删除重新添加的条款数据集合
// List<SarStandItemVal> itemValEOS = new ArrayList<>();//批量更新进去的条款参数集合
// List<SarFileSplitItems> UpSarFileSplitItemsList = new ArrayList<>();
// for(Map<String,Object> itemData:itemDataList){
// String itemStr = itemData.get("itemStr").toString();//条款的具体内容
// Map<String,String> itemAttrInfo = (Map<String, String>) itemData.get("itemAttrInfo");//条款的属性字段
// Map<String,Object> itemMap = new HashMap();
// //此处需要查询拆分库数据,将之前的拆分数据带入到当前标准中同时检查当前分解单中是否已经包含相关的条款信息,
// // 如果是则更新,如果没有则添加
// itemMap = JSONObject.parseObject(itemStr);;
// if (itemMap != null && !itemMap.isEmpty()) {
// if(itemMap.containsKey("resId")){
// //存在
// String splitItemId = String.valueOf(itemMap.get("resId"));
// if(StringUtils.isNotBlank(splitItemId)){
// SarFileSplitItems splitItemsEO = sarFileSplitItemsEOService.getById(splitItemId);
// if(splitItemsEO!=null){
// //拆分库有数据,检查当前的表单中是否有数据,如果有则直接获取后更新即可
// SarLawsItems nowItemEO = sarLawsItemsDao.selectById(splitItemId);
// if(nowItemEO!=null){
// //更新数据
// nowItemEO.setItemsNum(splitItemsEO.getItemsNum());
// nowItemEO.setItemsName(splitItemsEO.getItemsName());
// nowItemEO.setApplyArctic(splitItemsEO.getApplyArctic());
// nowItemEO.setLawsId(standId);
// nowItemEO.setTermsConditions(splitItemsEO.getItermsConditions());
// nowItemEO.setParts(splitItemsEO.getSvpps());
// nowItemEO.setCreationUser(UserUtils.getUserId());
// nowItemEO.setValidFlag(0);
// if(null!=fileType){
// nowItemEO.setFileType(fileType);
// }
// nowItemEO.setRemarks(splitItemsEO.getRemarks());
// nowItemEO.setModifyTime(new Date());
//
// nowItemEO.setClaimType(splitItemsEO.getClaimType());
// nowItemEO.setBusStandCover(splitItemsEO.getBusStandCover());
// nowItemEO.setResponsibleUnit(itemAttrInfo.get("ZRBM"));
// nowItemEO.setFo(itemAttrInfo.get("FO"));
// nowItemEO.setDutyEngineer(itemAttrInfo.get("XMPGJS"));
// nowItemEO.setSvpps(itemAttrInfo.get("SVPPS"));
// upItemsEOList.add(nowItemEO);
// }else{
// SarLawsItems itemsEO = new SarLawsItems();
// itemsEO.setId(splitItemId);
// itemsEO.setCreationTime(new Date());
// itemsEO.setModifyTime(new Date());
// itemsEO.setValidFlag(0);
// itemsEO.setLawsId(standId);
// itemsEO.setFileType(fileType);
// for (Map.Entry<String,Object> entry : itemMap.entrySet()) {
// String field = entry.getKey();
// Object value = entry.getValue();
// createItemsBaseField(itemsEO,field,value);
// }
// itemsEO.setItemsNum(splitItemsEO.getItemsNum());
// itemsEO.setItemsName(splitItemsEO.getItemsName());
// itemsEO.setApplyArctic(splitItemsEO.getApplyArctic());
// itemsEO.setTermsConditions(splitItemsEO.getItermsConditions());
// itemsEO.setParts(splitItemsEO.getSvpps());
// itemsEO.setCreationUser(UserUtils.getUserId());
// itemsEO.setRemarks(splitItemsEO.getRemarks());
// itemsEO.setClaimType(splitItemsEO.getClaimType());
// itemsEO.setBusStandCover(splitItemsEO.getBusStandCover());
// itemsEO.setResponsibleUnit(itemAttrInfo.get("ZRBM"));
// itemsEO.setFo(itemAttrInfo.get("FO"));
// itemsEO.setDutyEngineer(itemAttrInfo.get("XMPGJS"));
// itemsEO.setSvpps(itemAttrInfo.get("SVPPS"));
// //开始处理后续逻辑
// itemsEOList.add(itemsEO);
// }
// //apply数据
// if(StringUtils.isNotEmpty(splitItemsEO.getApplyArctic())){
// delValItemIds.add(splitItemsEO.getId());
// String[] applyarr = splitItemsEO.getApplyArctic().trim().split(",");
// for(String applya:applyarr){
// SarStandItemVal sarStandItemValEO = new SarStandItemVal();
// sarStandItemValEO.setValidFlag(ValueStateEnum.VALUE_TRUE.getValue());
// sarStandItemValEO.setCreationTime(new Date());
// sarStandItemValEO.setModifyTime(new Date());
// sarStandItemValEO.setItemId(splitItemsEO.getId());
// sarStandItemValEO.setId(UUIDUtils.randomUUID20());
// sarStandItemValEO.setPropertyType(PropertyTypeEnum.APPLY_ARCTIC.getValue());
// sarStandItemValEO.setPropertyVal(applya);
// itemValEOS.add(sarStandItemValEO);
// }
// }
// //TODO 开始处理拆分库数据
// splitItemsEO.setModifyTime(new Date());
// splitItemsEO.setResponsibleUnit(itemAttrInfo.get("ZRBM"));
// splitItemsEO.setFo(itemAttrInfo.get("FO"));
// splitItemsEO.setDutyEngineer(itemAttrInfo.get("XMPGJS"));
// splitItemsEO.setSvpps(itemAttrInfo.get("SVPPS"));
// UpSarFileSplitItemsList.add(splitItemsEO);
// }else{
// logger.error("拆分库中找不到对应数据了,数据不见了 /(ㄒoㄒ)/~~"+itemStr);
// }
// }else{
// logger.error("流程中携带的拆分库ID不见了 Σ(っ °Д °;)っ "+itemStr);
// }
// }else{
// //不存在 说明数据出现问题了
// logger.error("流程中携带的拆分库ID,数据不见了 /(ㄒoㄒ)/~~"+itemStr);
//
// }
// }
// }
// //更新拆分库数据
// if(UpSarFileSplitItemsList!=null && !UpSarFileSplitItemsList.isEmpty()){
// for(SarFileSplitItems items : UpSarFileSplitItemsList){
// sarFileSplitItemsEOService.updateById(items);
// }
// }
// //执行批量新增操作
// if(itemsEOList != null && !itemsEOList.isEmpty()){
// sarLawsItemsDao.insertForeach(itemsEOList);
//
// }
// //执行批量修改操作
// if(upItemsEOList != null && !upItemsEOList.isEmpty()){
// sarLawsItemsDao.updateForeach(upItemsEOList);
//
// }
// //执行适用车型批量操作
// if(itemValEOS != null && !itemValEOS.isEmpty()){
// sarLawsItemValDao.deleteByItemsIds(delValItemIds);
// sarLawsItemValDao.insertForeach(itemValEOS);
// }
// return itemsEOList;
// }
private void updateStandFileFieldData(Map<String,Object> addAttInfoMap,Map<String,Object> oldAttInfoMap){
if(oldAttInfoMap.containsKey("CA")){
String fileStr = (String) oldAttInfoMap.get("CA");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("CA")?(String)addAttInfoMap.get("CA"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("CA",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("CA",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("ZQYJG")){
String fileStr = (String) oldAttInfoMap.get("ZQYJG");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("ZQYJG")?(String)addAttInfoMap.get("ZQYJG"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("ZQYJG",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("ZQYJG",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("BPG")){
String fileStr = (String) oldAttInfoMap.get("BPG");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("BPG")?(String)addAttInfoMap.get("BPG"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("BPG",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("BPG",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("SSG")){
String fileStr = (String) oldAttInfoMap.get("SSG");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("SSG")?(String)addAttInfoMap.get("SSG"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("SSG",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("SSG",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("ZBJBD")){
String fileStr = (String) oldAttInfoMap.get("ZBJBD");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("ZBJBD")?(String)addAttInfoMap.get("ZBJBD"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("ZBJBD",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("ZBJBD",fileStr);
}
}
}else if(oldAttInfoMap.containsKey("FBGBJBD")){
String fileStr = (String) oldAttInfoMap.get("FBGBJBD");
if(StringUtils.isNotBlank(fileStr)){
String newFileStr =addAttInfoMap.containsKey("FBGBJBD")?(String)addAttInfoMap.get("FBGBJBD"):null;
if(StringUtils.isNotBlank(newFileStr)){
String[] fileSplit = fileStr.split(",");
String[] newFileSplit = newFileStr.split(",");
Set<String> fileSet = new HashSet<>();
for(String sData:fileSplit){
fileSet.add(sData);
}
for(String sData:newFileSplit){
fileSet.add(sData);
}
addAttInfoMap.put("FBGBJBD",StringUtils.join(fileSet.toArray(), ","));
}else{
addAttInfoMap.put("FBGBJBD",fileStr);
}
}
}
}
public Map<String,Object> saveFileMsg (Map<String,Object> attInfoMap,String fileIds,String textStatus) {
switch (textStatus) {
case "草案": attInfoMap.put("CA",fileIds);break;
case "征求意见稿": attInfoMap.put("ZQYJG",fileIds);break;
case "报批稿": attInfoMap.put("BPG",fileIds);break;
case "送审稿": attInfoMap.put("SSG",fileIds);break;
case "增补件(必读)":attInfoMap.put("ZBJBD",fileIds);break;
case "发布稿(必读)": attInfoMap.put("FBGBJBD",fileIds);break;
}
return attInfoMap;
}
/**
* 处理标准基础库字段
* @param sarLawsStandInfo
* @param field
* @param value
* @throws Exception
*/
public void createStandBaseField (SarLawsStandInfo sarLawsStandInfo,String field,Object value) throws Exception{
String valueStr = "";
if (value != null) {
valueStr = String.valueOf(value);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
switch (field) {
case "country": sarLawsStandInfo.setCountry(valueStr); break;
case "id": sarLawsStandInfo.setId(valueStr); break;
case "lawsType": sarLawsStandInfo.setLawsType(valueStr); break;
case "lawsNumber": sarLawsStandInfo.setLawsNumber(valueStr); break;
case "lawsName": sarLawsStandInfo.setLawsName(valueStr); break;
case "lawsEnName": sarLawsStandInfo.setLawsEnName(valueStr); break;
case "lawsNo": sarLawsStandInfo.setLawsNo(valueStr); break;
case "issueTime":
if (StringUtils.isNotBlank(valueStr)) {
sarLawsStandInfo.setIssueTime(valueStr);
}
break;
case "issueCompany": sarLawsStandInfo.setIssueCompany(valueStr); break;
case "commentCycleStart":
if (StringUtils.isNotBlank(valueStr)) {
sarLawsStandInfo.setCommentCycleStart(valueStr);
}
break;
case "commentCycleEnd":
if (StringUtils.isNotBlank(valueStr)) {
sarLawsStandInfo.setCommentCycleEnd(valueStr);
}
break;
case "lawsTextState": sarLawsStandInfo.setLawsTextState(valueStr); break;
case "lawsSyqy": sarLawsStandInfo.setLawsSyqy(valueStr); break;
case "lawsSycx": sarLawsStandInfo.setLawsSycx(valueStr); break;
case "isRelateAccess": sarLawsStandInfo.setIsRelateAccess(valueStr); break;
case "lawsYear": sarLawsStandInfo.setLawsYear(valueStr); break;
case "lawsNotisyncNum": sarLawsStandInfo.setLawsNotisyncNum(valueStr); break;
case "lawsBulletin": sarLawsStandInfo.setLawsBulletin(valueStr); break;
case "lawsLabel": sarLawsStandInfo.setLawsLabel(valueStr); break;
case "lawsRemark": sarLawsStandInfo.setLawsRemark(valueStr); break;
case "prcNum": sarLawsStandInfo.setProcessNum(valueStr); break;
case "menuId": sarLawsStandInfo.setMenuId(valueStr); break;
case "fileWord":
if (StringUtils.isNotBlank(sarLawsStandInfo.getFileIds()) && StringUtils.isNotBlank(valueStr)) {
valueStr = sarLawsStandInfo.getFileIds() + "," + valueStr;
}
sarLawsStandInfo.setFileIds(valueStr); break;
case "filePdf":
if (StringUtils.isNotBlank(sarLawsStandInfo.getFileIds()) && StringUtils.isNotBlank(valueStr)) {
valueStr = sarLawsStandInfo.getFileIds() + "," + valueStr;
}
sarLawsStandInfo.setFileIds(valueStr);
break;
default: break;
}
}
}
@@ -0,0 +1,45 @@
package com.adc.da.workFlow.service;
import com.adc.da.slrs.sarStandUnqualified.entity.BusinessDeptIssue;
import com.adc.da.slrs.sarStandUnqualified.service.IBusinessDeptIssueService;
import com.adc.da.util.UUIDUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class PolicyWorkFlowService {
@Autowired
private IBusinessDeptIssueService businessDeptIssueService;
public boolean enterIssue(String json){
boolean count=false; //是否成功
JSONObject dataJsonObj = JSONObject.parseObject(json);
if ("1".equals(dataJsonObj.getString("department"))) {
JSONArray dataList = dataJsonObj.getJSONArray("dataList");
/**
* 把json对象转换未实体对象
*/
List<BusinessDeptIssue> data = dataList
.stream()
.map(jsonObj -> {
BusinessDeptIssue businessDeptIssue = JSONObject.parseObject(jsonObj.toString(), BusinessDeptIssue.class);
businessDeptIssue.setId(UUIDUtils.randomUUID20());
return businessDeptIssue;
}).collect(Collectors.toList());
count=businessDeptIssueService.saveBatch(data);
}
return count;
}
}
+6
View File
@@ -43,6 +43,12 @@
<version>5.5.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -0,0 +1,74 @@
package com.adc.da.util;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
* token 工具类
*
* @author ch
* @version 1.0.0
* @since 1.0.0
* <p>
* Created at 2020/7/30 2:23 下午
*/
@Component
public class JwtSysUtils {
// 过期时间
private static long expire = 6048000;
// 秘钥
private static String secret = "HSyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9";
/**
* 创建一个token
*
* @param userId
* @return
*/
public String generateToken(String userId) {
Date now = new Date();
Date expireDate = new Date(now.getTime() + expire);
return Jwts.builder().setHeaderParam("type", "JWT").setSubject(userId).setIssuedAt(now)
.setExpiration(expireDate).signWith(
SignatureAlgorithm.HS512, secret).compact();
}
/**
* 解析token
*/
public Claims getClaimsByToken(String token) {
Claims claims;
try {
claims = Jwts.parser()
.setSigningKey(secret) // 设置标识名
.parseClaimsJws(token) //解析token
.getBody();
} catch (ExpiredJwtException e) {
claims = e.getClaims();
}
return claims;
}
public String getUserIdByToken(){
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
String user = "";
if(attributes != null){
HttpServletRequest request = attributes.getRequest();
Claims claim = getClaimsByToken(request.getHeader("token"));
user = claim.getSubject();
}
return user;
}
}
@@ -15,21 +15,7 @@ public class LoginUserUtil {
*
*/
public static String getUserId() {
String userId = null;
try {
Subject subject = SecurityUtils.getSubject();
Object object=subject.getPrincipal();
if(object!=null){
String json = JSONObject.toJSONString(object);
if(json!=null && json.length()>0){
Map<String, Object> userInfo=JSONObject.parseObject(json, Map.class);
userId=userInfo.get("id").toString();
}
}
} catch (UnavailableSecurityManagerException e) {
} catch (InvalidSessionException e) {
}
return userId;
return UserSysUtils.getUserId();
}
public static String getUserParamValue() {
@@ -0,0 +1,97 @@
package com.adc.da.util;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.UnavailableSecurityManagerException;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.session.InvalidSessionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Map;
public class UserSysUtils {
private UserSysUtils() {
super();
}
private static Logger logger = LoggerFactory.getLogger(UserSysUtils.class);
/**
* 当前登陆用户
*/
public static final String CURRENT_USER = "currentUser";
/**
* 角色信息
*/
public static final String CACHE_ROLE_LIST = "roleList";
/**
* 菜单信息
*/
public static final String CACHE_MENU_LIST = "menuList";
public static final String CACHE_MENU_TREE = "menuTree";
public static final String CACHE_AREA_LIST = "areaList";
public static final String CACHE_OFFICE_LIST = "officeList";
/**
* @see JwtSysUtils
*/
private static JwtSysUtils jwtUtils = SpringContextHolder1.getBean(JwtSysUtils.class);
/**
* 退出
*/
public static void logout() {
try {
SecurityUtils.getSubject().logout();
} catch (UnavailableSecurityManagerException e) {
logger.error(e.getMessage(),e);
} catch (InvalidSessionException e) {
logger.error(e.getMessage(),e);
}
}
/**
* 获取当前登陆用户ID
* @throws Exception
*/
public static String getUserId() {
return jwtUtils.getUserIdByToken();
}
public static void flush() {
CacheUtils.removeCache(CURRENT_USER);
}
private static final class CacheUtils {
public static Object getCache(String key) {
return getCache(key, null);
}
public static Object getCache(String key, Object defaultValue) {
Object obj = getCacheMap().get(key);
return obj == null ? defaultValue : obj;
}
public static void putCache(String key, Object value) {
getCacheMap().put(key, value);
}
public static void removeCache(String key) {
getCacheMap().remove(key);
}
public static Map<String, Object> getCacheMap() {
Map<String, Object> map = Maps.newHashMap();
return map;
}
}
}
@@ -49,18 +49,19 @@ public class WaterMarkUtil {
// set Transparency
PdfGState gs = new PdfGState();
// 设置透明度为0.2
gs.setFillOpacity(0.5f);
gs.setFillOpacity(0.25f);
under.setGState(gs);
under.restoreState();
under.beginText();
under.setFontAndSize(base, 13);
under.setFontAndSize(base, 50);
under.setTextMatrix(30, 30);
under.setColorFill(BaseColor.LIGHT_GRAY);
for (int y = 0; y < 10; y++) {
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 5; y++) {
for (int x = 0; x < 10; x++) {
// 水印文字成45度角倾斜
under.showTextAligned(Element.ALIGN_LEFT
, waterMarkName, 100 + 300 * x, 300 * y, 45); }
, waterMarkName, 100 + 300 * x, 300 * y, 40);
}
}
// 添加水印文字
+37 -1
View File
@@ -22,6 +22,42 @@
<artifactId>adc-da-sys</artifactId>
<version>3.0.0</version>
</dependency>
<!-- 导入本地jar -->
<!-- 操作ppt -->
<dependency>
<groupId>com.artofsolving</groupId>
<artifactId>jodconverter</artifactId>
<scope>system</scope>
<version>2.2.2</version>
<systemPath>${basedir}/src/main/lib/jodconverter-2.2.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>8.5.2</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/aspose-cells-8.5.2.jar</systemPath>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>16.7.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/aspose.slides-16.7.0.jar</systemPath>
</dependency>
<!-- 操作文本文件-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
<!-- openOffice 和 jobconverter-->
<dependency>
@@ -46,7 +82,7 @@
<artifactId>jodconverter-local</artifactId>
<version>4.3.0</version>
</dependency>
<!-- openOffice end-->
<!-- openOffice end-->
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>juh</artifactId>
@@ -0,0 +1,37 @@
package com.adc.da.convert.common;
import org.apache.commons.lang.StringUtils;
public class AsposeOfficeConvertUtils {
public static void convertOfficeFileToPDF(String fileType,String attFilePath,String savePdfPath) throws Exception {
if(StringUtils.isNotBlank(fileType)){
//去掉文件类型中的点
fileType = fileType.replace(".","");
fileType = fileType.toUpperCase();
switch (fileType){
case "DOC":
WordTPdfUtils.doc2pdf(attFilePath,savePdfPath);
break;
case "DOCX":
WordTPdfUtils.doc2pdf(attFilePath,savePdfPath);
break;
case "PPT":
SlidesTPdfUtils.ppt2pdf(attFilePath,savePdfPath);
break;
case "PPTX":
SlidesTPdfUtils.ppt2pdf(attFilePath,savePdfPath);
break;
case "XLS":
ExcelTPdfUtils.excel2pdf(attFilePath,savePdfPath);
break;
case "XLSX":
ExcelTPdfUtils.excel2pdf(attFilePath,savePdfPath);
break;
}
}
}
}
@@ -0,0 +1,122 @@
package com.adc.da.convert.common;
import com.aspose.cells.PdfSaveOptions;
import com.aspose.cells.Workbook;
import com.aspose.cells.License;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
import org.aspectj.weaver.ast.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
public class ExcelTPdfUtils {
private static final Logger logger = LoggerFactory.getLogger(WordTPdfUtils.class);
private static final String myLicense = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
/**
* 获取license 去除水印
* @return
*/
public static boolean getLicense() {
boolean result = false;
try {
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return result;
}
/**
* excel 转为pdf 输出。
*
* @param sourceFilePath excel文件
* @param desFilePathd pad 输出文件目录
*/
public static void excel2pdf(String sourceFilePath, String desFilePathd ) throws Exception {
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
File file = new File(desFilePathd); // 新建一个空白pdf文档
FileOutputStream fileOS = null;
try {
fileOS = new FileOutputStream(desFilePathd);
long old = System.currentTimeMillis();
Workbook wb = new Workbook(sourceFilePath);// 原始excel路径
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
int[] autoDrawSheets={3};
//当excel中对应的sheet页宽度太大时,在PDF中会拆断并分页。此处等比缩放。
// autoDraw(wb,autoDrawSheets);
int[] showSheets={0};
//隐藏workbook中不需要的sheet页。
printSheetPage(wb,showSheets);
wb.save(fileOS, pdfSaveOptions);
fileOS.flush();
fileOS.close();
long now = System.currentTimeMillis();
logger.info("转换文档:"+sourceFilePath+" "+"共耗时:" + ((now - old) / 1000.0) + "");
} catch (Exception e) {
if(fileOS!=null){
fileOS.flush();
fileOS.close();
}
file.delete();
logger.error("Document Convert Error:"+sourceFilePath);
logger.error(e.getMessage(),e);
throw new Exception("Document Convert Error:"+sourceFilePath);
}
}
/**
* 设置打印的sheet 自动拉伸比例
* @param wb
* @param page 自动拉伸的页的sheet数组
*/
public static void autoDraw(Workbook wb,int[] page){
if(null!=page&&page.length>0){
for (int i = 0; i < page.length; i++) {
wb.getWorksheets().get(i).getHorizontalPageBreaks().clear();
wb.getWorksheets().get(i).getVerticalPageBreaks().clear();
}
}
}
/**
* 隐藏workbook中不需要的sheet页。
* @param wb
* @param page 显示页的sheet数组
*/
public static void printSheetPage(Workbook wb,int[] page){
for (int i= 1; i < wb.getWorksheets().getCount(); i++) {
wb.getWorksheets().get(i).setVisible(false);
}
if(null==page||page.length==0){
wb.getWorksheets().get(0).setVisible(true);
}else{
for (int i = 0; i < page.length; i++) {
wb.getWorksheets().get(i).setVisible(true);
}
}
}
public static void main(String[] args) {
String sourceFilePath="E:\\EXCELTEXT\\一阶段问题清单426.xlsx";
String desFilePath="E:\\EXCELTEXT\\一阶段问题清单426.pdf";
try {
excel2pdf(sourceFilePath, desFilePath);
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
}
}
@@ -0,0 +1,72 @@
package com.adc.da.convert.common;
import com.aspose.slides.Presentation;
import com.aspose.slides.License;
import com.aspose.slides.SaveFormat;
import org.aspectj.weaver.ast.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
/**
* 采用破解版的Aspire插件转换文件
*/
public class SlidesTPdfUtils {
private static final Logger logger = LoggerFactory.getLogger(SlidesTPdfUtils.class);
private static final String myLicense = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
public static boolean getLicense() {
boolean result = false;
try {
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return result;
}
public static void ppt2pdf(String inPath, String outPath) throws Exception{
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
File file = new File(outPath); // 新建一个空白pdf文档
FileOutputStream os =null;
try {
long old = System.currentTimeMillis();
os = new FileOutputStream(file);
Presentation pres = new Presentation(inPath);
pres.save(os, SaveFormat.Pdf);
os.flush();
os.close();
// EPUB, XPS, SWF 相互转换
long now = System.currentTimeMillis();
logger.info("转换文档:"+inPath+" "+"共耗时:" + ((now - old) / 1000.0) + "");
} catch (Exception e) {
if(os!=null){
os.flush();
os.close();
}
file.delete();
logger.error("Document Convert Error:"+inPath);
logger.error(e.getMessage(),e);
throw new Exception("Document Convert Error:"+inPath);
}
}
public static void main(String[] args) throws Exception {
String sourceFilePath="E:\\PPTTEXT\\2.pptx";
String desFilePath="E:\\PPTTEXT\\2.pdf";
ppt2pdf(sourceFilePath, desFilePath);
}
}
@@ -0,0 +1,65 @@
package com.adc.da.convert.common;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.adc.da.util.exception.AdcDaBaseException;
import com.aspose.words.Document;
import org.aspectj.weaver.ast.Test;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 采用破解版的Aspire插件转换文件
*/
public class WordTPdfUtils {
private static final Logger logger = LoggerFactory.getLogger(WordTPdfUtils.class);
private static final String myLicense = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
public static boolean getLicense() {
boolean result = false;
try {
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
logger.error(e.getMessage(),e);
}
return result;
}
public static void doc2pdf(String inPath, String outPath) throws Exception{
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
File file = new File(outPath); // 新建一个空白pdf文档
FileOutputStream os = new FileOutputStream(file);
try {
long old = System.currentTimeMillis();
Document doc = new Document(inPath); // Address是将要被转化的word文档
doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
os.flush();
os.close();
// EPUB, XPS, SWF 相互转换
long now = System.currentTimeMillis();
logger.info("转换文档:"+inPath+" "+"共耗时:" + ((now - old) / 1000.0) + "");
} catch (Exception e) {
if(os!=null){
os.flush();
os.close();
}
file.delete();
logger.error("Document Convert Error:"+inPath);
logger.error(e.getMessage(),e);
throw new Exception("Document Convert Error:"+inPath);
}
}
}
@@ -4,12 +4,15 @@ import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.common.SarTypeEnum;
import com.adc.da.common.UseModuleEnum;
import com.adc.da.convert.common.AsposeOfficeConvertUtils;
import com.adc.da.convert.common.DocConverterPdf;
import com.adc.da.mq.CreateMQService;
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService;
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
import com.adc.da.slrs.sarLawsFile.dao.SarLawsFileDao;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
import com.adc.da.sys.util.LoginUserUtil;
@@ -62,6 +65,9 @@ public class SendConvertMQService {
@Autowired
private SarBussStandFileDao sarBussStandFileEODao;
@Autowired
private SarLawsFileDao sarLawsFileDao;
private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
@RabbitListener(bindings = @QueueBinding(
@@ -152,6 +158,7 @@ public class SendConvertMQService {
public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{
//保存在数据库中的ID
String path = localFilePath + convertMqEO.getFilePath();
path = path.replace("//","/");
String convertId = convertMqEO.getId();
try {
//进入转换方法中,修改OT_CONVERT表中状态为转换中
@@ -164,24 +171,28 @@ public class SendConvertMQService {
String converfilename = path.replaceAll("\\\\", "/");
logger.info("*****上传路径:*******"+localFilePath);
logger.info("************文件路径:**********" + convertMqEO.getFilePath());
logger.info("************接口:**********" + port);
// logger.info("************接口:**********" + port);
logger.info("*****上传路径替换,加入文件名*******"+converfilename);
//截取文件类型
int index = converfilename.lastIndexOf(".");
String fileType = converfilename.substring(index,converfilename.length());
String fileOriName = converfilename.substring(0,index);
//调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
d.setConvertHost(convertHost);
//调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
File getPdf = d.conver(fileType);
//调用getswfPath()方法,打印转换后的swf文件路径
String dPath = d.getpdfPath();
logger.info("*****转换后的pdf文件路径*******"+dPath);
// //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
// DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
// d.setConvertHost(convertHost);
// //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
// File getPdf = d.conver(fileType);
// //调用getswfPath()方法,打印转换后的swf文件路径
// String dPath = d.getpdfPath();
String savePdfFileName = converfilename.substring(0, converfilename.lastIndexOf("."));
String savePdfPath = savePdfFileName+".pdf";
AsposeOfficeConvertUtils.convertOfficeFileToPDF(fileType,converfilename,savePdfPath);
File pdfFile = new File(savePdfPath);
logger.info("*****转换后的pdf文件路径*******"+savePdfPath);
//判断是否转换成功,修改数据状态
if(!dPath.isEmpty() && getPdf.length()>0){
if(!savePdfPath.isEmpty() && pdfFile.length()>0){
// 上传转换后文件
String pdfId = attFileEOService.saveFileAttId(getPdf);
String pdfId = attFileEOService.saveFileAttId(pdfFile);
logger.info("////////转换后文件id"+pdfId);
int count = 0;
if("0".equals(convertMqEO.getAddOrUp())){
@@ -212,11 +223,11 @@ public class SendConvertMQService {
convertMqEO.setModifyTime(new Date());
convertMqEO.setMqState(2);
convertMqEOService.updateById(convertMqEO);
if(convertMqEO.getAgainNum()<=5){
throw new Exception("转换失败");
}
// if(convertMqEO.getAgainNum()<=5){
// throw new Exception("转换失败");
// }
}
return Result.success(dPath);
return Result.success(savePdfPath);
} else {
logger.error("转换时未获取到文件路径!");
return Result.error("文件存储失败,请重试");
@@ -228,7 +239,7 @@ public class SendConvertMQService {
convertMqEO.setId(convertId);
convertMqEO.setMqState(2);
convertMqEOService.updateById(convertMqEO);
this.restartUploadConvert(convertMqEO);
// this.restartUploadConvert(convertMqEO);
return Result.error("r0072", "文件转换失败,请重试");
}
}
@@ -270,14 +281,14 @@ public class SendConvertMQService {
lawsFile.setModifyTime(new Date());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile);
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
// SarLawsFile lawsFile = new SarLawsFile();
// lawsFile.setId(convertMq.getPdfId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setModifyTime(new Date());
// countSuccess = sarLawsFileEODao.updateByPrimaryKeySelective(lawsFile);
} else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) {
SarLawsFile lawsFile = new SarLawsFile();
lawsFile.setId(convertMq.getPdfId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
lawsFile.setModifyTime(new Date());
countSuccess = sarLawsFileDao.updateByPrimaryKeySelective(lawsFile);
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
SarBussStandFile lawsFile = new SarBussStandFile();
lawsFile.setId(convertMq.getPdfId());
@@ -336,21 +347,21 @@ public class SendConvertMQService {
lawsFile.setFileName(fileOriName+".pdf");
lawsFile.setFileSuffix("pdf");
countSuccess = sarStandFileEODao.insertSelective(lawsFile);
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
// SarLawsFile lawsFile = new SarLawsFile();
// lawsFile.setId(UUID.randomUUID(20));
// lawsFile.setLawsId(convertMq.getLawsId());
// lawsFile.setResId(convertMq.getResId());
// lawsFile.setAttId(pdfId);
// lawsFile.setOriAttId(convertMq.getOriAttId());
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
// lawsFile.setValidFlag("0");
// lawsFile.setCreationTime(new Date());
// lawsFile.setModifyTime(new Date());
// lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
// lawsFile.setFileName(fileOriName+".pdf");
// lawsFile.setFileSuffix("pdf");
// countSuccess = sarLawsFileEODao.insertSelective(lawsFile);
} else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) {
SarLawsFile lawsFile = new SarLawsFile();
lawsFile.setId(UUID.randomUUID(20));
lawsFile.setLawsId(convertMq.getLawsId());
lawsFile.setResId(convertMq.getResId());
lawsFile.setAttId(pdfId);
lawsFile.setOriAttId(convertMq.getOriAttId());
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
lawsFile.setValidFlag(0);
lawsFile.setCreationTime(new Date());
lawsFile.setModifyTime(new Date());
lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
lawsFile.setFileName(fileOriName+".pdf");
lawsFile.setFileSuffix("pdf");
countSuccess = sarLawsFileDao.insertSelective(lawsFile);
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
SarBussStandFile lawsFile = new SarBussStandFile();
lawsFile.setId(UUID.randomUUID(20));
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
<License>
<Data>
<Products>
<Product>Aspose.Total for Java</Product>
<Product>Aspose.Words for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>20991231</SubscriptionExpiry>
<LicenseExpiry>20991231</LicenseExpiry>
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
</Data>
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=
</Signature>
</License>
@@ -96,7 +96,7 @@ public class LoginRestController {
if(userEO.getDisableFlag()==1){
return Result.error("r0011", "帐号已禁用");
}
String token = jwtUtils.generateToken(account);
String token = jwtUtils.generateToken(userEO.getUsid());
userEO.setToken(token);
// 加密重要信息
BASE64Encoder encoder = new BASE64Encoder();
@@ -40,6 +40,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
addInterceptor.excludePathPatterns("/api/person/userInfo/getByUserInfoCode");
addInterceptor.excludePathPatterns("/api/att/attFile/upload");
addInterceptor.excludePathPatterns("/api/sarStandardsInfo/sar-standards-info/exportStandardsInfoExcel");
addInterceptor.excludePathPatterns("/api/lawss/sarLawsInfo/exportStandardsInfoExcel");
//pcms项目数据下发开放接口
addInterceptor.excludePathPatterns("/api/sarStandProjectLibrary/save");
addInterceptor.excludePathPatterns("/api/sar-stand-project-team/save");
@@ -54,6 +55,10 @@ public class WebMvcConfig implements WebMvcConfigurer {
//标准征求意见导出
addInterceptor.excludePathPatterns("/api/slrs/sar-public-idea-all/tuallStand");
//标准法规清单导出
addInterceptor.excludePathPatterns("/api/sarLawsAttrDetailedList/sar-laws-attr-detailed-list/ExportLawsById");
//标准法规清单车型导出
addInterceptor.excludePathPatterns("/api/sarStandProjectLibrary/exportStandAttrInfoExcel");
//为符合项整改导出
addInterceptor.excludePathPatterns("/api/sarStandUnqualified/sar-stand-unqualified/exportStandUnqulifiedExcel");
//文件预览
@@ -62,9 +67,20 @@ public class WebMvcConfig implements WebMvcConfigurer {
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFileForSar");
//水印下载
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFileForSarWaterMark");
//企业标准导出
addInterceptor.excludePathPatterns("/api/lawss/sarBussionessStand/exportSarBussionessStand");
//OCR回调存储文件
addInterceptor.excludePathPatterns("/api/ocr/OCRRestful/OcrHandleResult");
addInterceptor.excludePathPatterns("/api/sarStandProjectLibrary/exportStandAttrInfoExcel");
// 拆分查看页,导出程序异常
addInterceptor.excludePathPatterns("/api/lawss/sarFileSplitItems/exportSplitInfoZip");
//调研流程下载接口
addInterceptor.excludePathPatterns("/api/att/attFile/downloadFile");
// //测试接口使用
// addInterceptor.excludePathPatterns("/api/**");
@@ -21,7 +21,7 @@ public class IDMUtil {
private final String app_secret = "Fxi5LHbI5yGbQQDpVp86GcCdXeC5Bjfe";
private final String access_url = "http://sso.foton.com.cn/oauth2.0/accessTokenByJson";
private final String profile_ur = "http://sso.foton.com.cn/oauth2.0/profileByJson";
private final String redirect_url = "https://slrs.foton.com.cn";
private final String redirect_url = "https://srms.foton.com.cn";
public String idmLogin(String code){
try{
@@ -9,12 +9,12 @@ spring.profiles.active=dev
server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/plain,text/css,application/x-javascript
# 端口号设置
server.port=4202
server.port=9999
#主服务session超时
server.servlet.session.timeout =600
#tomcat /resource/local/version-manager 创建tomcat指定临时目录
server.tomcat.basedir=/data/slrs/temp
server.tomcat.basedir=/resource/local/version-manager
# http-only
server.session.cookie.http-only=true
@@ -30,14 +30,20 @@ logging.level.org.springframework=info
# 请求前缀
restPath=/api
#server.servlet.context-path=/api
#是否将自己注册到Eureka Server上,默认为true
eureka.client.register-with-eureka=true
##是否从Eureka Server上获取注册信息,默认为true
eureka.client.fetch-registry=true
eureka.instance.prefer-ip-address=true
eureka.client.service-url.defaultZone=http://10.100.5.117:4201/eureka/
#eureka.client.service-url.defaultZone=http://10.5.116.172:8672/eureka/
#eureka.client.service-url.defaultZone=http://127.0.0.1:8671/eureka/
#eureka.client.service-url.defaultZone=http://10.5.116.172:8672/eureka/
eureka.client.service-url.defaultZone=http://62.234.136.153:8761/eureka/
#eureka.client.service-url.defaultZone=http://10.96.10.171:8761/eureka/
# 请求连接的超时时间 默认的时间为 1 秒
ribbon.ConnectTimeout=500000
@@ -131,9 +137,9 @@ verifyCodeMode=1
# 文件上传管控及配置
# =============================================================================
# file模块上传文件的服务器地址
file.path=/data/slrs/file
# 文件下载地址参数(弃用)
file.downloadUrl=
file.path=D:/uploadfile/bus
# 文件下载地址参数
file.downloadUrl=http://39.98.140.126:10001/uploadPath
#上传文件白名单-以,分隔
upload.file.white.lists = doc,docx,xls,xlsx,pdf,PDF,png,jpg,pptx,ppt
@@ -141,13 +147,14 @@ upload.file.white.lists = doc,docx,xls,xlsx,pdf,PDF,png,jpg,pptx,ppt
# elasticsearch 配置
# =============================================================================
elasticsearch.clustername=elasticsearch
elasticsearch.ip=10.100.5.122
elasticsearch.ip=172.17.0.1
elasticsearch.port=9300
elasticsearch.poolSize=5
elas.flag=true
# 文档转换TCP通讯地址
convert.host=127.0.0.1
#convert.host=0.0.0.0
# =============================================================================
# scheduled 配置
@@ -8,7 +8,7 @@
<!-- 项目名称 -->
<property name="PROJECT_NAME" value="adc-da" />
<!-- 定义日志文件的存储地址,勿在 LogBack的配置中使用相对路径 -->
<property name="LOG_HOME" value="/tmp/applog/pcms-rest" />
<property name="LOG_HOME" value="/tmp/applog/pcms-rest-system" />
<!-- <property name="LOG_HOME" value="../logs/pcms-rest" />-->
<!-- 定义系统日志文件的存储地址,勿在 LogBack的配置中使用相对路径 -->
<property name="LOG_HOME_SYSTEM" value="system" />
@@ -96,7 +96,11 @@ public class SearchCenterController extends BaseController<Map<String, Object>>
}
return Result.success(getPageInfo(searchInfoEO.getPager(), result));
} else {
result = searchCenterService.searchSarBykey(searchInfoEO);
if (searchInfoEO.getQueryStatus() != null && StringUtils.isNotBlank(searchInfoEO.getQueryStatus()) && searchInfoEO.getQueryStatus().equals("advancedSearch") && null != searchInfoEO.getSelectValue() && StringUtils.isNotBlank(searchInfoEO.getSelectValue())) {
result = searchCenterService.searchSarBykey(searchInfoEO);
}else {
result = searchCenterService.searchSarConditionBykey(searchInfoEO);
}
// 非动态消息的需要查询为我推荐
for (int i = 0; i < result.size(); i++) {
String collectId = personCollectEOService.queryCollectByUserAndId(result.get(i).get("id").toString());
@@ -31,6 +31,9 @@ public class SeniorSearchInfoEO extends BasePage {
@ApiModelProperty(value = "标准分类")
private String standType;
@ApiModelProperty(value = "搜索分类")
private String type;
@ApiModelProperty(value = "国家地区")
private String country;
@@ -239,6 +242,33 @@ public class SeniorSearchInfoEO extends BasePage {
private String stand_status;
private String isHigh;
private String queryStatus;
private String lawsType;
private String lawsNumber;
private String lawsName;
private String lawsEnName;
private String lawsNo;
private String issueCompany;
private String commentCycleDate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date commentCycleStart;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date commentCycleEnd;
private String lawsTextState;
private String lawsSyqy;
private String lawsSycx;
private String lawsYear;
private String lawsNotisyncNum;
private String lawsBulletin;
private String lawsLabel;
private String lawsRemark;
private String CYSDLAWS;
private String NYLXCLASS;
@@ -11,6 +11,8 @@ public interface SearchCenterService {
List<Map<String, Object>> searchSarBykey(SeniorSearchInfoEO searchInfoEO) throws Exception;
List<Map<String, Object>> searchSarConditionBykey(SeniorSearchInfoEO searchInfoEO) throws Exception;
/**
* 查询结果集searchResponse装换成List形式
* @param searchResponse 需要转换的数据
@@ -243,34 +243,42 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
attrInfoMap.put(key, "null");
}
}
fullTextSearchEO.put("title",attrInfoMap.get("numbershow")+" "+attrInfoMap.get("nameshow"));
fullTextSearchEO.put("title",attrInfoMap.get("lawsNumber")+" "+attrInfoMap.get("lawsNumber"));
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("适用区域: ").append(attrInfoMap.get("countryShow")).append(" ");
contentBuilder.append("政策状态: ").append(attrInfoMap.get("standstateshow")).append(" ");
contentBuilder.append("政策号: ").append(attrInfoMap.get("numbershow")).append(" ");
contentBuilder.append("政策名称: ").append(attrInfoMap.get("nameshow")).append(" ");
contentBuilder.append("英文名称: ").append(attrInfoMap.get("standEnName")).append(" ");
contentBuilder.append("政策分类: ").append(attrInfoMap.get("lawsTypeName")).append(" ");
contentBuilder.append("政策编号: ").append(attrInfoMap.get("lawsNumber")).append(" ");
contentBuilder.append("中文名称: ").append(attrInfoMap.get("lawsName")).append(" ");
contentBuilder.append("英文名称: ").append(attrInfoMap.get("lawsEnName")).append(" ");
contentBuilder.append("政策文号: ").append(attrInfoMap.get("lawsNo")).append(" ");
// contentBuilder.append("发布日期:"+attrInfoMap.get("issueTime")+" ");
contentBuilder.append("纳入标准法规清单的国家/地区: ").append(attrInfoMap.get("accessCountry")).append(" ");
contentBuilder.append("代替政策编号: ").append(attrInfoMap.get("replaceLawsNum")).append(" ");
contentBuilder.append("重要度: ").append(attrInfoMap.get("isRelateAccess")).append(" ");
contentBuilder.append("要求类型: ").append(attrInfoMap.get("YQLXShow")).append(" ");
contentBuilder.append("适用车辆类型: ").append(attrInfoMap.get("SYCLLXShow")).append(" ");
// contentBuilder.append("监管类型:"+attrInfoMap.get("")+" ");
contentBuilder.append("监管类型: ").append(attrInfoMap.get("ZRLXShow")).append(" ");
contentBuilder.append("个性化标签: ").append(attrInfoMap.get("GXHBQShow")).append(" ");
contentBuilder.append("新车型实施日期(文本): ").append(attrInfoMap.get("XCXSSRQ")).append(" ");
contentBuilder.append("在产车实施日期(文本): ").append(attrInfoMap.get("ZCCSSRQ")).append(" ");
contentBuilder.append("EOP实施日期(文本): ").append(attrInfoMap.get("EOPSSRQ")).append(" ");
contentBuilder.append("维护工程师: ").append(attrInfoMap.get("ZCGCSShow")).append(" ");
contentBuilder.append("组织标准起草的执行机构/单位: ").append(attrInfoMap.get("FBJGShow")).append(" ");
contentBuilder.append("SVPPS: ").append(attrInfoMap.get("SVPPSName")).append(" ");
contentBuilder.append("相关部门: ").append(attrInfoMap.get("XGBMShow")).append(" ");
contentBuilder.append("责任部门: ").append(attrInfoMap.get("ZRBMShow")).append(" ");
contentBuilder.append("FO: ").append(attrInfoMap.get("FOShow")).append(" ");
contentBuilder.append("归口管理部门: ").append(attrInfoMap.get("GKGLBMShow")).append(" ");
contentBuilder.append("我司是否参与: ").append(attrInfoMap.get("WSSFCYShow")).append(" ");
contentBuilder.append("相关流程: ").append(attrInfoMap.get("XGLC")).append(" ");
contentBuilder.append("地区: ").append(attrInfoMap.get("country")).append(" ");
contentBuilder.append("发文日期: ").append(attrInfoMap.get("issueTime")).append(" ");
contentBuilder.append("发文单位: ").append(attrInfoMap.get("issueCompany")).append(" ");
contentBuilder.append("征集意见周期-起始时间: ").append(attrInfoMap.get("commentCycleStart")).append(" ");
contentBuilder.append("征集意见周期-结束时间: ").append(attrInfoMap.get("commentCycleEnd")).append(" ");
contentBuilder.append("文本状态: ").append(attrInfoMap.get("lawsTextStateName")).append(" ");
contentBuilder.append("适用区域: ").append(attrInfoMap.get("lawsSyqyName")).append(" ");
contentBuilder.append("适用车型: ").append(attrInfoMap.get("lawsSycxName")).append(" ");
contentBuilder.append("是否纳入认证清单: ").append(attrInfoMap.get("isRelateAccessName")).append(" ");
contentBuilder.append("年度: ").append(attrInfoMap.get("lawsYearName")).append(" ");
contentBuilder.append("福田转发通知文号: ").append(attrInfoMap.get("lawsNotisyncNum")).append(" ");
contentBuilder.append("信息简报: ").append(attrInfoMap.get("lawsBulletin")).append(" ");
contentBuilder.append("标签: ").append(attrInfoMap.get("lawsLabel")).append(" ");
contentBuilder.append("备注: ").append(attrInfoMap.get("lawsRemark")).append(" ");
contentBuilder.append("实施日期(文本): ").append(attrInfoMap.get("SSRQLAWSName")).append(" ");
contentBuilder.append("新车型实施日期(文本): ").append(attrInfoMap.get("XCXSSRQLAWSName")).append(" ");
contentBuilder.append("在产车实施日期(文本): ").append(attrInfoMap.get("ZCXSSRQLAWSName")).append(" ");
contentBuilder.append("发布机构: ").append(attrInfoMap.get("FBJGLAWSName")).append(" ");
contentBuilder.append("我司参与深度: ").append(attrInfoMap.get("CYSDLAWSName")).append(" ");
contentBuilder.append("投稿人: ").append(attrInfoMap.get("TGRLAWSName")).append(" ");
contentBuilder.append("投稿单位: ").append(attrInfoMap.get("TGRLAWSName")).append(" ");
contentBuilder.append("能源类型: ").append(attrInfoMap.get("NYLXLAWSName")).append(" ");
contentBuilder.append("适用认证: ").append(attrInfoMap.get("YYRZLAWSName")).append(" ");
contentBuilder.append("责任部门: ").append(attrInfoMap.get("ZRBMLAWSName")).append(" ");
contentBuilder.append("责任工程师: ").append(attrInfoMap.get("ZRGCSLAWSName")).append(" ");
contentBuilder.append("代替文件号: ").append(attrInfoMap.get("DTWJHLAWSName")).append(" ");
contentBuilder.append("被代替文件号: ").append(attrInfoMap.get("BDTWJHLAWSName")).append(" ");
contentBuilder.append("引用标准&政策: ").append(attrInfoMap.get("YYBZZCLAWSName")).append(" ");
// contentBuilder.append("相关资料:"+attrInfoMap.get("")+" ");
if (attrInfoMap.containsKey("content")){
if (null !=attrInfoMap.get("content") && StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("content")))){
@@ -285,10 +293,10 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.put("textContent",textContent.toString());
if (null != attrInfoMap.get("issue_time") && !"".equals(attrInfoMap.get("issue_time")) && !"null".equals(attrInfoMap.get("issue_time"))) {
fullTextSearchEO.put("issue_time", attrInfoMap.get("issue_time"));
if (null != attrInfoMap.get("issueTime") && !"".equals(attrInfoMap.get("issueTime")) && !"null".equals(attrInfoMap.get("issueTime"))) {
fullTextSearchEO.put("issue_time", attrInfoMap.get("issueTime"));
}else {
fullTextSearchEO.put("issue_time", "");
fullTextSearchEO.put("issue_time", "--");
}
}else if ("bussstand".equals(attrInfoMap.get("type"))){
@@ -11,6 +11,7 @@ import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -37,9 +38,7 @@ public class InitStandAttrSearchUtil implements ApplicationRunner {
standTypeList.add(SarTypeEnum.STAND.getValue());
standTypeList.add(SarTypeEnum.INLAND_STAND.getValue());
standTypeList.add(SarTypeEnum.FOREIGN_STAND.getValue());
lawsTypeList.add(SarTypeEnum.LAWS.getValue());
lawsTypeList.add(SarTypeEnum.INLAND_LAWS.getValue());
lawsTypeList.add(SarTypeEnum.FOREIGN_LAWS.getValue());
lawsTypeList.add(SarTypeEnum.LAWS_STAND.getValue());
standStateList.add("DRAFT");
standStateList.add("ADVICE");
standStateList.add("RADYSUBMIT");
@@ -78,6 +77,7 @@ public class InitStandAttrSearchUtil implements ApplicationRunner {
public static List<String> numFieldListLaws = new ArrayList<>(); // 属性表数字类型字段
public static List<SarStandAttrDetails> lawsInlandAttrFieldList = new ArrayList<>(); // 属性表数字类型字段
public static List<SarStandAttrDetails> lawsForeignAttrFieldList = new ArrayList<>(); // 全部政策字段属性
public static List<SarStandAttrDetails> lawsStandAttrFieldList = new ArrayList<>(); // 全部政策字段属性
public static Map<String,String> selectFieldMapLaws = new HashMap<>(); // 下拉属性字段及选项值
// 企标属性字段信息
@@ -95,7 +95,7 @@ public class InitStandAttrSearchUtil implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
logger.info("项目启动时加载-搜索中心-查询标准属性类!");
logger.info("项目启动时加载--查询标准属性类!");
// 属性表需要查询的字段
StringBuilder fieldInfoBuilder = new StringBuilder();
StringBuilder fieldInfoBuilderLaws = new StringBuilder();
@@ -108,7 +108,7 @@ public class InitStandAttrSearchUtil implements ApplicationRunner {
qw.orderByAsc("ORDER_NUM");
List<SarStandAttrDetails> getDetailsList = sarStandAttrDetailsEOService.list(qw);
if (getDetailsList != null && !getDetailsList.isEmpty()) {
logger.info("项目启动时加载-搜索中心-查询标准属性类--查询到" + getDetailsList.size() + "条属性字段数据!");
logger.info("项目启动时加载--查询标准属性类--查询到" + getDetailsList.size() + "条属性字段数据!");
for (SarStandAttrDetails detailsEO : getDetailsList) {
String sarType = detailsEO.getSarType();
String attrType = detailsEO.getAttrType();
@@ -137,12 +137,16 @@ public class InitStandAttrSearchUtil implements ApplicationRunner {
numFieldList.add(detailsEO.getAttrField());
}
} else if (lawsTypeList.contains(sarType)) {
if (!SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
lawsInlandAttrFieldList.add(detailsEO);
}
if (!SarTypeEnum.INLAND_LAWS.getValue().equals(sarType)) {
if (SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
lawsForeignAttrFieldList.add(detailsEO);
}
if (SarTypeEnum.LAWS_STAND.getValue().equals(sarType)) {
lawsStandAttrFieldList.add(detailsEO);
}
if (SarTypeEnum.INLAND_LAWS.getValue().equals(sarType)) {
lawsInlandAttrFieldList.add(detailsEO);
}
fieldInfoBuilderLaws.append(detailsEO.getAttrField() + ",");
fieldInfoNameBuilderLaws.append(detailsEO.getAttrName() + ",");
queryFieldListLaws.add(detailsEO.getAttrField());
@@ -193,9 +197,9 @@ public class InitStandAttrSearchUtil implements ApplicationRunner {
if (StringUtils.isNotBlank(queryFieldBuss)) {
queryFieldBuss = queryFieldBuss.substring(0,queryFieldBuss.length()-1);
}
logger.info("项目启动时加载-搜索中心-查询标准属性类--查询到属性字段为:" + queryField);
logger.info("项目启动时加载-搜索中心-查询政策属性类--查询到属性字段为:" + queryFieldLaws);
logger.info("项目启动时加载-搜索中心-查询企标属性类--查询到属性字段为:" + queryFieldBuss);
logger.info("项目启动时加载--查询标准属性类--查询到属性字段为:" + queryField);
logger.info("项目启动时加载--查询政策属性类--查询到属性字段为:" + queryFieldLaws);
logger.info("项目启动时加载--查询企标属性类--查询到属性字段为:" + queryFieldBuss);
queryFieldNames = fieldInfoNameBuilder.toString();
queryFieldNamesLaws = fieldInfoNameBuilderLaws.toString();
queryFieldNamesBuss = fieldInfoNameBuilderBuss.toString();
@@ -208,11 +212,11 @@ public class InitStandAttrSearchUtil implements ApplicationRunner {
if (StringUtils.isNotBlank(queryFieldNamesBuss)) {
queryFieldNamesBuss = queryFieldNamesBuss.substring(0,queryFieldNamesBuss.length()-1);
}
logger.info("项目启动时加载-搜索中心-查询标准属性类--查询到属性字段名称为:" + queryFieldNames);
logger.info("项目启动时加载-搜索中心-查询政策属性类--查询到属性字段名称为:" + queryFieldNamesLaws);
logger.info("项目启动时加载-搜索中心-查询企标属性类--查询到属性字段名称为:" + queryFieldNamesBuss);
logger.info("项目启动时加载--查询标准属性类--查询到属性字段名称为:" + queryFieldNames);
logger.info("项目启动时加载--查询政策属性类--查询到属性字段名称为:" + queryFieldNamesLaws);
logger.info("项目启动时加载--查询企标属性类--查询到属性字段名称为:" + queryFieldNamesBuss);
} else {
logger.error("项目启动时加载-搜索中心-查询标准属性类--未查询到属性字段数据!");
logger.error("项目启动时加载--查询标准属性类--未查询到属性字段数据!");
}
}
@@ -11,6 +11,7 @@ public enum SarTypeEnum {
FOREIGN_STAND("FOREIGN_STAND","国外标准法规"),FOREIGN_LAWS("FOREIGN_LAWS","国外政策"),
STAND("STAND","国内外标准法规"),
LAWS("LAWS","国内外政策"),
LAWS_STAND("LAWS_STAND","国内外政策"),
BUSINESS("BUSINESS","企业标准"),
BUSS("BUSS","企业标准"),
SPLIT("SPLIT","标准拆分"),
@@ -11,6 +11,7 @@ public enum SarTypeEnum {
FOREIGN_STAND("FOREIGN_STAND","国外标准法规"),FOREIGN_LAWS("FOREIGN_LAWS","国外政策"),
STAND("STAND","国内外标准法规"),
LAWS("LAWS","国内外政策"),
LAWS_STAND("LAWS_STAND","国内外政策"),
BUSINESS("BUSINESS","企业标准"),
BUSS("BUSS","企业标准"),
SPLIT("SPLIT","标准拆分"),
@@ -2,6 +2,7 @@ package com.adc.da.mq;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
import net.sf.json.JSONObject;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,15 +33,17 @@ public class CreateStandMQService {
this.rabbitTemplate.convertAndSend("stand-exchange_SQ_GSAR_RELEASE", "stand-key_SQ_GSAR_RELEASE", standMap);
}
public void sendLawsMQ(SarLawsInfo sarLawsInfoEO, String addOrUpdate) throws Exception{
JSONObject json = JSONObject.fromObject(sarLawsInfoEO);
String sarLawsInfoStr = json.toString();
public void sendLawsMQ(SarLawsStandInfo sarLawsStandInfo, String addOrUpdate) throws Exception{
// JSONObject json = JSONObject.fromObject(sarLawsStandInfo);
com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(sarLawsStandInfo);
String sarLawsInfoStr = object.toString();
Map<String,Object> lawsMap = new HashMap<String,Object>();
lawsMap.put("sarLaws", sarLawsInfoStr);
lawsMap.put("addOrUpdate", addOrUpdate);
//发送消息队列
this.rabbitTemplate.convertAndSend("laws-exchange_SQ_GSAR", "laws-key_SQ_GSAR", lawsMap);
this.rabbitTemplate.convertAndSend("laws-exchange_SQ_GSAR_RELEASE", "laws-key_SQ_GSAR_RELEASE", lawsMap);
}
public void sendBussStandMQ(Object sarBussionessStandEO, String addOrUpdate) throws Exception{
@@ -0,0 +1,324 @@
package com.adc.da.mq;
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.alibaba.fastjson.JSON;
import com.rabbitmq.client.Channel;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.json.JSONTokener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class SendLawsMQService {
@Autowired
private ISarStandardsInfoService sarStandardsInfoService;
@Autowired
private SysInfoEOService sysInfoEOService;
@Autowired
private DicTypeEODao dicTypeEODao;
private static final Logger logger = LoggerFactory.getLogger(SendLawsMQService.class);
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = "createLawsMQ_SQ_GSAR_RELEASE", durable = "true"),
exchange = @Exchange(value = "laws-exchange_SQ_GSAR_RELEASE", ignoreDeclarationExceptions = "true"),
key = "laws-key_SQ_GSAR_RELEASE"))
public void createMQ(Map<String,Object> bussMap, Message message, Channel channel) throws Exception{
try{
try{
Thread.sleep(5000);
insertOrUpdateBussInfo(bussMap);
}catch(InterruptedException e){
logger.error(e.toString());
Thread.currentThread().interrupt();
}
} catch (Exception e) {
logger.error("搜索中心国内外政策消息队列进入转换前失败!");
logger.error(e.getMessage(),e);
} finally {
Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
channel.basicAck(tag,false);
logger.debug("消息确认成功!!!!!!!!!");
}
}
public void insertOrUpdateBussInfo(Map<String,Object> bussMap) throws Exception {
String addOrUpdate = bussMap.get("addOrUpdate").toString();
String sarBuss = bussMap.get("sarLaws").toString();
JSONObject jsonobject = JSONObject.fromObject(sarBuss);
SarLawsStandInfo infoEO = com.alibaba.fastjson.JSONObject.parseObject(sarBuss,SarLawsStandInfo.class);
if(infoEO.getMapItems() == null || infoEO.getMapItems().isEmpty()){
if(jsonobject.get("mapItems") != null){
infoEO.setMapItems(net.sf.json.JSONObject.fromObject(jsonobject.get("mapItems")));
}
}
// SarLawsStandInfo infoEO = (SarLawsStandInfo) JSONObject.toBean(jsonobject,SarLawsStandInfo.class);
String FZRQFSRQ = null;
if ("updateFromAct".equals(addOrUpdate)){
addOrUpdate = "update";
FZRQFSRQ = "1";
}
String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr();
Map<String,Object> attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr);
Map<String,Object> infoMap = infoEO.getAttrInfoCaseMap();
Map<String,String> infoEOMapItems = infoEO.getMapItems();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//修改索引信息表
// 往索引表中插入数据
String baseSearchContent = "";
String getCodeName = "";
Map<String,Object> saveMap = new HashMap<>();
saveMap.put("standType","laws");
//发布日期 高级查询
saveMap.put("issueTime",dateFormatToStr(infoEO.getIssueTime()));
Date issue_time_data = null;
if (StringUtils.isNotBlank(infoEO.getIssueTime())) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
issue_time_data = format.parse(dateFormatToStr(infoEO.getIssueTime())+" 00:00:00");
} catch (ParseException ignored) {
}
}
if (issue_time_data != null) {
saveMap.put("issue_time_data",issue_time_data.getTime());
}else{
saveMap.put("issue_time_data",-1000000000000000000L);
}
//征集意见周期-起始时间
saveMap.put("commentCycleStart",dateFormatToStr(infoEO.getCommentCycleStart()));
Date commentCycleStart_data = null;
if (StringUtils.isNotBlank(infoEO.getCommentCycleStart())) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
commentCycleStart_data = format.parse(dateFormatToStr(infoEO.getCommentCycleStart())+" 00:00:00");
} catch (ParseException ignored) {
}
}
if (commentCycleStart_data != null) {
saveMap.put("commentCycleStart_data",commentCycleStart_data.getTime());
}else{
saveMap.put("commentCycleStart_data",-1000000000000000000L);
}
//征集意见周期-结束时间
saveMap.put("commentCycleEnd",dateFormatToStr(infoEO.getCommentCycleEnd()));
Date commentCycleEnd_data = null;
if (StringUtils.isNotBlank(infoEO.getCommentCycleStart())) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
commentCycleEnd_data = format.parse(dateFormatToStr(infoEO.getCommentCycleStart())+" 00:00:00");
} catch (ParseException ignored) {
}
}
if (commentCycleEnd_data != null) {
saveMap.put("commentCycleEnd_data",commentCycleEnd_data.getTime());
}else{
saveMap.put("commentCycleEnd_data",-1000000000000000000L);
}
saveMap.put("id",infoEO.getId());
String lawsTypeName = "";
if(infoEO.getLawsTextState() != null && StringUtils.isNotBlank(infoEO.getLawsType())){
List<String> valArr = Arrays.asList(infoEO.getLawsType().split(","));
lawsTypeName = dicTypeEODao.getDicNamesByCodes(valArr);
}
saveMap.put("lawsType",infoEO.getLawsType());
saveMap.put("lawsTypeName",lawsTypeName);
saveMap.put("lawsNumber",infoEO.getLawsNumber());
saveMap.put("lawsName",infoEO.getLawsName());
saveMap.put("lawsEnName",infoEO.getLawsEnName());
saveMap.put("lawsNo",infoEO.getLawsNo());
saveMap.put("issueCompany",infoEO.getIssueCompany());
String lawsSyqyName = "";
if(infoEO.getLawsTextState() != null && StringUtils.isNotBlank(infoEO.getLawsSyqy())){
List<String> valArr = Arrays.asList(infoEO.getLawsSyqy().split(","));
lawsSyqyName = dicTypeEODao.getDicNamesByCodes(valArr);
}
saveMap.put("lawsSyqy",infoEO.getLawsSyqy());
saveMap.put("lawsSyqyName",lawsSyqyName);
String lawsSycxName = "";
if(infoEO.getLawsTextState() != null && StringUtils.isNotBlank(infoEO.getLawsSycx())){
List<String> valArr = Arrays.asList(infoEO.getLawsSycx().split(","));
lawsSycxName = dicTypeEODao.getDicNamesByCodes(valArr);
}
saveMap.put("lawsSycx",infoEO.getLawsSycx());
saveMap.put("lawsSycxName",lawsSycxName);
String isRelateAccessName = "";
if(infoEO.getIsRelateAccess() != null && StringUtils.isNotBlank(infoEO.getIsRelateAccess())){
if(infoEO.getIsRelateAccess().equals("1")){
isRelateAccessName = "";
}else {
isRelateAccessName = "";
}
}
saveMap.put("isRelateAccess",infoEO.getIsRelateAccess());
saveMap.put("isRelateAccessName",isRelateAccessName);
String lawsYearName = "";
if(infoEO.getLawsTextState() != null && StringUtils.isNotBlank(infoEO.getLawsYear())){
List<String> valArr = Arrays.asList(infoEO.getLawsYear().split(","));
lawsYearName = dicTypeEODao.getDicNamesByCodes(valArr);
}
saveMap.put("lawsYear",infoEO.getLawsYear());
saveMap.put("lawsYearName",lawsYearName);
saveMap.put("lawsNotisyncNum",infoEO.getLawsNotisyncNum());
saveMap.put("lawsBulletin",infoEO.getLawsBulletin());
String lawsLabelName = "";
if(infoEO.getLawsTextState() != null && StringUtils.isNotBlank(infoEO.getLawsLabel())){
List<String> valArr = Arrays.asList(infoEO.getLawsLabel().split(","));
lawsLabelName = dicTypeEODao.getDicNamesByCodes(valArr);
}
saveMap.put("lawsLabel",infoEO.getLawsLabel());
saveMap.put("lawsLabelName",lawsLabelName);
saveMap.put("lawsRemark",infoEO.getLawsRemark());
String lawsTextStateName = "";
if(infoEO.getLawsTextState() != null && StringUtils.isNotBlank(infoEO.getLawsTextState())){
List<String> valArr = Arrays.asList(infoEO.getLawsTextState().split(","));
lawsTextStateName = dicTypeEODao.getDicNamesByCodes(valArr);
}
saveMap.put("lawsTextState",infoEO.getLawsTextState());
saveMap.put("lawsTextStateName",lawsTextStateName);
//新加字段
saveMap.put("country",infoEO.getCountry());
if(StringUtils.isNotEmpty(infoEO.getCountry())){
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getCountry());
saveMap.put("countryShow",codeName);
}
// 自定义属性字段
if (attrInfoMap != null && !attrInfoMap.isEmpty()) {
attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "laws",baseSearchContent);
saveMap.putAll(attrInfoMap);
}
saveMap.put("type","laws");
saveMap.put("validFlag","0");
saveMap.put("content",infoEO.getFileIds());
String fieldInfo = InitStandAttrUtil.queryFieldLaws;
List<String> fieldInfoList = Arrays.asList(fieldInfo .split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList());
// 动态存储属性字段
for (String field : fieldInfoList) {
saveMap.put(field,attrInfoMap.getOrDefault(field,""));
String fieldValue = "";
String fieldFilter = field.toLowerCase();
if(infoMap.get(fieldFilter) != null && StringUtils.isNotBlank(infoMap.get(fieldFilter).toString())){
Object json= new JSONTokener(infoMap.get(fieldFilter).toString()).nextValue();
if(!json.toString().equals("null")){
fieldValue = infoMap.get(fieldFilter).toString();
}
}
saveMap.put(field+"Name",fieldValue);
}
if(infoEOMapItems != null && !infoEOMapItems.isEmpty()){
saveMap.put("mapItems",infoEOMapItems);
}
//当建立代替时,产生的没有文件的问题
if (StringUtils.isBlank(String.valueOf(saveMap.get("content")))) {
String context = filterStringIsNotBlank(String.valueOf(saveMap.get("ZCWBLAWS")),true)
+ filterStringIsNotBlank(String.valueOf(saveMap.get("GCWBLAWS")),true)
+ filterStringIsNotBlank(String.valueOf(saveMap.get("JDWJLAWS")),true)
+ filterStringIsNotBlank(String.valueOf(saveMap.get("GLWJLAWS")),true);
context = context.replace(",,", ",");
saveMap.put("content", context);
}
if("add".equals(addOrUpdate)){
sarStandardsInfoService.insertIntoIndexForMap(saveMap);
} else {
sarStandardsInfoService.updateIntoIndexForMap(saveMap);
}
}
private String filterStringIsNotBlank(String str,boolean boo){
String f = ",";
return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);
}
private String dateFormatToStr(String dateStr){
if(dateStr == null || dateStr.equals("")){
return "";
}
String dateToStr = "";
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateToStr = dateFormat.format(dateFormat.parse(dateStr.trim().substring(0,10)));
}catch (Exception e){
e.getMessage();
}
return dateToStr;
}
public Map<String,Object> dealNumberMsg (Map<String,Object> saveMap,SarBussionessStand infoEO,String getCodeName) {
/*if(StringUtils.isNotEmpty(infoEO.getStandYear())){
String num = getCodeName + " " + infoEO.getStandCode() + "-" + infoEO.getStandYear();
saveMap.put("numbershow",num);
int index = infoEO.getStandCode().indexOf(".");
int index1 = infoEO.getStandCode().indexOf(":");
String numberExpNull = "";
if(index > -1){
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
+ "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
}else if(index1 > -1){
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
+ "-" + getCodeName + infoEO.getStandCode().substring(0,index1) + "-" + infoEO.getStandCode().substring(0,index1);
}else{
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","");
}
} else {
String number = getCodeName + " " + infoEO.getStandCode();
saveMap.put("numbershow",number);
String numberExpNull = "";
int index = infoEO.getStandCode().indexOf(".");
if(index > -1){
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","")
+ "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
}else{
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","");
}
saveMap.put("numberExpNull",numberExpNull);
}*/
String number = infoEO.getStandCode();
saveMap.put("numbershow",number);
String numberExpNull = "";
int index = infoEO.getStandCode().indexOf(".");
if(index > -1){
numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","")
+ "-" + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
}else{
numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","");
}
saveMap.put("numberExpNull",numberExpNull);
return saveMap;
}
}
@@ -0,0 +1,81 @@
package com.adc.da.slrs.ImportExcelDatas.POIUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
@Component
public class POIUtil {
//获取单元格各类型值,返回字符串类型
public static String getCellValueByCell(Cell cell) {
//判断是否为null或空串
if (cell==null || cell.toString().trim().equals("")) {
return "";
}
String cellValue = "";
CellType cellType = cell.getCellType();
cell.getCellType();
switch (cellType) {
case NUMERIC: // 数字
short format = cell.getCellStyle().getDataFormat();
if (DateUtil.isCellDateFormatted(cell)) {
SimpleDateFormat sdf = null;
//System.out.println("cell.getCellStyle().getDataFormat()="+cell.getCellStyle().getDataFormat());
if (format == 20 || format == 32) {
sdf = new SimpleDateFormat("HH:mm");
} else if (format == 14 || format == 31 || format == 57 || format == 58) {
// 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
sdf = new SimpleDateFormat("yyyy-MM-dd");
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil
.getJavaDate(value);
cellValue = sdf.format(date);
}else {// 日期
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
try {
cellValue = sdf.format(cell.getDateCellValue());// 日期
} catch (Exception e) {
try {
throw new Exception("exception on get date data !".concat(e.toString()));
} catch (Exception e1) {
e1.printStackTrace();
}
}finally{
sdf = null;
}
} else {
BigDecimal bd = new BigDecimal(cell.getNumericCellValue());
cellValue = bd.toPlainString();// 数值 这种用BigDecimal包装再获取plainString,可以防止获取到科学计数值
}
break;
case STRING: // 字符串
cellValue = cell.getStringCellValue();
break;
case BOOLEAN: // Boolean
cellValue = cell.getBooleanCellValue()+"";;
break;
case FORMULA: // 公式
cellValue = cell.getCellFormula();
break;
case BLANK: // 空值
cellValue = "";
break;
case ERROR: // 故障
cellValue = "ERROR VALUE";
break;
default:
cellValue = "UNKNOW VALUE";
break;
}
return cellValue;
}
}
@@ -0,0 +1,137 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class Analysis {
private static final Logger logger = LoggerFactory.getLogger(Contrast.class);
private int sortColumn=0;
public void run(MultipartFile file, MultipartFile sort) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashSet<String> sortSet = getSet(sort);
for (Row row : sheet) {
if (row.getCell(1)!=null){
//获取表1的标准号
String value = row.getCell(1).toString();
Cell sortCell = row.createCell(11);
Cell numberCell = row.createCell(12);
Cell yearCell = row.createCell(13);
sortCell.setCellType(CellType.STRING);
numberCell.setCellType(CellType.STRING);
yearCell.setCellType(CellType.STRING);
List<String> collect = sortSet.stream()
.filter(item ->{
int length = item.length();
if (value.length()>length){
return value.substring(0, length).contains(item);
}else return false;
})
.collect(Collectors.toList());
//对比在表2中是否存在
if (collect.size()==1){
String sortStr = collect.get(0);
int length = sortStr.length();
logger.info("*");
// Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
// pattern.matcher(standId).matches()
if (value.length()>=length+5){
sortCell.setCellValue(collect.get(0));
numberCell.setCellValue(value.substring(length,value.length()-5));
yearCell.setCellValue(value.substring(value.length()-4));
}
}else if (collect.size()>1){
String maxLenSort="";
for (String s : collect) {
if (s.length()>maxLenSort.length()){
maxLenSort=s;
}
}
int length = maxLenSort.length();
if (value.length()>=length+5){
logger.info("+");
sortCell.setCellValue(maxLenSort);
numberCell.setCellValue(value.substring(length,value.length()-5));
yearCell.setCellValue(value.substring(value.length()-4));
}
} else {
logger.info("-");
sortCell.setCellValue("-");
numberCell.setCellValue("-");
yearCell.setCellValue("-");
}
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\拆分标准号-企标.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
// HashMap<String, String> map = new HashMap<>();
}
public void setSortColumn(int sortColumn){
this.sortColumn=sortColumn;
}
/**
* 获取标准类别set集合
* @param file
* @return
* @throws IOException
*/
private HashSet<String> getSet(MultipartFile file) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// int lastNum = sheet.getLastRowNum();
HashSet<String> stringHashSet= new HashSet<>();
for (Row row : sheet) {
if (row.getCell(sortColumn)!=null){
stringHashSet.add(row.getCell(sortColumn).toString());
}
}
return stringHashSet;
}
}
@@ -0,0 +1,77 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
@Component
public class Contrast {
private static final Logger logger = LoggerFactory.getLogger(Contrast.class);
public void run(MultipartFile file,MultipartFile sort) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashSet<String> set = getSet(sort);
for (Row row : sheet) {
if (row.getCell(0)!=null){
//获取表1的标准号
String value = row.getCell(0).toString().trim();
Cell cell = row.createCell(11);
//对比在表2中是否存在
if (set.contains(value.trim())){
logger.info("*");
cell.setCellType(CellType.STRING);
cell.setCellValue("1");
}else {
logger.info("-");
cell.setCellType(CellType.STRING);
cell.setCellValue("0");
}
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\海外对比全数据.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
// HashMap<String, String> map = new HashMap<>();
}
private HashSet<String> getSet(MultipartFile file) throws IOException {
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// int lastNum = sheet.getLastRowNum();
HashSet<String> stringHashSet= new HashSet<>();
for (Row row : sheet) {
if (row.getCell(1)!=null){
stringHashSet.add(row.getCell(1).toString().trim());
}
}
return stringHashSet;
}
}
@@ -15,7 +15,7 @@ import java.util.List;
@Component
public class ExclErrorOut {
private static final Logger logger = LoggerFactory.getLogger(BussStandExportUtil.class);
private static final Logger logger = LoggerFactory.getLogger(ExclErrorOut.class);
public static Workbook exportDatas (List<ImportDto> datas,String header) {
Workbook workbook = new XSSFWorkbook();
@@ -1,17 +1,29 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
@Component
public class ExclExport extends ExclErrorOut {
private static final Logger logger = LoggerFactory.getLogger(ExclErrorOut.class);
/**
* 导出多个sheet页的excl
@@ -23,6 +35,7 @@ public class ExclExport extends ExclErrorOut {
for (Map.Entry<String, List<ImportDto>> entry : dataMap.entrySet()) {
List<ImportDto> datas = entry.getValue();
Sheet sheet = workbook.createSheet(entry.getKey());
sheet.setDefaultColumnWidth(25);
super.createHeader(workbook,sheet,header);
super.createDatas(workbook,sheet,datas);
@@ -33,4 +46,71 @@ public class ExclExport extends ExclErrorOut {
return workbook;
}
/**
* 比对表格中的数据是否在数据库表中
* @param sourceFile
* @return
*/
public void contrast(MultipartFile sourceFile, HashSet<List<String>> set) throws IOException {
InputStream inputStream = sourceFile.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// HashMap<String, String> map = new HashMap<>();
int lastNum = sheet.getLastRowNum();
for (int i = 0; i < lastNum; i++) {
XSSFRow row = sheet.getRow(i);
if (row.getCell(1)!=null){
// String value = row.getCell(1).toString();
// map.put(value,String.valueOf(i));
String value = row.getCell(1).toString();
Cell cell = row.createCell(11);
Set<List<String>> collect = set.stream()
.filter(item ->
value.contains(item.get(0).trim())
&& value.contains(item.get(1).trim())
&& value.contains(item.get(2).trim())
)
.collect(Collectors.toSet());
if (!collect.isEmpty()){
logger.info("*");
cell.setCellType(CellType.STRING);
cell.setCellValue("1");
}else {
logger.info("-");
cell.setCellType(CellType.STRING);
cell.setCellValue("0");
}
}
// map.strea
// List<User> filterList=map.stre()
// .filter(user -> serviceCodes.contains(user.getOrgId()))
// .collect(Collectors.toList());
}
File file = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\ouhuo.xlsx");
FileOutputStream os = new FileOutputStream(file);
workbook.write(os);
}
}
@@ -0,0 +1,120 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import com.alibaba.fastjson.JSON;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
public class PathMatcher {
private static final Logger logger = LoggerFactory.getLogger(PathMatcher.class);
public void run(MultipartFile target, MultipartFile attach) throws IOException {
InputStream inputStream = target.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet mySheet = workbook.getSheetAt(0);
HashMap<String, String> fileMap = getFileMap(attach);
for (Row row : mySheet) {
if (row.getCell(1) == null || row.getCell(10) == null) {
logger.info("+");
continue;
}
String latter = row.getCell(1).getStringCellValue().trim();//标准号
String[] fileIdArray = row.getCell(10).getStringCellValue().trim().split(",");//文档id
HashMap<String, String> idMapPath = new HashMap<>(); //文件id和路径的键值对
for (String fileId : fileIdArray) { //遍历文件id
StringBuilder builder = new StringBuilder();
builder.append(fileId)
.append(latter);//拼接文件id和标准号
if (!fileMap.containsKey(builder.toString())) {
logger.info("-");
continue;
}else {
Cell cell = row.createCell(9);
idMapPath.put(fileId,fileMap.get(builder.toString()));
String json = JSON.toJSONString(idMapPath);
cell.setCellType(CellType.STRING);
cell.setCellValue(json);
logger.info("*");
}
}
}
File file = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件路径-国内-多个路径.xlsx");
FileOutputStream os = new FileOutputStream(file);
workbook.write(os);
}
private HashMap<String, String> getFileMap(MultipartFile excel) throws IOException {
InputStream inputStream = excel.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
HashMap<String, String> resultMap = new HashMap<>();
for (Row row : sheet) {
String value = row.getCell(0).getStringCellValue();
String[] strArray = value.split(",");
StringBuilder builder = new StringBuilder();
builder.append(strArray[1].trim()) //文档id
.append(strArray[2].trim()); //标准号
String path = strArray[3];
resultMap.put(builder.toString(), path);
}
return resultMap;
}
}
@@ -0,0 +1,201 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static org.apache.poi.ss.usermodel.CellType.NUMERIC;
public class StandMatcher {
private static final Logger logger = LoggerFactory.getLogger(StandMatcher.class);
public void run(MultipartFile target,MultipartFile attach) throws IOException {
InputStream inputStream = target.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Map<String, String> matchSet = getMatchSet(attach);
for (Row row : sheet) {
/**
* 企标
*/
// String letter =convertCellValueToString(row.getCell(1));//标准号
// String publish = convertCellValueToString(row.getCell(4));//发布日期
// String impl= convertCellValueToString(row.getCell(5));//实施日期
// String state = convertCellValueToString(row.getCell(3));//状态
// String replace= convertCellValueToString(row.getCell(6));//代替标准号
/**
* 国内
*/
String letter =convertCellValueToString(row.getCell(1));//标准号
String publish = convertCellValueToString(row.getCell(3));//发布日期
String impl= convertCellValueToString(row.getCell(4));//实施日期
String state = convertCellValueToString(row.getCell(2));//状态
String replace= convertCellValueToString(row.getCell(5));//代替标准号
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(letter)
.append(publish)
.append(impl)
.append(state)
.append(replace);
String str = strBuilder.toString();
if (matchSet.containsKey(str)){
Cell cell = row.createCell(10); //再第10列存放文件id
cell.setCellType(CellType.STRING);
cell.setCellValue(matchSet.get(str));
logger.info("*");
}else {
logger.info("-");
}
}
File result = new File("C:\\Users\\22501\\Desktop\\foton标准数据\\匹配带入文件id-国内-多个文件id.xlsx");
FileOutputStream os = new FileOutputStream(result);
workbook.write(os);
}
private Map<String,String> getMatchSet(MultipartFile excel) throws IOException {
InputStream inputStream = excel.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
Map<String,String> resultSet = new HashMap<>();
for (Row row : sheet) {
String letter =convertCellValueToString(row.getCell(0));//标准号
String publish = convertCellValueToString(row.getCell(3));//发布日期
String impl= convertCellValueToString(row.getCell(4));//实施日期
String state = convertCellValueToString(row.getCell(5));//状态
String replace= convertCellValueToString(row.getCell(6));//代替标准号
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(letter)
.append(publish)
.append(impl)
.append(state)
.append(replace);
if (row.getCell(7).getCellType()== NUMERIC){
String s = row.getCell(7).toString();
String fileId =s.substring(0,s.length()-2);//文件id
String standStr = strBuilder.toString();
if(resultSet.containsKey(standStr)){
String s1 = resultSet.get(standStr);
resultSet.replace(standStr,s1+","+fileId);
}else {
resultSet.put(standStr,fileId);
}
}
}
return resultSet;
}
/**
* 将单元格内容转化为字符串
*/
private static String convertCellValueToString(Cell cell) {
if (null == cell) {
return "";
}
String returnValue = "";
switch (cell.getCellType()) {
case STRING: //字符串
returnValue = cell.getStringCellValue().trim();
break;
case NUMERIC: //数字
if (DateUtil.isCellDateFormatted(cell)) {
Date tempValue = cell.getDateCellValue();
SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
returnValue = simpleFormat.format(tempValue);
}else {
returnValue = String.valueOf(cell.getNumericCellValue());
}
returnValue=cell.toString().trim();
break;
case BOOLEAN: //布尔
boolean booleanCellValue = cell.getBooleanCellValue();
returnValue = Boolean.toString(booleanCellValue).trim();
break;
case BLANK: //空值
break;
case FORMULA: //公式
cell.getCellFormula();
break;
case ERROR: //故障
break;
default:
break;
}
return returnValue;
}
/**
* 判断是否为整数,是返回true,否则返回false.
*/
public static boolean isIntegerForDouble(Double num) {
double eqs = 1e-10; //精度范围
return num - Math.floor(num) < eqs;
}
}
@@ -0,0 +1,169 @@
package com.adc.da.slrs.ImportExcelDatas.comment;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.slrs.ImportExcelDatas.POIUtil.POIUtil;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@Component
public class Standard {
@Autowired
private IAttFileEOService attFileEOService;
private static final Logger logger = LoggerFactory.getLogger(Standard.class);
Map<String,String> standAttrMap = new TreeMap<>();
private String standType="";
Standard(){
/**
* 初始化国内外标准属性字段
*/
List<String> listStandField = InitStandAttrUtil.queryFieldList;
listStandField.forEach(item ->{
this.standAttrMap.put(item,"");
});
}
public void setStandType(String standType) {
if (!"INLAND,FOREIGN".contains(standType)){
logger.error("标准类别错误");
}else {
this.standType = standType;
}
}
public SarStandardsInfo getStandardsInfo(Row row){
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
if ("".equals(standType)){
logger.error("未设置标准类型");
}else {
sarStandardsInfo.setStandType(standType);
}
sarStandardsInfo.setValidFlag("0");
Map<String, String> fieldMap = standAttrMap;//标准字段初化
for (int i=0;i<10;i++){
Cell cell = row.getCell(i);
String value = POIUtil.getCellValueByCell(cell);
switch (i){
case 0://标准名称
sarStandardsInfo.setStandName(value);
break;
case 2://标准状态
//TODO 标准状态转换为代码
switch (value){
case "有效":
value="vsaga7nwub";
break;
case "作废":
value="chblaarg77";
break;
case "参考":
value="-";
break;
case "0":
value="-";
break;
default:value="-";
}
sarStandardsInfo.setTextStatus(value);
break;
case 3://发布日期
//日期格式转换 1970/1/1 时发布日期为空
if ("1970/1/1".equals(value.trim())){
value="";
}
sarStandardsInfo.setIssueTime(value);
break;
case 4://实施日期
fieldMap.put("SSRQ", value);
break;
case 5://代替标准号
fieldMap.put("DTBJH", value);
break;
case 6://标准类别
sarStandardsInfo.setStandSort(value);
break;
case 7://标准号
sarStandardsInfo.setStandNumber(value);
break;
case 8://标准年份
sarStandardsInfo.setStandYear(value);
break;
case 9://附件路径 ->上传
HashMap<String,String> pathMap = JSON.parseObject(value, HashMap.class);
if (pathMap!=null){
Cell standCodeCell = row.getCell(1);
String standCode = POIUtil.getCellValueByCell(standCodeCell);
StringBuilder fileNameBuilder = new StringBuilder();
fileNameBuilder.append(standCode) //标准号
.append(sarStandardsInfo.getStandName());//标准名称
AttFileVo fileInfo = importFile(pathMap,fileNameBuilder.toString());//上传文件
fieldMap.put("FBGBJBD", fileInfo.getAttId());
}
break;
}
}
Gson gson = new Gson();
String attrInfoJson = gson.toJson(fieldMap);
sarStandardsInfo.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
return sarStandardsInfo;
}
private AttFileVo importFile(HashMap<String,String> pathMap,String customName){
String realPath = "";
for(String path: pathMap.values()) {
String filePath[] = path.split("/");
for (int i = 3; i < filePath.length; i++) {
realPath = realPath + "/" + filePath[i];
}
break;
}
File file = new File("/data/from12/Attach_swf_bak" + realPath);
return attFileEOService.insertFileInfo(file,customName);
}
}
@@ -2,25 +2,17 @@ package com.adc.da.slrs.ImportExcelDatas.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.common.ReadExcel;
import com.adc.da.http.ResponseMessage;
import com.adc.da.slrs.ImportExcelDatas.comment.ExclErrorOut;
import com.adc.da.slrs.ImportExcelDatas.comment.*;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.IImportStandExcelService;
import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService;
import com.adc.da.slrs.ImportExcelDatas.service.impl.ImportExcelServiceImpl;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
import com.adc.da.util.exception.AdcDaBaseException;
import com.adc.da.util.utils.IOUtils;
import com.adc.da.util.utils.StringUtils;
import com.adc.da.utils.util.BussStandExportUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@@ -34,7 +26,7 @@ import java.util.Map;
@RestController
@Api(description = "|SarStandPutTime|")
@RequestMapping("/ImportExcel")
@RequestMapping("/api/ImportExcel")
public class ImportExcelController extends BaseController<ImportDto> {
@Autowired
@@ -43,14 +35,26 @@ public class ImportExcelController extends BaseController<ImportDto> {
@Autowired
private ExclErrorOut exclErrorOut;
@ApiOperation("批量删除用户收藏")
@ApiOperation("从excl中导入标准信息")
@PostMapping("/import")
public void deleteList(MultipartFile file, MultipartFile file2, HttpServletResponse response, HttpServletRequest request) throws IOException {
Map<String, List<ImportDto>> mapMap=importExcelService.getExcelData(file,file2);
List<ImportDto> errorList = importExcelService.storageExclData(mapMap);
/**
* 导入系统
*/
// List<ImportDto> errorList = importExcelService.storageExclData(mapMap);
// mapMap.put("导入后的信息",errorList);
// List<ImportDto> guonei= mapMap.get("GNBZ");
// List<ImportDto> haiwai = mapMap.get("HWBZ");
// List<ImportDto> qibiao = mapMap.get("QYBZ");
/**
* 生成错误表格
*/
OutputStream os = null;
Workbook workbook = null;
try {
@@ -61,7 +65,11 @@ public class ImportExcelController extends BaseController<ImportDto> {
response.setContentType("application/force-download");
//导出数据
String headStr="标准号,标准名称,英文名称,发布时间,实施时间,标准状态,代替标准号,附件路径,错误原因";
workbook = exclErrorOut.exportDatas(errorList,headStr);
// workbook = exclErrorOut.exportDatas(guonei,headStr);
ExclExport exclExport = new ExclExport();
workbook = exclExport.exportData(mapMap, headStr);
os = response.getOutputStream();
workbook.write(os);
os.flush();
@@ -75,8 +83,104 @@ public class ImportExcelController extends BaseController<ImportDto> {
}
// return responseMessage;
}
@ApiOperation("从excl分解出标准号")
@PostMapping("/analysisExcl")
public void analysisExcl(MultipartFile exclFile,MultipartFile standSort, HttpServletResponse response, HttpServletRequest request) throws IOException {
/**
* 分解数据
*/
String headStr="标准号,标准类别,内容,标准名称,英文名称,发布时间,实施时间,标准状态,代替标准号,//,//";
Map<String, List<ImportDto>> stringListMap = importExcelService.analysisExcl(exclFile,standSort);
/**
* 生成错误表格
*/
OutputStream os = null;
Workbook workbook = null;
try {
String exportName="错误表格";
response.setHeader("Content-Disposition",
"attachment; filename=" + ReadExcel.encodeFileName(exportName+".xlsx",request));
response.setContentType("application/force-download");
//导出数据
// workbook = exclErrorOut.exportDatas(guonei,headStr);
ExclExport exclExport = new ExclExport();
workbook = exclExport.exportData(stringListMap, headStr);
os = response.getOutputStream();
workbook.write(os);
os.flush();
} catch (IOException e) {
throw new AdcDaBaseException("下载文件失败,请重试");
} finally {
IOUtils.closeQuietly(os);
if (workbook != null) {
workbook.close();
}
}
}
@ApiOperation("excel表中的信息是否在数据库中存在")
@PostMapping("/isExist")
public String isExist(MultipartFile exclFile){
return importExcelService.isExist(exclFile);
}
@ApiOperation("对比两个excel表中的标准名称")
@PostMapping("/contrast")
public void contrast(MultipartFile targetExcel,MultipartFile excel) throws IOException {
Contrast contrast = new Contrast();
contrast.run(targetExcel,excel);
}
@ApiOperation("根据标准从excl中分解出标准号,类别,年份")
@PostMapping("/analysis")
public void analysis(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
Analysis analysis = new Analysis();
analysis.setSortColumn(1);
analysis.run(targetExcel,attachExcel);
}
@ApiOperation("匹配文件id(多个id)")
@PostMapping("/matching")
public void matching(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
StandMatcher standMatcher = new StandMatcher();
standMatcher.run(targetExcel, attachExcel);
}
@ApiOperation("根据文件id和标准号匹配文件路径")
@PostMapping("/matchingPath")
public void matchingPath(MultipartFile targetExcel,MultipartFile attachExcel) throws IOException {
PathMatcher pathMatcher = new PathMatcher();
pathMatcher.run(targetExcel,attachExcel);
}
@Autowired
private IImportStandExcelService iImportStandExcelService;
@ApiOperation("根据分解后的excel表 导入标准数据和附件")
@PostMapping("importStandFormExcel")
public void importStandFormExcel(MultipartFile targetExcel,String standType) throws IOException {
iImportStandExcelService.importStandExcel(targetExcel,standType);
}
}
@@ -8,6 +8,10 @@ public class ImportDto extends BaseEntity {
// 标准号
private String standId;
//标准类别
private String standSort;
//
private String standIdExcludeSort;
// 标准名称
private String standName;
// 英文名称
@@ -0,0 +1,14 @@
package com.adc.da.slrs.ImportExcelDatas.service;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public interface IImportStandExcelService {
String importStandExcel(MultipartFile file,String standType) throws IOException;
}
@@ -14,4 +14,13 @@ public interface ImportExcelService extends IService<ImportDto> {
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap);
public Map<String,List<ImportDto>> analysisExcl(MultipartFile exclFile,MultipartFile standSort);
public String isExist(MultipartFile exclFile);
}
@@ -2,7 +2,7 @@ package com.adc.da.slrs.ImportExcelDatas.service.impl;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.http.Result;
import com.adc.da.slrs.ImportExcelDatas.comment.ExclExport;
import com.adc.da.slrs.ImportExcelDatas.dao.ImportExcelDao;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService;
@@ -10,9 +10,7 @@ import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.sys.entity.DicTypeEO;
import com.adc.da.sys.entity.DictionaryEO;
import com.adc.da.sys.service.impl.DicTypeEOServiceImpl;
import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
@@ -26,14 +24,15 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Service
public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDto> implements ImportExcelService {
@@ -55,6 +54,9 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
private final static String GN = "GB,GB/T,QC/T,GJB,JB,JT,HG,YV,SY,SH,GA,HJ,QB,JG,NB,JC,YS/T,FZ/T,TB/T,JJG,SJ/T,T/TBPS" +
",NB/T,CJ/T,YS/T,SJ/T,BB/T,SN/T,SB/T,MH/T,DB11,SZDB/Z,HKG,T/ZSA,CSAE,T/CAS,T/CADA,T/CHTS,T/ITS,T/BJQC";
private final static String QB = "Q/QCBFC,Q/FT,Q/FL,Q/QCFLC,Q/BQB,Q/SGT," +
@@ -70,6 +72,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
dates.add("" + i);
dates.add("- " + i);
dates.add("" + i);
dates.add("" + i);
}
if (file == null || file.getSize() == 0) {
@@ -118,12 +121,18 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
//中间的Map 判断标准号属于哪种类型
Map<String, String> middle = new HashMap<>();
datas.forEach(items -> {
System.out.print(".");
//判断是否是正确的数据
String[] as = items.split(",");
if (!inDate(as[0], dates)) {
if( as.length < 8){
ImportDto importDto = new ImportDto();
importDto.setErrorStr(items);
error.add(importDto);
} else if (!inDate(as[0], dates) ) {
ImportDto importDto = getImportDto(as);
error.add(importDto);
middle.put(as[0].trim(), "error-" + error.size());
middle.put(as[7].trim(), "error-" + error.size());
} else {
//数据二次拆解 针对标准进行拆解
String[] step2 = as[0].trim().split(" ");
@@ -131,15 +140,15 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
if (isCheck(GNS, step2[0].trim())) {
ImportDto importDto = getImportDto(as);
InCountry.add(importDto);
middle.put(as[0].trim(), "GNBZ-" + InCountry.size());
middle.put(as[7].trim(), "GNBZ-" + InCountry.size());
} else if (isCheck(QBS, step2[0].trim())) {
ImportDto importDto = getImportDto(as);
QiBiao.add(importDto);
middle.put(as[0].trim(), "QYBZ-" + QiBiao.size());
middle.put(as[7].trim(), "QYBZ-" + QiBiao.size());
} else {
ImportDto importDto = getImportDto(as);
OutCountry.add(importDto);
middle.put(as[0].trim(), "HWBZ-" + OutCountry.size());
middle.put(as[7].trim(), "HWBZ-" + OutCountry.size());
}
}
});
@@ -151,9 +160,11 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
fujian.forEach(items2 -> {
String[] fj = items2.split(",");
if (fj.length > 2) {
if (null != middle.get(null != fj[2] ? fj[2].trim() : "")) {
if (null != middle.get(null != fj[1] ? fj[1].trim() : "")) {
//对应数据位置
String[] location = middle.get(fj[2].trim()).split("-");
String[] location = middle.get(fj[1].trim()).split("-");
// List<ImportDto> importDtos = res.get(location[0]);
res.get(location[0]).get(Integer.parseInt(location[1]) - 1).setPath(fj[3]);
}
}
@@ -189,26 +200,42 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}
/**
* 数据数组转换为实体类
* @param as
* @return
*/
//赋值方法
private ImportDto getImportDto(String[] as) {
ImportDto importDto = new ImportDto();
if (as.length == 7) {
String content = as[0];
int length = as.length;
if (length>6){
for (String s : sortList) {
int sortLength = s.length();//标准类别长度
if (s.equals(content.substring(0,sortLength ))){
importDto.setStandSort(s);
importDto.setStandIdExcludeSort(content.substring(sortLength));
}
}
importDto.setStandId(null != as[0] ? as[0].trim() : "");
importDto.setStandName(null != as[1] ? as[1].trim() : "");
importDto.setStandNameEN(null != as[2] ? as[2].trim() : "");
importDto.setPublishTime(null != as[3] ? as[3].trim() : "");
importDto.setImplementedTime(null != as[4] ? as[4].trim() : "");
importDto.setStandStatus(null != as[5] ? as[5].trim() : "");
importDto.setReplaceId(null != as[6] ? as[6].trim() : "");
} else if (as.length == 6) {
importDto.setStandId(null != as[0] ? as[0].trim() : "");
importDto.setStandName(null != as[1] ? as[1].trim() : "");
importDto.setStandNameEN(null != as[2] ? as[2].trim() : "");
importDto.setPublishTime(null != as[3] ? as[3].trim() : "");
importDto.setImplementedTime(null != as[4] ? as[4].trim() : "");
importDto.setStandStatus(null != as[5] ? as[5].trim() : "");
importDto.setReplaceId("");
if (length==7){
importDto.setReplaceId("");
}else if (length==8){
importDto.setReplaceId(null != as[6] ? as[6].trim() : "");
}
}
return importDto;
}
@@ -225,7 +252,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
HSSFSheet sheet = workbook.getSheetAt(i);
// 获取有多少行
int lastNum = sheet.getLastRowNum();
for (int j = 1; j <= lastNum; j++) {
for (int j = 0; j <= lastNum; j++) {
HSSFRow row = sheet.getRow(j);
if (null != row) {
strings.add(row.getCell(0).getStringCellValue());
@@ -248,11 +275,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
// 遍历sheet页
for (int i = 0; i <= sheetNum; i++) {
XSSFSheet sheet = workbook.getSheetAt(i);
// 获取有多少行
// 获取有多少行 0行开始
int lastNum = sheet.getLastRowNum();
for (int j = 1; j <= lastNum; j++) {
for (int j = 0; j <= lastNum; j++) {
XSSFRow row = sheet.getRow(j);
if (null != row) {
System.out.println("正在读取第"+j+"行...");
strings.add(row.getCell(0).getStringCellValue());
}
}
@@ -266,9 +294,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
private List<ImportDto> error = new ArrayList<>();
private List<ImportDto> fileError = new ArrayList<>();
@Autowired
private ISarStandardsInfoService sarStandardsInfoService;
@@ -278,12 +304,41 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
@Autowired
private ISarBussionessStandService sarBussionessStandService;
private List<ImportDto> error = new ArrayList<>();
private List<ImportDto> fileError = new ArrayList<>();
private HashSet<String> sarSort = new HashSet<>();
@Override
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
//TODO 利用stream把list变为set
// List<DicTypeEO> list = dicTypeEOService.list();
// list.stream().flatMap(dicTypeEO -> {
// return dicTypeEO;
// }.co)
List<DicTypeEO> isExist = dicTypeEOService.getTypeIdByDicIdAndTypeName("JKSADFH564S", null, null, null);
isExist.forEach(item->{
sarSort.add(item.getDicTypeCode());
});//标准类别集合
error = importListMap.get("error");
/**
* 计数
*/
AtomicInteger QYBZcount= new AtomicInteger();
AtomicInteger QYBZcountUpdate= new AtomicInteger();
AtomicInteger HWBZcount= new AtomicInteger();
AtomicInteger HWBZcountUpdate= new AtomicInteger();
AtomicInteger GNBZcount= new AtomicInteger();
AtomicInteger GNBZcountUpdate= new AtomicInteger();
/**
* 初始化国内外标准属性字段
*/
@@ -296,24 +351,26 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
/**
* 海外标准
*/
importListMap.get("HWBZ").forEach(item -> {
if (true ) {
String standID = UUIDUtils.randomUUID20();
String standID = UUIDUtils.randomUUID20();
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapField = standAttrMap;
SarStandardsInfo ForeignEO = parseImportDtoToStandardsInfo(item,mapField, standID);
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapField = standAttrMap;
SarStandardsInfo ForeignEO = parseImportDtoToStandardsInfo(item,mapField, standID);
if (ForeignEO != null) {
ForeignEO.setValidFlag("0");
ForeignEO.setStandType("FOREIGN");
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT", ForeignEO.getStandSort())
.eq("STAND_NUMBER", ForeignEO.getStandNumber())
.eq("STAND_YEAR", ForeignEO.getStandYear());
if (ForeignEO != null) {
ForeignEO.setValidFlag("0");
ForeignEO.setStandType("FOREIGN");
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT", ForeignEO.getStandSort())
.eq("STAND_NUMBER", ForeignEO.getStandNumber())
.eq("STAND_YEAR", ForeignEO.getStandYear());
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
@@ -322,6 +379,9 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
try {
sarStandardsInfoService.updateSarStandardsInfo(ForeignEO);
HWBZcountUpdate.getAndIncrement();
HWBZcount.getAndIncrement();
System.out.println("海外标准执行更新===第: "+HWBZcount+"");
} catch (Exception e) {
item.setErrorStr("标准更新失败");
error.add(item);
@@ -331,6 +391,8 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
} else {
try {
sarStandardsInfoService.createSarStandardsInfo(ForeignEO);
HWBZcount.getAndIncrement();
System.out.println("海外标准执行新增===第: "+HWBZcount+"");
} catch (Exception e) {
item.setErrorStr("标准新增失败");
error.add(item);
@@ -340,12 +402,16 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}
} else {
item.setErrorStr("标准号无法解析");
error.add(item);
} else {
item.setErrorStr("标准号无法解析");
error.add(item);
}
}
});
@@ -354,56 +420,60 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
*/
importListMap.get("GNBZ").forEach(item -> {
String standID = UUIDUtils.randomUUID20();
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapStandField = standAttrMap;
SarStandardsInfo InlandEO = parseImportDtoToStandardsInfo(item, mapStandField,standID);
if (InlandEO != null) {
InlandEO.setValidFlag("0");
InlandEO.setStandType("INLAND");
if (true) {
String standID = UUIDUtils.randomUUID20();
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapStandField = standAttrMap;
SarStandardsInfo InlandEO = parseImportDtoToStandardsInfo(item, mapStandField, standID);
if (InlandEO != null) {
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT", InlandEO.getStandSort())
.eq("STAND_NUMBER", InlandEO.getStandNumber())
.eq("STAND_YEAR", InlandEO.getStandYear());
InlandEO.setValidFlag("0");
InlandEO.setStandType("INLAND");
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
if (one != null) {
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT", InlandEO.getStandSort())
.eq("STAND_NUMBER", InlandEO.getStandNumber())
.eq("STAND_YEAR", InlandEO.getStandYear());
InlandEO.setId(one.getId());
try {
sarStandardsInfoService.updateSarStandardsInfo(InlandEO);
} catch (Exception e) {
item.setErrorStr("国内标准更新失败");
error.add(item);
e.printStackTrace();
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
if (one != null) {
InlandEO.setId(one.getId());
try {
sarStandardsInfoService.updateSarStandardsInfo(InlandEO);
} catch (Exception e) {
item.setErrorStr("国内标准更新失败");
error.add(item);
e.printStackTrace();
}
} else {
try {
sarStandardsInfoService.createSarStandardsInfo(InlandEO);
} catch (Exception e) {
item.setErrorStr("国内标准新增失败");
error.add(item);
e.printStackTrace();
}
}
} else {
try {
sarStandardsInfoService.createSarStandardsInfo(InlandEO);
} catch (Exception e) {
item.setErrorStr("国内标准新增失败");
error.add(item);
e.printStackTrace();
}
item.setErrorStr("标准号无法解析");
error.add(item);
importListMap.replace("error", error);
}
} else {
item.setErrorStr("标准号无法解析");
error.add(item);
importListMap.replace("error", error);
}
}
});
@@ -420,41 +490,149 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
listStandBussField.forEach(item->{
bussAttrMap.put(item,"");
});
importListMap.get("QYBZ").forEach(item -> {
String standId = UUIDUtils.randomUUID20();
SarBussionessStand BussEO = parseImportDtoToSarBussionessStand(item, bussAttrMap,standId);
if (BussEO != null) {
try {
QueryWrapper<SarBussionessStand> saveWrapper = new QueryWrapper<>();
saveWrapper.eq("STAND_CODE", item.getStandId());
SarBussionessStand one = sarBussionessStandService.getOne(saveWrapper);
if (one != null) {
BussEO.setId(one.getId());
sarBussionessStandService.updateSarBussionessStand(BussEO);
} else {
sarBussionessStandService.createSarBussionessStand(BussEO);
if (true){
// if (item.getStandId().contains("Q/FT T396—2021") ){
String standId = UUIDUtils.randomUUID20();
SarBussionessStand BussEO = parseImportDtoToSarBussionessStand(item, bussAttrMap,standId);
if (BussEO != null) {
try {
QueryWrapper<SarBussionessStand> saveWrapper = new QueryWrapper<>();
saveWrapper.eq("STAND_CODE", item.getStandId());
SarBussionessStand one = sarBussionessStandService.getOne(saveWrapper);
if (one != null) {
BussEO.setId(one.getId());
sarBussionessStandService.updateSarBussionessStand(BussEO);
QYBZcountUpdate.getAndIncrement();
QYBZcount.getAndIncrement();
System.out.println("企业标准执行更新====第: "+QYBZcount+"");
} else {
sarBussionessStandService.createSarBussionessStand(BussEO);
QYBZcount.getAndIncrement();
System.out.println("企业标准执行新增第: "+QYBZcount+"");
}
} catch (Exception e) {
item.setErrorStr("数据格式错误");
error.add(item);
e.printStackTrace();
}
} catch (Exception e) {
item.setErrorStr("数据格式错误");
error.add(item);
e.printStackTrace();
}
}
});
error.addAll(fileError);
System.out.println("执行结束");
System.out.println("执行国内标准"+GNBZcount+"");
System.out.println("国内标准执行更新"+GNBZcountUpdate+"");
System.out.println("执行国外标准"+HWBZcount+"");
System.out.println("海外标准执行更新"+HWBZcountUpdate+"");
System.out.println("执行企业标准"+QYBZcount+"");
System.out.println("企业标准执行更新"+QYBZcountUpdate+"");
return error;
}
private List<String> sortList=new LinkedList<>();
@Override
public Map<String,List<ImportDto>> analysisExcl(MultipartFile exclFile,MultipartFile standSort) {
//TODO analy
if (exclFile == null || exclFile.getSize() == 0) {
log.error("文件上传错误,重新上传");
}
String filename = exclFile.getOriginalFilename();
String standSortName=standSort.getOriginalFilename();
List<String> datas = new ArrayList<>();
if (filename.endsWith(".xls")) {
datas = isXls(exclFile);
} else {
datas = isXlsx(exclFile);
}
if (standSortName.endsWith(".xls")){
sortList = isXls(standSort);
}else {
sortList = isXlsx(standSort);
}
HashMap<String, List<ImportDto>> result = new HashMap<>();
LinkedList<ImportDto> exportList = new LinkedList<>();
HashSet<String> distinct = new HashSet<>();
datas.forEach(data->{
System.out.print("#");
String[] row = data.split("\\,");
if (row.length>7){
if ((!"".equals(row[0].trim()) || !"".equals(row[1].trim()))&&distinct.add(row[0].trim()+row[1].trim())){
ImportDto importDto = getImportDto(row);
if(importDto.getStandId()!=null&&importDto.getStandName()!=null){
exportList.add(importDto);
}
}
}
});
result.put("标准数据all_new",exportList);
return result;
}
@Override
public String isExist(MultipartFile exclFile) {
ExclExport exclExport = new ExclExport();
QueryWrapper<SarStandardsInfo> standWrapper = new QueryWrapper<>();
standWrapper.select("STAND_NUMBER,STAND_SORT,STAND_YEAR");
List<Map<String, Object>> maps = sarStandardsInfoService.listMaps(standWrapper);
QueryWrapper<SarBussionessStand> bussionessWrapper = new QueryWrapper<>();
bussionessWrapper.select("STAND_CODE AS STAND_NUMBER,STAND_SORT,STAND_YEAR");
List<Map<String, Object>> maps1 = sarBussionessStandService.listMaps(bussionessWrapper);
HashSet<List<String>> nameSet = new HashSet<>();
maps.addAll(maps1);
maps.forEach(item->{
List<String> strings = new LinkedList<>();
strings.add(item.get("STAND_NUMBER").toString().trim());
strings.add(item.get("STAND_SORT").toString().trim());
strings.add(item.get("STAND_YEAR").toString().trim());
nameSet.add(strings);
});
try {
exclExport.contrast(exclFile,nameSet);
return "success";
}catch (Exception e){
e.printStackTrace();
return "failed";
}
}
/**
* 整理为标准信息实体
@@ -464,13 +642,10 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
* @return
*/
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,Map<String,String> fieldMap, String standId) {
HashMap<String, String> analysis = analysisStandId(importDto);
if (analysis == null) {
return null;
}
SarStandardsInfo sarStandardsInfoEO = new SarStandardsInfo();
sarStandardsInfoEO.setId(standId);
@@ -507,21 +682,21 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
if (importDto.getPath() != null) {
String path[] = importDto.getPath().split("/");
String realPath = "";
for (int i = 4; i < path.length; i++) {
for (int i = 3; i < path.length; i++) {
realPath = realPath + "/" + path[i];
}
try {
// File file = new File("C:\\Users\\22501\\Desktop\\foton\\2021\\" + realPath);
// File file = new File("C:\\Users\\22501\\Desktop\\foton\\" + realPath);
// File file = new File(importPath + realPath);
File file = new File("/home/file/2021/" + realPath);
File file = new File("/data/from12/Attach_swf_bak" + realPath);
if (file.exists()) {
AttFileVo fileInfo = attFileEOService.saveFileInfo(file);
if (importDto.getImplementedTime() != null) {
fieldMap.put("FBGJBD", fileInfo.getAttId());
fieldMap.put("FBGBJBD", fileInfo.getAttId());
} else {
fieldMap.put("GLWJ", fileInfo.getAttId());
}
@@ -585,16 +760,16 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
if (importDto.getPath() != null) {
String path[] = importDto.getPath().split("/");
String realPath = "";
for (int i = 4; i < path.length; i++) {
for (int i = 3; i < path.length; i++) {
realPath = realPath + "/" + path[i];
}
try {
// File file = new File("C:\\Users\\22501\\Desktop\\foton\\2021\\" + realPath);
// File file = new File("C:\\Users\\22501\\Desktop\\foton\\" + realPath);
// File file = new File(importPath + realPath);
File file = new File("/home/file/2021/" + realPath);
File file = new File("/data/from12/Attach_swf_bak" + realPath);
if (file.exists()) {
AttFileVo fileInfo = attFileEOService.saveFileInfo(file);
@@ -639,12 +814,14 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
*/
public HashMap<String, String> analysisStandId(ImportDto importDto) {
HashMap<String, String> result = new HashMap<>();
if (importDto.getStandId() == null) {
String standId = importDto.getStandId();
if (standId == null) {
importDto.setErrorStr("标准号为空");
error.add(importDto);
return null;
} else {
String standId = importDto.getStandId();
// String standId = importDto.getStandId();
//格式 非空格字符+空格+非空格字符+‘-’或‘—’或空格+年份 如Q/FT F003—2001
Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
if (!pattern.matcher(standId).matches()) {
@@ -656,7 +833,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
String sort = "";
String number = "";
String year = "";
String[] split = importDto.getStandId().split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
String[] split = standId.split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
// 多种格式(╯‵□′)╯︵┻━┻ Q-FL T015-2021 Q/ FL T015-2021 Q/FL T015-2021
@@ -670,25 +847,27 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
result.put("sort", sort);
result.put("number", number);
result.put("year", year);
//标准类别不存在,新增标准类别
List<DicTypeEO> isExist = dicTypeEOService.getTypeIdByDicIdAndTypeName("JKSADFH564S", null, sort, null);
if (isExist == null || isExist.isEmpty() || isExist.size()==0){
DicTypeEO dicTypeVO = new DicTypeEO();
dicTypeVO.setId(null);
dicTypeVO.setDicId("JKSADFH564S");
dicTypeVO.setDicTypeCode(sort);
dicTypeVO.setDicTypeName(sort);
dicTypeVO.setShowIndex(1);
Integer dicTypeEO = dicTypeEOService.saveDictype(dicTypeVO);
if (dicTypeEO>0){
importDto.setErrorStr("标准类别不存在,已新增");
}else {
importDto.setErrorStr("标准类别不存在,新增失败");
}
error.add(importDto);
}
/**
* 标准类别不存在,新增标准类别
*/
// List<DicTypeEO> isExist = dicTypeEOService.getTypeIdByDicIdAndTypeName("JKSADFH564S", null, sort, null);
// if (!sarSort.contains(sort)){
//
// DicTypeEO dicTypeVO = new DicTypeEO();
// dicTypeVO.setId(null);
// dicTypeVO.setDicId("JKSADFH564S");
// dicTypeVO.setDicTypeCode(sort);
// dicTypeVO.setDicTypeName(sort);
// dicTypeVO.setShowIndex(1);
// Integer dicTypeEO = dicTypeEOService.saveDictype(dicTypeVO);
// if (dicTypeEO>0){
// sarSort.add(sort);
// importDto.setErrorStr("标准类别不存在,已新增");
// }else {
// importDto.setErrorStr("标准类别不存在,新增失败");
// }
// error.add(importDto);
// }
@@ -0,0 +1,112 @@
package com.adc.da.slrs.ImportExcelDatas.service.impl;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.slrs.ImportExcelDatas.POIUtil.POIUtil;
import com.adc.da.slrs.ImportExcelDatas.comment.PathMatcher;
import com.adc.da.slrs.ImportExcelDatas.comment.Standard;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.IImportStandExcelService;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.sys.service.impl.DicTypeEOServiceImpl;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.Gson;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@Service
public class ImportStandExcelServiceImpl implements IImportStandExcelService {
private static final Logger logger = LoggerFactory.getLogger(PathMatcher.class);
@Autowired
private ISarStandardsInfoService sarStandardsInfoService;
@Autowired
private Standard standard;
private List<ImportDto> error = new ArrayList<>();
private List<ImportDto> fileError = new ArrayList<>();
@Async
@Override
public String importStandExcel(MultipartFile file,String standType) throws IOException {
AtomicInteger countUpdate= new AtomicInteger();//更新 数量
AtomicInteger countInsert= new AtomicInteger();//新增 数量
InputStream inputStream = file.getInputStream();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
standard.setStandType(standType);
int lastRowNum = sheet.getLastRowNum();
for (int i = 1; i < lastRowNum; i++) {
XSSFRow row = sheet.getRow(i);
SarStandardsInfo standardsInfo = standard.getStandardsInfo(row);
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT", standardsInfo.getStandSort())
.eq("STAND_NUMBER", standardsInfo.getStandNumber())
.eq("STAND_YEAR", standardsInfo.getStandYear());
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
if (one != null) {
standardsInfo.setId(one.getId());
try {
sarStandardsInfoService.updateSarStandardsInfo(standardsInfo);
countUpdate.getAndIncrement();
logger.info("执行更新"+countUpdate+"条数据");
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
sarStandardsInfoService.createSarStandardsInfo(standardsInfo);
countInsert.getAndIncrement();
logger.info("执行新增"+countInsert+"条数据");
} catch (Exception e) {
e.printStackTrace();
}
}
}
return "success";
}
}
@@ -2,6 +2,7 @@ package com.adc.da.slrs.SarCompStatusInfo.dao;
import com.adc.da.slrs.SarCompStatusInfo.entity.SarCompStatusInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author super_liu
* @since 2021-06-21
*/
@Repository
public interface SarCompStatusInfoDao extends BaseMapper<SarCompStatusInfo> {
}
@@ -0,0 +1,78 @@
package com.adc.da.slrs.esRevisePlan.controller;
import com.adc.da.http.PageInfo;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.esRevisePlan.service.IEsRevisePlanService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import java.util.List;
/**
* <p>
* 企标制修订计划 前端控制器
* </p>
*
* @author zcr
* @since 2021-11-14
*/
@RestController
@Api(description = "|EsRevisePlan|")
@RequestMapping("api/esRevisePlan/es-revise-plan")
public class EsRevisePlanController extends BaseController<EsRevisePlan> {
@Autowired
IEsRevisePlanService iEsRevisePlanService;
@ApiOperation(value = "获取所有企标计划")
@GetMapping("getAllPlans")
public ResponseMessage<Object> getAllPlans(EsRevisePlan esRevisePlan){
List<EsRevisePlan> esRevisePlans = iEsRevisePlanService.getAllPlans(esRevisePlan);
PageInfo<EsRevisePlan> pageInfo = getPageInfo(esRevisePlan.getPager(),esRevisePlans);
return Result.success(pageInfo);
}
@ApiOperation(value = "多条件查询企标计划")
@PostMapping("queryAllPlans")
public ResponseMessage<Object> queryAllPlans(EsRevisePlan esRevisePlan){
List<EsRevisePlan> esRevisePlans = iEsRevisePlanService.queryAllPlans(esRevisePlan);
PageInfo<EsRevisePlan> pageInfo = getPageInfo(esRevisePlan.getPager(),esRevisePlans);
return Result.success(pageInfo);
}
@ApiOperation(value = "获取单个企标计划详情")
@GetMapping("getPlanInfo")
public ResponseMessage<Object> getPlanInfo(String id){
return Result.success(iEsRevisePlanService.getOnePlan(id));
}
@ApiOperation(value = "编辑企标计划")
@PostMapping("modPlan")
public ResponseMessage<Object> modPlan(EsRevisePlan esRevisePlan){
return Result.success(iEsRevisePlanService.modPlan(esRevisePlan));
}
@ApiOperation(value = "添加企标计划")
@PostMapping("addPlan")
public ResponseMessage<Object> addPlan(EsRevisePlan esRevisePlan){
return Result.success(iEsRevisePlanService.addPlan(esRevisePlan));
}
@ApiOperation(value = "删除单个企标计划")
@GetMapping("delPlan")
public ResponseMessage<Object> delPlan(String id){
return Result.success(iEsRevisePlanService.delPlan(id));
}
@ApiOperation(value = "批量删除企标计划")
@GetMapping("delPlans")
public ResponseMessage<Object> delPlans(String ids){
return Result.success(iEsRevisePlanService.delPlans(ids));
}
}
@@ -0,0 +1,28 @@
package com.adc.da.slrs.esRevisePlan.dao;
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan;
import com.adc.da.slrs.wgdCensusZ.entity.WgdAssocCost;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* 企标制修订计划 Mapper 接口
* </p>
*
* @author zcr
* @since 2021-11-14
*/
public interface EsRevisePlanDao extends BaseMapper<EsRevisePlan> {
Integer getTotal();
Integer getQueryTotal(EsRevisePlan esRevisePlan);
List<EsRevisePlan> selectAll(EsRevisePlan esRevisePlan);//查询所有
List<EsRevisePlan> queryAll(EsRevisePlan esRevisePlan);//多条件查询
EsRevisePlan selectOne(String id);//查询详情
int updateOne(EsRevisePlan esRevisePlan);//编辑
int insertOne(EsRevisePlan esRevisePlan);//插入
int deleteOne(String id);//删除
int deleteBatch(String[] ids);//批量删除
}
@@ -0,0 +1,60 @@
package com.adc.da.slrs.esRevisePlan.entity;
import java.util.Date;
import com.adc.da.base.page.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* <p>
* 企标制修订计划
* </p>
*
* @author zcr
* @since 2021-11-14
*/
@Data
@Accessors(chain = true)
@ApiModel(value="EsRevisePlan对象", description="企标制修订计划")
public class EsRevisePlan extends BasePage {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "企标名称")
private String esName;
@ApiModelProperty(value = "计划状态")
private String planStatus;
@ApiModelProperty(value = "制修订状态")
private String reviseStatus;
@ApiModelProperty(value = "起草人")
private String drafter;
@ApiModelProperty(value = "评审责任人")
private String resPerson;
@ApiModelProperty(value = "工作组组长")
private String wgLeader;
@ApiModelProperty(value = "计划标准初稿完成时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date draftTime;
@ApiModelProperty(value = "计划标准发布时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date releaseTime;
@ApiModelProperty(value = "起草责任单位")
private String unit;
}
@@ -0,0 +1,25 @@
package com.adc.da.slrs.esRevisePlan.service;
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 企标制修订计划 服务类
* </p>
*
* @author zcr
* @since 2021-11-14
*/
public interface IEsRevisePlanService extends IService<EsRevisePlan> {
List<EsRevisePlan> getAllPlans(EsRevisePlan esRevisePlan);//查询所有
List<EsRevisePlan> queryAllPlans(EsRevisePlan esRevisePlan);//多条件查询
EsRevisePlan getOnePlan(String id);//查询详情
int modPlan(EsRevisePlan esRevisePlan);//编辑
int addPlan(EsRevisePlan esRevisePlan);//插入
int delPlan(String id);//删除
int delPlans(String ids);//批量删除
}
@@ -0,0 +1,69 @@
package com.adc.da.slrs.esRevisePlan.service.impl;
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan;
import com.adc.da.slrs.esRevisePlan.dao.EsRevisePlanDao;
import com.adc.da.slrs.esRevisePlan.service.IEsRevisePlanService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 企标制修订计划 服务实现类
* </p>
*
* @author zcr
* @since 2021-11-14
*/
@Service
public class EsRevisePlanServiceImpl extends ServiceImpl<EsRevisePlanDao, EsRevisePlan> implements IEsRevisePlanService {
@Autowired
EsRevisePlanDao esRevisePlanDao;
@Override
public List<EsRevisePlan> getAllPlans(EsRevisePlan esRevisePlan) {
Integer count = esRevisePlanDao.getTotal();
esRevisePlan.getPager().setRowCount(count);
List<EsRevisePlan> esRevisePlans = esRevisePlanDao.selectAll(esRevisePlan);
return esRevisePlans;
}
@Override
public List<EsRevisePlan> queryAllPlans(EsRevisePlan esRevisePlan) {
Integer count = esRevisePlanDao.getQueryTotal(esRevisePlan);
esRevisePlan.getPager().setRowCount(count);
List<EsRevisePlan> esRevisePlans = esRevisePlanDao.queryAll(esRevisePlan);
return esRevisePlans;
}
@Override
public EsRevisePlan getOnePlan(String id) {
return esRevisePlanDao.selectOne(id);
}
@Override
public int modPlan(EsRevisePlan esRevisePlan) {
return esRevisePlanDao.updateOne(esRevisePlan);
}
@Override
public int addPlan(EsRevisePlan esRevisePlan) {
esRevisePlan.setId(UUIDUtils.randomUUID(32));
return esRevisePlanDao.insertOne(esRevisePlan);
}
@Override
public int delPlan(String id) {
return esRevisePlanDao.deleteOne(id);
}
@Override
public int delPlans(String ids) {
String[] str = ids.split(",");
return esRevisePlanDao.deleteBatch(str);
}
}
@@ -0,0 +1,69 @@
package com.adc.da.slrs.sapMeetInfo.controller;
import com.adc.da.slrs.sapMeetInfo.service.ISapMeetingService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import io.swagger.annotations.Api;
import com.adc.da.base.web.BaseController;
import java.util.Date;
import java.util.List;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
前端控制器
* </p>
*
* @author zcr
* @since 2021-11-09
*/
@RestController
@Api(description = "|SapMeeting|")
@RequestMapping("/api/sapMeetInfo")
public class SapMeetingController extends BaseController<SapMeeting> {
@Autowired
ISapMeetingService sapMeetingService;
@ApiOperation(value = "id查询会议信息")
@GetMapping("/getOneById")
public SapMeeting getOneById(String id){
return sapMeetingService.getMeetingById(id);
}
@ApiOperation(value = "获取日历显示会议信息")
@GetMapping("/getDateMeeting")
public int getDateMeeting(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date, String id,int type){
return sapMeetingService.getDateMeeting(date,id,type);
}
@ApiOperation(value = "获取当月")
@GetMapping("/getMeetingsByMonth")
public List<SapMeeting> getMeetingsByMonth(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date){
return sapMeetingService.getMeetingsByMonth(date);
}
@ApiOperation(value = "获取当月,根据标志位type区分 1标准活动和2政策课题")
@GetMapping("/getMeetingsByMonthType")
public List<SapMeeting> getMeetingsByMonthType(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date,int type){
return sapMeetingService.getMeetingsByMonth(date, type);
}
@ApiOperation(value = "获取当天列表")
@GetMapping("/getMeetingsByDate")
public List<SapMeeting> getMeetingsByDate(@DateTimeFormat(pattern = "yyyy-MM-dd") Date date,int type){
return sapMeetingService.getMeetingsByDate(date,type);
}
@ApiOperation(value = "插入会议")
@PostMapping("/addMeeting")
public int addMeeting(@RequestBody SapMeeting sapMeeting){
return sapMeetingService.addMeeting(sapMeeting);
}
}
@@ -0,0 +1,43 @@
package com.adc.da.slrs.sapMeetInfo.dao;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
@Repository
public interface SapMeetingDao extends BaseMapper<SapMeeting> {
int insertMeeting(SapMeeting sapMeeting);//参会流程结束--插入
List<SapMeeting> selectMeetingsByDate(Map map);//根据日期查找-当日所有会议(时间正序)
List<SapMeeting> selectMeetingsByMonth(Date date);//根据年,月查找
List<SapMeeting> selectMeetingsByMonthType(Map map);//根据年,月查找,type标志位 1标准化活动 2政策课题组
SapMeeting selectMeetingById(String id);
int deleteById(String id);
int deleteByDate(Date date);
int updateMeeting(SapMeeting sapMeeting);
}
@@ -0,0 +1,47 @@
package com.adc.da.slrs.sapMeetInfo.entity;
import com.adc.da.base.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
@Data
@Accessors(chain = true)
@ToString
@ApiModel(value="SapMeeting对象", description="流程通过的 标准化活动会议信息表 standard_activity_pass")
public class SapMeeting{
private static final long serialVersionUID = 1L;
private String id;//主键-会议id
private String title;//会议标题
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date date;//会议开始时间
private String content;//会议内容大纲
private int type;//标志位--1标准化活动会议,0政策组会议
private String attend;//参与人 {id,name} json
private String files;//附件 json
}
@@ -0,0 +1,38 @@
package com.adc.da.slrs.sapMeetInfo.service;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Date;
import java.util.List;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
服务类
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
public interface ISapMeetingService extends IService<SapMeeting> {
int addMeeting(SapMeeting sapMeeting);//参会流程结束--插入
List<SapMeeting> getMeetingsByDate(Date date,int type);//根据日期查找-当日所有会议(时间正序)
List<SapMeeting> getMeetingsByMonth(Date date);//根据年,月查找
List<SapMeeting> getMeetingsByMonth(Date date,int type);//根据年,月查找
int getDateMeeting(Date date,String id,int type);
SapMeeting getMeetingById(String id);
int delById(String id);
int delByDate(Date date);
int modMeeting(SapMeeting sapMeeting);
}
@@ -0,0 +1,112 @@
package com.adc.da.slrs.sapMeetInfo.service.impl;
import com.adc.da.slrs.sapMeetInfo.entity.SapMeeting;
import com.adc.da.slrs.sapMeetInfo.dao.SapMeetingDao;
import com.adc.da.slrs.sapMeetInfo.service.ISapMeetingService;
import com.adc.da.util.UUIDUtils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 流程通过的 标准化活动会议信息表
standard_activity_pass
服务实现类
* </p>
*
* @author super_liu
* @since 2021-11-09
*/
@Service
public class SapMeetingServiceImpl extends ServiceImpl<SapMeetingDao, SapMeeting> implements ISapMeetingService {
@Autowired
SapMeetingDao sapMeetingDao;
@Override
public int addMeeting(SapMeeting sapMeeting) {
sapMeeting.setId(UUIDUtils.randomUUID(30));
return sapMeetingDao.insertMeeting(sapMeeting);
}
@Override
public List<SapMeeting> getMeetingsByDate(Date date,int type) {
Map map = new HashMap();
map.put("date",date);
map.put("type",type);
return sapMeetingDao.selectMeetingsByDate(map);
}
@Override
public List<SapMeeting> getMeetingsByMonth(Date date) {
List<SapMeeting> sapMeetings = sapMeetingDao.selectMeetingsByMonth(date);
return sapMeetings;
}
@Override
public List<SapMeeting> getMeetingsByMonth(Date date, int type) {
Map map = new HashMap();
map.put("date",date);
map.put("type",type);
return sapMeetingDao.selectMeetingsByMonthType(map);
}
@Override
public int getDateMeeting(Date date,String id,int type) {
Map map = new HashMap();
map.put("type",type);
map.put("date",date);
List<SapMeeting> sapMeetings = sapMeetingDao.selectMeetingsByDate(map);
int rat = 0;//标志位 0无会议;1有会议;2有会议且有自己参会的会议
if(sapMeetings.isEmpty()){
rat = 1;
}else if(hasOwnMeeting(id,sapMeetings)){
rat = 2;
}
return rat;
}
@Override
public SapMeeting getMeetingById(String id) {
return sapMeetingDao.selectMeetingById(id);
}
@Override
public int delById(String id) {
return sapMeetingDao.deleteById(id);
}
@Override
public int delByDate(Date date) {
return sapMeetingDao.deleteByDate(date);
}
@Override
public int modMeeting(SapMeeting sapMeeting) {
return sapMeetingDao.updateMeeting(sapMeeting);
}
boolean hasOwnMeeting(String id,List<SapMeeting> sapMeetings){
for(SapMeeting sapMeeting : sapMeetings){
JSONObject jsonObject = JSONObject.parseObject(sapMeeting.getAttend());
String a = jsonObject.getString("id");
if(a.contains("[") && a.contains("]")){
a.substring(1,a.length()-1);
}
String[] split = a.trim().split(",");
for (String s : split) {
if (s.equals(id)) {
return true;
}
}
}
return false;
}
}
@@ -194,6 +194,16 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
return Result.success(result);
}
@ApiOperation(value = "|SarBussionessStandEO|详情")
@GetMapping("/getStandInfoUpdateById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
public ResponseMessage<SarBussionessStand> getStandInfoUpdateById(String id) throws Exception {
SarBussionessStand result = sarBussionessStandEOService.selectStandardsInfoUpdateByKey(id);
String collectId = personCollectEOService.queryCollectByUserAndId(id);
result.setCollectId(collectId);
return Result.success(result);
}
/**
* 给指定标准配置目录
* @param standardsInfoEO
@@ -232,37 +242,42 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
if(StringUtils.isNotBlank(page.getPaixu())){
String sql = page.getPaixu()+" "+page.getShunxu();
page.setSql(sql);
}else{
page.setOrderBy("SAR_BUSSIONESS_STAND.MODIFY_TIME DESC");
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
return Result.success(getPageInfo(page.getPager(), rows));
// if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
// List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
// String advanceStr = SarAdvanceSearchUtil.createSql(searchList);
// if (StringUtils.isNotBlank(advanceStr)) {
// page.setAdvanceSearchStr(advanceStr);
// } else {
// page.setAdvanceSearchStr(null);
// }
// }
// page.setOrderBy("SAR_BUSSIONESS_STAND.issue_time desc nulls last,SAR_BUSSIONESS_STAND.id");
// List<String> getMenuIdList = tsUserService.getResourceId(new TsResource());
//// List<String> getMenuIdList = iTsResourceService.queryRoleMenuIdList("BUSINESS_STAND",page.getMenuId());
// if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
// page.setMenuRoleList(getMenuIdList);
// } else {
// page.setMenuRoleList(null);
// }
// List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
// if (ids != null && !ids.isEmpty()) {
// page.setMenuAllChildrenIdList(ids);
// }
// List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
// return Result.success(getPageInfo(page.getPager(), rows));
}
private void nowOrderFunc(SarBussionessStandEOPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("tmp_tb.issue_time");//发布日期
break;
case 2:
page.setOrderByA("tmp_tb.put_time");//实施日期
break;
case 3:
page.setOrderByA("tmp_tb.standStatusShow");//文本状态
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
@@ -30,6 +30,8 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
SarBussionessStand selectStandardsInfoByKey(String id) throws Exception;
SarBussionessStand selectStandardsInfoUpdateByKey(String id) throws Exception;
SarBussionessStandEOPage updateStandardsMenu(SarBussionessStandEOPage standardsInfoEO);
List<SarBussionessStand> queryByList(SarBussionessStandEOPage sarBussionessStandEOPage);
@@ -35,6 +35,7 @@ import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
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.service.ISarUpdLogService;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
@@ -60,6 +61,7 @@ import org.springframework.stereotype.Service;
import java.sql.Clob;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
@@ -218,7 +220,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
if (StringUtils.isNotBlank(sarBussionessStandEO.getStandYear())) {
number += "-" + sarBussionessStandEO.getStandYear();
}
String content = "新增" + number + "" + sarBussionessStandEO.getStandName() + "";
String content = "入库" + number + "" + sarBussionessStandEO.getStandName() + "";
sarUpdLogEOService.createBaseLog(sarBussionessStandEO.getId(),"BUSINESS",content);
if(elasflag) {
attrInfoShowSearchDetails(sarBussionessStandEO,"add");
@@ -276,11 +278,46 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}else {
page.setUserId(LoginUserUtil.getUserId());
}
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
List<SarBussionessStand> getList = sarBussionessStandEODao.getSarBussionessStand(page);
attrInfoShow(getList);
attrInfoShowExport(getList);
return getList;
}
private void nowOrderFunc(SarBussionessStandEOPage page) {
switch (page.getNowOrderBy()) {
case 1:
page.setOrderByA("tmp_tb.issue_time");//发布日期
break;
case 2:
page.setOrderByA("tmp_tb.put_time");//实施日期
break;
case 3:
page.setOrderByA("tmp_tb.standStatusShow");//文本状态
break;
default:
page.setNowOrder(null);
break;
}
if (null != page.getNowOrder()) {
switch (page.getNowOrder()) {
case 1:
page.setOrder1("desc");
break;
case 2:
page.setOrder1("asc");
break;
default:
page.setOrder1(null);
break;
}
}
}
public void attrInfoShow (List<SarBussionessStand> sarlist) throws Exception {
for(SarBussionessStand row : sarlist){
attrInfoDetails(row);
@@ -330,6 +367,55 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
}
public void attrInfoShowExport (List<SarBussionessStand> sarlist) throws Exception {
for(SarBussionessStand row : sarlist){
attrInfoDetailsExport(row);
Map<String, Object> getAttrMap = row.getAttrInfoMap();
Map<String, Object> getNewMap = new LinkedHashMap<>();
if (getAttrMap != null && getAttrMap.size() > 0) {
String svppsTip = "";
for (Map.Entry<String,Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String value = "";
if ("SVPPS".equals(name)) {
Object svpps = entry.getValue();
if (svpps != null && StringUtils.isNotBlank(svpps.toString())) {
svppsTip = svpps.toString();
}
if (StringUtils.isNotBlank(svppsTip)) {
svppsTip = sysInfoEOService.getSvppsNamesTipByIds(svppsTip);
}
value = String.valueOf(getAttrMap.get("SVPPSName"));
entry.setValue(value);
} else if (entry.getValue() != null && InitStandAttrUtil.fileFieldListBuss != null && InitStandAttrUtil.fileFieldListBuss.size() > 0 && InitStandAttrUtil.fileFieldListBuss.contains(name)) {
value = entry.getValue().toString();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
entry.setValue(fileObj);
}
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal) || SelectionTypeEnum.USERLIST.getValue().equals(selVal) || SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) {
if("ZYQCR".equals(name)||"QTQCR".equals(name)){
if(getAttrMap.get(name + "Name")!=null && !getAttrMap.get(name + "Name").equals("")){
value = String.valueOf(getAttrMap.get(name + "Name"));
}
}else{
value = String.valueOf(getAttrMap.get(name + "Name"));
}
} else {
List<String> valArr = Arrays.asList(value.split(","));
value = dicTypeEODao.getDicNamesByCodes(valArr);
}
entry.setValue(value);
}
}
getAttrMap.put("SVPPSTips",svppsTip);
}
}
}
public SarBussionessStand updateSarBussionessStand(SarBussionessStand sarBussionessStandEO) throws Exception {
String standId = sarBussionessStandEO.getId();
SarBussionessStand beforeStandEO = this.baseMapper.selectByPrimaryKey(standId);
@@ -708,6 +794,19 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
return sarBussionessStandEO;
}
@Override
public SarBussionessStand selectStandardsInfoUpdateByKey(String id) throws Exception{
List<SarBussionessStand> sarBussionessStandlist = this.baseMapper.selectStandardsInfoByKey(id);
SarBussionessStand sarBussionessStandEO = new SarBussionessStand();
if(!sarBussionessStandlist.isEmpty()) {
List<SarBussionessStand> newStandList = new ArrayList<>();
newStandList.add(sarBussionessStandlist.get(0));
attrInfo(newStandList);
sarBussionessStandEO = newStandList.get(0);
}
return sarBussionessStandEO;
}
public void attrInfoShowDetails(List<SarBussionessStand> sarlist) throws Exception {
for (SarBussionessStand row : sarlist) {
attrInfoDetails(row);
@@ -802,7 +901,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarBussionessStand> sarlist = this.baseMapper.getBussionessStandInfoPage(page);
attrInfo(sarlist);
attrInfoCollect(sarlist);
return sarlist;
}
@@ -817,6 +916,17 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
}
public void attrInfoCollect (List<SarBussionessStand> sarlist) throws Exception {
List<String> collectResIds = sarlist.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
Map<String,String> collectMap = personCollectEOService.queryCollectByUserAndIds(collectResIds);
for (SarBussionessStand row : sarlist) {
if(collectMap != null && collectMap.get(row.getId()) != null){
row.setCollectId(collectMap.get(row.getId()));
}
}
}
public void attrInfo1 (SarBussionessStand row) throws Exception {
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
@@ -839,10 +949,10 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
public void attrInfoShowSearchDetails(SarBussionessStand row,String type) throws Exception {
if (row != null) {
attrInfoSearchDetails(row,type);
Map<String, Object> getAttrMap = row.getAttrInfoMap();
Map<String, Object> getAttrMap = row.getAttrInfoCaseMap();
if (getAttrMap != null && getAttrMap.size() > 0) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
String name = entry.getKey().toUpperCase();
String value = "";
List<String> valArr = new ArrayList<>();
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
@@ -939,13 +1049,55 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
if (value1 != null && value1.toString().equals("\"null\"")){
entry.setValue("");
}
if ("SVPPS".equals(name)) {
Object value = entry.getValue();
if (value != null && StringUtils.isNotBlank(value.toString())) {
value = sysInfoEOService.getSvppsNamesByIds(value.toString());
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
String value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
value = sysInfoEOService.getOrgNamesByIds(value);
newMap.put(name + "Name",value);
} else if (SelectionTypeEnum.USERLIST.getValue().equals(selVal)) {
value = sysInfoEOService.getUserNamesByIds(value);
newMap.put(name + "Name",value);
} else if (SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) {
value = sysInfoEOService.getRoleNamesByIds(value);
newMap.put(name + "Name",value);
}
newMap.put(name + "Name",value);
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
}
}
getAttrMap.putAll(newMap);
}
if (getAttrMap != null && !getAttrMap.isEmpty()) {
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
}
row.setAttrInfoMap(getAttrMap);
}
}
public void attrInfoDetailsExport (SarBussionessStand row) throws Exception {
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
// 查询属性表数据
if (StringUtils.isNotBlank(fieldInfo)) {
Map<String, Object> getAttrMap = sarBussStandAttrInfoEODao.selectStandFieldAndData(fieldInfo,row.getId());
if (InitStandAttrUtil.clobFieldListBuss != null && !InitStandAttrUtil.clobFieldListBuss.isEmpty()) {
// 遍历修改所有clob类型的值
for (String clobField : InitStandAttrUtil.clobFieldListBuss) {
Clob clobValue = (Clob) getAttrMap.get(clobField);
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
getAttrMap.put(clobField,fieldValue);
}
}
// 组织机构和人员
Map<String,Object> newMap = new HashMap<>();
if(getAttrMap != null){
for (Map.Entry<String,Object> entry : getAttrMap.entrySet()) {
String name = entry.getKey();
Object value1 = entry.getValue();
if (value1 != null && value1.toString().equals("\"null\"")){
entry.setValue("");
}
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
String value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
@@ -82,8 +82,8 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
@ApiOperation("获得下一级的部门和人员")
@GetMapping("/getNext")
public List<TsInstitution> getNext(String institutionId){
return tsInstitutionService.getNext(institutionId);
public List<TsInstitution> getNext(String institutionId,String userName){
return tsInstitutionService.getNext(institutionId,userName);
}
@ApiOperation("获得第一级部门目录")
@@ -93,6 +93,14 @@ public class TsInstitutionController extends BaseController<TsInstitution> {
}
@ApiOperation("通过部门机构名称查询部门树形结构 废弃使用")
@GetMapping("/findInstitution")
public List<TsInstitution> findInstitution(String institutionName){
//TODO 调用业务接口
tsInstitutionService.findInstitutionTreeByName(institutionName);
return null;
}
public static void main(String[] args) {
// System.out.println(json);
}
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarInstitution.dao;
import com.adc.da.slrs.sarInstitution.entity.InstitutionAndUser;
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@@ -26,10 +27,10 @@ public interface TsInstitutionDao extends BaseMapper<TsInstitution> {
* 根据部门id查询此部门的子一级人员
* @return
*/
List<TsInstitution> selectNextUser(String institutionId);
List<TsInstitution> selectNextUser(@Param("institutionId") String institutionId,@Param("userName") String userName);
List<TsInstitution> selectTreeByIds(@Param("rootIds") List<String> rootIds);
/**
* 查询最高级机构及其人员
@@ -11,6 +11,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@@ -73,4 +75,12 @@ public class TsInstitution extends BaseEntity {
this.parentId = parentId;
this.name = name;
}
// public void addChildren(TsInstitution node){
// if (this.children==null){
// this.children=Arrays.asList(node);
// }else {
// this.children.add(node);
// }
// }
}
@@ -35,7 +35,7 @@ public interface ITsInstitutionService extends IService<TsInstitution> {
* @param institutionId
* @return
*/
public List<TsInstitution> getNext(String institutionId);
public List<TsInstitution> getNext(String institutionId,String userName);
/**
* 获得第一级的部门
@@ -43,5 +43,13 @@ public interface ITsInstitutionService extends IService<TsInstitution> {
*/
public List<TsInstitution> getFirst();
/**
* 根据机构部门名称查询机构树
* @param institutionName
* @return
*/
public List<TsInstitution> findInstitutionTreeByName(String institutionName);
int clearData();
}
@@ -6,6 +6,7 @@ import com.adc.da.slrs.sarInstitution.entity.SyncInstitution;
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
import com.adc.da.slrs.sarInstitution.entity.TsUserVO;
import com.adc.da.slrs.sarInstitution.service.ITsInstitutionService;
import com.adc.da.slrs.sarInstitution.util.TreeUtil;
import com.adc.da.sync.service.SyncUserService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@@ -15,8 +16,8 @@ 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.*;
import java.util.stream.Collectors;
/**
* <p>
@@ -38,17 +39,21 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
*/
@Override
public List<TsInstitution> getInstitution() {
List<TsInstitution> institutionList = this.list();//查询所有的的数据
//查询第一层机构
List<TsInstitution> institutionRoot=tsInstitutionDao.selectRoot();
for(TsInstitution tsInstitution:institutionRoot){
tsInstitution.setChildren(recursionGetInstitution(tsInstitution));
}
return institutionRoot;
List<TsInstitution> root=tsInstitutionDao.selectRoot();
TreeUtil treeUtil = new TreeUtil();
List<TsInstitution> institutionTree = treeUtil.treeAsList(institutionList, root);
return institutionTree;
}
/**
* 递归获取子机构
* @param tsInstitution:父机构
@@ -109,21 +114,29 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
*/
@Override
public List<TsInstitution> getInstitutionAndUser(String userName) {
//查询第一层机构
List<TsInstitution> institutionRoot=tsInstitutionDao.selectRootAndUser(userName);
List<TsInstitution> tsInstitutions = new ArrayList<>();
//把查到的数据结构修改,把用户放
for(TsInstitution tsInstitution:institutionRoot){
tsInstitution.setDisabled(true);
tsInstitution.setChildren( recursionGetInstitutionAndUser(tsInstitution) );
for(TsUserVO user:tsInstitution.getUsers()){
if(tsInstitution.getChildren()==null){
tsInstitution.setChildren(new ArrayList<>());
//当条件为null时避免查询全部,直接返回第一级
if (userName==null||userName==""){
tsInstitutions=this.getFirst();
}else {
//查询第一层机构
tsInstitutions=tsInstitutionDao.selectRootAndUser(userName);
//把查到的数据结构修改,把用户放
for(TsInstitution tsInstitution:tsInstitutions){
tsInstitution.setDisabled(true);
// tsInstitution.setChildren( recursionGetInstitutionAndUser(tsInstitution) );
for(TsUserVO user:tsInstitution.getUsers()){
if(tsInstitution.getChildren()==null){
tsInstitution.setChildren(new ArrayList<>());
}
// tsInstitution.getChildren().add(user);
}
tsInstitution.getChildren().add(user);
}
}
return institutionRoot;
return tsInstitutions;
}
/**
@@ -191,9 +204,9 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
* 通过部门id获得这个部门下的下一级部门
* @return
*/
public List<TsInstitution> getNext(String institutionId){
public List<TsInstitution> getNext(String institutionId,String userName){
List<TsInstitution> tsInstitutions = tsInstitutionDao.selectNextInstitution(institutionId);
List<TsInstitution> tsUsers=tsInstitutionDao.selectNextUser(institutionId);
List<TsInstitution> tsUsers=tsInstitutionDao.selectNextUser(institutionId,userName);
for(TsInstitution tsInstitution:tsInstitutions){
@@ -213,6 +226,27 @@ public class TsInstitutionServiceImpl extends ServiceImpl<TsInstitutionDao, TsIn
return tsInstitutions;
}
@Override
public List<TsInstitution> findInstitutionTreeByName(String institutionName) {
QueryWrapper<TsInstitution> tsInstitutionQuery = new QueryWrapper<>();
tsInstitutionQuery.select("id")
.like("name",institutionName);
/**
* 查询出id的数据集合并转换成String类型
*/
List<String> rootIds = this.listObjs(tsInstitutionQuery)
.stream()
.map(item -> item.toString())
.collect(Collectors.toList());
List<TsInstitution> tsInstitutions = tsInstitutionDao.selectTreeByIds(rootIds);
return null;
}
@Override
public int clearData() {
return tsInstitutionDao.clearData();
@@ -0,0 +1,132 @@
package com.adc.da.slrs.sarInstitution.util;
import com.adc.da.slrs.sarInstitution.entity.TsInstitution;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class TreeUtil {
public List<TsInstitution> treeAsList(List<TsInstitution> institutionList,List<TsInstitution> rootList){
//转换为hashSet
List<String> root = rootList.stream()
.map(item -> item.getId())
.collect(Collectors.toList());
HashSet<String> rootSet = new HashSet<>(root);
//获取父节点,0表示父节点
List<TsInstitution> tree = institutionList.stream()
.filter(e -> rootSet.contains(e.getId()))
.map(e -> {
List<TsInstitution> childNode = getChildNode(e, institutionList);
e.setChildren(new ArrayList<>(childNode));
return e;
}).collect(Collectors.toList());
return tree;
}
/**
* 递归查询子节点
* @param root
* @param contentKnowledgeList
* @return
*/
private List<TsInstitution> getChildNode(TsInstitution root, List<TsInstitution> contentKnowledgeList) {
List<TsInstitution> childrenList = contentKnowledgeList.stream()
.filter(e -> Objects.equals(e.getParentId(), root.getId()))
.map(e -> {
List<TsInstitution> childNode = getChildNode(e, contentKnowledgeList);
e.setChildren(new ArrayList<>(childNode));
return e;
}
).collect(Collectors.toList());
return childrenList;
}
// public List<TsInstitution> getChildAsHash(TsInstitution root, Map<String, TsInstitution> hashInstitution){
// String id = root.getId();
// if (hashInstitution.containsKey(id)){
//
// }
// return null;
// }
// //TODO 利用HashMap组装树结构
//
// public List<TsInstitution> treeAsHash(List<TsInstitution> institutionList,List<TsInstitution> rootList) {
//
// Map<String, TsInstitution> idMap = institutionList.stream()
// .collect(Collectors.toMap(TsInstitution::getId, tsInstitution -> tsInstitution));
//
// Map<String, TsInstitution> pid_institution = institutionList.stream()
// .collect(Collectors.toMap(TsInstitution::getParentId, institution -> institution));
//
// for (TsInstitution institution : rootList) {
//
// String id = institution.getId();
// if (pid_institution.containsKey(id)) {
// institution.addChildren(pid_institution.get(id));
//
// }
//
// }
//
//
// Set<String> rootSet = rootList.stream()
// .map(TsInstitution::getId)
// .collect(Collectors.toSet());
//
// Iterator<TsInstitution> it = institutionList.iterator();
//
// ArrayList<TsInstitution> resultList = new ArrayList<>();
//
//
// HashMap<String, TsInstitution> id_obj = new HashMap<>();
// while (it.hasNext()) {
// TsInstitution next = it.next();
//
// String parentId = next.getParentId();
// id_obj.put(next.getId(), next);
// if (rootSet.contains(parentId)) {
// id_obj.put(next.getId(), next);
// } else if (id_obj.containsKey(parentId)) {
// id_obj.get(parentId).addChildren(next);
// }
//
// }
// return null ;
//
// }
//
//
//
// List<TreeNodeDTO> list = dbMapper.getNodeList();
// ArrayList<TreeNodeDTO> rootNodes = new ArrayList<>();
// Map<Integer, TreeNodeDTO> map = new HashMap<>();
// for (TreeNodeDTO node :list) {
// map.put(node.getId(), node);
// Integer parentId = node.getParentId();
// // 判断是否有父节点 (没有父节点本身就是个父菜单)
// if (parentId.equals('0')){
// rootNodes.add(node);
// // 找出不是父级菜单的且集合中包括其父菜单ID
// } else if (map.containsKey(parentId)){
// map.get(parentId).getChildren().add(node);
// }
// }
//
// }
}
@@ -0,0 +1,57 @@
package com.adc.da.slrs.sarIssueTrack.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrackVo;
import com.adc.da.slrs.sarIssueTrack.service.IIssueTrackService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@Controller
@RestController
@Api(tags = "重点标准跟踪清单")
@RequestMapping("/api/sarIssueTrack/issueTrack")
public class IssueTrackController {
@Autowired
private IIssueTrackService issueTrackService;
@PutMapping()
@ApiOperation("新增重点标准跟踪清单项目")
public ResponseMessage addIssueTrack(@RequestBody IssueTrack issueTrack){
boolean b = issueTrackService.addIssueTrack(issueTrack);
return Result.success(b);
}
@DeleteMapping
@ApiOperation("删除重点标准跟踪清单项目")
public ResponseMessage removeIssueTrack(@RequestParam(value="selectedString") String idList){
List<String> stringList = Arrays.asList(idList.split(","));
boolean b = issueTrackService.removeIssueTrack(stringList);
return Result.success(b);
}
@GetMapping
@ApiOperation("查询重点标准跟踪清单")
public ResponseMessage<IPage<IssueTrack>> getIssueTrack(IssueTrackVo wrapper){
IPage<IssueTrack> issueTrack = issueTrackService.getIssueTrack(wrapper);
return Result.success(issueTrack);
}
@PostMapping
@ApiOperation("更新重点标准跟踪清单项目")
public ResponseMessage updateIssueTrack(@RequestBody IssueTrack issueTrack){
boolean b = issueTrackService.updateIssueTrack(issueTrack);
return Result.success(b);
}
}
@@ -0,0 +1,7 @@
package com.adc.da.slrs.sarIssueTrack.dao;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface IssueTrackDao extends BaseMapper<IssueTrack> {
}
@@ -0,0 +1,46 @@
package com.adc.da.slrs.sarIssueTrack.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@TableName("issue_track")
public class IssueTrack {
@TableField("id")
private String id;
@TableField("law_id")
private String lawId;
@TableField("law_name")
private String lawName;
@TableField("product_type")
private String productType;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-mm-dd")
@TableField("impl_time")
private Date implTime;
@TableField("impl_require")
private String implRequire;
@TableLogic(value = "0",delval = "1")
@TableField("del_flag")
private String delFlag;
@TableField(exist = false)
private Integer page;
@TableField(exist = false)
private Integer pageSize;
}
@@ -0,0 +1,7 @@
package com.adc.da.slrs.sarIssueTrack.entity;
import lombok.Data;
@Data
public class IssueTrackVo extends IssueTrack {
}
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarIssueTrack.service;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrackVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
public interface IIssueTrackService {
public boolean addIssueTrack(IssueTrack obj);
public boolean removeIssueTrack(List<String> idList);
public IPage<IssueTrack> getIssueTrack(IssueTrackVo objVo);
public boolean updateIssueTrack(IssueTrack obj);
}
@@ -0,0 +1,73 @@
package com.adc.da.slrs.sarIssueTrack.service.impl;
import com.adc.da.slrs.sarIssueTrack.dao.IssueTrackDao;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrack;
import com.adc.da.slrs.sarIssueTrack.entity.IssueTrackVo;
import com.adc.da.slrs.sarIssueTrack.service.IIssueTrackService;
import com.adc.da.util.UUIDUtils;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class IssueTrackServiceImpl extends ServiceImpl<IssueTrackDao, IssueTrack> implements IIssueTrackService {
@Autowired
private IssueTrackDao issueTrackDao;
@Override
public boolean addIssueTrack(IssueTrack obj) {
obj.setId(UUIDUtils.randomUUID20());
obj.setDelFlag("0");
return this.save(obj);
}
@Override
public boolean removeIssueTrack(List<String> idList) {
return removeByIds(idList);
}
@Override
public IPage<IssueTrack> getIssueTrack(IssueTrackVo objVo) {
IPage<IssueTrack> trackPage = new Page<>(objVo.getPage(), objVo.getPageSize());
QueryWrapper<IssueTrack> wrapper = new QueryWrapper<>();
if (objVo.getPage()!=null && objVo.getPageSize()!=null){
trackPage=new Page<>(objVo.getPage(),objVo.getPageSize());
}else {
Integer count = issueTrackDao.selectCount(wrapper);
trackPage=new Page<>(0,count,false);
}
if (objVo.getLawId()!=null){
wrapper.like("law_id",objVo.getLawId());
}
if (objVo.getLawName()!=null){
wrapper.like("law_name",objVo.getLawName());
}
if (objVo.getProductType()!=null){
wrapper.like("product_type",objVo.getProductType());
}
trackPage = issueTrackDao.selectPage(trackPage, wrapper);
return trackPage;
}
@Override
public boolean updateIssueTrack(IssueTrack obj) {
return this.updateById(obj);
}
}
@@ -208,8 +208,12 @@ public class SarLawsAttrDetailedListController extends BaseController<SarLawsAtt
}
}
}
String completedString = builder.delete(builder.length()-1,builder.length()).toString();
list1.setZRBM(completedString);
try {
String completedString = builder.delete(builder.length()-1,builder.length()).toString();
list1.setZRBM(completedString);
}catch (Exception e){
System.out.println(e);
}
}else {
for (Map<String, String> map1 : zrbn) {
if (map1.get("value").equals(list1.getZRBM())) {
@@ -143,7 +143,13 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
}
}
}
String completedString = builder.delete(builder.length()-1,builder.length()).toString();
/**
* 当""时索引异常
*/
String completedString="";
if (!"".equals(builder.toString())){
completedString = builder.delete(builder.length()-1,builder.length()).toString();
}
list1.setZRBM(completedString);
}
else {
@@ -4,6 +4,7 @@ import com.adc.da.slrs.sarLawsAttrInfo.entity.SarLawsAttrInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Map;
@@ -15,6 +16,7 @@ import java.util.Map;
* @author super_liu
* @since 2021-06-04
*/
@Repository
public interface SarLawsAttrInfoDao extends BaseMapper<SarLawsAttrInfo> {
void deleteLawsAttr(@Param("fieldInfo") String fieldInfo);
@@ -3,12 +3,16 @@ package com.adc.da.slrs.sarLawsAttrInfo.entity;
import com.adc.da.base.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* <p>
@@ -43,68 +47,80 @@ public class SarLawsAttrInfo extends BaseEntity {
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
private LocalDateTime creationTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
private LocalDateTime modifyTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@TableField("SYCLLX")
private String sycllx;
@TableField("SSRQLAWS")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String ssrqlaws;
@TableField("SVPPS")
private String svpps;
@TableField("XCXSSRQLAWS")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String xcxssrqlaws;
@TableField("XCXSSRQ")
private String xcxssrq;
@TableField("ZCXSSRQLAWS")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private String zcxssrqlaws;
@TableField("ZCCSSRQ")
private String zccssrq;
@TableField("ZCWBLAWS")
private String zcwblaws;
@TableField("EOPSSRQ")
private String eopssrq;
@TableField("GCWBLAWS")
private String gcwblaws;
@TableField("XGBM")
private String xgbm;
@TableField("JDWJLAWS")
private String jdwjlaws;
@TableField("ZRBM")
private String zrbm;
@TableField("FBJGLAWS")
private String fbjglaws;
@TableField("FO")
private String fo;
@TableField("CYSDLAWS")
private String cysdlaws;
@TableField("ZRLX")
private String zrlx;
@TableField("TGRLAWS")
private String tgrlaws;
@TableField("YQLX")
private String yqlx;
@TableField("TGDWLAWS")
private String tgdwlaws;
@TableField("GXHBQ")
private String gxhbq;
@TableField("NYLXLAWS")
private String nylxlaws;
@TableField("ZCGCS")
private String zcgcs;
@TableField("YYRZLAWS")
private String yyrzlaws;
@TableField("GKGLBM")
private String gkglbm;
@TableField("ZRBMLAWS")
private String zrbmlaws;
@TableField("FBJG")
private String fbjg;
@TableField("ZRGCSLAWS")
private String zrgcslaws;
@TableField("WSSFCY")
private String wssfcy;
@TableField("DTWJHLAWS")
private String dtwjhlaws;
@TableField("ZCWB")
private String zcwb;
@TableField("BDTWJHLAWS")
private String bdtwjhlaws;
@TableField("GCGJ")
private String gcgj;
@TableField("GLWJ")
private String glwj;
@TableField("YYBZZCLAWS")
private String yybzzclaws;
@TableField("XGLC")
private String xglc;
@TableField("CHJLLAWS")
private String chjllaws;
@TableField("GLWJLAWS")
private String glwjlaws;
}
@@ -13,4 +13,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ISarLawsAttrInfoService extends IService<SarLawsAttrInfo> {
String selectFieldValByLawsId(String field,String standId);
int updateLawsInfo(String standId,String field,String value);
}
@@ -17,4 +17,13 @@ import org.springframework.stereotype.Service;
@Service
public class SarLawsAttrInfoServiceImpl extends ServiceImpl<SarLawsAttrInfoDao, SarLawsAttrInfo> implements ISarLawsAttrInfoService {
@Override
public String selectFieldValByLawsId (String field,String standId) {
return this.baseMapper.selectFieldValByLawsId(field,standId);
}
@Override
public int updateLawsInfo(String standId,String field,String value){
return this.baseMapper.updateLawsInfo(standId,field,value);
}
}
@@ -0,0 +1,57 @@
package com.adc.da.slrs.sarLawsFile.controller;
import com.adc.da.att.entity.AttFileEO;
import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarLawsFile.service.ISarLawsFileService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@RestController
@Api(description = "|SarLawsFile|")
@RequestMapping("/${restPath}/lawss/sarLawsFile")
public class SarLawsFileController extends BaseController<SarLawsFile> {
@Autowired
private IAttFileEOService attFileEOService;
@Autowired
private ISarLawsFileService iSarLawsFileService;
@ApiOperation(value = "|SarBussStandFileEO|查询转换后的文档详情")
@GetMapping("/queryConvertAtt")
/*@RequiresPermissions("lawss:sarLawsFile:list")*/
public ResponseMessage<SarLawsFile> queryConvertAtt(String attId) throws Exception {
List<SarLawsFile> getList = iSarLawsFileService.selectFileByAttId(attId);
SarLawsFile sarBussStandFileEO = new SarLawsFile();
if(getList != null && !getList.isEmpty()){
sarBussStandFileEO = getList.get(0);
AttFileEO attFileEO = attFileEOService.getFileInfo(attId);
if(attFileEO != null){
sarBussStandFileEO.setFileOldName(attFileEO.getOldFileName());
}
// readStandOrLawsLogService.sendReadSOLLog("BUSS",sarBussStandFileEO);
return Result.success(sarBussStandFileEO);
} else {
return Result.success(null);
}
}
}
@@ -0,0 +1,40 @@
package com.adc.da.slrs.sarLawsFile.dao;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@Repository
public interface SarLawsFileDao extends BaseMapper<SarLawsFile> {
List<SarLawsFile> selectFileBylawsId(String lawsId);
List<SarLawsFile> selectFileBylawsIdAndId(SarLawsFile laws);
List<SarLawsFile> selectFileByAttId(String attId);
List<SarLawsFile> selectFileMsgByAttId(String attId);
List<SarLawsFile> selectFileByResId(SarLawsFile sarBussStandFileEO);
int deleteBylawsId(String standId);
int insertForeach(List<SarLawsFile> list); //批量新增
int insertSelective(SarLawsFile sarBussStandFile);
int updateByPrimaryKeySelective(SarLawsFile sarBussStandFile);
int deleteByPrimaryKey(String value);
}
@@ -0,0 +1,98 @@
package com.adc.da.slrs.sarLawsFile.entity;
import com.adc.da.base.entity.BaseEntity;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarLawsFile对象", description="")
public class SarLawsFile extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableField("ID")
private String id;
@ApiModelProperty(value = "政策ID")
@TableField("LAWS_ID")
private String lawsId;
@ApiModelProperty(value = "政策文件分类")
@TableField("LAWS_FILE_CLASSIFY")
private String lawsFileClassify;
@ApiModelProperty(value = "文件主键")
@TableField("ATT_ID")
private String attId;
@ApiModelProperty(value = "文件名称")
@TableField("FILE_NAME")
private String fileName;
@ApiModelProperty(value = "文件后缀")
@TableField("FILE_SUFFIX")
private String fileSuffix;
@ApiModelProperty(value = "使用模式(SOURCE_FILE原文件,WEB_FILE转换后文件)")
@TableField("USE_MODEL")
private String useModel;
@ApiModelProperty(value = "加密密码")
@TableField("PASSWORD")
private String password;
@TableField("CREATION_USER")
private String creationUser;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private Integer validFlag;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@ApiModelProperty(value = "转换原文件id")
@TableField("ORI_ATT_ID")
private String oriAttId;
@TableField(exist = false)
private List<String> idList = new ArrayList<>();
@TableField(exist = false)
private String useModule;
@TableField(exist = false)
private String resId;
@TableField(exist = false)
private Integer pageCount;
@TableField(exist = false)
private String fileOldName;
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarLawsFile.service;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
public interface ISarLawsFileService extends IService<SarLawsFile> {
List<SarLawsFile> selectFileByAttId(String attId) throws Exception;
}
@@ -0,0 +1,26 @@
package com.adc.da.slrs.sarLawsFile.service.impl;
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
import com.adc.da.slrs.sarLawsFile.dao.SarLawsFileDao;
import com.adc.da.slrs.sarLawsFile.service.ISarLawsFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@Service
public class SarLawsFileServiceImpl extends ServiceImpl<SarLawsFileDao, SarLawsFile> implements ISarLawsFileService {
@Override
public List<SarLawsFile> selectFileByAttId(String attId) throws Exception{
return this.baseMapper.selectFileByAttId(attId);
}
}
@@ -2,9 +2,12 @@ package com.adc.da.slrs.sarLawsInfo.dao;
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage;
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
@@ -15,6 +18,7 @@ import java.util.List;
* @author super_liu
* @since 2021-06-01
*/
@Repository
public interface SarLawsInfoDao extends BaseMapper<SarLawsInfo> {
Integer selectLawsColumn(@Param("columnName") String columnName);
@@ -22,4 +26,85 @@ public interface SarLawsInfoDao extends BaseMapper<SarLawsInfo> {
List<SarLawsInfo> queryByPage(SarLawsInfoEOPage page);
Integer queryByCount(SarLawsInfoEOPage page);
/**
* @return com.adc.da.lawss.entity.SarLawsInfo
* @Author yangxuenan
* @Description 通过id查询详细信息
* Date 2018/9/21 16:42
* @Param [id]
**/
SarLawsInfo selectInfoById(String id);
/**
* @return java.util.List<com.adc.da.lawss.entity.SarLawsInfo>
* @Author yangxuenan
* @Description 分页查询配置法规
* Date 2018/9/30 17:02
* @Param [page]
**/
List<SarLawsInfo> queryConfigLawsByPage(SarLawsInfoEOPage page);
int queryConfigLawsByCount(SarLawsInfoEOPage page);
//liwenxuan:标准法规更新数量及清单:国内法规
Integer selectCounterLawsCountINLAND(Date visitTime);
//liwenxuan:标准法规更新数量及清单:国内法规All
Integer selectCounterLawsCountINLANDAll();
//liwenxuan:标准法规更新数量及清单:国外法规
Integer selectCounterLawsCountFOREIGN(Date visitTime);
//liwenxuan:标准法规更新数量及清单:国外法规All
Integer selectCounterLawsCountFOREIGNAll();
/**
* 功能描述: 通过文件号查询详细信息
*
* @param: [Number]
* @return: com.adc.da.lawss.entity.SarLawsInfo
* @auther: SYT
* @date: 2018/10/11 20:34
*/
List<SarLawsInfo> selectInfoByNumber(@Param("number") String number, @Param("resName") String resName, @Param("type") String type);
/**
* 搜索中心查询相关推荐
*
* @param:
* @auther: gaoyan
* @date: 2018/11/10 9:22
*/
List<RecommendVO> selectRecommendLaws(SarLawsInfoEOPage pagenew);
List<RecommendVO> selectCloseLaws(SarLawsInfoEOPage pagenew);
/**
* 功能描述: 查询所有小于当前时间的即将实施的条目
*
* @param: [lawsEO]
* @return: java.util.List<com.adc.da.lawss.entity.SarLawsInfo>
* @auther: SYT
* @date: 2018/11/16 15:24
*/
List<SarLawsInfo> queryByPutTimeList(SarLawsInfo lawsEO);
int updateSarStandReplaced(SarLawsInfo lawsInfoEO);
int updateRelacedNumByNumber(SarLawsInfoEOPage lawsInfoEO);
List<SarLawsInfo> selectLawsInfoByIdAndRole(SarLawsInfoEOPage lawsEOPage);
int queryByCountForES(SarLawsInfoEOPage lawsEOPage);
List<SarLawsInfo> queryByPageForES(SarLawsInfoEOPage lawsEOPage);
int updateByPrimaryKeyForSynchron(SarLawsInfo SarLawsInfo);
int deleteByPrimaryKeyFlag(String id);
SarLawsInfo selectByPrimaryKeyAndTime(SarLawsInfo lawsEO);
}
@@ -0,0 +1,23 @@
package com.adc.da.slrs.sarLawsItemVal.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarLawsItemVal.entity.SarLawsItemVal;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@RestController
@Api(description = "|SarLawsItemVal|")
@RequestMapping("/sarLawsItemVal/sar-laws-item-val")
public class SarLawsItemValController extends BaseController<SarLawsItemVal> {
}
@@ -0,0 +1,18 @@
package com.adc.da.slrs.sarLawsItemVal.dao;
import com.adc.da.slrs.sarLawsItemVal.entity.SarLawsItemVal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@Repository
public interface SarLawsItemValDao extends BaseMapper<SarLawsItemVal> {
}
@@ -0,0 +1,59 @@
package com.adc.da.slrs.sarLawsItemVal.entity;
import com.adc.da.base.entity.BaseEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="SarLawsItemVal对象", description="")
public class SarLawsItemVal extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("ID")
private String id;
@ApiModelProperty(value = "法规条目ID")
@TableField("LAWS_ITEM_ID")
private String lawsItemId;
@ApiModelProperty(value = "参数类型")
@TableField("PROPERTY_TYPE")
private String propertyType;
@ApiModelProperty(value = "参数内容")
@TableField("PROPERTY_VAL")
private String propertyVal;
@ApiModelProperty(value = "是否有效")
@TableField("VALID_FLAG")
private BigDecimal validFlag;
@ApiModelProperty(value = "创建时间")
@TableField("CREATION_TIME")
private LocalDateTime creationTime;
@ApiModelProperty(value = "修改时间")
@TableField("MODIFY_TIME")
private LocalDateTime modifyTime;
}
@@ -0,0 +1,16 @@
package com.adc.da.slrs.sarLawsItemVal.service;
import com.adc.da.slrs.sarLawsItemVal.entity.SarLawsItemVal;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
public interface ISarLawsItemValService extends IService<SarLawsItemVal> {
}
@@ -0,0 +1,20 @@
package com.adc.da.slrs.sarLawsItemVal.service.impl;
import com.adc.da.slrs.sarLawsItemVal.entity.SarLawsItemVal;
import com.adc.da.slrs.sarLawsItemVal.dao.SarLawsItemValDao;
import com.adc.da.slrs.sarLawsItemVal.service.ISarLawsItemValService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@Service
public class SarLawsItemValServiceImpl extends ServiceImpl<SarLawsItemValDao, SarLawsItemVal> implements ISarLawsItemValService {
}
@@ -2,10 +2,12 @@ package com.adc.da.slrs.sarLawsItems.dao;
import com.adc.da.slrs.sarLawsInfo.page.SarLawsItemsEOPage;
import com.adc.da.slrs.sarLawsItems.entity.SarLawsItems;
import com.adc.da.slrs.sarStandItems.entity.FindSarItemsPageReqDTO;
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
import com.adc.da.slrs.sarStandItems.page.SarStandItemsEOPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Set;
@@ -18,11 +20,16 @@ import java.util.Set;
* @author super_liu
* @since 2021-06-02
*/
@Repository
public interface SarLawsItemsDao extends BaseMapper<SarLawsItems> {
List<SarLawsItems> querySarItemAndInterpretation(FindSarItemsPageReqDTO page);
Set<String> selectClaimTypesByStandId(@Param("standId") String standId, @Param("fileType") String fileType, @Param("idList") String[] idList);
Set<String> selectSvppsByStandId(@Param("standId") String standId, @Param("fileType") String fileType, @Param("idList") String[] idList);
List<SarLawsItems> queryByList(SarLawsItemsEOPage page);
int deleteByStandIdAndFileType(@Param("standId") String standId, @Param("fileType") String fileType);
}
@@ -2,6 +2,8 @@ package com.adc.da.slrs.sarLawsItems.entity;
import com.adc.da.base.entity.BaseEntity;
import java.math.BigDecimal;
import com.adc.da.slrs.SarCompStatusInfo.entity.SarCompStatusInfo;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;
@@ -122,6 +124,16 @@ public class SarLawsItems extends BaseEntity {
@TableField("FILE_TYPE")
private String fileType;
@ApiModelProperty(value = "新车型实施日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("XCXSSRQLAWS")
private Date xcxssrqlaws;
@ApiModelProperty(value = "在产车实施日期")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("ZCXSSRQLAWS")
private Date zcxssrqlaws;
@TableField(exist = false)
private String applyArcticShow;
@TableField(exist = false)
@@ -155,5 +167,20 @@ public class SarLawsItems extends BaseEntity {
@TableField(exist = false)
private String wczrsh;
@TableField(exist = false)
private String emergyKindShow;
//新加字段
@TableField(exist = false)
private String foUser;//FO
//新加字段带show
@TableField(exist = false)
private String oldId;
@TableField(exist = false)
private SarCompStatusInfo pgForm;
//责任工程师
@TableField(exist = false)
private String responsibleEngineer;
}
@@ -0,0 +1,81 @@
package com.adc.da.slrs.sarLawsMenu.controller;
import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
import com.adc.da.slrs.sarLawsMenu.service.ISarLawsMenuService;
import com.adc.da.slrs.sarResource.entity.TsResource;
import com.adc.da.slrs.sarResource.service.ITsResourceService;
import com.adc.da.sys.util.UUIDUtils;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.adc.da.slrs.sarLawsMenu.entity.SarLawsMenu;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.adc.da.base.web.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author super_liu
* @since 2021-10-28
*/
@RestController
@Api(description = "|SarLawsMenu|")
@RequestMapping("/${restPath}/lawss/sarLawsMenu")
public class SarLawsMenuController extends BaseController<SarLawsMenu> {
@Autowired
private ISarLawsMenuService lawsMenuService;
@Autowired
private ITsResourceService sarMenuEOService;
@ApiOperation(value = "|SarBussStandMenuEO|修改")
@PutMapping("/removeStandInfo")
// @RequiresPermissions("lawss:sarStandMenu:update")
public ResponseMessage removeStandInfo(@RequestBody SarLawsMenu standardsInfoEO) throws Exception {
String[] idList = standardsInfoEO.getIdlist();
int count = 0;
if(idList != null){
for(String id : idList){
SarLawsMenu menuEO = new SarLawsMenu();
menuEO.setLawsId(id);
menuEO.setMenuId(standardsInfoEO.getMenuId());
//删除所选目录下关联
String oldMenuId = standardsInfoEO.getOldMenuId();
if (StringUtils.isEmpty(oldMenuId)) {
oldMenuId = standardsInfoEO.getMenuId();
}
menuEO.setOldMenuId(oldMenuId);
count += lawsMenuService.deleteByMenuId(menuEO);
//查询是否还有与其他节点的关联,若没有则增加与根节点的关联
List<SarLawsMenu> getList = lawsMenuService.selectAllMenuByStandId(menuEO);
if (getList == null || getList.isEmpty()) {
// 查询根节点
TsResource sarMenuEO = new TsResource();
sarMenuEO.setSorDivide("LAWS_STAND");
List<TsResource> getRootMenu = sarMenuEOService.queryMenuByDis(sarMenuEO);
menuEO.setMenuId(getRootMenu.get(0).getId());
menuEO.setId(UUIDUtils.randomUUID20());
menuEO.setValidFlag(0);
lawsMenuService.save(menuEO);
}
}
}
if(count>0){
return Result.success("0","移除成功!",true);
} else {
return Result.error("移除失败!");
}
}
}

Some files were not shown because too many files have changed in this diff Show More