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

This commit is contained in:
yuezhihang
2021-07-15 17:37:30 +08:00
3 changed files with 130 additions and 3 deletions
@@ -1,6 +1,7 @@
package com.adc.da.slrs.sarStandardComplianceAssessResult.controller;
import cn.hutool.core.map.MapUtil;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
@@ -16,12 +17,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import oracle.ucp.proxy.annotation.Post;
import org.apache.commons.beanutils.BeanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -98,6 +104,55 @@ public class SarStandardComplianceAssessResultController {
}
}
}
private static class InsertEntity<T>{
List<Map> entityList;
T eo;
}
@ApiOperation(value="(插入/更新)标准清单")
@PostMapping("/standard")
public ResponseMessage insertStandard(@RequestBody InsertEntity<SarStandardsInfoEO> insertEntity) throws InvocationTargetException, IllegalAccessException {
SarStandardsInfoEO eo = insertEntity.eo;
if (eo.getStandApplicationType() == 1) {
List<SarStandardComplianceProductAssess> entityList = new ArrayList<>();
for (int i = 0; i < insertEntity.entityList.size(); i++) {
SarStandardComplianceProductAssess obj=new SarStandardComplianceProductAssess();
BeanUtils.populate(obj, insertEntity.entityList.get(i));
entityList.add(obj);
}
iSarStandardComplianceProductAssessService.saveOrUpdateBatch(entityList);
}else {
if(eo.getPosition()==1){
List<SarInterpretationNationalStandard> entityList = new ArrayList<>();
for (int i = 0; i < insertEntity.entityList.size(); i++) {
SarInterpretationNationalStandard obj=new SarInterpretationNationalStandard();
BeanUtils.populate(obj, insertEntity.entityList.get(i));
entityList.add(obj);
}
iSarInterpretationNationalStandardService.saveOrUpdateBatch(entityList);
}else{
List<SarInterpretationForeignStandard> entityList = new ArrayList<>();
for (int i = 0; i < insertEntity.entityList.size(); i++) {
SarInterpretationForeignStandard obj=new SarInterpretationForeignStandard();
BeanUtils.populate(obj, insertEntity.entityList.get(i));
entityList.add(obj);
}
iSarInterpretationForeignStandardService.saveOrUpdateBatch(entityList);
}
}
return Result.success();
}
@ApiOperation(value = "条件查询标准涉及项目符合性清单")
@GetMapping("/product")
public ResponseMessage<IPage<SarStandardComplianceProductAssess>> selectProduct(SarStandardComplianceProductAssessEO eo) throws Exception {
@@ -114,6 +169,17 @@ public class SarStandardComplianceAssessResultController {
return Result.success(page);
}
@ApiOperation(value = "插入标准涉及项目符合性清单")
@PostMapping("/product")
public ResponseMessage insertProduct(List<SarStandardComplianceProductAssess> eo) throws Exception {
iSarStandardComplianceProductAssessService.saveOrUpdateBatch(eo);
return Result.success();
}
@ApiOperation(value = "条件查询技术审核符合性清单")
@GetMapping("/interpretation")
public ResponseMessage<Object> selectNationalStandard(InterpretationEO eo) throws Exception {
@@ -137,4 +203,37 @@ public class SarStandardComplianceAssessResultController {
return Result.success(page);
}
}
@ApiOperation(value = "插入技术审核符合性清单")
@PostMapping("/interpretation")
public ResponseMessage insertInterpretation(InsertEntity<InterpretationEO> insertEntity) throws Exception {
InterpretationEO eo = insertEntity.eo;
if (eo.getPosition()==1) {
List<SarInterpretationNationalStandard> entityList = new ArrayList<>();
for (int i = 0; i < insertEntity.entityList.size(); i++) {
SarInterpretationNationalStandard obj=new SarInterpretationNationalStandard();
BeanUtils.populate(obj, insertEntity.entityList.get(i));
entityList.add(obj);
}
iSarInterpretationNationalStandardService.saveOrUpdateBatch(entityList);
} else {
List<SarInterpretationForeignStandard> entityList = new ArrayList<>();
for (int i = 0; i < insertEntity.entityList.size(); i++) {
SarInterpretationForeignStandard obj=new SarInterpretationForeignStandard();
BeanUtils.populate(obj, insertEntity.entityList.get(i));
entityList.add(obj);
}
iSarInterpretationForeignStandardService.saveOrUpdateBatch(entityList);
}
return Result.success();
}
}
@@ -154,6 +154,8 @@ public class SarStandardsInfo extends BaseEntity {
@TableField(exist = false)
private Map<String, Object> attrInfoMap = new LinkedHashMap<>(); //属性表字段与值
@TableField(exist = false)
private Map<String, Object> attrInfoCaseMap = new LinkedHashMap<>(); //属性表字段与值小写前端带入渲染
@TableField(exist = false)
private String sarStandAttrEOStr; //新增修改时属性表信息
@TableField(exist = false)
private String menuId; //目录ID
@@ -286,10 +286,36 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}
getAttrMap.putAll(newMap);
}
if (getAttrMap != null && !getAttrMap.isEmpty()) {
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
}
row.setAttrInfoMap(getAttrMap);
}
}
private Map<String, Object> transformUpperCase(Map<String, Object> orgMap) {
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<String, Object> entry : orgMap.entrySet()) {
String newKey = entry.getKey().toLowerCase();
resultMap.put(newKey, orgMap.get(entry.getKey()));
if (entry.getValue() != null && InitStandAttrUtil.fileFieldList != null && !InitStandAttrUtil.fileFieldList.isEmpty() && InitStandAttrUtil.fileFieldList.contains(entry.getKey())) {
String value = entry.getValue().toString();
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
if(!fileObj.isEmpty()){
resultMap.put(newKey + "Name", fileObj.get(0).getOldFileName());
}
}
}
}
return resultMap;
}
public void attrInfoShow(List<SarStandardsInfo> sarlist) throws Exception {
for (SarStandardsInfo row : sarlist) {
attrInfoDetails(row);