在线Roll/angle

This commit is contained in:
cwchen 2026-01-07 13:53:55 +08:00
parent 1491b7c899
commit 2492d7561b
14 changed files with 374 additions and 60 deletions

View File

@ -1,6 +1,5 @@
package com.bonus.boot.manager.defectStatistics.controller;
import com.bonus.boot.manager.defectStatistics.entity.ComprehensiveVo;
import com.bonus.boot.manager.defectStatistics.entity.DayDefectRateDto;
import com.bonus.boot.manager.defectStatistics.entity.DayDefectRateVo;
import com.bonus.boot.manager.defectStatistics.service.IDayDefectRateService;
@ -12,7 +11,6 @@ import com.bonus.boot.manager.manager.utils.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

View File

@ -0,0 +1,50 @@
package com.bonus.boot.manager.defectStatistics.controller;
import com.bonus.boot.manager.defectStatistics.entity.DayDefectRateDto;
import com.bonus.boot.manager.defectStatistics.entity.RollAngleRateVo;
import com.bonus.boot.manager.defectStatistics.service.IRollAngleService;
import com.bonus.boot.manager.manager.annotation.DecryptAndVerify;
import com.bonus.boot.manager.manager.annotation.LogAnnotation;
import com.bonus.boot.manager.manager.entity.EncryptedReq;
import com.bonus.boot.manager.manager.utils.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @className:RollAngleController
* @author:cwchen
* @date:2025-12-29-15:30
* @version:1.0
* @description:RollAngle-web层
*/
@RestController
@RequestMapping("/rollAngle")
public class RollAngleController {
@Resource(name = "IRollAngleService")
private IRollAngleService rollAngleService;
@PostMapping(value = "getList")
@DecryptAndVerify(decryptedClass = DayDefectRateDto.class)//加解密统一管理
@LogAnnotation(operModul = "Roll/Angle比例列表查询", operation = "查询数据概览", operDesc = "系统级事件", operType = "查询")
public ServerResponse getList(EncryptedReq<DayDefectRateDto> data) {
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
List<RollAngleRateVo> list = rollAngleService.getList(data.getData());
PageInfo<RollAngleRateVo> pageInfo = new PageInfo<>(list);
return ServerResponse.createSuccessPage(pageInfo, data.getData().getPage(), data.getData().getLimit());
}
@PostMapping(value = "/downloadExcel")
@DecryptAndVerify(decryptedClass = DayDefectRateDto.class)
@LogAnnotation(operModul = "Roll/Angle比例", operation = "导出", operDesc = "系统级事件",operType="导出")
public void importantMatterExport(HttpServletResponse response, EncryptedReq<DayDefectRateDto> dto) {
rollAngleService.downloadExcel(dto.getData(),response);
}
}

View File

@ -0,0 +1,26 @@
package com.bonus.boot.manager.defectStatistics.dao;
import com.bonus.boot.manager.defectStatistics.entity.DayDefectRateDto;
import com.bonus.boot.manager.defectStatistics.entity.RollAngleRateVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @className:IRollAngleMapper
* @author:cwchen
* @date:2025-12-29-15:35
* @version:1.0
* @description:Roll/Angle比例数据层
*/
@Repository(value = "IRollAngleDao")
public interface IRollAngleDao {
/**
* Roll/Angle比例列表查询
* @param dto
* @return List<RollAngleRateVo>
* @author cwchen
* @date 2025/12/29 15:40
*/
List<RollAngleRateVo> getList(DayDefectRateDto dto);
}

View File

@ -0,0 +1,51 @@
package com.bonus.boot.manager.defectStatistics.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @className:RollAngleRatePo
* @author:cwchen
* @date:2025-12-29-13:03
* @version:1.0
* @description:rollangle缺陷比例-vo
*/
@Data
public class RollAngleRateVo {
/**
* 序号
*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private Long serialNumber;
@Excel(name = "照片编号", width = 30.0, orderNum = "1")
private String id;
/**
* rollAngle数据占比
*/
@Excel(name = "Roll/Angle比例", width = 20.0, orderNum = "2")
private String rollAngleRate;
/**
* 图片路径
*/
private String imgUrl;
/**
* 图片更新状态 0.未更新 1.已更新
*/
private String imgUpdateStatus = "0";
/**
* 图片更新次数 5次未更新成功则不再更新
*/
private int imgUpdateNum;
private Date createDay = new Date();
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "检测日期", width = 20.0, orderNum = "3", format = "yyyy-MM-dd HH:mm:ss")
private Date createTime = new Date();
}

