sonarqube质量修复

This commit is contained in:
gaoqr
2024-10-09 15:45:08 +08:00
parent 220d0ff28a
commit c0cc38c691
59 changed files with 481 additions and 701 deletions
@@ -5,7 +5,7 @@ package com.cf.imes.module.manage.enums;
*
* @author 晨丰科技
*/
public interface DictTypeConstants {
public class DictTypeConstants {
String PLATE_TEXTURE = "plate_texture_type";// 板件纹里
public static final String PLATE_TEXTURE = "plate_texture_type";// 板件纹里
}
@@ -1,11 +1,5 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
package com.cf.imes.module.manage.controller.admin.test;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Base64;
import java.io.ByteArrayOutputStream;
import java.util.zip.DataFormatException;
@@ -13,17 +7,10 @@ import java.util.zip.Deflater;
import java.util.zip.Inflater;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public class JsonUtil {
@@ -73,27 +60,6 @@ public class JsonUtil {
" \"prepareTime\": 0,\n" +
" \"description\": \"2024年5月30日\",\n" +
" \"organId\": 1\n" +
" },\n" +
" {\n" +
" \"createTime\": 1716191704000,\n" +
" \"updateTime\": 1716280724000,\n" +
" \"creator\": \"晨丰科技\",\n" +
" \"updater\": \"晨丰科技\",\n" +
" \"deleted\": false,\n" +
" \"id\": 355,\n" +
" \"name\": \"测试编辑dvdvd工序\",\n" +
" \"pieceRate\": 985,\n" +
" \"pieceType\": 7,\n" +
" \"type\": 2,\n" +
" \"isCustom\": true,\n" +
" \"isDealer\": false,\n" +
" \"sort\": 1001,\n" +
" \"hourCapacity\": 41,\n" +
" \"unit\": \"\",\n" +
" \"isEnabled\": true,\n" +
" \"prepareTime\": 0,\n" +
" \"description\": \"测试test69dvdvd9\",\n" +
" \"organId\": 1\n" +
" }\n" +
" ],\n" +
" \"msg\": \"\"\n" +
@@ -164,23 +130,24 @@ public class JsonUtil {
//设置解压缩的输入数据。
inflater.setInput(decode);
final byte[] bytes = new byte[256];
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
try {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256)) {
//finished() 如果已到达压缩数据流的末尾,则返回true。
while (!inflater.finished()) {
//将字节解压缩到指定的缓冲区中。
int length = inflater.inflate(bytes);
outputStream.write(bytes, 0, length);
}
return outputStream.toString();
} catch (DataFormatException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
//关闭解压缩器并丢弃任何未处理的输入。
inflater.end();
}
return outputStream.toString();
}
@@ -1,14 +1,6 @@
package com.cf.imes.module.manage.controller.admin.test;
import com.cf.imes.framework.common.util.json.JsonUtils;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.module.manage.controller.admin.patching.vo.PatchingDetailRespVO;
import com.cf.imes.module.manage.controller.admin.patching.vo.PatchingPlateRespVO;
import com.cf.imes.module.manage.dal.dataobject.process.OrderProcessStepItemNDO;
import com.cf.imes.module.manage.dal.mysql.plate.OrderPlateMapper;
import com.cf.imes.module.manage.dal.mysql.process.ProcessStepItemMapper;
import com.cf.imes.module.manage.dal.mysql.test.TestMapper;
import com.jacob.com.ComThread;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -27,23 +19,8 @@ import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import javax.sound.sampled.*;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.net.Socket;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import java.util.Random;
@@ -60,8 +37,6 @@ public class TestController {
private TestMapper testMapper;
@GetMapping("/get")
@PermitAll
@Operation(summary = "测试")
@@ -172,28 +147,22 @@ public class TestController {
}
public static Integer aacc(){
public static Integer aacc() {
RedisTemplate<Object, Object> re = new RedisTemplate<>();
int randomInt = new Random(System.currentTimeMillis()).nextInt(900) + 100;// 生成100到999之间的随机数
return randomInt;
}
@TestOnly
public static void main(String[] args) {
}
@TestOnly
public static void main(String[] args) {
// test main
}
}
@@ -51,6 +51,9 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
case "height" -> queryWrapper.orderByAsc(PlateDO::getHeight);
case "thickness" -> queryWrapper.orderByAsc(PlateDO::getThickness);
case "brand" -> queryWrapper.orderByAsc(PlateDO::getBrand);
default -> {
// default不排序
}
}
}else if (reqVO.getOrder().equals("descend")) {
switch (reqVO.getField()) {
@@ -63,6 +66,9 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
case "height" -> queryWrapper.orderByDesc(PlateDO::getHeight);
case "thickness" -> queryWrapper.orderByDesc(PlateDO::getThickness);
case "brand" -> queryWrapper.orderByDesc(PlateDO::getBrand);
default -> {
// default不排序
}
}
}
}
@@ -63,6 +63,9 @@ public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
case "initPlanId" -> wrapper.orderByAsc(RemainPlateDO::getInitPlanId);
case "planId" -> wrapper.orderByAsc(RemainPlateDO::getPlanId);
case "status" -> wrapper.orderByAsc(RemainPlateDO::getStatus);
default -> {
// default不排序
}
}
}else if (reqVO.getOrder().equals("descend")) {
switch (reqVO.getField()) {
@@ -78,6 +81,9 @@ public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
case "initPlanId" -> wrapper.orderByDesc(RemainPlateDO::getInitPlanId);
case "planId" -> wrapper.orderByDesc(RemainPlateDO::getPlanId);
case "status" -> wrapper.orderByDesc(RemainPlateDO::getStatus);
default -> {
// default不排序
}
}
}
}
@@ -1,7 +1,7 @@
package com.cf.imes.module.manage.service.pack;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.cf.imes.framework.common.enums.OrderItemTypeEnum;
@@ -137,7 +137,7 @@ public class PackServiceImpl implements PackService {
// 查询查询分页
packRespVOS = ordersMapper.selectOrderIdList(page, pageReqVO, getUserOrganId());
if (CollectionUtil.isEmpty(packRespVOS.getRecords())) {
if (CollUtil.isEmpty(packRespVOS.getRecords())) {
return new PageResult<>();
}
@@ -336,7 +336,7 @@ public class PackServiceImpl implements PackService {
IPage<OrderPackageVO> orderPackageDOIPage = orderPackageMapper.selectByOrderNo(page, queryWrapperX);
if (CollectionUtil.isEmpty(orderPackageDOIPage.getRecords())) {
if (CollUtil.isEmpty(orderPackageDOIPage.getRecords())) {
return new PageResult<>();
}
@@ -10,8 +10,8 @@ import com.cf.imes.module.manage.dal.mysql.patching.MachineMapper;
import com.cf.imes.module.manage.dal.mysql.patching.PatchDetailMapper;
import com.cf.imes.module.manage.dal.mysql.plate.OrderPlateMapper;
import com.cf.imes.module.manage.util.page.PageHelperUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -52,7 +52,7 @@ public class PatchingPlateServiceImpl implements PatchingPlateService{
public PageResult<PatchingDetailRespVO> searchPlateDetail(PatchingPlatePageReqVO pageReqVO) {
// 查询每个订单对应的板件的详细信息
PageHelper.startPage(pageReqVO.getPageNo(), pageReqVO.getPageSize());
PageMethod.startPage(pageReqVO.getPageNo(), pageReqVO.getPageSize());
List<PatchingDetailRespVO> plateDetailsRespVOS = orderPlateMapper.selectPlateDetail(pageReqVO);
//
@@ -1,15 +1,10 @@
package com.cf.imes.module.manage.service.plate;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.EasyExcelFactory;
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlateImportExcelVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -36,7 +31,7 @@ public class PlateExcelUtil {
value = "文件大小为 0";
throw new IOException("文件大小为 0");
} else {
EasyExcel.read(file.getInputStream(), PlateImportExcelVO.class, excelListener)
EasyExcelFactory.read(file.getInputStream(), PlateImportExcelVO.class, excelListener)
.autoCloseStream(true) // 不要自动关闭,交给 Servlet 自己处理
.headRowNumber(1).sheet(0).doRead();
//获取读取的数据
@@ -1,7 +1,7 @@
package com.cf.imes.module.manage.service.process;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.cf.imes.framework.common.enums.OrderStatusEnum;
@@ -100,7 +100,7 @@ public class ProductionProcessServiceImpl implements ProductionProcessService {
return null;
}
if (CollectionUtil.isEmpty(processRespVOS.getRecords())) {
if (CollUtil.isEmpty(processRespVOS.getRecords())) {
return new PageResult<>();
}
@@ -1,7 +1,7 @@
package com.cf.imes.module.manage.service.query;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.cf.imes.framework.common.enums.OrderPackageTypeEnum;
@@ -16,16 +16,14 @@ import com.cf.imes.module.manage.controller.admin.query.vo.salary.PriceRatePageR
import com.cf.imes.module.manage.controller.admin.query.vo.salary.PriceRateReqVO;
import com.cf.imes.module.manage.dal.dataobject.process.OrderDO;
import com.cf.imes.module.manage.dal.dataobject.process.OrderProcessStepNDO;
import com.cf.imes.module.manage.dal.mysql.pack.OrderPackageMapper;
import com.cf.imes.module.manage.dal.mysql.plate.OrderPlateMapper;
import com.cf.imes.module.manage.dal.mysql.process.OrdersMapper;
import com.cf.imes.module.manage.dal.mysql.process.ProcessStepItemMapper;
import com.cf.imes.module.manage.dal.mysql.process.ProcessStepMapper;
import com.cf.imes.module.manage.dal.mysql.query.OrderItemMapper;
import com.cf.imes.module.manage.dal.mysql.query.OrderPartsMapper;
import com.cf.imes.module.manage.util.page.PageHelperUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@@ -45,13 +43,6 @@ public class ProductionStatusServiceImpl implements ProductionStatusService {
@Resource
private ProcessStepMapper processStepMapper;
@Resource
private ProcessStepItemMapper processStepItemMapper;
@Resource
private OrderPackageMapper orderPackageMapper;
@Resource
private OrdersMapper ordersMapper;
@@ -108,7 +99,7 @@ public class ProductionStatusServiceImpl implements ProductionStatusService {
public PageResult<OrderPlateRespVO> getOrderPlatePage(PlatePageVO pageReqVO) {
PageHelper.startPage(pageReqVO.getPageNo(), pageReqVO.getPageSize());
PageMethod.startPage(pageReqVO.getPageNo(), pageReqVO.getPageSize());
List<OrderPlateRespVO> orderPlateRespVOS = orderItemMapper.selectPlateList(pageReqVO);
PageInfo<OrderPlateRespVO> pageInfo = new PageInfo<>(orderPlateRespVOS);
PageResult<OrderPlateRespVO> priceRateReqVOPageResult = PageHelperUtil.convertToPageResult(pageInfo);
@@ -128,7 +119,7 @@ public class ProductionStatusServiceImpl implements ProductionStatusService {
IPage<PriceRateReqVO> priceRateReqVOS = processStepMapper.selectSalaryList(page,pageReqVO,getUserOrganId());
if (CollectionUtil.isEmpty(priceRateReqVOS.getRecords())) {
if (CollUtil.isEmpty(priceRateReqVOS.getRecords())) {
return new PageResult<>();
}
@@ -189,7 +180,7 @@ public class ProductionStatusServiceImpl implements ProductionStatusService {
// 查看配件包裹
IPage<PackageDetailsRespVO> packageDetailsRespVOS = orderPartsMapper.selectParts(page,reqVO.getPackageId(),getUserOrganId());
if (CollectionUtil.isEmpty(packageDetailsRespVOS.getRecords())) {
if (CollUtil.isEmpty(packageDetailsRespVOS.getRecords())) {
return new PageResult<>();
}
@@ -201,7 +192,7 @@ public class ProductionStatusServiceImpl implements ProductionStatusService {
// 查看板材包裹
IPage<PackageDetailsRespVO> packageDetailsRespVOS = orderPlateMapper.selectPackPlateList(page,reqVO.getPackageId(),getUserOrganId());
if (CollectionUtil.isEmpty(packageDetailsRespVOS.getRecords())) {
if (CollUtil.isEmpty(packageDetailsRespVOS.getRecords())) {
return new PageResult<>();
}
@@ -40,6 +40,7 @@ public class SnowflakeIdWorker3rd {
// ==============================Constructors=====================================
public SnowflakeIdWorker3rd() {
// No Args Constructors
}
// ==============================Test=============================================