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

# Conflicts:
#	adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java
This commit is contained in:
11528
2022-03-18 16:41:16 +08:00
37 changed files with 2410 additions and 384 deletions
@@ -1,341 +1,342 @@
package com.adc.da.slrs.sarStandardComplianceAssessResult.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandardComplianceAssessResult.entity.*;
import com.adc.da.slrs.sarStandardComplianceAssessResult.service.ISarInterpretationForeignStandardService;
import com.adc.da.slrs.sarStandardComplianceAssessResult.service.ISarInterpretationNationalStandardService;
import com.adc.da.slrs.sarStandardComplianceAssessResult.service.ISarStandardComplianceProductAssessService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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 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.*;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* <p>
* 标准法规准入清单详情表 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@RestController
@Api(tags = "福田标准法规--标准法规库--标准合规评估结果")
@RequestMapping("/${restPath}/sarStandardComplianceAssessResult")
public class SarStandardComplianceAssessResultController {
private static final Logger logger = LoggerFactory.getLogger(SarStandardComplianceAssessResultController.class);
@Autowired
private ISarStandardComplianceProductAssessService iSarStandardComplianceProductAssessService;
@Autowired
private ISarInterpretationForeignStandardService iSarInterpretationForeignStandardService;
@Autowired
private ISarInterpretationNationalStandardService iSarInterpretationNationalStandardService;
@ApiOperation(value = "条件查询标准清单")
@GetMapping("/standard")
public ResponseMessage<Object> selectStandard(SarStandardsInfoEO eo) throws Exception {
if (eo.getStandApplicationType() == 1) {
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
queryWrapper.select(" STAND_ID,ANY_VALUE(STAND_NUMBER) as STAND_NUMBER, STAND_NAME, STAND_TYPE");
if (eo.getStandName() != null ) {
queryWrapper.like("STAND_NAME", eo.getStandName().replace(" ",""));
}
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
if (eo.getType() != null && !eo.getType().trim().equals("")) {
queryWrapper.like("type", eo.getType().trim());
}
queryWrapper.groupBy("STAND_ID,STAND_NAME,STAND_TYPE");
IPage<SarStandardComplianceProductAssess> page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
return Result.success(page);
} else {
if (eo.getPosition() == 1) {
QueryWrapper<SarInterpretationNationalStandard> queryWrapper = new QueryWrapper<>();
IPage<SarInterpretationNationalStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
queryWrapper.select("distinct STAND_ID, STAND_NUMBER, STAND_NAME, STAND_TYPE, INTERPRETATION_TIME,risk_degree");
if (eo.getStandName() != null && !eo.getStandName().trim().equals("")) {
queryWrapper.like("STAND_NAME", eo.getStandName().trim());
}
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
IPage<SarInterpretationNationalStandard> page = iSarInterpretationNationalStandardService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
return Result.success(page);
} else {
QueryWrapper<SarInterpretationForeignStandard> queryWrapper = new QueryWrapper<>();
IPage<SarInterpretationForeignStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
queryWrapper.select("distinct STAND_ID, STAND_NUMBER, STAND_NAME, STAND_TYPE, INTERPRETATION_TIME");
if (eo.getStandName() != null && !eo.getStandName().trim().equals("")) {
queryWrapper.like("STAND_NAME", eo.getStandName().trim());
}
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
IPage<SarInterpretationForeignStandard> page = iSarInterpretationForeignStandardService.page(iPage, queryWrapper);
while(page.getRecords().remove(null));
return Result.success(page);
}
}
}
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 {
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
if (eo.getType() != null) queryWrapper.eq("type", eo.getType());
if (eo.getProductName() != null) queryWrapper.like("product_name", eo.getProductName());
if (eo.getProductId() != null) queryWrapper.like("product_id", eo.getProductId());
queryWrapper.orderByAsc("product_name");
queryWrapper.orderByAsc("standard_item");
// if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
IPage<SarStandardComplianceProductAssess> page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
return Result.success(page);
}
@ApiOperation(value = "标准涉及项目复合性详情")
@GetMapping("/productNewDetail")
public ResponseMessage<Map<String,IPage<SarStandardComplianceProductAssess>>> selectProductDetail(SarStandardComplianceProductAssessEO eo) throws Exception {
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
Map<String,IPage<SarStandardComplianceProductAssess>> map=new HashMap<>();
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("STAND_ID", eo.getStandId());
queryWrapper.eq("product_id", eo.getProductId());
queryWrapper.and(sarStandardComplianceProductAssessQueryWrapper -> sarStandardComplianceProductAssessQueryWrapper.eq("no_involve","").or().isNull("no_involve"));
queryWrapper.isNotNull("research_completion_time");
queryWrapper.orderByAsc("product_name");
queryWrapper.orderByAsc("standard_item");
Page p1=new Page();
IPage<SarStandardComplianceProductAssess> page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
BeanUtils.copyProperties(page,p1);
p1.setRecords(orderUtils(page.getRecords()));
p1.setTotal(page.getTotal());
map.put("unfit",p1);
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("STAND_ID", eo.getStandId());
queryWrapper1.eq("product_id", eo.getProductId());
queryWrapper1.and(sarStandardComplianceProductAssessQueryWrapper -> sarStandardComplianceProductAssessQueryWrapper.ne("research_compliance","").or().isNotNull("research_compliance"));
queryWrapper1.orderByAsc("product_name");
queryWrapper1.orderByAsc("standard_item");
IPage<SarStandardComplianceProductAssess> page1 = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper1);
Page p2=new Page();
BeanUtils.copyProperties(page1,p2);
p2.setRecords(orderUtils(page1.getRecords()));
p2.setTotal(page1.getTotal());
map.put("fit",p2);
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("STAND_ID", eo.getStandId());
queryWrapper2.eq("product_id", eo.getProductId());
queryWrapper2.and(sarStandardComplianceProductAssessQueryWrapper -> sarStandardComplianceProductAssessQueryWrapper.ne("no_involve","").and(sarStandardComplianceProductAssessQueryWrapper1 -> sarStandardComplianceProductAssessQueryWrapper1.isNotNull("no_involve")));
queryWrapper2.orderByAsc("product_name");
queryWrapper2.orderByAsc("standard_item");
IPage<SarStandardComplianceProductAssess> page2 = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper2);
page2.setRecords(orderUtils(page2.getRecords()));
map.put("noFit",page2);
return Result.success(map);
}
private List<SarStandardComplianceProductAssess> orderUtils(List<SarStandardComplianceProductAssess> sarStandardCompliance){
Map<Integer,List<SarStandardComplianceProductAssess>> stringMap=new HashMap<>();
List<Integer> orderKey=new ArrayList<>();
for (SarStandardComplianceProductAssess s:sarStandardCompliance) {
if (null!=s.getStandardItem()) {
String[] as=(s.getStandardItem()+",").split(",");
if (orderKey.contains(Integer.valueOf(as[0].trim().toString()))) {
stringMap.get(Integer.valueOf(as[0].trim().toString())).add(s);
} else {
orderKey.add(Integer.valueOf(as[0].trim().toString()));
List<SarStandardComplianceProductAssess> assesses2 = new ArrayList<>();
assesses2.add(s);
stringMap.put(Integer.valueOf(as[0].trim().toString()), assesses2);
}
}else {
if (null!=stringMap.get(0)) {
stringMap.get(0).add(s);
}else {
List<SarStandardComplianceProductAssess> assesses = new ArrayList<>();
assesses.add(s);
stringMap.put(0,assesses);
orderKey.add(0);
}
}
}
Collections.sort(orderKey,(o1, o2) -> {
return (o1 -o2);
});
List<SarStandardComplianceProductAssess> res=new ArrayList<>();
orderKey.forEach(integer -> {
res.addAll(stringMap.get(integer));
});
return res;
}
@ApiOperation(value = "标准涉及项目复合性")
@GetMapping("/productNew")
public ResponseMessage<IPage<unCountDTO>> selectProduct(unCountDTO eo) throws Exception {
Page iPage = new Page<>();
iPage.setCurrent(eo.getCurrent());
iPage.setSize(eo.getSize());
IPage<unCountDTO> page = iSarStandardComplianceProductAssessService.selectPages(iPage, eo);
return Result.success(page);
}
@ApiOperation(value = "插入标准涉及项目符合性清单")
@PostMapping("/add")
public ResponseMessage insertProduct(@RequestBody List<SarStandardComplianceProductAssess> eo) throws Exception {
eo.forEach(sarStandardComplianceProductAssess -> {
sarStandardComplianceProductAssess.setId(UUIDUtils.randomUUID(32));
sarStandardComplianceProductAssess.setInterpretationTime(new Date());
});
iSarStandardComplianceProductAssessService.saveBatch(eo);
return Result.success();
}
@ApiOperation(value = "条件查询技术审核符合性清单")
@GetMapping("/interpretation")
public ResponseMessage<Object> selectNationalStandard(InterpretationEO eo) throws Exception {
if (eo.getPosition() == 1) {
IPage<SarInterpretationNationalStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
List<SarInterpretationNationalStandard> standards=iSarInterpretationNationalStandardService.getAllDatas(eo);
Integer datasCount=iSarInterpretationNationalStandardService.getAllDatasCount(eo);
iPage.setTotal(datasCount);
iPage.setRecords(standards);
while (iPage.getRecords().remove(null)) ;
return Result.success(iPage);
} else {
IPage<SarInterpretationForeignStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
QueryWrapper<SarInterpretationForeignStandard> queryWrapper = new QueryWrapper<>();
//如果查询条件里标准编号不为空,查询
if (eo.getStandNumber() != null) queryWrapper.like("STAND_NUMBER",eo.getStandNumber());
//如果查询条件里标准名称不为空,查询
if (eo.getStandName() != null) queryWrapper.like("STAND_NAME",eo.getStandName());
//如果查询条件里具体章条不为空,查询
if (eo.getSpecificItem() != null) queryWrapper.like("specific_item",eo.getSpecificItem());
if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
if (eo.getStandId() != null) queryWrapper.eq("STAND_ID", eo.getStandId());
IPage<SarInterpretationForeignStandard> page = iSarInterpretationForeignStandardService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
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();
}
}
package com.adc.da.slrs.sarStandardComplianceAssessResult.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandardComplianceAssessResult.entity.*;
import com.adc.da.slrs.sarStandardComplianceAssessResult.service.ISarInterpretationForeignStandardService;
import com.adc.da.slrs.sarStandardComplianceAssessResult.service.ISarInterpretationNationalStandardService;
import com.adc.da.slrs.sarStandardComplianceAssessResult.service.ISarStandardComplianceProductAssessService;
import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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 org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* <p>
* 标准法规准入清单详情表 前端控制器
* </p>
*
* @author super_liu
* @since 2021-06-02
*/
@RestController
@Api(tags = "福田标准法规--标准法规库--标准合规评估结果")
@RequestMapping("/${restPath}/sarStandardComplianceAssessResult")
public class SarStandardComplianceAssessResultController {
private static final Logger logger = LoggerFactory.getLogger(SarStandardComplianceAssessResultController.class);
@Autowired
private ISarStandardComplianceProductAssessService iSarStandardComplianceProductAssessService;
@Autowired
private ISarInterpretationForeignStandardService iSarInterpretationForeignStandardService;
@Autowired
private ISarInterpretationNationalStandardService iSarInterpretationNationalStandardService;
@ApiOperation(value = "条件查询标准清单")
@GetMapping("/standard")
public ResponseMessage<Object> selectStandard(SarStandardsInfoEO eo) throws Exception {
if (eo.getStandApplicationType() == 1) {
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
queryWrapper.select(" STAND_ID,ANY_VALUE(STAND_NUMBER) as STAND_NUMBER, STAND_NAME, STAND_TYPE");
if (eo.getStandName() != null ) {
queryWrapper.like("STAND_NAME", eo.getStandName().replace(" ",""));
}
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
if (eo.getType() != null && !eo.getType().trim().equals("")) {
queryWrapper.like("type", eo.getType().trim());
}
queryWrapper.groupBy("STAND_ID,STAND_NAME,STAND_TYPE");
IPage<SarStandardComplianceProductAssess> page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
return Result.success(page);
} else {
if (eo.getPosition() == 1) {
QueryWrapper<SarInterpretationNationalStandard> queryWrapper = new QueryWrapper<>();
IPage<SarInterpretationNationalStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
queryWrapper.select("distinct STAND_ID, STAND_NUMBER, STAND_NAME, STAND_TYPE, INTERPRETATION_TIME,risk_degree");
if (eo.getStandName() != null && !eo.getStandName().trim().equals("")) {
queryWrapper.like("STAND_NAME", eo.getStandName().trim());
}
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
IPage<SarInterpretationNationalStandard> page = iSarInterpretationNationalStandardService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
return Result.success(page);
} else {
QueryWrapper<SarInterpretationForeignStandard> queryWrapper = new QueryWrapper<>();
IPage<SarInterpretationForeignStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
queryWrapper.select("distinct STAND_ID, STAND_NUMBER, STAND_NAME, STAND_TYPE, INTERPRETATION_TIME");
if (eo.getStandName() != null && !eo.getStandName().trim().equals("")) {
queryWrapper.like("STAND_NAME", eo.getStandName().trim());
}
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER", eo.getStandNumber().trim());
}
IPage<SarInterpretationForeignStandard> page = iSarInterpretationForeignStandardService.page(iPage, queryWrapper);
while(page.getRecords().remove(null));
return Result.success(page);
}
}
}
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 {
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
if (eo.getType() != null) queryWrapper.eq("type", eo.getType());
if (eo.getProductName() != null) queryWrapper.like("product_name", eo.getProductName());
if (eo.getProductId() != null) queryWrapper.like("product_id", eo.getProductId());
queryWrapper.orderByAsc("product_name");
queryWrapper.orderByAsc("standard_item");
// if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
IPage<SarStandardComplianceProductAssess> page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
return Result.success(page);
}
@ApiOperation(value = "标准涉及项目复合性详情")
@GetMapping("/productNewDetail")
public ResponseMessage<Map<String,IPage<SarStandardComplianceProductAssess>>> selectProductDetail(SarStandardComplianceProductAssessEO eo) throws Exception {
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
Map<String,IPage<SarStandardComplianceProductAssess>> map=new HashMap<>();
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("STAND_ID", eo.getStandId());
queryWrapper.eq("product_id", eo.getProductId());
queryWrapper.and(sarStandardComplianceProductAssessQueryWrapper -> sarStandardComplianceProductAssessQueryWrapper.eq("no_involve","").or().isNull("no_involve"));
queryWrapper.isNotNull("research_completion_time");
queryWrapper.orderByAsc("product_name");
queryWrapper.orderByAsc("standard_item");
Page p1=new Page();
IPage<SarStandardComplianceProductAssess> page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
BeanUtils.copyProperties(page,p1);
p1.setRecords(orderUtils(page.getRecords()));
p1.setTotal(page.getTotal());
map.put("unfit",p1);
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("STAND_ID", eo.getStandId());
queryWrapper1.eq("product_id", eo.getProductId());
queryWrapper1.and(sarStandardComplianceProductAssessQueryWrapper -> sarStandardComplianceProductAssessQueryWrapper.ne("research_compliance","").isNotNull("research_compliance"));
queryWrapper1.orderByAsc("product_name");
queryWrapper1.orderByAsc("standard_item");
IPage<SarStandardComplianceProductAssess> page1 = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper1);
Page p2=new Page();
BeanUtils.copyProperties(page1,p2);
p2.setRecords(orderUtils(page1.getRecords()));
p2.setTotal(page1.getTotal());
map.put("fit",p2);
QueryWrapper<SarStandardComplianceProductAssess> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("STAND_ID", eo.getStandId());
queryWrapper2.eq("product_id", eo.getProductId());
queryWrapper2.and(sarStandardComplianceProductAssessQueryWrapper -> sarStandardComplianceProductAssessQueryWrapper.ne("no_involve","").and(sarStandardComplianceProductAssessQueryWrapper1 -> sarStandardComplianceProductAssessQueryWrapper1.isNotNull("no_involve")));
queryWrapper2.orderByAsc("product_name");
queryWrapper2.orderByAsc("standard_item");
IPage<SarStandardComplianceProductAssess> page2 = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper2);
page2.setRecords(orderUtils(page2.getRecords()));
map.put("noFit",page2);
return Result.success(map);
}
private List<SarStandardComplianceProductAssess> orderUtils(List<SarStandardComplianceProductAssess> sarStandardCompliance){
Map<Integer,List<SarStandardComplianceProductAssess>> stringMap=new HashMap<>();
List<Integer> orderKey=new ArrayList<>();
for (SarStandardComplianceProductAssess s:sarStandardCompliance) {
if (null!=s.getStandardItem()) {
String[] as=(s.getStandardItem()+",").split(",");
if (orderKey.contains(Integer.valueOf(as[0].trim().toString()))) {
stringMap.get(Integer.valueOf(as[0].trim().toString())).add(s);
} else {
orderKey.add(Integer.valueOf(as[0].trim().toString()));
List<SarStandardComplianceProductAssess> assesses2 = new ArrayList<>();
assesses2.add(s);
stringMap.put(Integer.valueOf(as[0].trim().toString()), assesses2);
}
}else {
if (null!=stringMap.get(0)) {
stringMap.get(0).add(s);
}else {
List<SarStandardComplianceProductAssess> assesses = new ArrayList<>();
assesses.add(s);
stringMap.put(0,assesses);
orderKey.add(0);
}
}
}
Collections.sort(orderKey,(o1, o2) -> {
return (o1 -o2);
});
List<SarStandardComplianceProductAssess> res=new ArrayList<>();
orderKey.forEach(integer -> {
res.addAll(stringMap.get(integer));
});
return res;
}
@ApiOperation(value = "标准涉及项目复合性")
@GetMapping("/productNew")
public ResponseMessage<IPage<unCountDTO>> selectProduct(unCountDTO eo) throws Exception {
Page iPage = new Page<>();
iPage.setCurrent(eo.getCurrent());
iPage.setSize(eo.getSize());
IPage<unCountDTO> page = iSarStandardComplianceProductAssessService.selectPages(iPage, eo);
return Result.success(page);
}
@ApiOperation(value = "插入标准涉及项目符合性清单")
@PostMapping("/add")
public ResponseMessage insertProduct(@RequestBody List<SarStandardComplianceProductAssess> eo) throws Exception {
eo.forEach(sarStandardComplianceProductAssess -> {
sarStandardComplianceProductAssess.setId(UUIDUtils.randomUUID(32));
sarStandardComplianceProductAssess.setInterpretationTime(new Date());
});
iSarStandardComplianceProductAssessService.saveBatch(eo);
return Result.success();
}
@ApiOperation(value = "条件查询技术审核符合性清单")
@GetMapping("/interpretation")
public ResponseMessage<Object> selectNationalStandard(InterpretationEO eo) throws Exception {
if (eo.getPosition() == 1) {
IPage<SarInterpretationNationalStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
List<SarInterpretationNationalStandard> standards=iSarInterpretationNationalStandardService.getAllDatas(eo);
Integer datasCount=iSarInterpretationNationalStandardService.getAllDatasCount(eo);
iPage.setTotal(datasCount);
iPage.setRecords(standards);
while (iPage.getRecords().remove(null)) ;
return Result.success(iPage);
} else {
IPage<SarInterpretationForeignStandard> iPage = new Page<>(eo.getCurrent(), eo.getSize());
QueryWrapper<SarInterpretationForeignStandard> queryWrapper = new QueryWrapper<>();
//如果查询条件里标准编号不为空,查询
if (eo.getStandNumber() != null) queryWrapper.like("STAND_NUMBER",eo.getStandNumber());
//如果查询条件里标准名称不为空,查询
if (eo.getStandName() != null) queryWrapper.like("STAND_NAME",eo.getStandName());
//如果查询条件里具体章条不为空,查询
if (eo.getSpecificItem() != null) queryWrapper.like("specific_item",eo.getSpecificItem());
if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
if (eo.getStandId() != null) queryWrapper.eq("STAND_ID", eo.getStandId());
IPage<SarInterpretationForeignStandard> page = iSarInterpretationForeignStandardService.page(iPage, queryWrapper);
while (page.getRecords().remove(null)) ;
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();
}
}