原始记录管理

This commit is contained in:
jjLv 2024-07-26 11:20:28 +08:00
parent 025c845b15
commit 60795a84f8
11 changed files with 394 additions and 139 deletions

View File

@ -3,6 +3,7 @@ package com.bonus.aqgqj.primaryData.controller;
import com.bonus.aqgqj.annotation.DecryptAndVerify;
import com.bonus.aqgqj.annotation.LogAnnotation;
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo;
import com.bonus.aqgqj.exper.dao.DeviceDao;
import com.bonus.aqgqj.exper.entity.vo.ExperDevice;
@ -54,5 +55,16 @@ public class PrimaryDataController {
return ServerResponse.createSuccessPage(pageInfo, data.getData().getPage(), data.getData().getLimit());
}
@PostMapping(value = "getDetailList")
@DecryptAndVerify(decryptedClass = ParamsDto.class)//加解密统一管理
@LogAnnotation(operModul = "试验详情管理", operation = "查询试验详情列表", operDesc = "系统级事件", operType = "查询")
// @PreAuthorize("@pms.hasPermission('sys:experimentalTest:query')")
public ServerResponse getDetailList(EncryptedReq<ParamsDto> data) {
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
List<ExperimentalDetailVo> list = primarydataService.getDetailList(data.getData());
PageInfo<ExperimentalDetailVo> pageInfo = new PageInfo<>(list);
return ServerResponse.createSuccessPage(pageInfo, data.getData().getPage(), data.getData().getLimit());
}
}

View File

@ -1,11 +1,14 @@
package com.bonus.aqgqj.primaryData.dao;
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo;
import com.bonus.aqgqj.exper.entity.vo.ExperDevice;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface PrimaryDataDao {
@ -17,46 +20,25 @@ public interface PrimaryDataDao {
*/
List<ExperimentalVo> getList(ParamsDto data);
// /**
// * 根据实验设备id获取信息
// * @param device
// * @return
// */
// ExperDevice getDeviceId(ExperDevice device);
//
// /**
// * 根据设备id查询是否重名
// * @param devName
// * @param devId
// * @return
// */
// ExperDevice getDevice(String devName,Long devId);
//
// /**
// * 修改该条设备数据
// * @param device
// * @return
// */
// int update(ExperDevice device);
//
// /**
// * 根据设备名称查是否重名
// * @param devName
// * @return
// */
// ExperDevice getAdd(String devName);
//
// /**
// * 新增该条数据
// * @param device
// * @return
// */
// int add(ExperDevice device);
// /**
// * 删除该条数据
// * @param devId
// * @return
// */
// int delDevice(Long devId);
/**
* 试验详情列表
*
* @param dto
* @return List<ExperimentalDetailVo>
* @author cwchen
* @date 2024/7/20 13:27
*/
List<ExperimentalDetailVo> getDetailList(ParamsDto dto);
/**
* 查询试验设备数量
*
* @param experId
* @return List<Sample>
* @author cwchen
* @date 2024/7/22 10:58
*/
@MapKey("id")
List<Map<String, String>> getExperDevItemsNum(Long experId);
}

View File

@ -1,6 +1,7 @@
package com.bonus.aqgqj.primaryData.service;
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo;
@ -15,47 +16,14 @@ public interface PrimaryDataService {
*/
List<ExperimentalVo> getList(ParamsDto data);
// /**
// * 根据实验设备id获取信息
// * @param device
// * @return
// */
// ServerResponse getDeviceId(ExperDevice device);
//
// /**
// * 根据设备id查询是否重名
// * @param devName
// * @param devId
// * @return
// */
// ExperDevice getDevice(String devName,Long devId);
//
// /**
// * 修改该条设备数据
// * @param device
// * @return
// */
// ExperDevice updateDevice(ExperDevice device);
//
// /**
// * 根据设备名称查是否重名
// * @param devName
// * @return
// */
// ExperDevice getAdd(String devName);
//
// /**
// * 新增该条数据
// * @param device
// * @return
// */
// ExperDevice add(ExperDevice device);
//
// /**
// * 删除该条数据
// * @param devId
// * @return
// */
// int delDevice(Long devId);
/**
* 试验详情列表
*
* @param data
* @return List<ExperimentalDetailVo>
* @author cwchen
* @date 2024/7/20 13:26
*/
List<ExperimentalDetailVo> getDetailList(ParamsDto data);
}

View File

@ -1,14 +1,18 @@
package com.bonus.aqgqj.primaryData.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.bonus.aqgqj.basis.entity.dto.ParamsDto;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo;
import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo;
import com.bonus.aqgqj.primaryData.dao.PrimaryDataDao;
import com.bonus.aqgqj.primaryData.service.PrimaryDataService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
@ -30,55 +34,29 @@ public class PrimaryDataServiceImpl implements PrimaryDataService {
return list;
}
// @Override
// public ServerResponse getDeviceId(ExperDevice device) {
// try{
// ExperDevice vo= deviceDao.getDeviceId(device);
// return ServerResponse.createSuccess(vo);
// }catch (Exception e){
// return ServerResponse.createSuccess("修改成功");
// }
// }
//
// @Override
// public ExperDevice getDevice(String devName,Long devId) {
// try{
// return deviceDao.getDevice(devName,devId);
// }catch (Exception e){
// log.error(e.toString(),e);
// }
// return null;
// }
//
//
// @Override
// @Transactional
// public ExperDevice updateDevice(ExperDevice device) {
// deviceDao.update(device);
// return device;
// }
//
// @Override
// public ExperDevice getAdd(String devName) {
// try{
// return deviceDao.getAdd(devName);
// }catch (Exception e){
// log.error(e.toString(),e);
// }
// return null;
// }
//
// @Override
// @Transactional
// public ExperDevice add(ExperDevice device) {
// deviceDao.add(device);
// return device;
// }
//
// @Override
// public int delDevice(Long devId) {
// return deviceDao.delDevice(devId);
// }
//
@Override
public List<ExperimentalDetailVo> getDetailList(ParamsDto dto) {
List<ExperimentalDetailVo> list = new ArrayList<>();
try {
list = primarydataDao.getDetailList(dto);
if (CollectionUtils.isNotEmpty(list)) {
for (ExperimentalDetailVo detailVo : list) {
// 样品试验结果样品数量送样总数
List<ExperimentalDetailVo.Sample> sampleList = new ArrayList<>();
if (detailVo.getExperId() != null) {
List<Map<String, String>> mapList = primarydataDao.getExperDevItemsNum(detailVo.getExperId());
JSONArray jsonArray = new JSONArray();
jsonArray.addAll(mapList);
sampleList = jsonArray.toJavaList(ExperimentalDetailVo.Sample.class);
}
detailVo.setSampleList(sampleList);
detailVo.setSampleQuantity(sampleList.size());
}
}
} catch (Exception e) {
log.error(e.toString(), e);
}
return list;
}
}

