diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java index d58aa1d68..d3c878a23 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/DateUtils.java @@ -1,5 +1,6 @@ package com.jero.common.util; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.util.StringUtils; import java.beans.PropertyEditorSupport; @@ -8,6 +9,7 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; +import java.util.stream.Collectors; /** * 类描述:时间操作定义类 @@ -614,6 +616,28 @@ public class DateUtils extends PropertyEditorSupport { return 0; } + /** + * 日期数据转换字符串 + * @param dateList + * @return + */ + public static String formatDateList(List dateList) { + StringBuilder strSb = new StringBuilder(); + + if(CollectionUtils.isNotEmpty(dateList)){ + dateList = dateList.stream().distinct().sorted().collect(Collectors.toList()); + for (Date date : dateList) { + strSb.append(date_sdf.get().format(date)).append(","); + } + } + + String result = ""; + if(!StringUtils.isEmpty(strSb.toString())){ + result = strSb.substring(0,strSb.length()-1); + } + return result; + } + /** * String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd * HH:mm:ss“ * @param text String类型的时间值 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java index 44bf75694..d4dcac1fd 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java @@ -33,6 +33,7 @@ import com.jero.modules.document.entity.BussDocumentLibraryEO; import com.jero.modules.document.entity.OSSFileForDocumentLibrary; import com.jero.modules.document.entity.PhasedImplementationDetailsEO; import com.jero.modules.document.enums.FieldTypeEnum; +import com.jero.modules.document.enums.ImplementationTypeEnum; import com.jero.modules.document.enums.LawsStateEnum; import com.jero.modules.document.enums.SearchEnum; import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper; @@ -794,6 +795,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl fieldListTemp = fieldList.stream().filter(e -> onlCgformAreaTemp.getId().equals(e.getShowArea())).collect(Collectors.toList()); + OnlCgformField phasedOnlCgformField = new OnlCgformField(); + phasedOnlCgformField.setId(UUID.randomUUID().toString().replace("-", "")); + phasedOnlCgformField.setDbFieldTxt("分阶段实施详情"); + phasedOnlCgformField.setDbFieldEnName("Details of the phased implementation"); + phasedOnlCgformField.setDbFieldName("phasedImplDetails"); + fieldListTemp.add(phasedOnlCgformField); for (OnlCgformField onlCgformField : fieldListTemp) { String dictId = onlCgformField.getDictId(); List sysCategoryTreeVOList = new ArrayList<>(); @@ -4233,12 +4240,36 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl= '" + value.split(",")[0] + "'" - + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); - } else { - conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); + // 如果是查询实施日期,需要单独处理一下,刚加的分阶段实施详情需求 + if(StringUtils.equals("xin1_che1_xing2_shi2_shi1_ri4_qi1",key) || StringUtils.equals("implement_time",key)){ + //日期(区分单日期还时间范围) + if (value.contains(",")) { + conditionSb.append(" and ("); + conditionSb.append(" ("); + conditionSb.append("date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" + + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); + conditionSb.append(" )"); + conditionSb.append(" or id in ("); + conditionSb.append("select buss_document_library_id from phased_implementation_details"); + conditionSb.append(" where implementation_date >= '" + value.split(",")[0] + "' and implementation_date <= '" + value.split(",")[1] + "'"); + if(StringUtils.equals("xin1_che1_xing2_shi2_shi1_ri4_qi1",key)){ + conditionSb.append(" and implementation_type like concat(concat('%','" + ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue() + "'),'%')"); + }else if(StringUtils.equals("implement_time",key)){ + conditionSb.append(" and implementation_type like concat(concat('%','" + ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue() + "'),'%')"); + } + conditionSb.append(" )"); + conditionSb.append(" )"); + } else { + conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); + } + }else { + //日期(区分单日期还时间范围) + if (value.contains(",")) { + conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'" + + " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'"); + } else { + conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'"); + } } } else if (FieldTypeEnum.PERSON.getValue().equals(fieldType)) { //输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/' @@ -5209,6 +5240,14 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl list = new LinkedList<>(); list.add(title); list.add(sbTwo.toString()); @@ -5888,327 +5927,415 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl map : fieldList) { - String fieldNameCn = (String) map.get("db_field_txt");//中文名称 - String fieldName = (String) map.get("db_field_name");//字段名 - String mustInput = (String) map.get("field_must_input");//是否必填 - String dbLength = map.get("db_length").toString();//字段长度 - String fieldShowType = (String) map.get("field_show_type");//字段类型 + // 如果是分阶段实施字段,单独处理,如果是其它字段,按照原有逻辑处理 + if(StringUtils.equals(key,"分阶段实施详情") || StringUtils.equals(key,"Details of the phased implementation")){ + if(StringUtils.isNotEmpty(value)){ + List phasedImplementationDetailsEOList = new ArrayList<>(); + List phasedImplDetailsList = Arrays.asList(value.split("#")); + for (String phasedImplDetails : phasedImplDetailsList) { + PhasedImplementationDetailsEO phasedImplementationDetailsEO = new PhasedImplementationDetailsEO(); + String[] phasedImplDetailsArr = phasedImplDetails.split("

"); + if(phasedImplDetailsArr.length >= 1){ + String standNumberOrClause = phasedImplDetailsArr[0]; + if (StringUtils.isNotBlank(standNumberOrClause) && standNumberOrClause.length() > 100) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += "分阶段实施详情-法规编号/条款不能超过" + 100 + "个字符, "; + }else{ + errorMsg += "Details of the phased implementation standNumberOrClause Can not be more than " + 100 + " char, "; + } + countError++; + }else { + phasedImplementationDetailsEO.setStandNumberOrClause(standNumberOrClause); + } + } + if(phasedImplDetailsArr.length >= 2){ + String implementationTypeName = phasedImplDetailsArr[1]; + if(StringUtils.isNotEmpty(implementationTypeName)){ + String[] implementationTypeNameArr = implementationTypeName.split(","); + ImplementationTypeEnum[] implementationTypeEnums = ImplementationTypeEnum.values(); + List implementationTypeList = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> { + boolean flag = false; + for (String type : implementationTypeNameArr) { + if(StringUtils.equals(type,implementationTypeEnum.getNameCn()) || StringUtils.equals(type,implementationTypeEnum.getNameEn())){ + flag = true; + } + } + return flag; + }).map(ImplementationTypeEnum::getItemValue).collect(Collectors.toList()); - if (key.equals(fieldNameCn)) { - field = fieldName; - //验证字段是否必填,长度,下拉框和树形的值是否匹配 - if (FieldTypeEnum.TREE.getValue().equals(fieldShowType)) { - //树形 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than " + dbLength + " char, "; - } - countError++; - } - //判断数据是否匹配 - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (!treeNameList.contains(valueTemp)) { + if(implementationTypeNameArr.length != implementationTypeList.size()){ if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; + errorMsg += "分阶段实施详情-实施类型填写有误,填写值为'新车型 或 在产车', "; }else{ - errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; + errorMsg += "Details of the phased implementation implementationType The value is set to 'New car model or Car in production', "; } countError++; + }else { + phasedImplementationDetailsEO.setImplementationType(implementationTypeList.stream().collect(Collectors.joining(","))); } } } - String valueId = ""; - //文字转ID - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (treeNameList.contains(valueTemp)) { - List collect = new ArrayList<>(); - if(CutEnum.CN.getValue().equals(cut)){ - collect = categoryList.stream().filter(e -> e.getName().equals(valueTemp)).collect(Collectors.toList()); - }else{ - collect = categoryList.stream().filter(e -> e.getEnName().equals(valueTemp)).collect(Collectors.toList()); - } - valueId += collect.get(0).getId()+","; - } + if(phasedImplDetailsArr.length >= 3){ + Date implementationDate = null; + try { + implementationDate = DateUtils.parseDate(phasedImplDetailsArr[2], "yyyy-MM-dd"); + } catch (ParseException e) { + e.printStackTrace(); } - if(StringUtils.isNotBlank(valueId)){ - value = valueId.substring(0, valueId.length() - 1); - } - } - - } else if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldShowType)) { - //输入框 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than" + dbLength + "char, "; - } - countError++; - } - - } else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldShowType)) { - //正则判断仅能为 负号(-),小数点(.)和数字 - - - } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldShowType)) { - //下拉单选 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than" + dbLength + " char, "; - } - countError++; - } - //判断是否是单选 - if (StringUtils.isNotBlank(value) && value.contains(",")) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为单选项, "; - }else{ - errorMsg += key + " Is multiple choice, "; - } - - countError++; - } - //判断数据是否匹配 - if (StringUtils.isNotBlank(value)) { - if (!itemNameList.contains(value)) { + if(implementationDate == null){ if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "中的" + value + "与数据字典不匹配, "; + errorMsg += "分阶段实施详情-实施日期格式错误,正确格式为'yyyy-MM-dd', "; }else{ - errorMsg += key + " " + value + " Does not match the data dictionary, "; + errorMsg += "Details of the phased implementation implementationDate format is incorrect. The correct format is 'yyyy-MM-dd', "; + } + countError++; + }else { + phasedImplementationDetailsEO.setImplementationDate(implementationDate); + } + } + if(phasedImplDetailsArr.length >= 4){ + String remarks = phasedImplDetailsArr[3]; + if (StringUtils.isNotBlank(remarks) && remarks.length() > 1000) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += "分阶段实施详情-备注不能超过" + 1000 + "个字符, "; + }else{ + errorMsg += "Details of the phased implementation ramarks Can not be more than " + 1000 + " char, "; + } + countError++; + }else { + phasedImplementationDetailsEO.setRemarks(remarks); + } + } + phasedImplementationDetailsEOList.add(phasedImplementationDetailsEO); + } + + mapResult.put("phasedImplementationDetailsEOList",phasedImplementationDetailsEOList); + } + }else { + for (Map map : fieldList) { + String fieldNameCn = (String) map.get("db_field_txt");//中文名称 + String fieldName = (String) map.get("db_field_name");//字段名 + if(StringUtils.equals(fieldName,"phasedImplDetails")){ + continue; + } + String mustInput = (String) map.get("field_must_input");//是否必填 + String dbLength = map.get("db_length").toString();//字段长度 + String fieldShowType = (String) map.get("field_show_type");//字段类型 + + if (key.equals(fieldNameCn)) { + field = fieldName; + //验证字段是否必填,长度,下拉框和树形的值是否匹配 + if (FieldTypeEnum.TREE.getValue().equals(fieldShowType)) { + //树形 + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; } countError++; } - } - //文字转数据字典编码 - if (itemNameList.contains(value)) { - String finalValue = value; - List collect = new ArrayList<>(); - if(CutEnum.CN.getValue().equals(cut)){ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(finalValue)).collect(Collectors.toList()); - }else{ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(finalValue)).collect(Collectors.toList()); - } - if (collect.size() != 0) { - value = collect.get(0).getItemValue(); - } - } - } else if (FieldTypeEnum.PULL_MORE.getValue().equals(fieldShowType)) { - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than" + dbLength + " char, "; - } - countError++; - } - //下拉多选 - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (!itemNameList.contains(valueTemp)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; - }else{ - errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; - } - countError++; + //判断长度 + if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "不能超过" + dbLength + "个字符, "; + }else{ + errorMsg += key + " Can not be more than " + dbLength + " char, "; } + countError++; } - } - - String valueId = ""; - //文字转数据字典id - if (StringUtils.isNotBlank(value)) { - for (String valueTemp : value.split(",")) { - if (itemNameList.contains(valueTemp)) { - List collect = new ArrayList<>(); - if(CutEnum.CN.getValue().equals(cut)){ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(valueTemp)).collect(Collectors.toList()); - }else{ - collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(valueTemp)).collect(Collectors.toList()); - } - - valueId += collect.get(0).getItemValue() + ","; - } - } - if (StringUtils.isNotBlank(valueId)) { - value = valueId.substring(0, valueId.length() - 1); - } - } - - - } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { - value = value.replaceAll("/","-"); - //单选日期 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //a判断是否是单日期选择 - if (StringUtils.isNotBlank(value) && value.contains(",")) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为单日期选项, "; - }else{ - errorMsg += key + " Is single date option, "; - } - countError++; - } - //判断格式是否正确 - if (!DateUtils.isValidDate((String) value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - }else{ - errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - } - countError++; - } - - } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { - //多选日期 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断格式是否正确 - if (!DateUtils.isValidDate((String) value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - }else{ - errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; - } - countError++; - } - - - } else if (FieldTypeEnum.FILE.getValue().equals(fieldShowType)) { - //文件 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; - } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than " + dbLength + " char, "; - } - countError++; - } - if (StringUtils.isNotBlank(value)) { - StringBuilder sb = new StringBuilder(); - for (String fileName : value.split(",")) { - List nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,cut,errorMsg,null,key,key); - if (nowFileList.size() == 0) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + " 压缩包中没有" + fileName + "文件, "; - }else{ - errorMsg += key + " Not in the zip package" + fileName + "file, "; - } - countError++; - } else { - try { - FileInputStream input = new FileInputStream(nowFileList.get(0)); - MultipartFile multipartFile = - new MockMultipartFile(nowFileList.get(0).getName(), nowFileList.get(0).getName(), "text/plain", input); - //文件存入文件表 - OSSFile ossFile = iOSSFileService.uploadLocalOfCos(multipartFile, "", null,null); - if (ObjectUtils.isNotEmpty(ossFile)) { - sb.append(ossFile.getId() + ","); + //判断数据是否匹配 + if (StringUtils.isNotBlank(value)) { + for (String valueTemp : value.split(",")) { + if (!treeNameList.contains(valueTemp)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; + }else{ + errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; } - } catch (IOException e) { - e.printStackTrace(); + countError++; } } } - if (StringUtils.isNotBlank(sb)) { - String substring = sb.substring(0, sb.length() - 1); - value = substring; + String valueId = ""; + //文字转ID + if (StringUtils.isNotBlank(value)) { + for (String valueTemp : value.split(",")) { + if (treeNameList.contains(valueTemp)) { + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(cut)){ + collect = categoryList.stream().filter(e -> e.getName().equals(valueTemp)).collect(Collectors.toList()); + }else{ + collect = categoryList.stream().filter(e -> e.getEnName().equals(valueTemp)).collect(Collectors.toList()); + } + valueId += collect.get(0).getId()+","; + } + } + if(StringUtils.isNotBlank(valueId)){ + value = valueId.substring(0, valueId.length() - 1); + } } - } - } else if (FieldTypeEnum.STANDARD.getValue().equals(fieldShowType)) { - //标准选择 - //判断是否必填 - if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "为必填项,不能为空, "; - }else{ - errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } else if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldShowType)) { + //输入框 + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } + countError++; } - countError++; - } - //判断长度 - if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { - if(CutEnum.CN.getValue().equals(cut)){ - errorMsg += key + "不能超过" + dbLength + "个字符, "; - }else{ - errorMsg += key + " Can not be more than " + dbLength + " char, "; + //判断长度 + if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "不能超过" + dbLength + "个字符, "; + }else{ + errorMsg += key + " Can not be more than" + dbLength + "char, "; + } + countError++; } - countError++; - } - //判断库中是否存在,如果存在则存id,如果不存在则存输入的值 + + } else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldShowType)) { + //正则判断仅能为 负号(-),小数点(.)和数字 + + + } else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldShowType)) { + //下拉单选 + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } + countError++; + } + //判断长度 + if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "不能超过" + dbLength + "个字符, "; + }else{ + errorMsg += key + " Can not be more than" + dbLength + " char, "; + } + countError++; + } + //判断是否是单选 + if (StringUtils.isNotBlank(value) && value.contains(",")) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为单选项, "; + }else{ + errorMsg += key + " Is multiple choice, "; + } + + countError++; + } + //判断数据是否匹配 + if (StringUtils.isNotBlank(value)) { + if (!itemNameList.contains(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "中的" + value + "与数据字典不匹配, "; + }else{ + errorMsg += key + " " + value + " Does not match the data dictionary, "; + } + countError++; + } + } + //文字转数据字典编码 + if (itemNameList.contains(value)) { + String finalValue = value; + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(cut)){ + collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(finalValue)).collect(Collectors.toList()); + }else{ + collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(finalValue)).collect(Collectors.toList()); + } + if (collect.size() != 0) { + value = collect.get(0).getItemValue(); + } + } + } else if (FieldTypeEnum.PULL_MORE.getValue().equals(fieldShowType)) { + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } + countError++; + } + //判断长度 + if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "不能超过" + dbLength + "个字符, "; + }else{ + errorMsg += key + " Can not be more than" + dbLength + " char, "; + } + countError++; + } + //下拉多选 + if (StringUtils.isNotBlank(value)) { + for (String valueTemp : value.split(",")) { + if (!itemNameList.contains(valueTemp)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "中的" + valueTemp + "与数据字典不匹配, "; + }else{ + errorMsg += key +" "+ valueTemp + " Does not match the data dictionary, "; + } + countError++; + } + } + } + + String valueId = ""; + //文字转数据字典id + if (StringUtils.isNotBlank(value)) { + for (String valueTemp : value.split(",")) { + if (itemNameList.contains(valueTemp)) { + List collect = new ArrayList<>(); + if(CutEnum.CN.getValue().equals(cut)){ + collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getItemText()) && e.getItemText().equals(valueTemp)).collect(Collectors.toList()); + }else{ + collect = dictItemList.stream().filter(e -> StringUtils.isNotBlank(e.getEnName()) && e.getEnName().equals(valueTemp)).collect(Collectors.toList()); + } + + valueId += collect.get(0).getItemValue() + ","; + } + } + if (StringUtils.isNotBlank(valueId)) { + value = valueId.substring(0, valueId.length() - 1); + } + } + + + } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { + value = value.replaceAll("/","-"); + //单选日期 + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } + countError++; + } + //a判断是否是单日期选择 + if (StringUtils.isNotBlank(value) && value.contains(",")) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为单日期选项, "; + }else{ + errorMsg += key + " Is single date option, "; + } + countError++; + } + //判断格式是否正确 + if (!DateUtils.isValidDate((String) value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; + }else{ + errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; + } + countError++; + } + + } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { + //多选日期 + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } + countError++; + } + //判断格式是否正确 + if (!DateUtils.isValidDate((String) value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "格式不正确, 正确格式如:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; + }else{ + errorMsg += key + " Incorrect format correct format is:yyyy/m/d、yyyy-MM-dd、yyyy年MM月dd日, "; + } + countError++; + } + + + } else if (FieldTypeEnum.FILE.getValue().equals(fieldShowType)) { + //文件 + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } + countError++; + } + //判断长度 + if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "不能超过" + dbLength + "个字符, "; + }else{ + errorMsg += key + " Can not be more than " + dbLength + " char, "; + } + countError++; + } + if (StringUtils.isNotBlank(value)) { + StringBuilder sb = new StringBuilder(); + for (String fileName : value.split(",")) { + List nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,cut,errorMsg,null,key,key); + if (nowFileList.size() == 0) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + " 压缩包中没有" + fileName + "文件, "; + }else{ + errorMsg += key + " Not in the zip package" + fileName + "file, "; + } + countError++; + } else { + try { + FileInputStream input = new FileInputStream(nowFileList.get(0)); + MultipartFile multipartFile = + new MockMultipartFile(nowFileList.get(0).getName(), nowFileList.get(0).getName(), "text/plain", input); + //文件存入文件表 + OSSFile ossFile = iOSSFileService.uploadLocalOfCos(multipartFile, "", null,null); + if (ObjectUtils.isNotEmpty(ossFile)) { + sb.append(ossFile.getId() + ","); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + if (StringUtils.isNotBlank(sb)) { + String substring = sb.substring(0, sb.length() - 1); + value = substring; + } + } + + } else if (FieldTypeEnum.STANDARD.getValue().equals(fieldShowType)) { + //标准选择 + //判断是否必填 + if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "为必填项,不能为空, "; + }else{ + errorMsg += key + " This parameter is mandatory and cannot be empty, "; + } + countError++; + } + //判断长度 + if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) { + if(CutEnum.CN.getValue().equals(cut)){ + errorMsg += key + "不能超过" + dbLength + "个字符, "; + }else{ + errorMsg += key + " Can not be more than " + dbLength + " char, "; + } + countError++; + } + //判断库中是否存在,如果存在则存id,如果不存在则存输入的值 // List> listBySerialNumber = getListBySerialNumber(value); // String serialNumberStr = ""; // StringBuilder sb = new StringBuilder(); @@ -6231,14 +6358,15 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl 0) { -// msgList.add(errorMsg); -// } - mapResult.put(field, value); +// if (countError > 0) { +// msgList.add(errorMsg); +// } + mapResult.put(field, value); + } } if (countError > 0) { if(errorMsg.endsWith(", ")){ diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java index be56b93b6..17d3a7ad7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/dummy/service/impl/DummyInventoryInfoEOServiceImpl.java @@ -16,8 +16,11 @@ import com.jero.common.system.vo.LoginUser; import com.jero.common.util.DateUtils; import com.jero.common.util.oss.CosBootUtil; import com.jero.modules.document.entity.BussDocumentLibraryEO; +import com.jero.modules.document.entity.PhasedImplementationDetailsEO; +import com.jero.modules.document.enums.ImplementationTypeEnum; import com.jero.modules.document.enums.LawsStateEnum; import com.jero.modules.document.service.IBussDocumentLibraryEOService; +import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; import com.jero.modules.dummy.entity.DummyInventoryBaseEO; import com.jero.modules.dummy.entity.DummyInventoryInfoEO; import com.jero.modules.dummy.entity.DummyInventoryInfoEOEn; @@ -98,6 +101,8 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl getPageInfo(DummyInventoryInfoEO dummyInventoryInfoEO,HttpServletRequest req) { @@ -401,6 +406,52 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl phasedDetailsQueryWrap = new QueryWrapper<>(); + phasedDetailsQueryWrap.lambda().like(PhasedImplementationDetailsEO::getImplementationType,ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue()); + phasedDetailsQueryWrap.lambda().ge(PhasedImplementationDetailsEO::getImplementationDate,implementTimeArr[0]); + phasedDetailsQueryWrap.lambda().le(PhasedImplementationDetailsEO::getImplementationDate,implementTimeArr[1]); + List bussDocumentLibraryIdList = this.phasedImplementationDetailsEOService.list(phasedDetailsQueryWrap) + .stream().map(PhasedImplementationDetailsEO::getBussDocumentLibraryId).collect(Collectors.toList()); + + queryWrapper.and(query -> { + query.and(q -> { + q.lambda().ge(DummyInventoryInfoEO::getImplementTime,implementTimeArr[0]); + q.lambda().le(DummyInventoryInfoEO::getImplementTime,implementTimeArr[1]); + }); + + if(CollectionUtils.isNotEmpty(bussDocumentLibraryIdList)){ + query.or(q -> { + q.lambda().in(DummyInventoryInfoEO::getBussDocumentLibraryId,bussDocumentLibraryIdList); + }); + } + }); + } + if(StringUtils.isNotEmpty(dummyInventoryInfoEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1String())){ + String[] newCarTimeArr = dummyInventoryInfoEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1String().split(","); + + QueryWrapper phasedDetailsQueryWrap = new QueryWrapper<>(); + phasedDetailsQueryWrap.lambda().like(PhasedImplementationDetailsEO::getImplementationType,ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue()); + phasedDetailsQueryWrap.lambda().ge(PhasedImplementationDetailsEO::getImplementationDate,newCarTimeArr[0]); + phasedDetailsQueryWrap.lambda().le(PhasedImplementationDetailsEO::getImplementationDate,newCarTimeArr[1]); + List bussDocumentLibraryIdList = this.phasedImplementationDetailsEOService.list(phasedDetailsQueryWrap) + .stream().map(PhasedImplementationDetailsEO::getBussDocumentLibraryId).collect(Collectors.toList()); + + queryWrapper.and(query -> { + query.and(q -> { + q.lambda().ge(DummyInventoryInfoEO::getXin1Che1Xing2Shi2Shi1Ri4Qi1,newCarTimeArr[0]); + q.lambda().le(DummyInventoryInfoEO::getXin1Che1Xing2Shi2Shi1Ri4Qi1,newCarTimeArr[1]); + }); + if(CollectionUtils.isNotEmpty(bussDocumentLibraryIdList)){ + query.or(q -> { + q.lambda().in(DummyInventoryInfoEO::getBussDocumentLibraryId,bussDocumentLibraryIdList); + }); + } + }); + } + List dummyInventoryInfoEOList = this.list(queryWrapper); log.info("一阶段消耗时间:" + (System.currentTimeMillis() - startTime)); //数据字典 @@ -412,6 +463,9 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl datas, String cut) { + if(CollectionUtils.isNotEmpty(datas)){ + List bussDocumentLibraryIdList = datas.stream().map(DummyInventoryInfoEO::getBussDocumentLibraryId).distinct().collect(Collectors.toList()); + QueryWrapper phasedDetailsQueryWrap = new QueryWrapper<>(); + phasedDetailsQueryWrap.lambda().in(PhasedImplementationDetailsEO::getBussDocumentLibraryId,bussDocumentLibraryIdList); + List phasedDetailsList = this.phasedImplementationDetailsEOService.list(phasedDetailsQueryWrap); + + // 新车型分阶段实施数据信息 + List newCarModelPhasedDetailsList = phasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if(StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + // 在产车分阶段实施数据信息 + List carInProductionPhasedDetailsList = phasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if(StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + for (DummyInventoryInfoEO data : datas) { + // 处理新车型实施日期展示 + List newCarModelDateList = newCarModelPhasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if (StringUtils.equals(phasedDetails.getBussDocumentLibraryId(), data.getBussDocumentLibraryId())) { + flag = true; + } + return flag; + }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); + if(data.getXin1Che1Xing2Shi2Shi1Ri4Qi1() != null){ + newCarModelDateList.add(data.getXin1Che1Xing2Shi2Shi1Ri4Qi1()); + } + String newCarModelDateStr = DateUtils.formatDateList(newCarModelDateList); + data.setXin1Che1Xing2Shi2Shi1Ri4Qi1String(newCarModelDateStr); + + // 处理在产车实施日期展示 + List carInProductionDateList = carInProductionPhasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if (StringUtils.equals(phasedDetails.getBussDocumentLibraryId(), data.getBussDocumentLibraryId())) { + flag = true; + } + return flag; + }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); + if(data.getImplementTime() != null){ + carInProductionDateList.add(data.getImplementTime()); + } + String carInProductionDateStr = DateUtils.formatDateList(carInProductionDateList); + data.setImplementTimeString(carInProductionDateStr); + } + } + } + private List hearSort(String orderBy, String orderByField, List dummyInventoryInfoEOList) { if(ObjectUtils.isNotEmpty(orderByField)){ Collator comparator = Collator.getInstance(Locale.CHINESE); diff --git a/jero-web/src/views/documentTools/virtualList/components/virtualListDetails.vue b/jero-web/src/views/documentTools/virtualList/components/virtualListDetails.vue index 507e800ba..afcddbf77 100644 --- a/jero-web/src/views/documentTools/virtualList/components/virtualListDetails.vue +++ b/jero-web/src/views/documentTools/virtualList/components/virtualListDetails.vue @@ -72,6 +72,26 @@ v-model="queryParam.subtitle"> + {{$t('query')}} {{$t('reset')}} + + {{ !toggleSearchStatus ? $t('open') : $t('away') }} + + @@ -328,6 +352,7 @@ title: '维护虚拟清单', queryParam: {}, components: {}, + toggleSearchStatus: false, visibleFile: false, transferList: false, orderBy: '1', @@ -439,14 +464,16 @@ title: this.$t('ImplementationDate'), align: 'left', width: 200, - dataIndex: 'xin1Che1Xing2Shi2Shi1Ri4Qi1', + dataIndex: 'xin1Che1Xing2Shi2Shi1Ri4Qi1String', + scopedSlots: { customRender: 'titleName' }, ellipsis: true }, { title: this.$t('vehicleInProductionDate'), align: 'left', width: 220, - dataIndex: 'implementTime', + dataIndex: 'implementTimeString', + scopedSlots: { customRender: 'titleName' }, ellipsis: true }, { @@ -981,7 +1008,7 @@ name: this.$t('ImplementationDate'), headFieldCn:'标准实施日期', headFieldEn:'New Type Execution Date', - field: 'xin1Che1Xing2Shi2Shi1Ri4Qi1', + field: 'xin1Che1Xing2Shi2Shi1Ri4Qi1String', key: 9, moduleFlag:this.$route.query.title == '虚拟清单详情' ? '虚拟清单详情' : '维护清单', }, @@ -990,7 +1017,7 @@ name: this.$t('vehicleInProductionDate'), headFieldCn:'在产车实施日期', headFieldEn:'New Vehicle Execution Date', - field: 'implementTime', + field: 'implementTimeString', key: 10, moduleFlag:this.$route.query.title == '虚拟清单详情' ? '虚拟清单详情' : '维护清单', }, @@ -1271,16 +1298,16 @@ text: this.$t('implementationCategory'), dictCode: 'implement_type'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框 }, - { - type: 'date', - value: 'xin1Che1Xing2Shi2Shi1Ri4Qi1', - text: this.$t('ImplementationDate') - }, - { - type: 'date', - value: 'implementTime', - text: this.$t('vehicleInProductionDate') - }, + // { + // type: 'date', + // value: 'xin1Che1Xing2Shi2Shi1Ri4Qi1', + // text: this.$t('ImplementationDate') + // }, + // { + // type: 'date', + // value: 'implementTime', + // text: this.$t('vehicleInProductionDate') + // }, { type: 'string', value: 'wvtaId', @@ -1363,9 +1390,9 @@ this.getList() }, searchReset() { + this.queryParam = {} this.$refs.globalAdvancedQueryRef.resetLine() this.$refs.globalAdvancedQueryRef.emitCallback() - this.queryParam = {} this.getList() }, //模板下载 @@ -1451,6 +1478,9 @@ } this.getList() }, + handleToggleSearch() { + this.toggleSearchStatus = !this.toggleSearchStatus + }, getHeader(){ getAction('head/headCustomEO/list', { moduleFlag: this.$route.query.title == '虚拟清单详情' ? '虚拟清单详情' : '维护清单' @@ -1482,6 +1512,14 @@ item.scopedSlots = { customRender: 'titleName' } + }else if(item.title == '在产车实施日期'){ + item.scopedSlots = { + customRender: 'titleName' + } + }else if(item.title == '标准实施日期'){ + item.scopedSlots = { + customRender: 'titleName' + } } else if(item.title == '清单确认状态' || item.title == '任务确认状态' || item.title == '认证级别' || item.title == 'WVTA ID' || item.title == '责任领域' || item.title == '法规工程师' || item.title == '认证工程师' || item.title == '工程接口人'){ @@ -1516,6 +1554,12 @@ }) }, getList() { + if(this.queryParam.xin1Che1Xing2Shi2Shi1Ri4Qi1String && this.queryParam.xin1Che1Xing2Shi2Shi1Ri4Qi1String instanceof Array){ + this.queryParam.xin1Che1Xing2Shi2Shi1Ri4Qi1String = this.queryParam.xin1Che1Xing2Shi2Shi1Ri4Qi1String.join(',') + } + if(this.queryParam.implementTimeString && this.queryParam.implementTimeString instanceof Array){ + this.queryParam.implementTimeString = this.queryParam.implementTimeString.join(',') + } let query = { ...this.queryParam, ...this.queryParamQuery, @@ -1564,6 +1608,22 @@ onChange(){ this.selectedValue = this.checkedList }, + onChangedatet(values){ + let StartTime = values[0].format('YYYY-MM-DD') + let EndTime = values[1].format('YYYY-MM-DD') + let array = [] + array.push(StartTime,EndTime) + console.log(array) + this.queryParam.xin1Che1Xing2Shi2Shi1Ri4Qi1String = array + }, + onChangedate(values){ + let StartTime = values[0].format('YYYY-MM-DD') + let EndTime = values[1].format('YYYY-MM-DD') + let array = [] + array.push(StartTime,EndTime) + console.log(array) + this.queryParam.implementTimeString = array + }, getcustomize(){ this.customizevisible = true },