fix(解读流程): 汇总节点字段长度校验
This commit is contained in:
+46
@@ -8,11 +8,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import com.jero.common.api.SendMessageAPI;
|
import com.jero.common.api.SendMessageAPI;
|
||||||
import com.jero.common.api.dto.message.SendMessageDTO;
|
import com.jero.common.api.dto.message.SendMessageDTO;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.api.vo.ResultCommon;
|
import com.jero.common.api.vo.ResultCommon;
|
||||||
import com.jero.common.constant.CommonConstant;
|
import com.jero.common.constant.CommonConstant;
|
||||||
|
import com.jero.common.constant.enums.LanguageEnum;
|
||||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.common.system.base.controller.JeroController;
|
import com.jero.common.system.base.controller.JeroController;
|
||||||
@@ -64,6 +66,8 @@ import com.jero.modules.split.service.ISarFileSplitInfoService;
|
|||||||
import com.jero.modules.system.entity.SysDepart;
|
import com.jero.modules.system.entity.SysDepart;
|
||||||
import com.jero.modules.system.service.ISysDepartService;
|
import com.jero.modules.system.service.ISysDepartService;
|
||||||
import com.jero.modules.system.service.ISysDictService;
|
import com.jero.modules.system.service.ISysDictService;
|
||||||
|
import com.jero.modules.tag.entity.LawsTag;
|
||||||
|
import com.jero.modules.tag.service.ILawsTagService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.activiti.engine.ManagementService;
|
import org.activiti.engine.ManagementService;
|
||||||
@@ -91,6 +95,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -134,6 +139,7 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
|||||||
private final ILawsStandardMasterPlanService lawsStandardMasterPlanService;
|
private final ILawsStandardMasterPlanService lawsStandardMasterPlanService;
|
||||||
private final ProcessStandardInterpretMapper processStandardInterpretMapper;
|
private final ProcessStandardInterpretMapper processStandardInterpretMapper;
|
||||||
private final SendMessageAPI sendMessageAPI;
|
private final SendMessageAPI sendMessageAPI;
|
||||||
|
private final ILawsTagService lawsTagService;
|
||||||
|
|
||||||
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
private final List<String> tempList = new ArrayList<>();
|
private final List<String> tempList = new ArrayList<>();
|
||||||
@@ -547,6 +553,43 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
|||||||
log.info("标准解读流程-流程监听器 结束");
|
log.info("标准解读流程-流程监听器 结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkLength(ProcessStandardInterpretClauseSublist clauseSublist, int i) {
|
||||||
|
List<LawsTag> tagList = lawsTagService.list(
|
||||||
|
new LambdaQueryWrapper<LawsTag>()
|
||||||
|
.eq(LawsTag::getTableName, "laws_document_split")
|
||||||
|
.eq(LawsTag::getIsShowList, YesOrNoEnum.YES.getValue())
|
||||||
|
.ne(LawsTag::getDbFieldName, "is_same_as_prev_version"));
|
||||||
|
// 反射获取字段名称
|
||||||
|
Field[] fields = clauseSublist.getClass().getDeclaredFields();
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
String name = field.getName();
|
||||||
|
// 驼峰转下划线
|
||||||
|
String finalName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||||
|
Optional<LawsTag> optionalLawsTag = tagList.stream()
|
||||||
|
.filter(tag -> tag.getDbFieldName().equals(finalName)).findFirst();
|
||||||
|
optionalLawsTag.ifPresent(v -> {
|
||||||
|
String value = null;
|
||||||
|
try {
|
||||||
|
value = (String) field.get(clauseSublist);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
if (value.length() > v.getDbLength()) {
|
||||||
|
if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
|
||||||
|
throw new JeroBootException("第" + (i + 1) + "行: 字段 " +
|
||||||
|
v.getDbFieldTxt() + "长度不能超过" + v.getDbLength() + "<br/>");
|
||||||
|
}else {
|
||||||
|
throw new JeroBootException("Line " + (i + 1) + ": The field " +
|
||||||
|
v.getDbFieldName() + "length shall not exceed" + v.getDbFieldEnName() + "<br/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void distinct(ProcessStandardInterpretClauseSublist data) {
|
private void distinct(ProcessStandardInterpretClauseSublist data) {
|
||||||
data.setPartName(toDistinct(data.getPartName()));
|
data.setPartName(toDistinct(data.getPartName()));
|
||||||
data.setKeyController(toDistinct(data.getKeyController()));
|
data.setKeyController(toDistinct(data.getKeyController()));
|
||||||
@@ -1625,6 +1668,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
|||||||
break;
|
break;
|
||||||
// 标准主解读汇总(分发)
|
// 标准主解读汇总(分发)
|
||||||
case StandardInterpretCommon.MASTER_INTERPRET_SUMMARY:
|
case StandardInterpretCommon.MASTER_INTERPRET_SUMMARY:
|
||||||
|
for (int i = 0; i < processStandardInterpretClauseSublistList.size(); i++) {
|
||||||
|
checkLength(processStandardInterpretClauseSublistList.get(i), i);
|
||||||
|
}
|
||||||
// 保存会签人员、审核人员、批准人员
|
// 保存会签人员、审核人员、批准人员
|
||||||
processStandardInterpretService.updateById(processStandardInterpret);
|
processStandardInterpretService.updateById(processStandardInterpret);
|
||||||
map.put(StandardInterpretCommon.JOINTLY_SIGN_LIST,
|
map.put(StandardInterpretCommon.JOINTLY_SIGN_LIST,
|
||||||
|
|||||||
Reference in New Issue
Block a user