View File

@ -51,4 +51,36 @@
ORDER BY dispatch_time ASC
</select>
<!--试验详情列表-->
<select id="getDetailList" resultType="com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo">
SELECT * FROM (
SELECT ANY_VALUE(tsd.sample_id) AS sampleId,
ANY_VALUE(tsd.dev_type_name) AS devTypeName,
tsd.dev_type_code AS devTypeCode,
ANY_VALUE(te.id) AS experId,
COUNT(tsd.dev_type_code) AS sampleNum,
ANY_VALUE(te.audit_remakr) AS causeOfRejection,
ANY_VALUE(su2.user_name) AS experimenter,
ANY_VALUE(DATE_FORMAT(te.update_time, '%Y-%m-%d')) AS testTime
FROM tb_sample_device tsd
LEFT JOIN tb_exper te ON tsd.sample_id = te.sample_id AND tsd.dev_type_code = te.dev_type_code AND te.del_flag = 0
LEFT JOIN sys_user su2 ON te.update_user = su2.id AND su2.del_flag = 0
WHERE tsd.sample_id = #{id} AND tsd.del_falg = 0 and te.`status` = 4 and te.audit_status = 1
<if test="devTypeCode != null and devTypeCode!=''">
AND INSTR(tsd.dev_type_code,#{devTypeCode})
</if>
GROUP BY tsd.dev_type_code
)a
ORDER BY a.testTime DESC
</select>
<!--查询试验设备数量-->
<select id="getExperDevItemsNum" resultType="java.util.Map">
SELECT dev_code AS devCode,
case is_hg WHEN '1' THEN '不合格'
WHEN '0' THEN '合格'
ELSE '不合格' END AS testResult
FROM tb_exper_dev
WHERE exper_id = #{experId}
</select>
</mapper>

View File

@ -161,9 +161,9 @@ function reloadData() {
// 新增/修改平台用户
function addData(customId) {
console.log()
let title = '新增单位客户'
let title = '新增部门客户'
if (customId) {
title = '修改单位客户';
title = '修改部门客户';
}
let param = {
'customId': customId,

View File

@ -0,0 +1,283 @@
let form, layer, table, tableIns,idParam,customNumParam;
let pageNum = 1, limitSize = 10; // 默认第一页分页数量为10
var pers = checkPermission();
function setParams(params) {
idParam = JSON.parse(params).id;
customNumParam = JSON.parse(params).customNum;
layui.use(['form', 'layer', 'table', 'laydate'], function () {
form = layui.form;
layer = layui.layer;
table = layui.table;
layui.form.render();
getDevSelected();
pages(1, 10, 1);
})
}
function pages(pageNum, pageSize, typeNum) {
let params = getReqParams(pageNum, pageSize, typeNum);
let url = dataUrl + "/primaryDatas/getDetailList"
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (result.code === 200) {
if (result.data) {
initTable(result.data, result.limit, result.curr)
laypages(result.count, result.curr, result.limit)
}
} else if (result.code === 500) {
layer.alert(result.msg, {icon: 2})
}
}, function (xhr) {
error(xhr)
});
}
function laypages(total, page, limit) {
layui.use(['laypage'], function () {
let laypage = layui.laypage;
laypage.render({
elem: 'voi-page',
count: total,
curr: page,
limit: limit,
limits: [10, 20, 50, 100, 200, 500],
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
groups: 5,
jump: function (obj, first) {
if (!first) {
pageNum = obj.curr, limitSize = obj.limit;
pages(obj.curr, obj.limit, null);
}
}
});
})
}
/*初始化表格*/
function initTable(dataList, limit, page) {
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
tableIns = table.render({
elem: "#table_data",
height: "full-130",
data: dataList,
limit: limit,
cols: [
[
//表头
{title: "序号", width: 80, unresize: true, align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{field: "devTypeName", title: "样品类型", unresize: true, align: "center"},
// {field: "devModule", title: "规格型号", unresize: true, align: "center"},
{field: "sampleNum", title: "送样数量", unresize: true, align: "center"},
{field: "", title: "样品数量", unresize: true, align: "center",
templet: function (d) {
var testResult="";
var html = '';
var sampleList = JSON.stringify(d.sampleList);
if(d.sampleList.length>0){
for (let i = 0; i < d.sampleList.length; i++) {
if (d.sampleList[i].testResult == "合格") {
}else{
testResult = d.sampleList[i].testResult
}
}
// sampleList = JSON.stringify(d.sampleList);
}
if(testResult=="不合格"){
// 添加包裹元素并应用类
html += "<span class='layui-show-details' onmouseover='getMouseover("+ sampleList +")' onmouseout='getMouseout()' style='color: #F39268; cursor: pointer'>" +
d.sampleQuantity +
"</span>";
}else{
// 添加包裹元素并应用类
html += "<span class='layui-show-details' onmouseover='getMouseover("+ sampleList +")' onmouseout='getMouseout()' style='color: #2A6EDF; cursor: pointer'>" +
d.sampleQuantity +
"</span>";
}
return html;
}
},
{title: "原始记录", unresize: true, width: 300, align: "center",
templet: function (d) {
return '<a href="#" style="color: blue;" onclick="testClick(\'' + d.id + '\',\''+d.customNum+'\')">查看</a>';
}
},
],
],
done: function (res, curr, count) {
layer.close(loadingMsg);
table.resize("table_data");
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
},
});
}
var devOpenIndex='';
function getMouseover(data){
// console.log(data)
// openIframeTable(data)
var html = '<table class="layui-table" lay-skin="line" lay-size="sm" style="width: 100%;">' +
'<thead>' +
'<tr>' +
'<th>序号</th>' +
'<th>设备编号</th>' +
'<th>试验结果</th>'+
'</tr>'+
'</thead>'
html += '<tbody>';
if (data.length>0){
for (let i = 0; i < data.length; i++){
html += '<tr>' +
'<td>' + (i+1) + '</td>' +
'<td title="'+ data[i].devCode +'" style="cursor: pointer;" >' + data[i].devCode + '</td>' +
'<td title="'+ data[i].testResult +'" style="cursor: pointer;">' + data[i].testResult + '</td>' +
'</tr>';
}
}else{
html += '<tr>' +
'<td colspan="3" style="text-align: center">暂无数据</td>' +
'</tr>';
}
html += '</tbody>';
html += '</table>';
devOpenIndex = layer.open({
type: 0,
title: '设备信息',
area: ['300px', '300px'],
content: html,
btn: ['关闭'],
yes: function (index, layero) {
layer.close(index);
}
});
}
function getMouseout(){
// alert("鼠标移出");
// layer.close(devOpenIndex);
}
// 获取参数
function getReqParams(page, limit, type) {
// console.log(idParam)
let obj = {};
if (!type) {
obj = {
page: page + "",
limit: limit + "",
devTypeCode: $('#devId').val(),
id: idParam
};
} else {
obj = {
page: '1',
limit: '10',
devTypeCode: '',
id: idParam
};
}
// console.log(obj)
obj={
encryptedData:encryptCBC(JSON.stringify(obj))
}
return obj;
}
// 查询/重置
function query() {
pageNum = 1;
pages(1, limitSize);
}
function reloadData() {
pages(pageNum, limitSize);
}
// 查看
function buttonCheck(experId,sampleId,devTypeCode, permission, pers){
if(permission != ""){
if ($.inArray(permission, pers) < 0) {
return ""
}
}
var btn=$("<a class=\"layui-icon layui-icon-search\" title='查看' style=\"color: blue;\" onclick=\"checkData('" + experId + "','" + sampleId + "','"+ devTypeCode+"')\"></a>");
return btn.prop("outerHTML");
}
function checkData(experId,sampleId,devTypeCode) {
let param = {
'experId': experId,
'sampleId': sampleId,
'devTypeCode':devTypeCode,
'customNum':customNumParam
}
openIframeMax("testCheck.html", "查看试验", "testCheck.html", '80%', '100%', param);
}
// 试验新增、修改
function addData(experId,sampleId,devTypeCode) {
let title = '新增试验'
if (experId!=null && experId!='null') {
title = '修改试验';
}
let param = {
'experId': experId,
'sampleId': sampleId,
'devTypeCode':devTypeCode,
'customNum':customNumParam
}
openIframeMax("testForm", title, "testForm.html", '80%', '100%', param);
}
function testClick(id,customNum) {
let title = '试验详细信息'
let param = {
'id': id,
'customNum':customNum
}
openIframeMax("primaryDataList", title, "child/primaryDataList.html", '100%', '100%', param);
}
function getDevSelected() {
let url = dataUrl + '/sys/select/getDicts';
let obj = {
'code':"dev_code"
}
let params = {
encryptedData: encryptCBC(JSON.stringify(obj))
}
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
if (result.code === 200) {
setSelectValue(result.data, 'devId');
// return result.data
} else {
layer.alert(result.msg, {icon: 2})
}
}, function (xhr) {
error(xhr)
});
}
/*下拉选表单赋值*/
function setSelectValue(list, selectName) {
let html = '<option value="" selected>请选设备类型</option>';
$.each(list, function (index, item) {
html += '<option value="' + item.value + '">' + item.name + '</option>';
})
$('#' + selectName).empty().append(html);
layui.form.render();
}

View File

@ -175,7 +175,7 @@ function reloadData() {
// 试验标准新增、修改
function testClick(id,customNum) {
let title = '试验'
let title = '试验详细信息'
let param = {
'id': id,
'customNum':customNum

View File

@ -20,7 +20,7 @@
<input hidden id="id" name="id">
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户名称</label>
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>部门名称</label>
<div class="layui-input-inline">
<input class="layui-input" id="customName" name="customName" autocomplete="off"
lay-verify="required" maxlength="50">

View File

@ -19,7 +19,7 @@
<form class="layui-form" onsubmit="return false;" lay-filter="formInfo">
<input hidden id="id" name="id">
<div class="layui-form-item" style="margin-top: 2%;">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>客户名称</label>
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>单位名称</label>
<div class="layui-input-inline">
<input class="layui-input" id="customName" name="customName" autocomplete="off"
lay-verify="required" maxlength="50">

View File

@ -38,5 +38,5 @@
</div>
</div>
</body>
<script src="../../../js/basis/standard/child/testList.js" charset="UTF-8" type="text/javascript"></script>
<script src="../../../js/primaryData/child/primaryAddList.js" charset="UTF-8" type="text/javascript"></script>
</html>