bug修复
This commit is contained in:
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
public class PqDevParam {
|
||||
|
||||
@ApiModelProperty(value = "名称", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
|
||||
@@ -40,8 +41,9 @@ public class PqDevParam {
|
||||
@ApiModelProperty(value = "出厂日期", required = true)
|
||||
private String createDate;
|
||||
|
||||
@ApiModelProperty(value = "设备序列号", required = true)
|
||||
@ApiModelProperty(value = "装置编号", required = true)
|
||||
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DEV_CREATE_ID_REGEX, message = DetectionValidMessage.DEV_CREATE_ID_FORMAT_ERROR)
|
||||
private String createId;
|
||||
|
||||
@ApiModelProperty(value = "固件版本", required = true)
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CNDevExcel {
|
||||
|
||||
@Excel(name = "设备编号(开始编号-结束编号,编号为数字)*", width = 50, orderNum = "2")
|
||||
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||
@Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX_IMPORT, message = DetectionValidMessage.CN_DEV_NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "设备类型*", width = 20, orderNum = "3")
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
@@ -31,11 +32,7 @@ import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.report.pojo.DevReportParam;
|
||||
import com.njcn.gather.report.service.IPqReportService;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import com.njcn.gather.system.cfg.pojo.enums.SceneEnum;
|
||||
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
|
||||
@@ -49,7 +46,6 @@ import com.njcn.gather.type.service.IDevTypeService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -61,6 +57,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -113,15 +110,10 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
|
||||
PqDev pqDev = new PqDev();
|
||||
BeanUtil.copyProperties(pqDevParam, pqDev);
|
||||
if (pqDevParam.getEncryptionFlag() == 1) {
|
||||
if (StrUtil.isNotBlank(pqDevParam.getSeries()) && StrUtil.isNotBlank(pqDevParam.getDevKey())) {
|
||||
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
|
||||
pqDev.setDevKey(EncryptionUtil.encodeString(1, pqDev.getDevKey()));
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
if ("1".equals(sysTestConfigService.getCurrrentScene())) {
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
this.checkParams(pqDev, currrentScene);
|
||||
|
||||
if (SceneEnum.LEAVE_FACTORY_TEST.getValue().equals(currrentScene)) {
|
||||
pqDev.setManufacturer("8fa73802c9e1abab973adcbeb0d58567"); // 南京灿能字典项目对应的id
|
||||
}
|
||||
// 新增时默认设置
|
||||
@@ -143,13 +135,14 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return this.save(pqDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean updatePqDev(PqDevParam.UpdateParam updateParam) {
|
||||
this.checkRepeat(updateParam, true);
|
||||
|
||||
PqDev pqDev = new PqDev();
|
||||
BeanUtil.copyProperties(updateParam, pqDev);
|
||||
/**
|
||||
* 校验参数
|
||||
*
|
||||
* @param pqDev
|
||||
* @param currrentScene
|
||||
*/
|
||||
private void checkParams(PqDev pqDev, String currrentScene) {
|
||||
SceneEnum sceneEnum = SceneEnum.getSceneEnum(currrentScene);
|
||||
if (pqDev.getEncryptionFlag() == 1) {
|
||||
if (StrUtil.isNotBlank(pqDev.getSeries()) && StrUtil.isNotBlank(pqDev.getDevKey())) {
|
||||
pqDev.setSeries(EncryptionUtil.encodeString(1, pqDev.getSeries()));
|
||||
@@ -158,6 +151,34 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
throw new BusinessException(DetectionResponseEnum.SERIES_AND_DEVKEY_NOT_BLANK);
|
||||
}
|
||||
}
|
||||
switch (sceneEnum) {
|
||||
case PROVINCE_PLATFORM:
|
||||
if(!Pattern.matches(PatternRegex.PROVINCE_DEV_NAME_REGEX, pqDev.getName())){
|
||||
throw new BusinessException(DetectionResponseEnum.PROVINCE_DEV_NAME_FORMAT_ERROR);
|
||||
}
|
||||
break;
|
||||
case LEAVE_FACTORY_TEST:
|
||||
if (!Pattern.matches(PatternRegex.CN_DEV_NAME_REGEX, pqDev.getName())) {
|
||||
throw new BusinessException(DetectionResponseEnum.CN_DEV_NAME_FORMAT_ERROR);
|
||||
}
|
||||
break;
|
||||
case SELF_TEST:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean updatePqDev(PqDevParam.UpdateParam updateParam) {
|
||||
this.checkRepeat(updateParam, true);
|
||||
|
||||
PqDev pqDev = new PqDev();
|
||||
BeanUtil.copyProperties(updateParam, pqDev);
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
this.checkParams(pqDev, currrentScene);
|
||||
|
||||
// 比对式设备修改监测点
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictDataService.getDictDataById(updateParam.getPattern()).getCode())) {
|
||||
if (ObjectUtil.isNotEmpty(updateParam.getMonitorList())) {
|
||||
@@ -344,23 +365,22 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
this.lambdaUpdate().set(PqDev::getPlanId, planId).in(PqDev::getId, devIds).update();
|
||||
List<PqDev> list = this.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, devIds));
|
||||
//判断是否有处了未检的其他设备
|
||||
List<Integer> notUnchecked = list.stream().map(PqDev::getCheckState).filter(x -> !x.equals(CheckStateEnum.UNCHECKED.getValue())).distinct().collect(Collectors.toList());
|
||||
List<String> notUnchecked = list.stream().filter(x -> !CheckStateEnum.UNCHECKED.getValue().equals(x.getCheckState())).map(PqDev::getId).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(notUnchecked)) {
|
||||
List<Integer> unchecked = list.stream().map(PqDev::getCheckState).filter(x -> x.equals(CheckStateEnum.UNCHECKED.getValue())).distinct().collect(Collectors.toList());
|
||||
List<String> unchecked = list.stream().filter(x -> CheckStateEnum.UNCHECKED.getValue().equals(x.getCheckState())).map(PqDev::getId).distinct().collect(Collectors.toList());
|
||||
//计划未检测
|
||||
if (CollUtil.isNotEmpty(unchecked)) {
|
||||
return CheckStateEnum.CHECKING.getValue();
|
||||
}
|
||||
//计划检测中
|
||||
List<String> checking = list.stream().filter(x -> CheckStateEnum.CHECKING.getValue().equals(x.getCheckState()) ||
|
||||
CheckStateEnum.CHECKED.getValue().equals(x.getCheckState()) ||
|
||||
List<String> checking = list.stream().filter(x -> x.getCheckState().equals(CheckStateEnum.CHECKED.getValue()) &&
|
||||
!DevDocumentStateEnum.DOCUMENTED.getValue().equals(x.getReportState())
|
||||
).map(PqDev::getId).distinct().collect(Collectors.toList());
|
||||
if (checking.size() == notUnchecked.size()) {
|
||||
return CheckStateEnum.CHECKING.getValue();
|
||||
}
|
||||
//检测完成
|
||||
List<Integer> checked = list.stream().map(PqDev::getCheckState).filter(x -> x.equals(CheckStateEnum.DOCUMENTED.getValue())).distinct().collect(Collectors.toList());
|
||||
List<String> checked = list.stream().filter(x -> CheckStateEnum.DOCUMENTED.getValue().equals(x.getCheckState())).map(PqDev::getId).distinct().collect(Collectors.toList());
|
||||
if (checked.size() == notUnchecked.size()) {
|
||||
return CheckStateEnum.CHECKED.getValue();
|
||||
}
|
||||
@@ -499,7 +519,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateResult(List<String> ids, List<String> valueType, String code,String userId) {
|
||||
public boolean updateResult(List<String> ids, List<String> valueType, String code, String userId) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
SysTestConfig config = sysTestConfigService.getOneConfig();
|
||||
Map<String, Integer> result = detectionDataDealService.devResult(ids, valueType, code);
|
||||
@@ -903,8 +923,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
|
||||
// 是否支持系数校准
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(startCol + 8);
|
||||
pullDown.setLastCol(startCol + 8);
|
||||
pullDown.setFirstCol(startCol + 7);
|
||||
pullDown.setLastCol(startCol + 7);
|
||||
pullDown.setStrings(Arrays.asList("是", "否"));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user