|
@@ -975,12 +975,14 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
|
|
public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
|
|
|
|
+
|
|
//------初始当前填报的表pKeyIds------
|
|
//------初始当前填报的表pKeyIds------
|
|
this.initTrialTabIds(dto);
|
|
this.initTrialTabIds(dto);
|
|
|
|
|
|
- //------初始编号信息------
|
|
|
|
- this.initBuildNumber(dto);
|
|
|
|
-
|
|
|
|
|
|
+ if(!this.judgingParameters(dto)){
|
|
|
|
+ //------初始编号信息------
|
|
|
|
+ this.initBuildNumber(dto);
|
|
|
|
+ }
|
|
//------新增或编辑------
|
|
//------新增或编辑------
|
|
this.saveOrUpdate(dto);
|
|
this.saveOrUpdate(dto);
|
|
|
|
|
|
@@ -990,7 +992,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
//如果传递了就修改对应记录的值
|
|
//如果传递了就修改对应记录的值
|
|
this.updateRecordNoOrReportNo(obj, dto);
|
|
this.updateRecordNoOrReportNo(obj, dto);
|
|
//------编辑时记录表编号或报告单编号为Null的重新生成------
|
|
//------编辑时记录表编号或报告单编号为Null的重新生成------
|
|
- this.reBuildNumber(obj, dto);
|
|
|
|
|
|
+ if(this.judgingParameters(dto)){
|
|
|
|
+ this.reBuildNumber(obj, dto);
|
|
|
|
+ }
|
|
|
|
|
|
//------保存实体表数据、试验记录信息、生成PDF------
|
|
//------保存实体表数据、试验记录信息、生成PDF------
|
|
this.submitTrialData(obj, dto);
|
|
this.submitTrialData(obj, dto);
|
|
@@ -1039,15 +1043,65 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
if("1".equals(singleTableType[i])){
|
|
if("1".equals(singleTableType[i])){
|
|
//记录表
|
|
//记录表
|
|
this.updateRecordNoOrReportNo(dto,jsonObject,doc,"记录编 号:","record_no");
|
|
this.updateRecordNoOrReportNo(dto,jsonObject,doc,"记录编 号:","record_no");
|
|
|
|
+ this.updateRecordNoOrReportNo(dto,jsonObject,doc,"记录编号:","record_no");
|
|
}else if("2".equals(singleTableType[i])){
|
|
}else if("2".equals(singleTableType[i])){
|
|
//报告单
|
|
//报告单
|
|
this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
|
|
this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
-
|
|
|
|
|
|
+ log.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 判断入参中用户是否自己手动填写了 报告编号或者记录编号
|
|
|
|
+ * @param dto
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private boolean judgingParameters(TrialSelfInspectionRecordDTO dto) {
|
|
|
|
+ JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
|
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = dataArray.getJSONObject(i);
|
|
|
|
+ String pkeyId = jsonObject.getString("pkeyId");
|
|
|
|
+ String sql = "select * from m_wbs_tree_private where p_key_id =" + pkeyId;
|
|
|
|
+ WbsTreePrivate table = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
+ String fileUrl = table.getHtmlUrl();
|
|
|
|
+ try {
|
|
|
|
+ InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
|
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
|
+ htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
|
+ Document doc = Jsoup.parse(htmlString);
|
|
|
|
+ //可能出现的几种情况 4种情况 记录编 号: 记录编号: 报告编号: 编号:
|
|
|
|
+ Elements elementsWithPlaceholderxx = doc.select("[placeholderxx='记录编 号:']");
|
|
|
|
+ if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
|
|
|
|
+ elementsWithPlaceholderxx = doc.select("[placeholderxx='记录编号:']");
|
|
|
|
+ if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
|
|
|
|
+ elementsWithPlaceholderxx = doc.select("[placeholderxx='报告编号:']");
|
|
|
|
+ if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
|
|
|
|
+ elementsWithPlaceholderxx = doc.select("[placeholderxx='编号:']");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //没找到直接返回false
|
|
|
|
+ if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
|
|
|
|
+ log.error("方法:private boolean JudgingParameters(TrialSelfInspectionRecordDTO dto)中 未找到元素");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ Element first = elementsWithPlaceholderxx.first();
|
|
|
|
+ String key = first.attr("id");
|
|
|
|
+ //记录编号或者报告编号的值
|
|
|
|
+ String recordOrReportNo = jsonObject.getString(key);
|
|
|
|
+ if(recordOrReportNo != null || "".equals(recordOrReportNo)){
|
|
|
|
+ return true;
|
|
|
|
+ }else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1060,10 +1114,14 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
*/
|
|
*/
|
|
private void updateRecordNoOrReportNo(TrialSelfInspectionRecord dto,JSONObject jsonObject,Document doc,String value, String fileVlue) {
|
|
private void updateRecordNoOrReportNo(TrialSelfInspectionRecord dto,JSONObject jsonObject,Document doc,String value, String fileVlue) {
|
|
Elements elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
|
|
Elements elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
|
|
- if((elementsWithPlaceholderxx.size() == 0 ||elementsWithPlaceholderxx == null) && value.equals("报告编号:")){
|
|
|
|
|
|
+ if((elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) && value.equals("报告编号:")){
|
|
|
|
+ //特殊情况
|
|
value = "编号:";
|
|
value = "编号:";
|
|
elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
|
|
elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
|
|
}
|
|
}
|
|
|
|
+ if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
Element first = elementsWithPlaceholderxx.first();
|
|
Element first = elementsWithPlaceholderxx.first();
|
|
String key = first.attr("id");
|
|
String key = first.attr("id");
|
|
//记录编号或者报告编号的值
|
|
//记录编号或者报告编号的值
|