Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
e6dc515248
|
|
@ -6,6 +6,7 @@ import com.securitycontrol.common.core.web.page.TableDataInfo;
|
||||||
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
||||||
import com.securitycontrol.entity.screen.vo.DataAnalysisDetailVo;
|
import com.securitycontrol.entity.screen.vo.DataAnalysisDetailVo;
|
||||||
import com.securitycontrol.entity.screen.vo.ProjectQualityVo;
|
import com.securitycontrol.entity.screen.vo.ProjectQualityVo;
|
||||||
|
import com.securitycontrol.screen.mapper.DataAnalysisMapper;
|
||||||
import com.securitycontrol.screen.service.DataAnalysisService;
|
import com.securitycontrol.screen.service.DataAnalysisService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -18,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -38,6 +40,8 @@ public class DataAnalysisController extends BaseController {
|
||||||
@Resource(name = "DataAnalysisService")
|
@Resource(name = "DataAnalysisService")
|
||||||
private DataAnalysisService service;
|
private DataAnalysisService service;
|
||||||
|
|
||||||
|
@Resource(name = "DataAnalysisMapper")
|
||||||
|
private DataAnalysisMapper mapper;
|
||||||
@ApiOperation("根据类型获取数据分析应用")
|
@ApiOperation("根据类型获取数据分析应用")
|
||||||
@GetMapping("getDataAnalysisByType")
|
@GetMapping("getDataAnalysisByType")
|
||||||
public AjaxResult getDataAnalysisByType(ScreenParamDto dto) {
|
public AjaxResult getDataAnalysisByType(ScreenParamDto dto) {
|
||||||
|
|
@ -131,33 +135,52 @@ public class DataAnalysisController extends BaseController {
|
||||||
|
|
||||||
int allValues = 0;
|
int allValues = 0;
|
||||||
int passValues = 0;
|
int passValues = 0;
|
||||||
|
StringBuilder noPassReason = new StringBuilder();
|
||||||
List<List<String>> table2 = result.get("表格2");
|
List<List<String>> table2 = result.get("表格2");
|
||||||
|
allValues = allValues + table2.size();
|
||||||
for (List<String> row : table2) {
|
for (List<String> row : table2) {
|
||||||
for (String cell : row) {
|
for (String cell : row) {
|
||||||
allValues++;
|
if (cell.equals("合格")) {
|
||||||
if (cell.equals("合格"))
|
|
||||||
passValues++;
|
passValues++;
|
||||||
|
} else if (cell.equals("不合格")) {
|
||||||
|
noPassReason.append(row.get(row.size() - 1));
|
||||||
|
noPassReason.append(",");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<List<String>> table3 = result.get("表格3");
|
List<List<String>> table3 = result.get("表格3");
|
||||||
|
allValues = allValues + table3.size();
|
||||||
for (List<String> row : table3) {
|
for (List<String> row : table3) {
|
||||||
for (String cell : row) {
|
for (String cell : row) {
|
||||||
allValues++;
|
if (cell.equals("合格")) {
|
||||||
if (cell.equals("合格"))
|
|
||||||
passValues++;
|
passValues++;
|
||||||
|
} else if (cell.equals("不合格")) {
|
||||||
|
noPassReason.append(row.get(row.size() - 1));
|
||||||
|
noPassReason.append(",");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
String lastValue = row.get(row.size() - 1);
|
||||||
|
noPassReason.append(lastValue);
|
||||||
|
noPassReason.append(",");
|
||||||
}
|
}
|
||||||
List<List<String>> table4 = result.get("表格4");
|
List<List<String>> table4 = result.get("表格4");
|
||||||
|
allValues = allValues + table4.size();
|
||||||
for (List<String> row : table4) {
|
for (List<String> row : table4) {
|
||||||
for (String cell : row) {
|
for (String cell : row) {
|
||||||
allValues++;
|
if (cell.equals("合格")) {
|
||||||
if (cell.equals("合格"))
|
|
||||||
passValues++;
|
passValues++;
|
||||||
|
} else if (cell.equals("不合格")) {
|
||||||
|
noPassReason.append(row.get(row.size() - 1));
|
||||||
|
noPassReason.append(",");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(allValues + " haha" + passValues);
|
vo.setCheckNum(new BigDecimal(allValues));
|
||||||
|
vo.setPassNum(new BigDecimal(passValues));
|
||||||
|
noPassReason.deleteCharAt(noPassReason.length() - 1);
|
||||||
|
vo.setUnqualifiedItems(noPassReason.toString());
|
||||||
|
mapper.addProjectQuality(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("处理Word文档时出错: " + e.getMessage(), e);
|
throw new RuntimeException("处理Word文档时出错: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,6 @@ public interface DataAnalysisMapper {
|
||||||
List<DataAnalysisDetailVo> getListByType(ScreenParamDto dto);
|
List<DataAnalysisDetailVo> getListByType(ScreenParamDto dto);
|
||||||
|
|
||||||
List<ProjectQualityVo> getEngqualityAnalysis(ScreenParamDto dto);
|
List<ProjectQualityVo> getEngqualityAnalysis(ScreenParamDto dto);
|
||||||
|
|
||||||
|
Integer addProjectQuality(ProjectQualityVo vo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,6 @@ public class DataAnalysisServiceImpl implements DataAnalysisService {
|
||||||
public List<ProjectQualityVo> getEngqualityAnalysis(ScreenParamDto dto) {
|
public List<ProjectQualityVo> getEngqualityAnalysis(ScreenParamDto dto) {
|
||||||
List<ProjectQualityVo> list = null;
|
List<ProjectQualityVo> list = null;
|
||||||
try {
|
try {
|
||||||
if (dto.getTypeCode() == 1) {
|
|
||||||
dto.setProjectName("安徽淮北凌云220kv变电站新建工程");
|
|
||||||
} else if (dto.getTypeCode() == 2) {
|
|
||||||
dto.setProjectName("淮北红枫110kV变电站新建工程");
|
|
||||||
}
|
|
||||||
list = Optional.ofNullable(mapper.getEngqualityAnalysis(dto)).orElseGet(ArrayList::new);
|
list = Optional.ofNullable(mapper.getEngqualityAnalysis(dto)).orElseGet(ArrayList::new);
|
||||||
for (ProjectQualityVo projectQualityVo : list) {
|
for (ProjectQualityVo projectQualityVo : list) {
|
||||||
// 避免除不尽,设置精度为 4 位小数,四舍五入
|
// 避免除不尽,设置精度为 4 位小数,四舍五入
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="com.securitycontrol.screen.mapper.DataAnalysisMapper">
|
<mapper namespace="com.securitycontrol.screen.mapper.DataAnalysisMapper">
|
||||||
|
<insert id="addProjectQuality">
|
||||||
|
INSERT INTO tb_project_quality(project_name, project_manager, team, start_time, check_num, pass_num,unqualified_items)
|
||||||
|
VALUES (#{projectName}, #{projectManager}, #{team}, #{startTime}, #{checkNum}, #{passNum}, #{unqualifiedItems})
|
||||||
|
</insert>
|
||||||
|
|
||||||
<!--根据类型获取数据分析应用-->
|
<!--根据类型获取数据分析应用-->
|
||||||
<select id="getDataAnalysisByType" resultType="com.securitycontrol.entity.screen.vo.DataAnalysisVo">
|
<select id="getDataAnalysisByType" resultType="com.securitycontrol.entity.screen.vo.DataAnalysisVo">
|
||||||
|
|
@ -34,17 +38,15 @@
|
||||||
FROM tb_data_analysis_app WHERE data_type = #{type}
|
FROM tb_data_analysis_app WHERE data_type = #{type}
|
||||||
</select>
|
</select>
|
||||||
<select id="getEngqualityAnalysis" resultType="com.securitycontrol.entity.screen.vo.ProjectQualityVo">
|
<select id="getEngqualityAnalysis" resultType="com.securitycontrol.entity.screen.vo.ProjectQualityVo">
|
||||||
select project_name as projectName,
|
select tpq.project_name as projectName,
|
||||||
project_manager as projectManager,
|
tpq.project_manager as projectManager,
|
||||||
team,
|
tpq.team,
|
||||||
start_time as startTime,
|
tpq.start_time as startTime,
|
||||||
check_num as checkNum,
|
tpq.check_num as checkNum,
|
||||||
pass_num as passNum,
|
tpq.pass_num as passNum,
|
||||||
unqualified_items as unqualifiedItems
|
tpq.unqualified_items as unqualifiedItems
|
||||||
from tb_project_quality
|
from tb_project_quality tpq
|
||||||
where 1 = 1
|
left join tb_project_new tpn on tpq.project_name = tpn.pro_name
|
||||||
<if test="projectName != null and projectName != ''">
|
where tpn.bid_code = #{bidCode}
|
||||||
and projectName = #{projectName}
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue