This commit is contained in:
caozehui
2025-03-12 15:04:01 +08:00
parent c80ae2f95f
commit 1c014a75a7
11 changed files with 52 additions and 19 deletions

View File

@@ -780,7 +780,7 @@ public class SocketDevResponseService {
if (param.getOperateType().equals(SourceOperateCodeEnum.RE_ERROR_TEST.getValue())) {
//不合格项复检
StorageParam storageParam = new StorageParam();
storageParam.setCode(Integer.valueOf(param.getCode()));
storageParam.setCode(param.getCode());
storageParam.setScriptId(param.getScriptId());
List<Integer> indexes = adHarmonicService.getIndex(storageParam, true);
issueParam.setIndexList(indexes);

View File

@@ -379,7 +379,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
// scriptDtlsList = scriptDtlsList.stream().filter(obj -> !sortSet.contains(obj.getScriptIndex())).collect(Collectors.toList());
// }
StorageParam storageParam = new StorageParam();
storageParam.setCode(Integer.valueOf(adPlan.getCode()));
storageParam.setCode(adPlan.getCode()+"");
storageParam.setScriptId(adPlan.getScriptId());
List<Integer> indexes = adHarmonicService.getIndex(storageParam, true);
scriptDtlsList = scriptDtlsList.stream().filter(obj -> indexes.contains(obj.getScriptIndex())).collect(Collectors.toList());

View File

@@ -6,7 +6,6 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.LogUtil;
import com.njcn.gather.device.pojo.param.PqDevParam;
import com.njcn.gather.result.pojo.param.ResultParam;
import com.njcn.gather.result.pojo.vo.FormContentVO;
import com.njcn.gather.result.pojo.vo.ResultVO;
@@ -20,10 +19,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -98,4 +94,16 @@ public class ResultController extends BaseController {
resultService.changeErrorSystem(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
@GetMapping("/deleteTempTable")
@ApiOperation("删除临时表")
@ApiImplicitParam(name = "param", value = "删除参数", required = true)
public HttpResult<Object> deleteTempTable(@RequestParam("code") String code) {
String methodDescribe = getMethodDescribe("deleteTempTable");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, code);
resultService.deleteTempTable(code);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -38,7 +38,7 @@ public class ResultParam {
/**
* 自动生成,用于生成数据表后缀
*/
private Integer code;
private String code;
/**
* 检测脚本序号
@@ -86,6 +86,6 @@ public class ResultParam {
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR)
private String deviceId;
private Integer code;
private String code;
}
}

View File

@@ -52,4 +52,11 @@ public interface IResultService {
* @param param
*/
void changeErrorSystem(ResultParam.ChangeErrorSystemParam param);
/**
* 删除(更换误差体系时产生的)临时表
*
* @param code
*/
void deleteTempTable(String code);
}

View File

@@ -106,13 +106,13 @@ public class ResultServiceImpl implements IResultService {
DictTree dictTree = dictTreeService.getById(queryParam.getScriptType());
if (HARMONIC_TYPE_CODE.contains(dictTree.getCode())) {
allResultList.addAll(adHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
allResultList.addAll(adHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
} else {
allResultList.addAll(adNonHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
allResultList.addAll(adNonHarmonicService.get(scriptId, indexList, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
}
} else { //查询所有的脚本类型
allResultList.addAll(adHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
allResultList.addAll(adNonHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode()));
allResultList.addAll(adHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
allResultList.addAll(adNonHarmonicService.get(scriptId, null, queryParam.getDeviceId(), queryParam.getChnNum(), plan.getCode() + ""));
}
@@ -866,6 +866,11 @@ public class ResultServiceImpl implements IResultService {
this.insertTempResultTable(param.getPlanId(), param.getScriptId(), param.getCode() + "", param.getErrorSysId(), param.getDeviceId());
}
@Override
public void deleteTempTable(String code) {
this.dropTempResultTable(code);
}
private Integer conform(Set<Integer> numbers) {
if (CollUtil.isNotEmpty(numbers)) {
if (numbers.size() > 1) {
@@ -894,7 +899,7 @@ public class ResultServiceImpl implements IResultService {
* @param code
*/
private void createTempResultTable(String code) {
tableGenMapper.genAdHarmonicTable("drop table if exists AD_Non_Harmonic_Result_" + code + "_temp,AD_Harmonic_Result_" + code + "_temp");
this.dropTempResultTable(code);
tableGenMapper.genAdNonHarmonicResultTable(code + "_temp");
StringBuilder A = new StringBuilder();
StringBuilder B = new StringBuilder();
@@ -922,6 +927,19 @@ public class ResultServiceImpl implements IResultService {
" PRIMARY KEY (Monitor_Id, Script_Id, Sort, AD_Type)\n" +
") COMMENT='监测数据表';";
tableGenMapper.genAdHarmonicTable(sql1);
sql1 = "CREATE TABLE ad_non_harmonic_" + code + "_temp " + "LIKE ad_non_harmonic_" + code;
tableGenMapper.genAdHarmonicTable(sql1);
sql1 = "INSERT INTO ad_non_harmonic_" + code + "_temp " + "SELECT * FROM ad_non_harmonic_" + code;
tableGenMapper.genAdHarmonicTable(sql1);
sql1 = "CREATE TABLE ad_harmonic_" + code + "_temp " + "LIKE ad_harmonic_" + code;
tableGenMapper.genAdHarmonicTable(sql1);
sql1 = "INSERT INTO ad_harmonic_" + code + "_temp " + "SELECT * FROM ad_harmonic_" + code;
tableGenMapper.genAdHarmonicTable(sql1);
}
private void dropTempResultTable(String code) {
tableGenMapper.genAdHarmonicTable("drop table if exists AD_Non_Harmonic_Result_" + code + "_temp,AD_Harmonic_Result_" + code + "_temp," + "ad_non_harmonic_" + code + "_temp," + "ad_harmonic_" + code + "_temp");
}
/**

View File

@@ -35,7 +35,7 @@ public class StorageParam {
/**
* 自动生成,用于生成数据表后缀
*/
private Integer code;
private String code;
/**
* 谐波次数

View File

@@ -26,7 +26,7 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
* @param code 计划code
* @return 谐波结果
*/
List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum, Integer code);
List<AdBaseResult> get(String scriptId, List<Integer> index, String deviceId, String chnNum, String code);
/**
* 查询原始数据

View File

@@ -23,7 +23,7 @@ public interface AdNonHarmonicService extends IService<AdNonHarmonicResult> {
* @param chnNum 通道号从1开始
* @return 非谐波结果
*/
List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, Integer code);
List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, String code);
/**
* 非谐波原始数据展示

View File

@@ -47,7 +47,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
private final DictTreeMapper dictTreeMapper;
@Override
public List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, Integer code) {
public List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, String code) {
String prefix = "ad_harmonic_result_";
DynamicTableNameHandler.setTableName(prefix + code);
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();

View File

@@ -41,7 +41,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
private final IDictTreeService dictTreeService;
@Override
public List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, Integer code) {
public List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, String code) {
String prefix = "ad_non_harmonic_result_";
DynamicTableNameHandler.setTableName(prefix + code);