refactor(nanjing): 优化时段统计功能

- 调整时间输入框样式和布局
- 添加 laydate 日期选择器
- 修改导出按钮位置
- 优化导出功能,调整线程池配置
- 更新错误提示信息
- 移除冗余代码和注释
master
zch 5 days ago
parent 1ec77e594d
commit 87a176aeb0

@ -29,10 +29,6 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.config.Global;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
@ -114,16 +110,15 @@ public class SelectProRpListController extends BaseController
public AjaxResult export(ProRpList proRpList) {
Map<String, Object> map = new HashMap<>();
map.put("beginTime", proRpList.getParams().get("startTime"));
map.put("startTime", proRpList.getParams().get("startTime"));
map.put("endTime", proRpList.getParams().get("endTime"));
map.put("productId", proRpList.getProductID());
map.put("productType", proRpList.getProductType());
map.put("state", proRpList.getState());
map.put("semiBarcode", proRpList.getSemiBarcode());
map.put("beginTime", proRpList.getParams().get("beginTime"));
map.put("endTime", proRpList.getParams().get("endTime"));
TSyTracestate tSyTracestate = new TSyTracestate();
tSyTracestate.setProductID(proRpList.getProductID());
tSyTracestate.setState(proRpList.getState());
tSyTracestate.setBarcode(proRpList.getSemiBarcode());
tSyTracestate.setParams(map);
// 获取TSyTracestate列表
List<TSyTracestate> list = tracestateService.selectTSyTracestateList(tSyTracestate);
@ -133,7 +128,7 @@ public class SelectProRpListController extends BaseController
.collect(Collectors.toList());
// 优化线程池配置
int BATCH_SIZE = 500; // 每批处理500条记录
int BATCH_SIZE = 1600; // 每批处理1600条记录
// 计算最优线程数
int CPU_CORES = Runtime.getRuntime().availableProcessors();
@ -141,7 +136,6 @@ public class SelectProRpListController extends BaseController
Math.max(CPU_CORES / 4, 4), // CPU核心数的1/4但不少于4个线程
8 // 最大不超过8个线程
);
// 线程池配置
ThreadPoolExecutor executorService = new ThreadPoolExecutor(
OPTIMAL_THREADS, // 核心线程数
@ -177,7 +171,7 @@ public class SelectProRpListController extends BaseController
}
// 优化7检查是否有足够的数据
if (printInfo.isEmpty()) {
return AjaxResult.error("未能成功获取数据,请重试或减少数据量");
return AjaxResult.error("未能成功获取数据,请重试或减少数据量,或者该段时间无数据");
}
// 创建 ExcelUtil 实例
@ -186,7 +180,8 @@ public class SelectProRpListController extends BaseController
Map<String, List<?>> sheetDataMap = new HashMap<>();
sheetDataMap.put("时段查询", list);
sheetDataMap.put("工位数据", printInfo);
String fileName = "data_" + DateUtils.dateTimeNow() + ".xlsx";
String fileName = DateUtils.dateTimeNow() + ".xlsx";
return excelUtil.exportMultiSheet(sheetDataMap, fileName);
} catch (Exception e) {

@ -12,10 +12,10 @@
<div class="select-list">
<ul>
<li class="select-time">
<label class="is-required">时间区间: </label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[startTime]"/>
<label >时间区间: </label>
<input type="text" class="form-control" id="beginTime" name="params[beginTime]" placeholder="开始时间">
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
<input type="text" class="form-control" id="endTime" name="params[endTime]" placeholder="结束时间">
</li>
<li>
<label class="required">产品码:</label>
@ -48,18 +48,16 @@
<!-- </li>-->
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<!-- <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;查询全部</a>-->
<a class="btn btn-warning" onclick="$.table.exportExcel()" >
<i class="fa fa-download"></i> 导出
</a>
<!-- <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;查询全部</a>-->
<!-- <a class="btn btn-info btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="nanjing:ProRpList:export"><i class="fa fa-download"></i> 导出</a>-->
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-warning" onclick="$.table.exportExcel()" >
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -213,6 +211,23 @@
}
});
}
$(function(){
<!-- laydate示例 -->
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#beginTime',
type: 'datetime',
trigger: 'click'
});
laydate.render({
elem: '#endTime',
type: 'datetime',
trigger: 'click'
});
});
});
</script>
</body>
</html>

@ -139,9 +139,6 @@
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and datediff(dd,#{params.beginTime},t1.beginTime)>= 0
</if>
<if test="params.startTime != null and params.startTime != ''"><!-- 开始时间检索 -->
and datediff(dd,#{params.startTime},t1.beginTime)>= 0
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and datediff(dd,t1.beginTime,#{params.endTime})>= 0
</if>

Loading…
Cancel
Save