View File

@ -0,0 +1,37 @@
package com.bonus.boot.manager.defectStatistics.service;
import com.bonus.boot.manager.defectStatistics.entity.DayDefectRateDto;
import com.bonus.boot.manager.defectStatistics.entity.RollAngleRateVo;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @className:IRollAngleService
* @author:cwchen
* @date:2025-12-29-15:34
* @version:1.0
* @description:Roll/Angle比例业务层
*/
public interface IRollAngleService {
/**
* Roll/Angle比例列表查询
*
* @param data
* @return List<RollAngleRateVo>
* @author cwchen
* @date 2025/12/29 15:38
*/
List<RollAngleRateVo> getList(DayDefectRateDto data);
/**
* Roll/Angle比例导出
*
* @param data
* @param response
* @return void
* @author cwchen
* @date 2025/12/29 15:46
*/
void downloadExcel(DayDefectRateDto data, HttpServletResponse response);
}

View File

@ -0,0 +1,69 @@
package com.bonus.boot.manager.defectStatistics.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.bonus.boot.manager.defectStatistics.dao.IRollAngleDao;
import com.bonus.boot.manager.defectStatistics.entity.DayDefectRateDto;
import com.bonus.boot.manager.defectStatistics.entity.RollAngleRateVo;
import com.bonus.boot.manager.defectStatistics.service.IRollAngleService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.List;
/**
* @className:RollAngleServiceImpl
* @author:cwchen
* @date:2025-12-29-15:35
* @version:1.0
* @description:Roll/Angle比列业务逻辑层
*/
@Service(value = "IRollAngleService")
@Slf4j
public class RollAngleServiceImpl implements IRollAngleService {
@Resource(name = "IRollAngleDao")
private IRollAngleDao rollAngleDao;
@Override
public List<RollAngleRateVo> getList(DayDefectRateDto dto) {
List<RollAngleRateVo> list = null;
try {
List<RollAngleRateVo> result = rollAngleDao.getList(dto);
list = result == null ? Collections.emptyList() : result;
} catch (Exception e) {
log.error(e.toString(), e);
list = Collections.emptyList();
}
return list;
}
@Override
public void downloadExcel(DayDefectRateDto dto, HttpServletResponse response) {
try {
List<RollAngleRateVo> list = getList(dto);
final Long[] num = {1L};
list.forEach(vo -> {
vo.setSerialNumber(num[0]);
num[0]++;
});
ExportParams exportParams = new ExportParams("Roll/Angle比例", "Roll/Angle比例", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, RollAngleRateVo.class, list);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("Roll/Angle比例" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
log.error(e.toString(), e);
}
}
}

View File

@ -4,6 +4,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.bonus.boot.manager.home.dao.PublicDao;
import com.bonus.boot.manager.home.entity.PublicBean;
@ -50,6 +51,13 @@ public class PermissionController {
@Autowired
private PermissionService permissionService;
private static final Set<Long> ONLINE_IGNORE_IDS = Stream.of(58L, 60L,95L, 72L, 96L, 82L, 75L)
.collect(Collectors.toSet());
private static final Set<Long> OFFNLINE_IGNORE_IDS = Stream.of(101L, 102L)
.collect(Collectors.toSet());
@Autowired
private PublicDao pdao;
@ -65,24 +73,31 @@ public class PermissionController {
}
LoginUser loginUser = UserUtil.getLoginUser();
List<Permission> list = loginUser.getPermissions();
List<Permission> filteredList = null;
//在线 权限
if("1".equals(onlinetype)){
for (int i = 0; i < list.size(); i++) {
/*for (int i = 0; i < list.size(); i++) {
if (list.get(i).getId().equals(58L)||list.get(i).getId().equals(60L)||list.get(i).getId().equals(60L)||list.get(i).getId().equals(64L)||list.get(i).getId().equals(95L)||list.get(i).getId().equals(72L)||list.get(i).getId().equals(64L)||list.get(i).getId().equals(96L)||list.get(i).getId().equals(82L)||list.get(i).getId().equals(75L)) {
list.remove(i);
i--; // 注意要将索引减1因为列表大小减小了
}
}
}*/
filteredList = list.stream()
.filter(item -> !ONLINE_IGNORE_IDS.contains(item.getId()))
.collect(Collectors.toList());
} else {
for (int i = 0; i < list.size(); i++) {
/*for (int i = 0; i < list.size(); i++) {
if (list.get(i).getId().equals(101L) || list.get(i).getId().equals(102L)) {
list.remove(i);
i--; // 注意要将索引减1因为列表大小减小了
}
}
}*/
filteredList = list.stream()
.filter(item -> !OFFNLINE_IGNORE_IDS.contains(item.getId()))
.collect(Collectors.toList());
}
int ll=0;
final List<Permission> permissions = list.stream().filter(l -> l.getType().equals(1))
final List<Permission> permissions = filteredList.stream().filter(l -> l.getType().equals(1))
.collect(Collectors.toList());
List<Permission> firstLevel = permissions.stream().filter(p -> p.getParentId().equals(0L)).collect(Collectors.toList());

View File

@ -816,12 +816,19 @@ public class PlanTask {
try{
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy HHmmss");
SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<RewordBean> rbs=dao.getObjectBySqlReword(
/*List<RewordBean> rbs=dao.getObjectBySqlReword(
"select * from (SELECT a.bale_num_id as id,b.bale_num as baleNum,ROUND(AVG(CAST(a.tows_avg_width as SIGNED)), 2) as avgWidth,max(a.createTime) as createTime \n" +
" FROM bm_tows a \n" +
" left join bm_tows_bag b on a.bale_num_id=b.id \n" +
" where a.data_type='0' and a.is_active='1' and a.is_del_img='0' and a.createTime like '2025%' and a.is_txt='1' \n" +
" and b.bale_num is not null " +
" group by a.bale_num_id ) a order by createTime desc ");*/
List<RewordBean> rbs=dao.getObjectBySqlReword(
"select * from (SELECT a.bale_num_id as id,b.bale_num as baleNum,ROUND(AVG(CAST(a.tows_avg_width as SIGNED)), 2) as avgWidth,max(a.createTime) as createTime \n" +
" FROM bm_tows a \n" +
" left join bm_tows_bag b on a.bale_num_id=b.id \n" +
" where a.data_type='0' and a.is_active='1' and a.is_del_img='0' AND a.createTime >= '2025-01-01 00:00:00' and a.is_txt='1' \n" +
" and b.bale_num is not null " +
" group by a.bale_num_id ) a order by createTime desc ");
if(rbs!=null&&rbs.size()>0){
System.err.println(rbs.get(0).getCreateTime());

View File

@ -315,6 +315,7 @@ Roll = Roll
Angle = Angle
proportion=占比
quantity=数量
roll_angle_rate=Roll/Angle比例
# laydate 语言
laydateEn =

View File

@ -321,3 +321,4 @@ roughening = Roughened
roughening_num = the number of brushed hairs
roughening_width = burr length
roughening_width_proportion = roughening length ratio
roll_angle_rate=Roll/AngleProportion

View File

@ -319,4 +319,5 @@ custom = 自定义
roughening = 拉毛
roughening_num = 拉毛个数
roughening_width = 毛边长度
roughening_width_proportion = 拉毛长度比
roughening_width_proportion = 拉毛长度比
roll_angle_rate=Roll/Angle比例

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.boot.manager.defectStatistics.dao.IRollAngleDao">
<!--Roll/Angle比例列表查询-->
<select id="getList" resultType="com.bonus.boot.manager.defectStatistics.entity.RollAngleRateVo">
SELECT
id,
rollangle_rate AS rollangleRate,
img_url AS imgUrl,
create_time AS createTime
FROM tb_rollangle_rate
<where>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND create_day BETWEEN #{startDate} AND #{endDate}
</if>
</where>
ORDER BY create_time DESC
</select>
</mapper>

View File

@ -83,6 +83,9 @@ layui.use(['form', 'layer', 'table', 'laydate'], function () {
function pages(pageNum, pageSize, typeNum) {
var params = getReqParams(pageNum, pageSize, typeNum);
var url = dataUrl + "/proportion/getList";
if(isOnline === '1'){
url = dataUrl + "/rollAngle/getList";
}
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
console.log(result);
@ -196,28 +199,28 @@ function setTableField(page,limit){
return (page - 1) * limit + d.LAY_INDEX + 1;
}
},
{ field: 'bambooMaxProportion',width: '15%',align: "center",title: mean_curl_ratio },
{ field: 'bambooMinProportion',width: '15%',align: "center", title: maximum_curl_ratio },
{ field: 'bambooAvgProportion',width: '15%',align: "center", title: minimum_curl_ratio },
{ field: 'imgNum', width: '20%',align: "center",title: photo_number,
// { field: 'bambooMinProportion',width: '15%',align: "center", title: maximum_curl_ratio },
// { field: 'bambooAvgProportion',width: '15%',align: "center", title: minimum_curl_ratio },
{ field: 'id', width: '30%',align: "center",title: photo_number,
templet: function (d) {
var html = '';
if(d.id=="" || d.imgNum=="" || d.imgNum=="null" || d.imgNum==null){
if(d.id=="" || d.id=="" || d.id=="null" || d.id==null){
return '';
}
html += "<a style='color: #3E689A;font-weight: bold;' onclick='getImgNum("+d.id+")'>"+d.imgNum+"</a>";
html += "<a style='color: #3E689A;font-weight: bold;' onclick='getImgNum2("+JSON.stringify(d)+")'>"+d.id+"</a>";
return html;
}
},
{ field: 'createTime', width: '20%',align: "center",title: test_date },
{
{ field: 'rollAngleRate',width: '25%',align: "center",title: roll_angle_rate },
{ field: 'createTime', width: '40%',align: "center",title: test_date },
/*{
title: operate,
width: '10%',
align: "center",
templet: function(d) {
return "<a style='color: #E70E4E;font-weight: bold;' onclick=\"delData('" + d.id + "')\">"+delete_button+"</a>";
}
}
}*/
]
}
return cols;
@ -243,6 +246,30 @@ function getImgNum(id) {
openIframe2("imgNumOpen", photo_details, "imgNumForm.html?l="+localStorage.getItem("lang"), width, height, param);
}
/**RollAngle比例图片*/
function getImgNum2(obj) {
layer.photos({
photos: {
"title": photo_details,
"start": 0,
"data": [
{
"alt": "RollAngle比例图片",
"pid": 1,
// "src": "https://unpkg.com/outeres@0.1.1/demo/layer.png"
"src": imgpathurl +'/online' + obj.imgUrl,
}
]
},
// --- 调整背景透明度 ---
shade: [0.3, '#000'], // 0.3 表示 30% 透明度的黑色,背景不会那么黑
// -------------------
maxWidth: 800,
maxHeight: 600,
anim: 5
});
}
// 获取参数
function getReqParams(page, limit, type) {
var obj = {};
@ -251,14 +278,18 @@ function getReqParams(page, limit, type) {
page: page + "",
limit: limit + "",
baleNum: $('#baleNum').val(),
operateTime: $('#operateTime').val()
operateTime: $('#operateTime').val(),
startDate: $('#operateTime').val() ? $('#operateTime').val().split(' - ')[0] : '',
endDate: $('#operateTime').val() ? $('#operateTime').val().split(' - ')[1] : '',
};
} else {
obj = {
page: '1',
limit: '10',
keyWord: '',
operateTime: ''
operateTime: '',
startDate: $('#operateTime').val() ? $('#operateTime').val().split(' - ')[0] : '',
endDate: $('#operateTime').val() ? $('#operateTime').val().split(' - ')[1] : '',
};
}
@ -278,57 +309,62 @@ function reloadData() {
}
function exportData() {
let token = tokens;
let loadingMsg = layer.msg(export_data_tip, {icon: 16, scrollbar: false, time: 0});
let url = ctxPath + "/proportion/export?baleNum=" + $('#baleNum').val().trim() + "&operateTime=" + $("#operateTime").val().trim()+ "&token=" + token;
if(isOnline === '1'){
exportDataByRollAngle();
}else{
let token = tokens;
let loadingMsg = layer.msg(export_data_tip, {icon: 16, scrollbar: false, time: 0});
let url = ctxPath + "/proportion/export?baleNum=" + $('#baleNum').val().trim() + "&operateTime=" + $("#operateTime").val().trim()+ "&token=" + token;
let xhr = new XMLHttpRequest();
xhr.open("get", url, true);
xhr.responseType = "blob"; // 转换流
xhr.onload = function () {
layer.close(loadingMsg);
if (this.status === 200) {
let blob = this.response;
var a = document.createElement("a");
let url = window.URL.createObjectURL(blob);
a.href = url;
a.download = roll_Angle_ratio_excel; // 文件名
}else {
layer.msg(export_error_tip, {icon: 16, scrollbar: false, time: 2000});
}
a.click();
window.URL.revokeObjectURL(url)
};
xhr.send();
}
}
// 导出数据
function exportDataByRollAngle(){
let obj = {
startDate: $('#operateTime').val() ? $('#operateTime').val().split(' - ')[0] : '',
endDate: $('#operateTime').val() ? $('#operateTime').val().split(' - ')[1] : '',
}
let params = {
encryptedData: encryptCBC(JSON.stringify(obj))
}
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
let url = dataUrl + "/rollAngle/downloadExcel?token=" + tokens + "&encryptedData=" + encodeURIComponent(encryptCBC(JSON.stringify(obj)));
let xhr = new XMLHttpRequest();
xhr.open("get", url, true);
xhr.responseType = "blob"; // 转换流
xhr.open("post", url, true);
xhr.responseType = "blob"; // 转换流
xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8')
xhr.onload = function () {
layer.close(loadingMsg);
if (this.status === 200) {
let blob = this.response;
var a = document.createElement("a");
let url = window.URL.createObjectURL(blob);
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = roll_Angle_ratio_excel; // 文件名
}else {
layer.msg(export_error_tip, {icon: 16, scrollbar: false, time: 2000});
} else {
layer.msg("数据导出发生异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000});
}
a.click();
window.URL.revokeObjectURL(url)
window.URL.revokeObjectURL(url);
};
xhr.send();
}
/*删除数据*/
function delData(id) {
layer.confirm(delete_tip, {
move: false,
title:message, // 设置弹框标题
btn:([confirm, cancel]), // 设置按钮内容
}, function (index) {
// 在这里设置按钮内容和标题
let loadingMsg = layer.msg(delete_tip2, {icon: 16, scrollbar: false, time: 0});
let url = dataUrl + "/dayDefectRate/delTowsData";
let params = {
id
}
params={
encryptedData:encryptCBC(JSON.stringify(params))
}
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
layer.close(loadingMsg); // 关闭提示层
if (result.code === 200) {
parent.layer.msg(result.msg, {icon: 1})
reloadData();
} else if (result.code === 500) {
layer.alert(result.msg, {icon: 2})
}
}, function (xhr) {
layer.close(loadingMsg); // 关闭提示层
error(xhr)
});
})
}

View File

@ -87,6 +87,7 @@
let number_of_cuts=[[#{number_of_cuts}]];//切断个数
let cut_off_area=[[#{cut_off_area}]];//切断面积
let proportion_of_cutting_area=[[#{proportion_of_cutting_area}]];//切断面积占比
let roll_angle_rate=[[#{roll_angle_rate}]];//rollAngle占比
let operate =[[#{operate}]]; // 操作