diff --git a/src/main/java/com/bonus/aqgqj/primaryData/controller/PrimaryDataController.java b/src/main/java/com/bonus/aqgqj/primaryData/controller/PrimaryDataController.java index 22b3621..6732177 100644 --- a/src/main/java/com/bonus/aqgqj/primaryData/controller/PrimaryDataController.java +++ b/src/main/java/com/bonus/aqgqj/primaryData/controller/PrimaryDataController.java @@ -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 data) { + PageHelper.startPage(data.getData().getPage(), data.getData().getLimit()); + List list = primarydataService.getDetailList(data.getData()); + PageInfo pageInfo = new PageInfo<>(list); + return ServerResponse.createSuccessPage(pageInfo, data.getData().getPage(), data.getData().getLimit()); + } + } diff --git a/src/main/java/com/bonus/aqgqj/primaryData/dao/PrimaryDataDao.java b/src/main/java/com/bonus/aqgqj/primaryData/dao/PrimaryDataDao.java index a03b567..15a06ef 100644 --- a/src/main/java/com/bonus/aqgqj/primaryData/dao/PrimaryDataDao.java +++ b/src/main/java/com/bonus/aqgqj/primaryData/dao/PrimaryDataDao.java @@ -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 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 + * @author cwchen + * @date 2024/7/20 13:27 + */ + List getDetailList(ParamsDto dto); + + /** + * 查询试验设备数量 + * + * @param experId + * @return List + * @author cwchen + * @date 2024/7/22 10:58 + */ + @MapKey("id") + List> getExperDevItemsNum(Long experId); } diff --git a/src/main/java/com/bonus/aqgqj/primaryData/service/PrimaryDataService.java b/src/main/java/com/bonus/aqgqj/primaryData/service/PrimaryDataService.java index aa5ccb9..2677c2c 100644 --- a/src/main/java/com/bonus/aqgqj/primaryData/service/PrimaryDataService.java +++ b/src/main/java/com/bonus/aqgqj/primaryData/service/PrimaryDataService.java @@ -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 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 + * @author cwchen + * @date 2024/7/20 13:26 + */ + List getDetailList(ParamsDto data); } diff --git a/src/main/java/com/bonus/aqgqj/primaryData/service/impl/PrimaryDataServiceImpl.java b/src/main/java/com/bonus/aqgqj/primaryData/service/impl/PrimaryDataServiceImpl.java index 5ac3a29..49820bb 100644 --- a/src/main/java/com/bonus/aqgqj/primaryData/service/impl/PrimaryDataServiceImpl.java +++ b/src/main/java/com/bonus/aqgqj/primaryData/service/impl/PrimaryDataServiceImpl.java @@ -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 getDetailList(ParamsDto dto) { + List list = new ArrayList<>(); + try { + list = primarydataDao.getDetailList(dto); + if (CollectionUtils.isNotEmpty(list)) { + for (ExperimentalDetailVo detailVo : list) { + // 样品试验结果、样品数量、送样总数 + List sampleList = new ArrayList<>(); + if (detailVo.getExperId() != null) { + List> 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; + } } diff --git a/src/main/resources/mappers/primaryData/PrimaryDataMapper.xml b/src/main/resources/mappers/primaryData/PrimaryDataMapper.xml index 2f496c0..d8f79c9 100644 --- a/src/main/resources/mappers/primaryData/PrimaryDataMapper.xml +++ b/src/main/resources/mappers/primaryData/PrimaryDataMapper.xml @@ -51,4 +51,36 @@ ORDER BY dispatch_time ASC + + + + + \ No newline at end of file diff --git a/src/main/resources/static/js/basis/customDept.js b/src/main/resources/static/js/basis/customDept.js index 880ea42..5fe525f 100644 --- a/src/main/resources/static/js/basis/customDept.js +++ b/src/main/resources/static/js/basis/customDept.js @@ -161,9 +161,9 @@ function reloadData() { // 新增/修改平台用户 function addData(customId) { console.log() - let title = '新增单位客户' + let title = '新增部门客户' if (customId) { - title = '修改单位客户'; + title = '修改部门客户'; } let param = { 'customId': customId, diff --git a/src/main/resources/static/js/primaryData/child/primaryAddList.js b/src/main/resources/static/js/primaryData/child/primaryAddList.js new file mode 100644 index 0000000..095be67 --- /dev/null +++ b/src/main/resources/static/js/primaryData/child/primaryAddList.js @@ -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 += "" + + d.sampleQuantity + + ""; + }else{ + // 添加包裹元素并应用类 + html += "" + + d.sampleQuantity + + ""; + + } + return html; + } + }, + {title: "原始记录", unresize: true, width: 300, align: "center", + templet: function (d) { + return '查看'; + } + }, + ], + ], + 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 = '' + + '' + + '' + + '' + + '' + + ''+ + ''+ + '' + + html += ''; + if (data.length>0){ + for (let i = 0; i < data.length; i++){ + html += '' + + '' + + '' + + '' + + ''; + } + }else{ + html += '' + + '' + + ''; + } + html += ''; + html += '
序号设备编号试验结果
' + (i+1) + '' + data[i].devCode + '' + data[i].testResult + '
暂无数据
'; + + 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=$(""); + 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 = ''; + $.each(list, function (index, item) { + html += ''; + }) + $('#' + selectName).empty().append(html); + layui.form.render(); +} \ No newline at end of file diff --git a/src/main/resources/static/js/primaryData/primary.js b/src/main/resources/static/js/primaryData/primary.js index ed5e91b..731cdac 100644 --- a/src/main/resources/static/js/primaryData/primary.js +++ b/src/main/resources/static/js/primaryData/primary.js @@ -175,7 +175,7 @@ function reloadData() { // 试验标准新增、修改 function testClick(id,customNum) { - let title = '试验' + let title = '试验详细信息' let param = { 'id': id, 'customNum':customNum diff --git a/src/main/resources/static/pages/basis/customAddDeptForm.html b/src/main/resources/static/pages/basis/customAddDeptForm.html index 79f5502..82a8307 100644 --- a/src/main/resources/static/pages/basis/customAddDeptForm.html +++ b/src/main/resources/static/pages/basis/customAddDeptForm.html @@ -20,7 +20,7 @@
- +
diff --git a/src/main/resources/static/pages/basis/customAddForm.html b/src/main/resources/static/pages/basis/customAddForm.html index 6aede07..7312486 100644 --- a/src/main/resources/static/pages/basis/customAddForm.html +++ b/src/main/resources/static/pages/basis/customAddForm.html @@ -19,7 +19,7 @@
- +
diff --git a/src/main/resources/static/pages/primaryData/child/primaryDataList.html b/src/main/resources/static/pages/primaryData/child/primaryDataList.html index 29ce626..eec43b5 100644 --- a/src/main/resources/static/pages/primaryData/child/primaryDataList.html +++ b/src/main/resources/static/pages/primaryData/child/primaryDataList.html @@ -38,5 +38,5 @@
- + \ No newline at end of file