Browse Source

2024-08-09

功能优化
java8
fengyuan_yang 1 year ago
parent
commit
d9cfda7628
  1. 24
      src/main/java/com/xujie/sys/modules/pms/data/QcReportData.java
  2. 14
      src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java
  3. 71
      src/main/resources/mapper/pms/QcReportMapper.xml

24
src/main/java/com/xujie/sys/modules/pms/data/QcReportData.java

@ -248,4 +248,28 @@ public class QcReportData extends QueryPage {
* 物料类别
*/
private String invdefinetype;
/**
* 协同人员
*/
private String operator;
/**
* 协同人员名称
*/
private String operatorName;
/**
* 责任人
*/
private String responsiblePerson;
/**
* 责任人名称
*/
private String responsiblePersonName;
/**
* 项目检验结论
*/
private String itemResult;
/**
* 项目检验结论
*/
private String itemResultDesc;
}

14
src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java

@ -24,6 +24,7 @@ import com.xujie.sys.modules.sys.entity.SysUserEntity;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
@ -4782,6 +4783,7 @@ public class QcServiceImpl implements QcService {
ArrayList<Integer> errInfo2 = new ArrayList<>();
// 记录不符合上下限的实测值数量
HashMap<String, Integer> countMap = new HashMap<>();
DataFormatter formatter = new DataFormatter();
// 遍历每一行, 从第三行开始
for (int j = 2; j < rows; j++) {
if (sheet.getRow(j) == null || sheet.getRow(j).getCell(0) == null) {
@ -4835,11 +4837,13 @@ public class QcServiceImpl implements QcService {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
stringValue = dateFormat.format(dateValue);
} else {
// 数字格式化
double numericValue = cell.getNumericCellValue();
BigDecimal bigDecimalValue = BigDecimal.valueOf(numericValue);
DecimalFormat decimalFormat = new DecimalFormat("#.####"); // 保留四位小数
stringValue = decimalFormat.format(bigDecimalValue);
// // 数字格式化
// double numericValue = cell.getNumericCellValue();
// BigDecimal bigDecimalValue = BigDecimal.valueOf(numericValue);
// DecimalFormat decimalFormat = new DecimalFormat("#.####"); // 保留四位小数
// stringValue = decimalFormat.format(bigDecimalValue);
// 使用 DataFormatter 获取实际显示值
stringValue = formatter.formatCellValue(cell);
}
break;
case STRING:

71
src/main/resources/mapper/pms/QcReportMapper.xml

@ -39,6 +39,10 @@
a.action_by,
a.submission_remark,
a.submission_type,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
b.item_no,
b.item_desc,
b.default_value,
@ -46,6 +50,10 @@
b.min_value,
b.sampling_qty as itemSamplingQty,
b.unqualified_quantity,
b.item_result,
CASE WHEN b.item_result = 'Y' THEN '合格'
WHEN b.item_result = 'N' THEN '不合格'
END as itemResultDesc,
CASE WHEN b.value_type_db = 'T' THEN b.text_value
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
END as textValue
@ -111,6 +119,18 @@
<if test = "query.submissionType != null and query.submissionType != ''">
AND a.submission_type = #{query.submissionType}
</if>
<if test = "query.submissionType != null and query.submissionType != ''">
AND a.submission_type = #{query.submissionType}
</if>
<if test = "query.operatorName != null and query.operatorName != ''">
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
</if>
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
</if>
<if test = "query.itemResult != null and query.itemResult != ''">
AND b.item_result = #{query.itemResult}
</if>
</where>
ORDER BY
CASE WHEN a.state = '待检验' THEN 1
@ -157,6 +177,10 @@
dbo.qc_get_um_name(a.site, a.um_id) as umName,
a.action_date,
a.action_by,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
b.item_no,
b.item_desc,
b.default_value,
@ -164,6 +188,10 @@
b.min_value,
b.sampling_qty as itemSamplingQty,
b.unqualified_quantity,
b.item_result,
CASE WHEN b.item_result = 'Y' THEN '合格'
WHEN b.item_result = 'N' THEN '不合格'
END as itemResultDesc,
CASE WHEN b.value_type_db = 'T' THEN b.text_value
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
END as textValue
@ -226,6 +254,15 @@
<if test="query.endDate2 != null">
AND #{query.endDate2} >= a.task_date
</if>
<if test = "query.operatorName != null and query.operatorName != ''">
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
</if>
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
</if>
<if test = "query.itemResult != null and query.itemResult != ''">
AND b.item_result = #{query.itemResult}
</if>
</where>
ORDER BY
CASE WHEN a.state = '待检验' THEN 1
@ -273,6 +310,10 @@
dbo.qc_get_um_name(a.site, a.um_id) as umName,
a.action_date,
a.action_by,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
b.item_no,
b.item_desc,
b.default_value,
@ -280,6 +321,10 @@
b.min_value,
b.sampling_qty as itemSamplingQty,
b.unqualified_quantity,
b.item_result,
CASE WHEN b.item_result = 'Y' THEN '合格'
WHEN b.item_result = 'N' THEN '不合格'
END as itemResultDesc,
CASE WHEN b.value_type_db = 'T' THEN b.text_value
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
END as textValue
@ -339,6 +384,15 @@
<if test="query.endDate2 != null">
AND #{query.endDate2} >= a.task_date
</if>
<if test = "query.operatorName != null and query.operatorName != ''">
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
</if>
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
</if>
<if test = "query.itemResult != null and query.itemResult != ''">
AND b.item_result = #{query.itemResult}
</if>
</where>
ORDER BY
CASE WHEN a.state = '待检验' THEN 1
@ -386,6 +440,10 @@
dbo.qc_get_um_name(a.site, a.um_id) as umName,
a.action_date,
a.action_by,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
isnull(dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
b.item_no,
b.item_desc,
b.default_value,
@ -393,6 +451,10 @@
b.min_value,
b.sampling_qty as itemSamplingQty,
b.unqualified_quantity,
b.item_result,
CASE WHEN b.item_result = 'Y' THEN '合格'
WHEN b.item_result = 'N' THEN '不合格'
END as itemResultDesc,
CASE WHEN b.value_type_db = 'T' THEN b.text_value
WHEN b.value_type_db = 'N' THEN CONVERT(varchar, b.number_value, 126)
END as textValue
@ -452,6 +514,15 @@
<if test="query.endDate2 != null">
AND #{query.endDate2} >= a.task_date
</if>
<if test = "query.operatorName != null and query.operatorName != ''">
AND dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination') like '%' + #{query.operatorName} + '%'
</if>
<if test = "query.responsiblePersonName != null and query.responsiblePersonName != ''">
AND dbo.joint_name2(a.site, a.bu_no, a.inspection_no, 'responsible') like '%' + #{query.responsiblePersonName} + '%'
</if>
<if test = "query.itemResult != null and query.itemResult != ''">
AND b.item_result = #{query.itemResult}
</if>
</where>
ORDER BY
CASE WHEN a.state = '待检验' THEN 1

Loading…
Cancel
Save