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

This commit is contained in:
yanyizhou
2021-09-09 19:37:34 +08:00
13 changed files with 199 additions and 165 deletions
@@ -24,8 +24,8 @@ import org.springframework.stereotype.Component;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.regex.Pattern;
import java.util.stream.Stream;
@EnableScheduling @EnableScheduling
@Component @Component
@@ -215,56 +215,50 @@ public class ScheduledJob {
//查询代替标准字段得到一个 被代替了的标准的id的键值对列表 //查询代替标准字段得到一个 被代替了的标准的id的键值对列表
List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH); List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH);
HashMap<String, Integer> replaceIdCountMap = new HashMap<>(); HashMap<String, Integer> replaceIdCountMap = new HashMap<>();
// 格式为 T/CSAE 175-2021
Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
replaceStandIdMaps.forEach(item->{ replaceStandIdMaps.forEach(item->{
if (item!=null){ if (item!=null){
//此标准代替的标准的标准号的数组 //此标准代替的标准的标准号的数组
String DTBJHStr = item.get("DTBJH").toString(); String DTBJHStr = item.get("DTBJH").toString();
//数据格式: (GB 123-2000,GB 4233434-2021,GB 423423423-2021) //数据格式: (GB 123-2000,GB 4233434-2021,GB 423423423-2021)
if (!DTBJHStr.equals("")){ if (!DTBJHStr.equals("")) {
try{ String[] DTBJHArray = DTBJHStr.split(",");
String[] DTBJHArray = DTBJHStr.split(","); for (String DTBJH : DTBJHArray) {
for (String DTBJH : DTBJHArray) {
String[] sortAndNumberAndYear = DTBJH.split("\\s+");
String sort = sortAndNumberAndYear[0];
String[] numberAndYear = sortAndNumberAndYear[1].split("\\-");
String number=numberAndYear[0];
String year=numberAndYear[1];
QueryWrapper<SarStandardsInfo> infoWrapper = new QueryWrapper<>();
infoWrapper.select("ID")
.eq("STAND_SORT",sort)
.eq("STAND_NUMBER",number)
.eq("STAND_YEAR",year);
List<Map<String, Object>> idMaps = sarStandardsInfoDao.selectMaps(infoWrapper);
if (idMaps.size()>0){
String standId = idMaps.get(0).get("ID").toString();
//如果代替标准id已存在则映射为2不存在则添加并映射为1
if (replaceIdCountMap.containsKey(standId)) {
replaceIdCountMap.replace(standId,2);
}else {
replaceIdCountMap.put(standId, 1);
}
}
if (!pattern.matcher(DTBJH).matches()){
continue;
} }
}catch (Exception e){
System.out.println("=====错误===="+item+"=====错误====="); String[] split = DTBJH.split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
String sort = split[0];
String number = split[1];
String year = split[2];
QueryWrapper<SarStandardsInfo> infoWrapper = new QueryWrapper<>();
infoWrapper.select("ID")
.eq("STAND_SORT", sort)
.eq("STAND_NUMBER", number)
.eq("STAND_YEAR", year);
List<Map<String, Object>> idMaps = sarStandardsInfoDao.selectMaps(infoWrapper);
if (idMaps.size() > 0) {
String standId = idMaps.get(0).get("ID").toString();
//如果代替标准id已存在则映射为2不存在则添加并映射为1
if (replaceIdCountMap.containsKey(standId)) {
replaceIdCountMap.replace(standId, 2);
} else {
replaceIdCountMap.put(standId, 1);
}
}
} }
} }
} }
}); });
@@ -47,11 +47,10 @@ public class ImportExcelController extends BaseController<ImportDto> {
@PostMapping("/import") @PostMapping("/import")
public void deleteList(MultipartFile file, MultipartFile file2, HttpServletResponse response, HttpServletRequest request) throws IOException { public void deleteList(MultipartFile file, MultipartFile file2, HttpServletResponse response, HttpServletRequest request) throws IOException {
Map<String, List<ImportDto>> mapMap=importExcelService.getExcelData(file,file2); Map<String, List<ImportDto>> mapMap=importExcelService.getExcelData(file,file2);
List<ImportDto> errorList = importExcelService.storageExclData(mapMap); List<ImportDto> errorList = importExcelService.storageExclData(mapMap);
// ResponseMessage responseMessage=new ResponseMessage(); // List<ImportDto> guonei= mapMap.get("GNBZ");
// responseMessage.setMessage(mapMap.toString()); // List<ImportDto> haiwai = mapMap.get("HWBZ");
// responseMessage.isOk(); // List<ImportDto> qibiao = mapMap.get("QYBZ");
OutputStream os = null; OutputStream os = null;
Workbook workbook = null; Workbook workbook = null;
try { try {
@@ -34,7 +34,9 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Pattern;
@Service @Service
public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDto> implements ImportExcelService { public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDto> implements ImportExcelService {
@@ -75,16 +77,19 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
",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"; ",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," + private final static String QB = "Q/QCBFC,Q/FT,Q/FL,Q/QCFLC,Q/BQB,Q/SGT," +
"Q-AMSN,QB-NE,Q-IOUM,Q房/AYJ,KNT"; "Q-AMSN,QB-NE,Q-IOUM,Q房/AYJ,KNT";
private final static String DATE = "-2008,—2008,-2009,—2009,-2010,—2010,-2011,—2011,-2012,—2012,-2013,—2013," +
"- 2008,— 2008,- 2009,— 2009,- 2010,— 2010,- 2011,— 2011,- 2012,— 2012,- 2013,— 2013" +
",-2014,—2014,-2015,—2015,-2016,—2016,-2017,—2017,-2018,—2018,-2019,—2019,-2020,—2020,-2021,—2021" +
",- 2014,— 2014,- 2015,— 2015,- 2016,— 2016,- 2017,— 2017,- 2018,— 2018,- 2019,— 2019,- 2020,— 2020,- 2021,— 2021";
// file 为主 file2 为附件 // file 为主 file2 为附件
@Override @Override
public Map<String, List<ImportDto>> getExcelData(MultipartFile file, MultipartFile file2) { public Map<String, List<ImportDto>> getExcelData(MultipartFile file, MultipartFile file2) {
List<String> dates=new ArrayList<>();
for(int i=1669;i<2023;i++){
dates.add("-"+i);
dates.add("—"+i);
dates.add("- "+i);
dates.add("— "+i);
}
if (file == null || file.getSize() == 0) { if (file == null || file.getSize() == 0) {
log.error("文件上传错误,重新上传"); log.error("文件上传错误,重新上传");
} }
@@ -133,7 +138,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
datas.forEach(items -> { datas.forEach(items -> {
//判断是否是正确的数据 //判断是否是正确的数据
String[] as = items.split(","); String[] as = items.split(",");
if (!inDate(as[0])) { if (!inDate(as[0],dates)) {
ImportDto importDto = getImportDto(as); ImportDto importDto = getImportDto(as);
error.add(importDto); error.add(importDto);
middle.put(as[0].trim(), "error-"+error.size()); middle.put(as[0].trim(), "error-"+error.size());
@@ -176,8 +181,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
return res; return res;
} }
private boolean inDate(String as) { private boolean inDate(String as,List<String> dates) {
List<String> dates = new ArrayList<>(Arrays.asList(DATE.split(",")));
if (null != as && !"".equals(as)) { if (null != as && !"".equals(as)) {
for (String s : dates) { for (String s : dates) {
if (s.equals(as.trim())) { if (s.equals(as.trim())) {
@@ -283,6 +287,8 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
private String importPath; private String importPath;
private List<ImportDto> error=new ArrayList<>(); private List<ImportDto> error=new ArrayList<>();
private List<ImportDto> fileError=new ArrayList<>();
@Override @Override
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) { public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
@@ -296,8 +302,8 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
String standID = UUIDUtils.randomUUID20(); String standID = UUIDUtils.randomUUID20();
SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID); SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID);
//
//
if (sarStandardsInfo!=null) if (sarStandardsInfo!=null)
{ {
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID); SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
@@ -422,7 +428,6 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
if (sarBussionessStand!=null) { if (sarBussionessStand!=null) {
SarBussStandAttrInfo sarBussStandAttrInfo = parseImportDtoToSarBussStandAttrInfo(item, standId); SarBussStandAttrInfo sarBussStandAttrInfo = parseImportDtoToSarBussStandAttrInfo(item, standId);
@@ -451,16 +456,11 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
} catch (Exception e) { } catch (Exception e) {
item.setErrorStr("数据格式错误"); item.setErrorStr("数据格式错误");
error.add(item); error.add(item);
importListMap.replace("error",error);
System.out.println("issueTime====Hello======" + sarBussionessStand.getIssueTime() + "===hello=====" + item);
e.printStackTrace(); e.printStackTrace();
} }
}else {
item.setErrorStr("标准号无法解析");
error.add(item);
importListMap.replace("error",error);
} }
}); });
@@ -470,8 +470,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
// String head="standId,standName,standNameEN,publishTime,implementedTime" + // String head="standId,standName,standNameEN,publishTime,implementedTime" +
// ",standStatus,replaceId,path"; // ",standStatus,replaceId,path";
// String headStr="标准号,标准名称,英文名称,发布时间,实施时间,标准状态,代替标准号,附件路径"; // String headStr="标准号,标准名称,英文名称,发布时间,实施时间,标准状态,代替标准号,附件路径";
error.addAll(fileError);
return error; return error;
} }
@@ -482,41 +481,34 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,String standId){ public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,String standId){
String sort="";
String number="";
String year="";
try {
String[] sortAndNumberAndYear = importDto.getStandId().split("\\s+");
sort = sortAndNumberAndYear[0];
String[] numberAndYear = sortAndNumberAndYear[1].split("\\-");
number=numberAndYear[0];
year=numberAndYear[1];
}catch (Exception e){ HashMap<String, String> analysis = analysisStandId(importDto);
if (analysis==null){
return null;
}else {
System.out.println("id为"+importDto.getStandId()+"格式无法解析"); SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
// return null; sarStandardsInfo.setId(standId);
sarStandardsInfo.setStandSort(analysis.get("sort"));
sarStandardsInfo.setStandNumber(analysis.get("number"));
sarStandardsInfo.setStandYear(analysis.get("year"));
sarStandardsInfo.setStandName(importDto.getStandName());
sarStandardsInfo.setStandEnName(importDto.getStandNameEN());
String issueDate = importDto.getPublishTime().substring(0, 9);
sarStandardsInfo.setIssueTime(issueDate);//标准发布日期
String standStatus = importDto.getStandStatus();
if ("有效".equals(standStatus)) {
sarStandardsInfo.setTextStatus("vsaga7nwub");//现行有效
}
return sarStandardsInfo;
} }
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
sarStandardsInfo.setId(standId);
sarStandardsInfo.setStandSort(sort);
sarStandardsInfo.setStandNumber(number);
sarStandardsInfo.setStandYear(year);
sarStandardsInfo.setStandName(importDto.getStandName());
sarStandardsInfo.setStandEnName(importDto.getStandNameEN());
sarStandardsInfo.setIssueTime(importDto.getPublishTime());//标准发布日期
String standStatus = importDto.getStandStatus();
if ("有效".equals(standStatus)){
sarStandardsInfo.setTextStatus("vsaga7nwub");//现行有效
}
return sarStandardsInfo;
} }
@@ -529,7 +521,9 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
sarStandAttrInfo.setId(UUIDUtils.randomUUID20()); sarStandAttrInfo.setId(UUIDUtils.randomUUID20());
sarStandAttrInfo.setStandId(standId); sarStandAttrInfo.setStandId(standId);
sarStandAttrInfo.setDtbjh(importDto.getReplaceId()); sarStandAttrInfo.setDtbjh(importDto.getReplaceId());
sarStandAttrInfo.setSsrq(importDto.getImplementedTime());
String ssrqDate = importDto.getImplementedTime().substring(0, 9);
sarStandAttrInfo.setSsrq(ssrqDate);
sarStandAttrInfo.setValidFlag("0"); sarStandAttrInfo.setValidFlag("0");
@@ -564,7 +558,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
sarStandardsInfoService.createStandFile(standId,fileMap); sarStandardsInfoService.createStandFile(standId,fileMap);
} catch (Exception e) { } catch (Exception e) {
importDto.setErrorStr("创建标准文件异常"); importDto.setErrorStr("创建标准文件异常");
error.add(importDto); fileError.add(importDto);
e.printStackTrace(); e.printStackTrace();
System.out.println("创建标准文件异常"); System.out.println("创建标准文件异常");
} }
@@ -572,12 +566,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
sarStandAttrInfo.setGlwj(fileInfo.getAttId()); sarStandAttrInfo.setGlwj(fileInfo.getAttId());
}else { }else {
importDto.setErrorStr("文件不存在"); importDto.setErrorStr("文件不存在");
error.add(importDto); fileError.add(importDto);
} }
}catch (Exception e){ }catch (Exception e){
importDto.setErrorStr("文件打开失败"); importDto.setErrorStr("文件打开失败");
error.add(importDto); fileError.add(importDto);
e.printStackTrace(); e.printStackTrace();
} }
@@ -597,41 +591,29 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,String standId){ public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,String standId){
if(importDto.getStandId()==null){ HashMap<String, String> analysis = analysisStandId(importDto);
if (analysis==null){
return null; return null;
}else {
SarBussionessStand sarBussionessStand = new SarBussionessStand();
sarBussionessStand.setId(standId);
sarBussionessStand.setStandSort(analysis.get("sort"));
sarBussionessStand.setStandYear(analysis.get("year"));
sarBussionessStand.setStandCode(importDto.getStandId());
sarBussionessStand.setStandName(importDto.getStandName());
sarBussionessStand.setStandEnName(importDto.getStandNameEN());
sarBussionessStand.setIssueTime(importDto.getPublishTime());
sarBussionessStand.setPutTime(importDto.getImplementedTime());
sarBussionessStand.setReplacedStandNum(importDto.getReplaceId());
sarBussionessStand.setValidFlag(0);
if ("有效".equals(importDto.getStandStatus())){
sarBussionessStand.setTextStatusBuss("vsaga7nwub");
}
return sarBussionessStand;
} }
String sort="";
String number="";
String year="";
try {
String[] sortAndNumberAndYear = importDto.getStandId().split("\\s+");
sort = sortAndNumberAndYear[0];
String[] numberAndYear = sortAndNumberAndYear[1].split("\\-");
number=numberAndYear[0];
year=numberAndYear[1];
}catch (Exception e){
System.out.println("id为"+importDto.getStandId()+"格式无法解析");
// return null;
}
SarBussionessStand sarBussionessStand = new SarBussionessStand();
sarBussionessStand.setId(standId);
sarBussionessStand.setStandSort(sort);
sarBussionessStand.setStandYear(year);
sarBussionessStand.setStandCode(importDto.getStandId());
sarBussionessStand.setStandName(importDto.getStandName());
sarBussionessStand.setStandEnName(importDto.getStandNameEN());
sarBussionessStand.setIssueTime(importDto.getPublishTime());
sarBussionessStand.setPutTime(importDto.getImplementedTime());
sarBussionessStand.setReplacedStandNum(importDto.getReplaceId());
sarBussionessStand.setValidFlag(0);
if ("有效".equals(importDto.getStandStatus())){
sarBussionessStand.setTextStatusBuss("vsaga7nwub");
}
return sarBussionessStand;
} }
@@ -672,7 +654,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
sarBussionessStandService.createStandFile(standId,fileMap); sarBussionessStandService.createStandFile(standId,fileMap);
} catch (Exception e) { } catch (Exception e) {
importDto.setErrorStr("创建标准文件异常"); importDto.setErrorStr("创建标准文件异常");
error.add(importDto); fileError.add(importDto);
e.printStackTrace(); e.printStackTrace();
System.out.println("创建标准文件异常"); System.out.println("创建标准文件异常");
} }
@@ -681,12 +663,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}else { }else {
importDto.setErrorStr("文件不存在"); importDto.setErrorStr("文件不存在");
error.add(importDto); fileError.add(importDto);
} }
}catch (Exception e){ }catch (Exception e){
importDto.setErrorStr("路径错误!"); importDto.setErrorStr("路径错误!");
error.add(importDto); fileError.add(importDto);
e.printStackTrace(); e.printStackTrace();
} }
@@ -696,4 +678,43 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
return sarBussStandAttrInfo; return sarBussStandAttrInfo;
} }
public HashMap<String,String> analysisStandId(ImportDto importDto){
HashMap<String, String> result = new HashMap<>();
if(importDto.getStandId()==null){
importDto.setErrorStr("标准号为空");
error.add(importDto);
return null;
}else {
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()){
importDto.setErrorStr("标准号无法解析");
error.add(importDto);
return null;
}
String sort="";
String number="";
String year="";
String[] split = importDto.getStandId().split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
// 多种格式(╯‵□′)╯︵┻━┻ Q-FL T015-2021 Q/ FL T015-2021 Q/FL T015-2021
int length = split.length;
number=split[length-2];
year=split[length-1];
for (int i = 0; i < length-2; i++) {
sort+=split[i];
}
result.put("sort",sort);
result.put("number",number);
result.put("year",year);
return result;
}
}
} }
@@ -24,6 +24,8 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
SarBussionessStand updateSarBussionessStand(SarBussionessStand sarBussionessStandEO) throws Exception; SarBussionessStand updateSarBussionessStand(SarBussionessStand sarBussionessStandEO) throws Exception;
ResponseMessage<SarBussionessStand> createSarBussionessStand(SarBussionessStand sarBussionessStandEO) throws Exception;
List<SarBussionessStand> selectStandardsByStandNumber(String replaceStandNum); List<SarBussionessStand> selectStandardsByStandNumber(String replaceStandNum);
SarBussionessStand selectStandardsInfoByKey(String id) throws Exception; SarBussionessStand selectStandardsInfoByKey(String id) throws Exception;
@@ -288,6 +288,8 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
} }
private void dateTime(LinkedHashMap<String, List<String>> mapList, List<String> putTime, List<String> xcx, List<String> zcc, StandRegionalTimeDto s) { private void dateTime(LinkedHashMap<String, List<String>> mapList, List<String> putTime, List<String> xcx, List<String> zcc, StandRegionalTimeDto s) {
//临时
putTime.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getPutTime())); putTime.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getPutTime()));
xcx.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getXcxssrq())); xcx.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getXcxssrq()));
zcc.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq())); zcc.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq()));
@@ -599,6 +599,11 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
@Override @Override
public void standardToLaws(String countryArea,TimeDto timeDto) { public void standardToLaws(String countryArea,TimeDto timeDto) {
if (countryArea==null){
countryArea="";
}
/** /**
* 加入对应"国家/地区"的清单列表 * 加入对应"国家/地区"的清单列表
*/ */
@@ -291,6 +291,7 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>(); QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.eq("PARENT_ID",parent.getId()); TsResourceQueryWrapper.eq("PARENT_ID",parent.getId());
TsResourceQueryWrapper.in("ID",getMenuIdList); TsResourceQueryWrapper.in("ID",getMenuIdList);
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<TsResource> children=dao.selectList(TsResourceQueryWrapper); List<TsResource> children=dao.selectList(TsResourceQueryWrapper);
for(TsResource TsResource:children){ for(TsResource TsResource:children){
TsResource.setChildren(recursionGetListChildren((TsResource),(getMenuIdList))); TsResource.setChildren(recursionGetListChildren((TsResource),(getMenuIdList)));
@@ -39,7 +39,7 @@ public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
@ApiOperation(value = "分页查询") @ApiOperation(value = "分页查询")
@GetMapping("/SelectAllPage") @GetMapping("/SelectAllPage")
public ResponseMessage selectAllPage(@RequestParam(defaultValue="1")Integer page,@RequestParam(defaultValue="10")Integer size,String categorg, String cname, public ResponseMessage selectAllPage(@RequestParam(defaultValue="1")Integer page,@RequestParam(defaultValue="10")Integer size,String categorg, String cname,
String start, String end){ String start, String end,String type){
Date startdate = null; Date startdate = null;
Date enddate = null; Date enddate = null;
SimpleDateFormat formater = new SimpleDateFormat(); SimpleDateFormat formater = new SimpleDateFormat();
@@ -54,7 +54,7 @@ public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
IPage<SarPublicIdea> Publiclist =sarPublicIdeaService.selectAllP(page,size,categorg,cname,startdate,enddate); IPage<SarPublicIdea> Publiclist =sarPublicIdeaService.selectAllP(page,size,categorg,cname,startdate,enddate,type);
return Result.success(Publiclist); return Result.success(Publiclist);
} }
@@ -66,5 +66,11 @@ public class SarPublicIdea extends BaseEntity {
@TableField("uniques") @TableField("uniques")
private String uniques; private String uniques;
@TableField("files")
private String files;
@TableField("files_name")
private String filesName;
} }
@@ -20,6 +20,6 @@ import java.util.Date;
public interface ISarPublicIdeaService extends IService<SarPublicIdea> { public interface ISarPublicIdeaService extends IService<SarPublicIdea> {
String add(SarPublicIdea sarPublicIdea); String add(SarPublicIdea sarPublicIdea);
IPage<SarPublicIdea> selectAllP(Integer page, Integer size, String categorg, String cname, Date startdate, Date enddate); IPage<SarPublicIdea> selectAllP(Integer page, Integer size, String categorg, String cname, Date startdate, Date enddate, String type);
IPage<SarPublicIdea> selectAllDynamic(SeByoDto seByoDto); IPage<SarPublicIdea> selectAllDynamic(SeByoDto seByoDto);
} }
@@ -1,7 +1,6 @@
package com.adc.da.slrs.sarStandIdea.service.Impl; package com.adc.da.slrs.sarStandIdea.service.Impl;
import com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaDao; import com.adc.da.slrs.sarStandIdea.dao.SarPublicIdeaDao;
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdea; import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdea;
@@ -22,7 +21,7 @@ import java.util.Date;
/** /**
* <p> * <p>
* 服务实现类 * 服务实现类
* </p> * </p>
* *
* @author super_liu * @author super_liu
@@ -36,7 +35,7 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
@Override @Override
public String add(SarPublicIdea sarPublicIdea) { public String add(SarPublicIdea sarPublicIdea) {
if (!sarPublicIdea.getId().isEmpty()){ if (!sarPublicIdea.getId().isEmpty()) {
sarPublicIdea.setId(UUIDUtils.randomUUID10()); sarPublicIdea.setId(UUIDUtils.randomUUID10());
sarPublicIdeaDao.insert(sarPublicIdea); sarPublicIdeaDao.insert(sarPublicIdea);
return "增加成功"; return "增加成功";
@@ -45,22 +44,29 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
} }
@Override @Override
public IPage<SarPublicIdea> selectAllP(Integer p, Integer size, String category, String cname, Date start, Date end) { public IPage<SarPublicIdea> selectAllP(Integer p, Integer size, String category, String cname, Date start, Date end, String type) {
QueryWrapper<SarPublicIdea> list = new QueryWrapper<>(); QueryWrapper<SarPublicIdea> list = new QueryWrapper<>();
list.like(StringUtils.isNotEmpty(category),"category",category) if ("1".equals(type)) {
.like(StringUtils.isNotEmpty(cname),"cname",cname) list.like(StringUtils.isNotEmpty(category), "category", category)
.ge(start!=null,"start_time",start) .like(StringUtils.isNotEmpty(cname), "cname", cname)
.le(end!=null,"end_time",end) .ge(start != null, "start_time", start)
.orderByAsc("end_time"); .le(end != null, "end_time", end)
Page<SarPublicIdea> page = new Page<>(p,size); .orderByDesc("start_time");
} else {
list.like(StringUtils.isNotEmpty(category), "category", category)
.like(StringUtils.isNotEmpty(cname), "cname", cname)
.ge(start != null, "start_time", start)
.le(end != null, "end_time", end)
.orderByAsc("end_time");
}
Page<SarPublicIdea> page = new Page<>(p, size);
IPage<SarPublicIdea> userIPage = sarPublicIdeaDao.selectPage(page, list); IPage<SarPublicIdea> userIPage = sarPublicIdeaDao.selectPage(page, list);
System.out.println("总条数"+userIPage.getTotal()); System.out.println("总条数" + userIPage.getTotal());
System.out.println("总页数"+userIPage.getPages()); System.out.println("总页数" + userIPage.getPages());
return userIPage; return userIPage;
} }
/** /**
*
* @param seByoDto * @param seByoDto
* @return * @return
*/ */
@@ -72,33 +78,33 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
SimpleDateFormat formater = new SimpleDateFormat(); SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd"); formater.applyPattern("yyyy-MM-dd");
try { try {
if (seByoDto.getStartTime()!=null){ if (seByoDto.getStartTime() != null) {
sar.setStartTime(formater.parse(seByoDto.getStartTime())); sar.setStartTime(formater.parse(seByoDto.getStartTime()));
} }
if (seByoDto.getEndTime()!=null){ if (seByoDto.getEndTime() != null) {
sar.setEndTime(formater.parse(seByoDto.getEndTime())); sar.setEndTime(formater.parse(seByoDto.getEndTime()));
} }
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
QueryWrapper<SarPublicIdea> wrapper = new QueryWrapper<>(); QueryWrapper<SarPublicIdea> wrapper = new QueryWrapper<>();
if (sar.getCategory()!=null&&sar.getCategory().length()!=0){ if (sar.getCategory() != null && sar.getCategory().length() != 0) {
wrapper.like("category",sar.getCategory()); wrapper.like("category", sar.getCategory());
} }
if (sar.getCname()!=null&&sar.getCname().length()!=0){ if (sar.getCname() != null && sar.getCname().length() != 0) {
wrapper.like("cname",sar.getCname()); wrapper.like("cname", sar.getCname());
} }
if (sar.getStartTime()!=null){ if (sar.getStartTime() != null) {
wrapper.le("start_time",sar.getStartTime()); wrapper.le("start_time", sar.getStartTime());
} }
if (sar.getEndTime()!=null){ if (sar.getEndTime() != null) {
wrapper.gt("end_time",sar.getEndTime()); wrapper.gt("end_time", sar.getEndTime());
} }
Page<SarPublicIdea> page = new Page<>(seByoDto.getPage(), seByoDto.getSize()); Page<SarPublicIdea> page = new Page<>(seByoDto.getPage(), seByoDto.getSize());
IPage<SarPublicIdea> userIPage = sarPublicIdeaDao.selectPage(page, wrapper); IPage<SarPublicIdea> userIPage = sarPublicIdeaDao.selectPage(page, wrapper);
System.out.println("总条数"+userIPage.getTotal()); System.out.println("总条数" + userIPage.getTotal());
System.out.println("总页数"+userIPage.getPages()); System.out.println("总页数" + userIPage.getPages());
return userIPage; return userIPage;
@@ -136,7 +136,7 @@
<!-- 查询字段及对应数据--> <!-- 查询字段及对应数据-->
<select id="selectStandFieldAndData" resultType="Map"> <select id="selectStandFieldAndData" resultType="Map">
SELECT ${fieldInfo} SELECT STAND_ID,${fieldInfo}
FROM SAR_BUSS_STAND_ATTR_INFO FROM SAR_BUSS_STAND_ATTR_INFO
WHERE valid_flag=0 and stand_id = #{standId} WHERE valid_flag=0 and stand_id = #{standId}
</select> </select>
@@ -161,4 +161,4 @@
FROM SAR_BUSS_STAND_ATTR_INFO FROM SAR_BUSS_STAND_ATTR_INFO
WHERE stand_id = #{standId} and valid_flag=0 WHERE stand_id = #{standId} and valid_flag=0
</select> </select>
</mapper> </mapper>
@@ -122,7 +122,6 @@
#{item} #{item}
</foreach> </foreach>
</where> </where>
group by a.ID
limit #{start},#{end} limit #{start},#{end}
</select> </select>
@@ -150,13 +149,12 @@
#{item} #{item}
</foreach> </foreach>
</where> </where>
group by a.ID
</select> </select>
<select id="selectTimes" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandRegionalTimeDto"> <select id="selectTimes" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandRegionalTimeDto">
SELECT SELECT
b.country_area AS country, b.country_area AS country,
a.ssrq AS ssrq, a.ssrq AS putTime,
a.xcxssrq AS xcxssrq, a.xcxssrq AS xcxssrq,
a.zccssrq AS zccssrq a.zccssrq AS zccssrq
FROM FROM