Commit 1fdc9dfd authored by limei's avatar limei

Merge branch 'develop_dl_plan6' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6

parents a869d0ea ee1f5e2d
package com.yeejoin.amos.boot.module.tdc.api.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value="CheckResultDto", description="维表")
public class DimensionTableDto {
private String key;
private String title;
private List<DimensionTableDto> children;
}
...@@ -36,5 +36,7 @@ public interface IdxFeignService { ...@@ -36,5 +36,7 @@ public interface IdxFeignService {
@RequestMapping(value = "/report/getTasks/v1", method = RequestMethod.GET) @RequestMapping(value = "/report/getTasks/v1", method = RequestMethod.GET)
ResponseModel<JSONObject> getInfo(@RequestParam("pageNumber") int pageNumber,@RequestParam("pageSize") int pageSize); ResponseModel<JSONObject> getInfo(@RequestParam("pageNumber") int pageNumber,@RequestParam("pageSize") int pageSize);
@RequestMapping(value = "/dimensionTable/treeView", method = RequestMethod.GET)
ResponseModel<JSONObject> getDimensionTable(@RequestParam("id") String id);
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.DimensionTableDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto; import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -25,7 +26,7 @@ public interface CheckResultService extends IService<CheckResult> { ...@@ -25,7 +26,7 @@ public interface CheckResultService extends IService<CheckResult> {
List<CheckResultDto> selectDetails(String batchNo,Integer modelId); List<CheckResultDto> selectDetails(String batchNo,Integer modelId);
String saveSql(String amosOrgCode,String userName); String saveSql(String amosOrgCode,String userName, String batchNo);
/** /**
* 根据机构code获取模型数据树 * 根据机构code获取模型数据树
...@@ -55,4 +56,5 @@ public interface CheckResultService extends IService<CheckResult> { ...@@ -55,4 +56,5 @@ public interface CheckResultService extends IService<CheckResult> {
*/ */
Integer selectItemNo(String batchNo,Long modelId); Integer selectItemNo(String batchNo,Long modelId);
List<DimensionTableDto> getDimensionTable(String id);
} }
...@@ -63,7 +63,6 @@ public class CheckModelAction { ...@@ -63,7 +63,6 @@ public class CheckModelAction {
@MethodParam(paramLabel = "规范标签内容") String checkExplain, @MethodParam(paramLabel = "规范标签内容") String checkExplain,
@MethodParam(paramLabel = "校验项") String checkItem, @MethodParam(paramLabel = "校验项") String checkItem,
@MethodParam(paramLabel = "校验项值") String checkItemValue, @MethodParam(paramLabel = "校验项值") String checkItemValue,
@MethodParam(paramLabel = "校验项标准值") String checkItemRealValue,
@MethodParam(paramLabel = "对象") IdxProjectModel idxProjectModel) { @MethodParam(paramLabel = "对象") IdxProjectModel idxProjectModel) {
// 1. 检验结果入库 // 1. 检验结果入库
...@@ -142,7 +141,7 @@ public class CheckModelAction { ...@@ -142,7 +141,7 @@ public class CheckModelAction {
if (checkType == 0) { if (checkType == 0) {
// 全站校验生成报告 // 全站校验生成报告
checkResultService.saveSql(orgCode, checkPeopleName); checkResultService.saveSql(orgCode, checkPeopleName, batchNo);
List<CheckModel> checkModels = checkModelService.selectByOrgCode(orgCode); List<CheckModel> checkModels = checkModelService.selectByOrgCode(orgCode);
checkModels.forEach(checkModel -> { checkModels.forEach(checkModel -> {
saveCheckModel(checkModel, batchNo); saveCheckModel(checkModel, batchNo);
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tdc.biz.controller; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.DimensionTableDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto; import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
...@@ -93,12 +94,22 @@ public class CheckResultController extends BaseController { ...@@ -93,12 +94,22 @@ public class CheckResultController extends BaseController {
/** /**
* cs * cs
*/ */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @GetMapping(value = "/saveSql")
// @ApiOperation(httpMethod = "GET", value = "result", notes = "result")
// public ResponseModel<String> saveSql(String amosOrgCode) {
// AgencyUserModel user = getUserInfo();
// return ResponseHelper.buildResponse(checkResultService.saveSql(amosOrgCode,user.getUserName()));
// }
/**
* cs
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/saveSql") @GetMapping(value = "/getDimensionTable")
@ApiOperation(httpMethod = "GET", value = "result", notes = "result") @ApiOperation(httpMethod = "GET", value = "result", notes = "result")
public ResponseModel<String> saveSql(String amosOrgCode) { public ResponseModel<List<DimensionTableDto>> getDimensionTable(String id) {
AgencyUserModel user = getUserInfo(); return ResponseHelper.buildResponse(checkResultService.getDimensionTable(id));
return ResponseHelper.buildResponse(checkResultService.saveSql(amosOrgCode,user.getUserName()));
} }
......
...@@ -13,6 +13,7 @@ import com.mysql.cj.xdevapi.JsonArray; ...@@ -13,6 +13,7 @@ import com.mysql.cj.xdevapi.JsonArray;
import com.mysql.cj.xdevapi.Result; import com.mysql.cj.xdevapi.Result;
import com.stoyanr.evictor.queue.NavigableMapEvictionQueue; import com.stoyanr.evictor.queue.NavigableMapEvictionQueue;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.DimensionTableDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto; import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
...@@ -31,6 +32,7 @@ import com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo; ...@@ -31,6 +32,7 @@ import com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import liquibase.pro.packaged.M;
import org.codehaus.jettison.json.JSONString; import org.codehaus.jettison.json.JSONString;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -43,6 +45,7 @@ import java.io.FileInputStream; ...@@ -43,6 +45,7 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> implements CheckResultService { public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> implements CheckResultService {
...@@ -139,12 +142,18 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -139,12 +142,18 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
List<TableColumnsVo> columns = subjectTreeVo.getTableCols(); List<TableColumnsVo> columns = subjectTreeVo.getTableCols();
Map tableMap = checkResultMapper.getTables(subjectTreeVo.getTableName(), checkModel.getAmosOrgCode()); Map tableMap = checkResultMapper.getTables(subjectTreeVo.getTableName(), checkModel.getAmosOrgCode());
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
//TODO 不校验项 后期提出去,或数据库增加配置
String noItem = "org_code,biz_org_code,biz_org_name,station_name,station_code,inspector,check_item_value,factory_classify,fire_spacing_class,auditClas,distanceType,firewallClass";
String[] split = noItem.split(",");
columns.forEach(tableColumnsVo -> { columns.forEach(tableColumnsVo -> {
Map<String, Object> map = new HashMap<>(3); List<String> collect = Arrays.stream(split).filter(item -> item.equals(tableColumnsVo.getColumnName())).collect(Collectors.toList());
map.put("name", tableColumnsVo.getName()); if (collect.size() == 0) {
map.put("id", tableColumnsVo.getId()); Map<String, Object> map = new HashMap<>(3);
map.put("data", tableMap.get(tableColumnsVo.getColumnName())); map.put("name", tableColumnsVo.getName());
list.add(map); map.put("id", tableColumnsVo.getId());
map.put("data", tableMap.get(tableColumnsVo.getColumnName()));
list.add(map);
}
}); });
modelTreeDto.setChildren(list); modelTreeDto.setChildren(list);
return modelTreeDto; return modelTreeDto;
...@@ -174,20 +183,28 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -174,20 +183,28 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
return this.baseMapper.selectCount(wrapper); return this.baseMapper.selectCount(wrapper);
} }
@Override
public List<DimensionTableDto> getDimensionTable(String id) {
ResponseModel<JSONObject> dimensionTable = idxFeignService.getDimensionTable(id);
JSONObject result = dimensionTable.getResult();
DimensionTableDto subjectTreeVo = JSON.parseObject(JSON.toJSONString(result), DimensionTableDto.class);
return subjectTreeVo.getChildren();
}
/** /**
* 获取报告数据 * 获取报告数据
* @param amosOrgCode * @param amosOrgCode
* @return * @return
*/ */
private Map<String,Object> getData(String amosOrgCode) { private Map<String,Object> getData(String amosOrgCode, String batchNo) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
//获取统计表信息 //获取统计表信息
ArrayList<Map<String, Object>> list = new ArrayList<>(); ArrayList<Map<String, Object>> list = new ArrayList<>();
List<CheckResultDto> selectBatch = checkResultMapper.getOne(amosOrgCode); List<CheckResultDto> selectBatch = checkResultMapper.getOne(amosOrgCode);
for(CheckResultDto checkResultDto1 : selectBatch){ // for(CheckResultDto checkResultDto1 : selectBatch){
List<CheckResultDto> systemList = selectStatistion( checkResultDto1.getBatchNo(), amosOrgCode); List<CheckResultDto> systemList = selectStatistion(batchNo, amosOrgCode);
for (CheckResultDto system : systemList) { for (CheckResultDto system : systemList) {
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
...@@ -232,7 +249,7 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -232,7 +249,7 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
map.put("list2",list2); map.put("list2",list2);
}); });
} // }
return map; return map;
} }
...@@ -241,8 +258,8 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -241,8 +258,8 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
* @param amosOrgCode * @param amosOrgCode
* @return * @return
*/ */
public String getUrl(String amosOrgCode) { public String getUrl(String amosOrgCode, String batchNo) {
Map<String, Object> dataMap = getData(amosOrgCode); Map<String, Object> dataMap = getData(amosOrgCode, batchNo);
WordPowerUtils instance = WordPowerUtils.getInstance(); WordPowerUtils instance = WordPowerUtils.getInstance();
String pdfUrlString = ""; String pdfUrlString = "";
File filepdf = null; File filepdf = null;
...@@ -289,8 +306,8 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -289,8 +306,8 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
* @return * @return
*/ */
@Override @Override
public String saveSql(String amosOrgCode,String userName){ public String saveSql(String amosOrgCode,String userName, String batchNo){
String url = getUrl(amosOrgCode); String url = getUrl(amosOrgCode, batchNo);
CheckReport checkReport = new CheckReport(); CheckReport checkReport = new CheckReport();
checkReport.setReportUrl(url); checkReport.setReportUrl(url);
checkReport.setCreateDate(new Date()); checkReport.setCreateDate(new Date());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment