Commit eddc4c47 by lijingjing

大屏接口添加;

parent 81133afa
......@@ -40,10 +40,7 @@ public class DateKit {
}
public static Integer daysBetweenTwoDates(Date start, Date end) {
if (null == start || null == end) {
return null;
}
return daysBetweenTwoDates(start, end);
return daysBetweenTwoDates(date2Local(start), date2Local(end));
}
public static Integer daysBetweenTwoDates(LocalDate start, LocalDate end) {
......@@ -93,6 +90,7 @@ public class DateKit {
/**
* 根据当前系统时间获取班次
*
* @return
*/
public static String getShiftByNow() {
......
package com.patzn.cloud.service.lims.hmhj.controller;
import com.baomidou.kisso.annotation.Action;
import com.baomidou.kisso.annotation.Login;
import com.baomidou.mybatisplus.plugins.Page;
import com.patzn.cloud.commons.api.RestConstants;
import com.patzn.cloud.commons.api.RestResult;
......@@ -82,12 +84,14 @@ public class NoticeAnnouncementController extends ServiceController {
@PostMapping("/recent/")
public RestResult<List<NoticeAnnouncement>> recent(
@RequestParam(value = "count", required = false) Integer count) {
if (count == null)
if (count == null) {
count = 3;
}
return success(noticeAnnouncementService.recent(count));
}
@ApiOperation("显示最新 N 条通知公告")
@Login(action = Action.Skip)
@PostMapping("/latest")
public RestResult<List<NoticeAnnouncement>> latestNotices(Integer limit) {
return success(noticeAnnouncementService.latestNotices(limit));
......
......@@ -72,6 +72,7 @@ public class StatisticsController extends ServiceController {
@ApiOperation("检测项目数量统计")
@Login(action = Action.Skip)
@PostMapping("/item_quantity")
public RestResult<List<Statistics>> getItemQuantity(QueryDTO queryDTO) {
return success(statsService.getItemQuantity(queryDTO));
......@@ -120,24 +121,28 @@ public class StatisticsController extends ServiceController {
}
@ApiOperation("获取外检完成量数据")
@Login(action = Action.Skip)
@PostMapping("/out_test_finish_quantity")
public RestResult<Statistics> getOutTestFinishQuantity(QueryDTO queryDTO) {
return success(statsService.getOutTestFinishQuantity(queryDTO));
}
@ApiOperation("外检项目数量统计")
@Login(action = Action.Skip)
@PostMapping("/out_test_item_quantity")
public RestResult<List<Statistics>> getOutTestItemQuantity(QueryDTO queryDTO) {
return success(statsService.getOutTestItemQuantity(queryDTO));
}
@ApiOperation("工作量统计")
@Login(action = Action.Skip)
@PostMapping("/workload_quantity")
public RestResult<Statistics> getWorkloadQuantity(RangeStatsQueryDTO queryDTO) {
return success(statsService.getWorkloadQuantity(queryDTO));
}
@ApiOperation("本周验收合格情况")
@Login(action = Action.Skip)
@PostMapping("/cur_week_acceptance_qualified")
public RestResult<List<Statistics>> getCurWeekAcceptanceQualified(QueryDTO queryDTO) {
return success(statsService.getCurWeekAcceptanceQualified(queryDTO));
......@@ -158,12 +163,14 @@ public class StatisticsController extends ServiceController {
}
@ApiOperation("本周自产炭块质量统计")
@Login(action = Action.Skip)
@PostMapping("/cur_week_carbon_blocks")
public RestResult<List<Statistics>> getCurWeekCarbonBlocks(QueryDTO queryDTO) {
return success(statsService.getCurWeekCarbonBlocks(queryDTO));
}
@ApiOperation("当日原铝质量统计")
@Login(action = Action.Skip)
@PostMapping("/al_brands_rate")
public RestResult<List<Statistics>> getAlBrandsRate(QueryDTO queryDTO) {
return success(statsService.getAlBrandsRate(queryDTO));
......@@ -220,4 +227,40 @@ public class StatisticsController extends ServiceController {
public RestResult<Statistics> getTestItemQuantityStats(QueryDTO queryDTO) {
return success(statsService.getTestItemQuantityStats(queryDTO));
}
@ApiOperation("获取化验委托数量统计数据")
@Login(action = Action.Skip)
@PostMapping("/assay_material_quantity")
public RestResult<List<Map<String, Object>>> getAssayMaterialQuantity(QueryDTO queryDTO) {
return success(statsService.getAssayMaterialQuantity(queryDTO));
}
@ApiOperation("获取可检测项目统计数据")
@Login(action = Action.Skip)
@PostMapping("/detectable_item_quantity")
public RestResult<List<Map<String, Object>>> getDetectableItemQuantity(QueryDTO queryDTO) {
return success(statsService.getDetectableItemQuantity(queryDTO));
}
@ApiOperation("获取化验检测完毕任务数量统计数据")
@Login(action = Action.Skip)
@PostMapping("/detected_tasks_quantity")
public RestResult<List<Map<String, Object>>> getDetectedTasksQuantity(QueryDTO queryDTO) {
return success(statsService.getDetectedTasksQuantity(queryDTO));
}
@ApiOperation("获取日原辅料检测当前实时数据情况")
@Login(action = Action.Skip)
@PostMapping("/cur_raw_material_quantity")
public RestResult<Map<String, Object>> getRawMaterialStageQuantity(QueryDTO queryDTO) {
return success(statsService.getRawMaterialStageQuantity(queryDTO));
}
@ApiOperation("获取日过程样检测当前实时数据情况")
@Login(action = Action.Skip)
@PostMapping("/cur_process_sample_quantity")
public RestResult<Map<String, Object>> getProcessSampleStageQuantity(QueryDTO queryDTO) {
return success(statsService.getProcessSampleStageQuantity(queryDTO));
}
}
package com.patzn.cloud.service.lims.hmhj.mapper;
import com.baomidou.mybatisplus.annotations.SqlParser;
import com.patzn.cloud.commons.mapper.BatchMapper;
import com.patzn.cloud.service.hmhj.entity.NoticeAnnouncement;
import org.apache.ibatis.annotations.Param;
......@@ -30,5 +31,6 @@ public interface NoticeAnnouncementMapper extends BatchMapper<NoticeAnnouncement
* @param limit the limit
* @return the list
*/
@SqlParser(filter = true)
List<NoticeAnnouncement> selectLatestNotices(@Param("limit") Integer limit);
}
......@@ -10,6 +10,7 @@ import com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface StatisticsMapper extends BatchMapper<Statistics> {
......@@ -93,4 +94,19 @@ public interface StatisticsMapper extends BatchMapper<Statistics> {
@SqlParser(filter = true)
Statistics selectAlProductInspectionQuantityRate(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true)
List<Map<String, Object>> selectAssayMaterialQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true)
List<Map<String, Object>> selectDetectableItemQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true)
List<Map<String, Object>> selectDetectedTasksQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true)
Map<String,Object> selectRawMaterialStageQuantity(@Param("vo") QueryDTO queryDTO);
@SqlParser(filter = true)
Map<String, Object> selectProcessSampleStageQuantity(@Param("vo") QueryDTO queryDTO);
}
......@@ -33,6 +33,12 @@ public interface IStatisticsService extends IBaseService<Statistics> {
List<Statistics> getSamplingQuantity(RangeStatsQueryDTO queryDTO);
List<Map<String, Object>> getDetectableItemQuantity(QueryDTO queryDTO);
List<Map<String, Object>> getDetectedTasksQuantity(QueryDTO queryDTO);
Map<String, Object> getRawMaterialStageQuantity(QueryDTO queryDTO);
Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO);
Statistics getOutTestFinishQuantity(QueryDTO queryDTO);
......@@ -70,4 +76,8 @@ public interface IStatisticsService extends IBaseService<Statistics> {
Integer getAlProductInspectionQuantity(QueryDTO queryDTO);
Statistics getAlProductInspectionQuantityRate(QueryDTO queryDTO);
List<Map<String, Object>> getAssayMaterialQuantity(QueryDTO queryDTO);
Map<String, Object> getProcessSampleStageQuantity(QueryDTO queryDTO);
}
......@@ -3,7 +3,6 @@ package com.patzn.cloud.service.lims.hmhj.service.impl;
import com.baomidou.mybatisplus.toolkit.CollectionUtils;
import com.patzn.cloud.commons.api.RestAssert;
import com.patzn.cloud.commons.service.impl.BaseServiceImpl;
import com.patzn.cloud.commons.toolkit.BigDecimalUtils;
import com.patzn.cloud.service.hmhj.dto.LedgerQueryDTO;
import com.patzn.cloud.service.hmhj.dto.QueryDTO;
import com.patzn.cloud.service.hmhj.dto.RangeStatsQueryDTO;
......@@ -16,7 +15,6 @@ import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
......@@ -89,24 +87,24 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
@Override
public List<Statistics> getPrevAlBrandsRate(QueryDTO queryDTO) {
List<Statistics> statistics = getAlBrandsRate(queryDTO);
if (CollectionUtils.isEmpty(statistics)) {
return statistics;
}
queryDTO.setType("Al99.70");
Integer total = statistics.get(0).getTotal();
Integer num = baseMapper.selectAlBrandLowFeStats(queryDTO);
num = null == num ? 0 : num;
Statistics lowFe = new Statistics();
lowFe.setBrand(queryDTO.getType() + "低铁");
lowFe.setTotal(total);
lowFe.setBrandNum(num);
if (null == total || 0 == total) {
lowFe.setRatio(0.0000);
} else {
double def = 1.0000;
lowFe.setRatio(BigDecimalUtils.div(new BigDecimal(def * num), new BigDecimal(def * total), 4).doubleValue());
}
statistics.add(lowFe);
// if (CollectionUtils.isEmpty(statistics)) {
// return statistics;
// }
// queryDTO.setType("Al99.70");
// Integer total = statistics.get(0).getTotal();
// Integer num = baseMapper.selectAlBrandLowFeStats(queryDTO);
// num = null == num ? 0 : num;
// Statistics lowFe = new Statistics();
// lowFe.setBrand(queryDTO.getType() + "低铁");
// lowFe.setTotal(total);
// lowFe.setBrandNum(num);
// if (null == total || 0 == total) {
// lowFe.setRatio(0.0000);
// } else {
// double def = 1.0000;
// lowFe.setRatio(BigDecimalUtils.div(new BigDecimal(def * num), new BigDecimal(def * total), 4).doubleValue());
// }
// statistics.add(lowFe);
return statistics;
}
......@@ -143,7 +141,7 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
}
@Override
public Statistics getAnodeInspectionDoneQuantity(QueryDTO queryDTO){
public Statistics getAnodeInspectionDoneQuantity(QueryDTO queryDTO) {
return baseMapper.selectAnodeInspectionDoneQuantity(queryDTO);
}
......@@ -210,6 +208,37 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
}
@Override
public List<Map<String, Object>> getAssayMaterialQuantity(QueryDTO queryDTO) {
return baseMapper.selectAssayMaterialQuantity(queryDTO);
}
@Override
public List<Map<String, Object>> getDetectableItemQuantity(QueryDTO queryDTO) {
return baseMapper.selectDetectableItemQuantity(queryDTO);
}
@Override
public List<Map<String, Object>> getDetectedTasksQuantity(QueryDTO queryDTO) {
return baseMapper.selectDetectedTasksQuantity(queryDTO);
}
@Override
public Map<String, Object> getRawMaterialStageQuantity(QueryDTO queryDTO) {
if (null == queryDTO.getQueryDate()) {
queryDTO.setQueryDate(new Date());
}
return baseMapper.selectRawMaterialStageQuantity(queryDTO);
}
@Override
public Map<String, Object> getProcessSampleStageQuantity(QueryDTO queryDTO) {
if (null == queryDTO.getQueryDate()) {
queryDTO.setQueryDate(new Date());
}
return baseMapper.selectProcessSampleStageQuantity(queryDTO);
}
@Override
public Statistics getItemSamesChainQuantity(RangeStatsQueryDTO queryDTO) {
handleSamesChainTimeRange(queryDTO);
return baseMapper.selectItemSamesChainQuantity(queryDTO);
......@@ -231,7 +260,7 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
private void handleTimeRange(RangeStatsQueryDTO queryDTO) {
queryDTO.setLastYearTimeS(DateUtils.addYears(queryDTO.getTimeS(), -1));
queryDTO.setLastYearTimeE(DateUtils.addYears(queryDTO.getTimeE(), -1));
Integer days = DateKit.monthsBetweenTwoDates(queryDTO.getTimeS(), queryDTO.getTimeE());
Integer days = DateKit.daysBetweenTwoDates(queryDTO.getTimeS(), queryDTO.getTimeE()) + 2;
queryDTO.setPrevTimeS(DateUtils.addDays(queryDTO.getTimeS(), -days));
queryDTO.setPrevTimeE(queryDTO.getTimeS());
}
......
......@@ -4,28 +4,27 @@
<!--当日原铝质量统计-->
<select id="selectAlBrandsRateStats" resultType="com.patzn.cloud.service.hmhj.entity.Statistics">
with total as (
SELECT
COUNT(1) "total"
FROM
entrust_sample s
SELECT COUNT(1) "total"
FROM entrust_sample s
JOIN entrust e ON s.entrust_id = e.ID AND e.deleted = 0
WHERE
s.deleted = 0
WHERE s.deleted = 0
AND s.TYPE = 0
AND s.NAME = '原铝'
AND s.sample_grading IS NOT NULL
AND to_char(s.judge_time, 'yyyy-MM-dd') = to_char(#{vo.queryDate}::TIMESTAMP, 'yyyy-MM-dd')
)
SELECT
s.sample_grading "brand",
SELECT s.sample_grading "brand",
total,
count(1) "brand_num",
round(count(1)::numeric / total, 4) "ratio"
FROM
entrust_sample s,total, entrust e
WHERE
s.entrust_id = e.id and s.deleted = 0 and e.deleted = 0
AND s.TYPE = 0 and s.name = '原铝'
FROM entrust_sample s,
total,
entrust e
WHERE s.entrust_id = e.id
and s.deleted = 0
and e.deleted = 0
AND s.TYPE = 0
and s.name = '原铝'
AND s.sample_grading IS NOT NULL
AND to_char(s.judge_time, 'yyyy-MM-dd') = to_char(#{vo.queryDate}::TIMESTAMP, 'yyyy-MM-dd')
GROUP BY s.sample_grading, total
......@@ -34,15 +33,16 @@
<!--查询原铝某一牌号低铁-->
<select id="selectAlBrandLowFeStats" resultType="java.lang.Integer">
SELECT
count(distinct(case when to_number(ii.test_value, '99.9999') &lt;= 0.1 then s.id else null end)) "num"
FROM
entrust_sample s
SELECT count(distinct (case when to_number(ii.test_value, '99.9999') &lt;= 0.1 then s.id else null end)) "num"
FROM entrust_sample s
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
JOIN entrust_sample_item i on i.entrust_sample_id = s.id and i.deleted = 0
JOIN entrust_sample_item_index ii on ii.entrust_sample_item_id = i.id and ii.deleted = 0
WHERE
s.deleted = 0 and s.name = '原铝' and s.type = 0 and s.sample_grading = #{vo.type} and ii.NAME = '原铝Fe'
WHERE s.deleted = 0
and s.name = '原铝'
and s.type = 0
and s.sample_grading = #{vo.type}
and ii.NAME = '原铝Fe'
AND to_char(s.judge_time, 'yyyy-MM-dd') = to_char(#{vo.queryDate}, 'yyyy-MM-dd')
</select>
......@@ -88,7 +88,7 @@
FROM entrust_sample s
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0
AND s.type = 0
AND s.type = 0 and s.name = '自产阳极炭块'
AND s.sample_grading IS NOT NULL
AND s.status = 70
AND s.judge_status = 2
......@@ -192,9 +192,9 @@
<select id="selectWorkloadQuantity" resultType="com.patzn.cloud.service.hmhj.entity.Statistics">
SELECT a.*,
round((case when 0 = b.total then 0 else a.total - b.total end)::numeric /
(case when 0 = b.total then 1 else b.total end), 2) "chain_ratio",
(case when 0 = b.total then 1 else b.total end), 2) "sames_ratio",
round((case when 0 = c.total then 0 else a.total - c.total end)::numeric /
(case when 0 = c.total then 1 else c.total end), 2) "sames_ratio"
(case when 0 = c.total then 1 else c.total end), 2) "chain_ratio"
from (SELECT count(r.id) "total",
sum(case when s.ok_judge = '合格' then 1 else 0 end) "done_num",
count(1) - sum(case when s.ok_judge = '合格' then 1 else 0 end) "fail_num",
......@@ -260,25 +260,28 @@
b.total "sames_num",
c.total "chain_num",
round((case when 0 = b.total then 0 else a.total - b.total end)::numeric /
(case when 0 = b.total then 1 else b.total end), 2) "chain_ratio",
(case when 0 = b.total then 1 else b.total end), 2) "sames_ratio",
round((case when 0 = c.total then 0 else a.total - c.total end)::numeric /
(case when 0 = c.total then 1 else c.total end), 2) "sames_ratio"
(case when 0 = c.total then 1 else c.total end), 2) "chain_ratio"
from (SELECT count(s.id) "total"
FROM entrust_sample s
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 AND s.type = 0
WHERE s.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.timeS} and #{vo.timeE}
) a,
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 AND s.type = 0
WHERE s.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE}
) b,
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 AND s.type = 0
WHERE s.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.prevTimeS} and #{vo.prevTimeE}
) c
</select>
......@@ -319,9 +322,9 @@
b.total "sames_num",
c.total "chain_num",
round((case when 0 = b.total then 0 else a.total - b.total end)::numeric /
(case when 0 = b.total then 1 else b.total end), 2) "chain_ratio",
(case when 0 = b.total then 1 else b.total end), 2) "sames_ratio",
round((case when 0 = c.total then 0 else a.total - c.total end)::numeric /
(case when 0 = c.total then 1 else c.total end), 2) "sames_ratio"
(case when 0 = c.total then 1 else c.total end), 2) "chain_ratio"
from (SELECT count(s.id) "total"
FROM entrust_sample s
JOIN entrust e on e.id = s.entrust_id and e.deleted = 0
......@@ -331,13 +334,15 @@
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 AND s.type = 0
WHERE s.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE}
) b,
(SELECT count(s.id) "total"
FROM entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
WHERE s.deleted = 0 AND s.type = 0
WHERE s.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.prevTimeS} and #{vo.prevTimeE}
) c
</select>
......@@ -348,28 +353,31 @@
b.total "sames_num",
c.total "chain_num",
round((case when 0 = b.total then 0 else a.total - b.total end)::numeric /
(case when 0 = b.total then 1 else b.total end), 2) "chain_ratio",
(case when 0 = b.total then 1 else b.total end), 2) "sames_ratio",
round((case when 0 = c.total then 0 else a.total - c.total end)::numeric /
(case when 0 = c.total then 1 else c.total end), 2) "sames_ratio"
(case when 0 = c.total then 1 else c.total end), 2) "chain_ratio"
from (SELECT count(i.id) "total"
FROM entrust_sample_item i
JOIN entrust_sample s on s.id = i.entrust_sample_id and s.deleted = 0
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0 AND s.type = 0
WHERE i.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.timeS} and #{vo.timeE}
) a,
(SELECT count(i.id) "total"
FROM entrust_sample_item i
JOIN entrust_sample s on s.id = i.entrust_sample_id and s.deleted = 0
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0 AND s.type = 0
WHERE i.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.lastYearTimeS} and #{vo.lastYearTimeE}
) b,
(SELECT count(i.id) "total"
FROM entrust_sample_item i
JOIN entrust_sample s on s.id = i.entrust_sample_id and s.deleted = 0
JOIN entrust e on e.id = i.entrust_id and e.deleted = 0
WHERE i.deleted = 0 AND s.type = 0
WHERE i.deleted = 0
AND s.type = 0
AND e.entrust_time between #{vo.prevTimeS} and #{vo.prevTimeE}
) c
</select>
......@@ -421,9 +429,9 @@
b.total "sames_num",
c.total "chain_num",
round((case when 0 = b.total then 0 else a.total - b.total end)::numeric /
(case when 0 = b.total then 1 else b.total end), 2) "chain_ratio",
(case when 0 = b.total then 1 else b.total end), 2) "sames_ratio",
round((case when 0 = c.total then 0 else a.total - c.total end)::numeric /
(case when 0 = c.total then 1 else c.total end), 2) "sames_ratio"
(case when 0 = c.total then 1 else c.total end), 2) "chain_ratio"
from (SELECT count(r.id) "total"
FROM entrust e
join entrust_report r on r.entrust_id = e.id and r.deleted = 0
......@@ -472,19 +480,15 @@
</select>
<sql id="query_date">
SELECT
to_char( tt.DAY, 'yyyy-mm-dd' ) AS DAY
FROM
(
SELECT
generate_series (
CAST ('${vo.yearMonth}-01' AS DATE ),
CAST ( CAST ('${vo.yearMonth}-01' AS TIMESTAMP ) + '1 MONTH' + '-1 d' AS DATE ),
SELECT to_char(tt.DAY, 'yyyy-mm-dd') AS DAY
FROM (
SELECT generate_series(
CAST('${vo.yearMonth}-01' AS DATE),
CAST(CAST('${vo.yearMonth}-01' AS TIMESTAMP) + '1 MONTH' + '-1 d' AS DATE),
'1 d'
) AS DAY
) AS tt
ORDER BY
DAY
ORDER BY DAY
</sql>
<sql id="ledger_where">
......@@ -607,7 +611,8 @@
<select id="selectAlFeLedgerStats" resultType="com.patzn.cloud.service.hmhj.vo.DailyStatsLedgerVO">
SELECT
"unnest" ( Array[0,1,2,3,4,5,6] ) "sn",
"unnest" ( string_to_array( 'Fe≤0.100台次,Fe≤0.095台次,Fe≤0.090台次,Fe≤0.080台次,99.70以上槽台数,低铁铝台次,低镍铝台次', ',' ) ) "label",
"unnest" ( string_to_array( 'Fe≤0.100台次,Fe≤0.095台次,Fe≤0.090台次,Fe≤0.080台次,99.70以上槽台数,低铁铝台次,低镍铝台次', ',' ) )
"label",
T.test_time "day",
"unnest" (Array[t.fe_01,t.fe_0095,t.fe_0090,t.fe_0080,t.over_70,t.low_fe,t.low_ni]) "value"
FROM
......@@ -618,9 +623,12 @@
SUM ( i.fe_0095 ) "fe_0095",
SUM ( i.fe_0090 ) "fe_0090",
SUM ( i.fe_0080 ) "fe_0080",
SUM ( CASE WHEN s.sample_grading IN ( 'Al99.85', 'Al99.70DT', 'Al99.80', 'Al99.70' ) THEN 1 ELSE 0 END ) "over_70",
SUM ( CASE WHEN s.sample_grading IN ( 'Al99.85', 'Al99.70DT', 'Al99.80', 'Al99.70' ) AND i.fe_01 > 0 THEN 1 ELSE 0 END ) "low_fe",
SUM ( CASE WHEN s.sample_grading IN ( 'Al99.85', 'Al99.70DT', 'Al99.80', 'Al99.70' ) AND i.fe_01 > 0 AND i.ni_00042 > 0 THEN 1 ELSE 0 END ) "low_ni"
SUM ( CASE WHEN s.sample_grading IN ( 'Al99.85', 'Al99.70DT', 'Al99.80', 'Al99.70' ) THEN 1 ELSE 0 END )
"over_70",
SUM ( CASE WHEN s.sample_grading IN ( 'Al99.85', 'Al99.70DT', 'Al99.80', 'Al99.70' ) AND i.fe_01 > 0 THEN 1 ELSE
0 END ) "low_fe",
SUM ( CASE WHEN s.sample_grading IN ( 'Al99.85', 'Al99.70DT', 'Al99.80', 'Al99.70' ) AND i.fe_01 > 0 AND
i.ni_00042 > 0 THEN 1 ELSE 0 END ) "low_ni"
FROM
entrust_sample s
JOIN electrolyzer e ON e.ID = s.electrolyzer_id AND e.deleted = 0
......@@ -629,10 +637,14 @@
i.entrust_sample_id,
to_char( MAX ( i.test_time ), 'yyyy-mm-dd' ) "test_time",
SUM ( CASE WHEN ii.NAME = '原铝Fe' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.1 THEN 1 ELSE 0 END ) "fe_01",
SUM ( CASE WHEN ii.NAME = '原铝Fe' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.095 THEN 1 ELSE 0 END ) "fe_0095",
SUM ( CASE WHEN ii.NAME = '原铝Fe' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.090 THEN 1 ELSE 0 END ) "fe_0090",
SUM ( CASE WHEN ii.NAME = '原铝Fe' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.080 THEN 1 ELSE 0 END ) "fe_0080",
SUM ( CASE WHEN ii.NAME = '原铝Ni' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.0042 THEN 1 ELSE 0 END) "ni_00042"
SUM ( CASE WHEN ii.NAME = '原铝Fe' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.095 THEN 1 ELSE 0 END )
"fe_0095",
SUM ( CASE WHEN ii.NAME = '原铝Fe' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.090 THEN 1 ELSE 0 END )
"fe_0090",
SUM ( CASE WHEN ii.NAME = '原铝Fe' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.080 THEN 1 ELSE 0 END )
"fe_0080",
SUM ( CASE WHEN ii.NAME = '原铝Ni' AND CAST ( ii.test_value AS NUMERIC ) &lt;= 0.0042 THEN 1 ELSE 0 END)
"ni_00042"
FROM
entrust_sample_item i
JOIN entrust_sample_item_index ii ON ii.entrust_sample_item_id = i.ID AND ii.deleted = 0
......@@ -724,4 +736,80 @@
</if>
</select>
<!--获取化验委托数量统计数据: 获取LIMS平台某段时间内各类物料的化验委托数量数据-->
<select id="selectAssayMaterialQuantity" resultType="map">
select
s.name,
count(s.id) "data"
from
entrust_sample s
join entrust e on e.id = s.entrust_id and e.deleted = 0
where
s.deleted = 0 and s.type = 0
<if test="null != vo.timeS">
AND e.ctime >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND e.ctime &lt;= #{vo.timeE}
</if>
group by
s.name
</select>
<!--获取可检测项目统计数据:获取LIMS平台可检测项目统计数据-->
<select id="selectDetectableItemQuantity" resultType="map">
select m.name,
count(mi.id) "data"
from material m
left join material_item mi on m.id = mi.material_id and mi.deleted = 0
where m.deleted = 0
group by m.name order by m.name
</select>
<!--获取化验检测完毕任务数量统计数据:获取LIMS平台某段时间内各类物料的化验检测完毕任务数量数据-->
<select id="selectDetectedTasksQuantity" resultType="map">
select
es.name,
count(distinct es.id) "data"
from entrust_sample es
join entrust e on es.entrust_id = e.id and e.deleted = 0
where es.deleted = 0 and es.type = 0 and es.status > 20
<if test="null != vo.timeS">
AND e.ctime >= #{vo.timeS}
</if>
<if test="null != vo.timeE">
AND e.ctime &lt;= #{vo.timeE}
</if>
group by es.name
</select>
<!--获取日原辅料检测当前实时数据情况: 获取当天的截止查询时间内原辅料检测各个阶段的数量-->
<select id="selectRawMaterialStageQuantity" resultType="map">
select count(distinct cs.id) "inspectQuantity",
count(distinct e.id) "entrustQuantity",
count(distinct csl.id) "samplingQuantity",
count(distinct (case when cs.status = 180 then cs.id else null end)) "finishQuantity",
count(distinct r.id) "reportQuantity"
from contract_sample cs
left join contract_sampling csl on csl.contract_sample_id = cs.id and csl.deleted = 0
left join entrust_sample es on cs.id = es.contract_sample_id and es.deleted = 0
left join entrust e on e.id = es.entrust_id and e.deleted = 0
left join entrust_report r on e.id = r.entrust_id and r.deleted = 0
where cs.deleted = 0 and es.contract_sample_id is not null
and to_char(cs.ctime,'yy-MM-dd') = to_char(#{vo.queryDate}::timestamp,'yyyy-MM-dd')
</select>
<select id="selectProcessSampleStageQuantity" resultType="map">
select count(distinct e.id) "inspectQuantity",
count(distinct e.id) "entrustQuantity",
count(distinct s.id) "samplingQuantity",
count(distinct (case when s.status = 70 then e.id else null end)) "finishQuantity",
count(distinct r.id) "reportQuantity"
from entrust e
left join entrust_sample s on e.id = s.entrust_id and s.deleted = 0
left join entrust_report r on e.id = r.entrust_id and r.deleted = 0
where e.deleted = 0
and s.contract_sample_id is null and s.type = 0
and to_char(e.entrust_time,'yy-MM-dd') = to_char(#{vo.queryDate}::timestamp,'yyyy-MM-dd')
</select>
</mapper>
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