diff --git a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java index eb039cbb..6b981425 100644 --- a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java +++ b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java @@ -63,6 +63,11 @@ public class PreDetectionController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } + /** + * 程控源-源通讯校验 + * @param param + * @return + */ @PostMapping("/ytxCheckSimulate") @OperateInfo @ApiOperation("源通讯校验") @@ -74,7 +79,7 @@ public class PreDetectionController extends BaseController { } /** - * 模拟检测 + * 程控源检测 */ @PostMapping("/startSimulateTest") @OperateInfo @@ -87,7 +92,7 @@ public class PreDetectionController extends BaseController { } /** - * 关闭检测 + * 关闭检测-程控源 */ @PostMapping("/closeSimulateTest") @OperateInfo diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index 0130c04f..00b75ecd 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -1074,7 +1074,7 @@ public class SocketDevResponseService { checkDataParam.setIsValueTypeName(false); List valueType = iPqScriptCheckDataService.getValueType(checkDataParam); - iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode()); + iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(),param.getUserId()); CnSocketUtil.quitSend(param); } successComm.clear(); diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java b/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java index 00f9b7b3..51a8f4ec 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java @@ -63,4 +63,6 @@ public class PreDetectionParam { private String code; private Boolean sendWebMsg; + + private String userId; } diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java index 86d563d7..f8a404e0 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java @@ -209,7 +209,7 @@ public class PreDetectionServiceImpl implements PreDetectionService { checkDataParam.setIsValueTypeName(false); List valueType = iPqScriptCheckDataService.getValueType(checkDataParam); - iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode()); + iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(),param.getUserId()); CnSocketUtil.quitSend(param); } diff --git a/detection/src/main/java/com/njcn/gather/device/controller/PqDevController.java b/detection/src/main/java/com/njcn/gather/device/controller/PqDevController.java index 36e89764..488de871 100644 --- a/detection/src/main/java/com/njcn/gather/device/controller/PqDevController.java +++ b/detection/src/main/java/com/njcn/gather/device/controller/PqDevController.java @@ -140,7 +140,7 @@ public class PqDevController extends BaseController { @ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true), @ApiImplicitParam(name = "patternId", value = "模式id", required = true) }) - public HttpResult importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) { + public HttpResult importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) { String methodDescribe = getMethodDescribe("importDev"); LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename()); boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename()); @@ -187,14 +187,14 @@ public class PqDevController extends BaseController { @PostMapping("/documented") @ApiOperation("设备归档") @ApiImplicitParam(name = "id", value = "设备id", required = true) - public HttpResult> documented(@RequestBody List ids) { + public HttpResult documented(@RequestBody List ids) { String methodDescribe = getMethodDescribe("documented"); LogUtil.njcnDebug(log, "{},设备id为:{}", methodDescribe, ids); boolean result = pqDevService.documented(ids); if (result) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe); } } } diff --git a/detection/src/main/java/com/njcn/gather/device/mapper/PqDevMapper.java b/detection/src/main/java/com/njcn/gather/device/mapper/PqDevMapper.java index e6206dfa..f939aa9f 100644 --- a/detection/src/main/java/com/njcn/gather/device/mapper/PqDevMapper.java +++ b/detection/src/main/java/com/njcn/gather/device/mapper/PqDevMapper.java @@ -41,5 +41,12 @@ public interface PqDevMapper extends MPJBaseMapper { * @param testState */ void updatePlanTestState(@Param("planId")String planId, @Param("testState")Integer testState); + + /** + * 根据计划id获取脚本id + * + * @param planId + */ + String getScriptIdByPlanId(String planId); } diff --git a/detection/src/main/java/com/njcn/gather/device/mapper/mapping/PqDevMapper.xml b/detection/src/main/java/com/njcn/gather/device/mapper/mapping/PqDevMapper.xml index 5815d40a..df97f298 100644 --- a/detection/src/main/java/com/njcn/gather/device/mapper/mapping/PqDevMapper.xml +++ b/detection/src/main/java/com/njcn/gather/device/mapper/mapping/PqDevMapper.xml @@ -66,6 +66,8 @@ update ad_plan set Test_State = #{testState} where id = #{planId} - + diff --git a/detection/src/main/java/com/njcn/gather/device/service/IPqDevService.java b/detection/src/main/java/com/njcn/gather/device/service/IPqDevService.java index aae756ad..6f2f5063 100644 --- a/detection/src/main/java/com/njcn/gather/device/service/IPqDevService.java +++ b/detection/src/main/java/com/njcn/gather/device/service/IPqDevService.java @@ -151,9 +151,10 @@ public interface IPqDevService extends IService { * @param ids * @param valueType * @param code + * @param userId * @return */ - boolean updateResult(List ids, List valueType, String code); + boolean updateResult(List ids, List valueType, String code,String userId); void updatePqDevReportState(String devId, int i); diff --git a/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java b/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java index dd396ef3..dd04bcc6 100644 --- a/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java @@ -31,7 +31,11 @@ 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; @@ -495,11 +499,12 @@ public class PqDevServiceImpl extends ServiceImpl implements } @Override - public boolean updateResult(List ids, List valueType, String code) { + public boolean updateResult(List ids, List valueType, String code,String userId) { if (CollUtil.isNotEmpty(ids)) { SysTestConfig config = sysTestConfigService.getOneConfig(); Map result = detectionDataDealService.devResult(ids, valueType, code); List list = this.list(new LambdaQueryWrapper().in(PqDev::getId, ids)); + for (PqDev pqDev : list) { if (result.containsKey(pqDev.getId())) { Integer checkState; @@ -518,7 +523,7 @@ public class PqDevServiceImpl extends ServiceImpl implements .set(PqDev::getReCheckNum, i) .set(PqDev::getCheckState, checkState) .set(PqDev::getCheckResult, result.get(pqDev.getId())) - .set(PqDev::getCheckBy, RequestUtil.getUserId()) + .set(PqDev::getCheckBy, userId) .set(PqDev::getCheckTime, LocalDateTime.now()) .set(PqDev::getReportState, DevReportStateEnum.NOT_GENERATED.getValue()) .eq(PqDev::getId, pqDev.getId())); diff --git a/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java b/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java index 7c47388e..5e5ce876 100644 --- a/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java +++ b/detection/src/main/java/com/njcn/gather/plan/controller/AdPlanController.java @@ -136,7 +136,7 @@ public class AdPlanController extends BaseController { @ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true), @ApiImplicitParam(name = "pattern", value = "模式Id", required = true) }) - public HttpResult importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) { + public HttpResult importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) { String methodDescribe = getMethodDescribe("importCNPlan"); LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename()); diff --git a/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java b/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java index 1204ba26..83b64c83 100644 --- a/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java +++ b/detection/src/main/java/com/njcn/gather/report/controller/ReportController.java @@ -17,6 +17,7 @@ import io.swagger.annotations.ApiImplicitParam; 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.*; import javax.servlet.http.HttpServletResponse; @@ -70,7 +71,7 @@ public class ReportController extends BaseController { @PostMapping("/list") @ApiOperation("分页查询报告模板") @ApiImplicitParam(name = "param", value = "查询参数", required = true) - public HttpResult> list(@RequestBody ReportParam.QueryParam queryParam) { + public HttpResult> list(@RequestBody @Validated ReportParam.QueryParam queryParam) { String methodDescribe = getMethodDescribe("list"); LogUtil.njcnDebug(log, "{},查询参数为:{}", methodDescribe, queryParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqReportService.list(queryParam), methodDescribe); @@ -90,7 +91,7 @@ public class ReportController extends BaseController { @PostMapping("/add") @ApiOperation("新增报告模板") @ApiImplicitParam(name = "param", value = "报告模板参数", required = true) - public HttpResult add(ReportParam reportParam) { + public HttpResult add(@RequestBody @Validated ReportParam reportParam) { String methodDescribe = getMethodDescribe("add"); LogUtil.njcnDebug(log, "{},新增参数为:{}", methodDescribe, reportParam); boolean result = pqReportService.add(reportParam); @@ -105,7 +106,7 @@ public class ReportController extends BaseController { @PostMapping("/update") @ApiOperation("更新报告模板") @ApiImplicitParam(name = "param", value = "报告模板参数", required = true) - public HttpResult update(ReportParam.UpdateParam reportParam) { + public HttpResult update(@RequestBody @Validated ReportParam.UpdateParam reportParam) { String methodDescribe = getMethodDescribe("update"); LogUtil.njcnDebug(log, "{},修改参数为:{}", methodDescribe, reportParam); boolean result = pqReportService.update(reportParam); diff --git a/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java b/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java index 60360b10..f753883f 100644 --- a/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java +++ b/detection/src/main/java/com/njcn/gather/result/controller/ResultController.java @@ -87,7 +87,7 @@ public class ResultController extends BaseController { @PostMapping("/reCalculate") @ApiOperation("重新计算检测结果") @ApiImplicitParam(name = "queryParam", value = "查询参数", required = true) - public HttpResult reCalculate(@RequestBody ResultParam.ChangeErrorSystemParam param) { + public HttpResult reCalculate(@RequestBody @Validated ResultParam.ChangeErrorSystemParam param) { String methodDescribe = getMethodDescribe("reCalculate"); LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param); @@ -100,7 +100,7 @@ public class ResultController extends BaseController { @PostMapping("/changeErrorSystem") @ApiOperation("更换误差体系") @ApiImplicitParam(name = "param", value = "修改参数", required = true) - public HttpResult changeErrorSystem(@RequestBody ResultParam.ChangeErrorSystemParam param) { + public HttpResult changeErrorSystem(@RequestBody @Validated ResultParam.ChangeErrorSystemParam param) { String methodDescribe = getMethodDescribe("changeErrorSystem"); LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param); diff --git a/detection/src/main/java/com/njcn/gather/script/controller/PqScriptController.java b/detection/src/main/java/com/njcn/gather/script/controller/PqScriptController.java index f2a3e5a8..e55cf12e 100644 --- a/detection/src/main/java/com/njcn/gather/script/controller/PqScriptController.java +++ b/detection/src/main/java/com/njcn/gather/script/controller/PqScriptController.java @@ -116,7 +116,7 @@ public class PqScriptController extends BaseController { @GetMapping("/upgradeToTemplate") @ApiOperation("升级为模板") @ApiImplicitParam(name = "id", value = "检测脚本id", required = true) - public HttpResult upgradeToTemplate(@RequestParam("id") String id, HttpServletRequest request) { + public HttpResult upgradeToTemplate(@RequestParam("id") String id) { String methodDescribe = getMethodDescribe("upgradeToTemplate"); LogUtil.njcnDebug(log, "{},升级ID数据为:{}", methodDescribe, id); boolean result = pqScriptService.upgradeToTemplate(id); diff --git a/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java b/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java index b5855a5c..8b70523c 100644 --- a/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java +++ b/system/src/main/java/com/njcn/gather/system/cfg/controller/SysTestConfigController.java @@ -62,9 +62,19 @@ public class SysTestConfigController extends BaseController { @GetMapping("/getCurrentScene") public HttpResult getCurrentScene() { String methodDescribe = getMethodDescribe("getCurrentScene"); - LogUtil.njcnDebug(log, "{},获取当前场景", methodDescribe); + LogUtil.njcnDebug(log, "{}", methodDescribe); String currrentScene = sysTestConfigService.getCurrrentScene(); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, currrentScene, methodDescribe); } + + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("获取是否在检测时同时生成报告") + @GetMapping("/getAutoGenerate") + public HttpResult getAutoGenerate() { + String methodDescribe = getMethodDescribe("getAutoGenerate"); + LogUtil.njcnDebug(log, "{}", methodDescribe); + Integer autoGenerate = sysTestConfigService.getAutoGenerate(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, autoGenerate, methodDescribe); + } } diff --git a/system/src/main/java/com/njcn/gather/system/cfg/service/ISysTestConfigService.java b/system/src/main/java/com/njcn/gather/system/cfg/service/ISysTestConfigService.java index fbd439db..00fef95b 100644 --- a/system/src/main/java/com/njcn/gather/system/cfg/service/ISysTestConfigService.java +++ b/system/src/main/java/com/njcn/gather/system/cfg/service/ISysTestConfigService.java @@ -37,4 +37,11 @@ public interface ISysTestConfigService extends IService { SysTestConfig getOneConfig(); String getCurrrentScene(); + + /** + * 获取是否在检测时自动生成报告 + * + * @return 0-否,1-是 + */ + Integer getAutoGenerate(); } diff --git a/system/src/main/java/com/njcn/gather/system/cfg/service/impl/SysTestConfigServiceImpl.java b/system/src/main/java/com/njcn/gather/system/cfg/service/impl/SysTestConfigServiceImpl.java index 5f488e3d..855f7993 100644 --- a/system/src/main/java/com/njcn/gather/system/cfg/service/impl/SysTestConfigServiceImpl.java +++ b/system/src/main/java/com/njcn/gather/system/cfg/service/impl/SysTestConfigServiceImpl.java @@ -73,4 +73,9 @@ public class SysTestConfigServiceImpl extends ServiceImpl dictDataExcels; } diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictDataService.java b/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictDataService.java index 6a6e9b62..463c64eb 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictDataService.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/service/IDictDataService.java @@ -26,6 +26,14 @@ public interface IDictDataService extends IService { */ Page getDictDataByTypeId(DictDataParam.QueryParam queryParam); + /** + * 根据字典类型id查询该类型下所有字典数据 + * + * @param typeId + * @return + */ + List listDictDataByTypeId(String typeId); + /** * 根据字典类型id查询字典信息 * @param typeId 字典类型id diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictDataServiceImpl.java b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictDataServiceImpl.java index 5f127801..aa2f9ef5 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictDataServiceImpl.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictDataServiceImpl.java @@ -64,6 +64,11 @@ public class DictDataServiceImpl extends ServiceImpl i return this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper); } + @Override + public List listDictDataByTypeId(String typeId) { + return this.lambdaQuery().eq(DictData::getTypeId, typeId).eq(DictData::getState, DataStateEnum.ENABLE.getCode()).list(); + } + @Override public List getDictDataByTypeId(String typeId) { return this.lambdaQuery().eq(DictData::getTypeId, typeId).eq(DictData::getState, DataStateEnum.ENABLE.getCode()).list(); diff --git a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTypeServiceImpl.java b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTypeServiceImpl.java index d11d01fb..166429bc 100644 --- a/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTypeServiceImpl.java +++ b/system/src/main/java/com/njcn/gather/system/dictionary/service/impl/DictTypeServiceImpl.java @@ -12,7 +12,9 @@ import com.njcn.common.pojo.exception.BusinessException; import com.njcn.db.mybatisplus.constant.DbConstant; import com.njcn.gather.system.dictionary.mapper.DictTypeMapper; import com.njcn.gather.system.dictionary.pojo.param.DictTypeParam; +import com.njcn.gather.system.dictionary.pojo.po.DictData; import com.njcn.gather.system.dictionary.pojo.po.DictType; +import com.njcn.gather.system.dictionary.pojo.vo.DictDataExcel; import com.njcn.gather.system.dictionary.pojo.vo.DictTypeExcel; import com.njcn.gather.system.dictionary.service.IDictDataService; import com.njcn.gather.system.dictionary.service.IDictTypeService; @@ -23,6 +25,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; /** @@ -100,7 +103,16 @@ public class DictTypeServiceImpl extends ServiceImpl i } queryWrapper.ne("sys_dict_type.state", DataStateEnum.DELETED.getCode()); List dictTypes = this.list(queryWrapper); - List dictTypeVOS = BeanUtil.copyToList(dictTypes, DictTypeExcel.class); + + List dictTypeVOS = new ArrayList<>(); + dictTypes.forEach(dictType -> { + DictTypeExcel dictTypeExcel = BeanUtil.copyProperties(dictType, DictTypeExcel.class); + List dictDataList = dictDataService.listDictDataByTypeId(dictType.getId()); + List dictDataExcels = BeanUtil.copyToList(dictDataList, DictDataExcel.class); + dictTypeExcel.setDictDataExcels(dictDataExcels); + dictTypeVOS.add(dictTypeExcel); + }); + ExcelUtil.exportExcel("字典类型导出数据.xlsx", "字典类型", DictTypeExcel.class, dictTypeVOS); } diff --git a/user/src/main/java/com/njcn/gather/user/user/controller/AuthController.java b/user/src/main/java/com/njcn/gather/user/user/controller/AuthController.java index 5cad36bd..3ff7ac47 100644 --- a/user/src/main/java/com/njcn/gather/user/user/controller/AuthController.java +++ b/user/src/main/java/com/njcn/gather/user/user/controller/AuthController.java @@ -86,6 +86,7 @@ public class AuthController extends BaseController { Map map = new HashMap<>(); map.put("name", user.getName()); + map.put("id", user.getId()); token.setUserInfo(map);