Merge remote-tracking branch 'origin/master'
| | |
| | | // ========== 自定义错误段 ========== |
| | | ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求,请稍后重试"); // 重复请求 |
| | | ErrorCode DEMO_DENY = new ErrorCode(901, "演示模式,禁止写操作"); |
| | | ErrorCode NOT_GENERAT = new ErrorCode(902, "测试运行模型前请先生成代码"); |
| | | |
| | | ErrorCode UNKNOWN = new ErrorCode(999, "未知错误"); |
| | | |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Operation(summary = "根据预测时间获取最后预测值") |
| | | Map<String, BigDecimal> getPredictValueByTime(@RequestBody PredictLastValueReqVO reqVO); |
| | | |
| | | @GetMapping(PREFIX + "/predict/model/setting/update") |
| | | @Operation(summary = "修改预测模型配置") |
| | | Boolean updatePredictModelSetting(@RequestParam("modelCode") String modelCode, @RequestParam("key") String key, @RequestParam("value") String value); |
| | | |
| | | } |
| | |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mcs.pre.enums.PredGranularityEnum; |
| | | import com.iailab.module.model.mcs.pre.service.*; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemOutputRespVO; |
| | |
| | | |
| | | @Autowired |
| | | private StScheduleModelSettingService stScheduleModelSettingService; |
| | | |
| | | @Autowired |
| | | private MmPredictModelService mmPredictModelService; |
| | | |
| | | @Autowired |
| | | private MmModelArithSettingsService mmModelArithSettingsService; |
| | | |
| | | private int HOUR_MINS = 60; |
| | | |
| | | @Override |
| | |
| | | return stScheduleSuggestService.getLastSuggest(params); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updatePredictModelSetting(String modelCode, String key, String value) { |
| | | MmPredictModelEntity model = mmPredictModelService.getByModelCode(modelCode); |
| | | mmModelArithSettingsService.updateByModelIdAndKey(model.getId(), key, value); |
| | | return true; |
| | | } |
| | | |
| | | private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { |
| | | Date[] result = new Date[3]; |
| | | Date predictTime = predictItem.getLastTime(); |
| | |
| | | List<ScheduleSuggestRespDTO> data = mcsApi.getLastSuggest(params); |
| | | return CommonResult.success(data); |
| | | } |
| | | |
| | | @GetMapping("/predict/model/setting/update") |
| | | @Operation(summary = "修改调度模型配置") |
| | | public CommonResult<Boolean> updatePredictModelSetting(@RequestParam("modelCode") String modelCode, @RequestParam("key") String key, @RequestParam("value") String value){ |
| | | mcsApi.updatePredictModelSetting(modelCode, key, value); |
| | | return success( true); |
| | | } |
| | | } |
| | |
| | | void insertList(List<MmModelArithSettingsEntity> list); |
| | | |
| | | void updatePyFile(@Param("likeValue") String likeValue,@Param("value") String value); |
| | | |
| | | void updateByModelIdAndKey(@Param("modelId") String modelId,@Param("key") String key,@Param("value") String value); |
| | | } |
| | |
| | | List<MmModelArithSettingsEntity> getByModelId(String modelId); |
| | | |
| | | void updatePyFile(String pyModule, String fileName); |
| | | |
| | | void updateByModelIdAndKey(String modelId, String key, String value); |
| | | } |
| | |
| | | MmPredictModelEntity getActiveModelByItemId(String itemId); |
| | | |
| | | void clearCache(); |
| | | |
| | | MmPredictModelEntity getByModelCode(String modelCode); |
| | | } |
| | |
| | | // 清空缓存 |
| | | modelIdMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByModelIdAndKey(String modelId, String key, String value) { |
| | | baseMapper.updateByModelIdAndKey(modelId,key,value); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public MmPredictModelEntity getByModelCode(String modelCode) { |
| | | return mmPredictModelDao.selectOne("modelno", modelCode); |
| | | } |
| | | |
| | | @Override |
| | | public MmPredictModelEntity getInfo(String id) { |
| | | return mmPredictModelDao.selectById(id); |
| | | } |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_GENERAT; |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | |
| | | try { |
| | | File jarFile = new File(mpkTenantBakFilePath + File.separator + MdkConstant.JAR + File.separator + dto.getPyName() + ".jar"); |
| | | if (!jarFile.exists()) { |
| | | throw new RuntimeException("jar包不存在,请先生成代码。jarPath:" + jarFile.getAbsolutePath()); |
| | | log.error("jar包不存在,请先生成代码。jarPath:" + jarFile.getAbsolutePath()); |
| | | return CommonResult.error(NOT_GENERAT.getCode(),NOT_GENERAT.getMsg()); |
| | | } |
| | | File dllFile = new File(mpkTenantBakFilePath + File.separator + MdkConstant.DLL + File.separator + dto.getPyName() + ".dll"); |
| | | if (!dllFile.exists()) { |
| | | throw new RuntimeException("dll文件不存在,请先生成代码。dllPath:" + dllFile.getAbsolutePath()); |
| | | log.error("dll文件不存在,请先生成代码。dllPath:" + dllFile.getAbsolutePath()); |
| | | return CommonResult.error(NOT_GENERAT.getCode(),NOT_GENERAT.getMsg()); |
| | | } |
| | | // 加载jar包 |
| | | classLoader = DllUtils.loadJar(jarFile.getAbsolutePath()); |
| | |
| | | DllUtils.unloadDll(classLoader); |
| | | DllUtils.unloadJar(classLoader); |
| | | } |
| | | System.gc(); |
| | | } |
| | | } |
| | | |
| | |
| | | (#{item.id}, #{item.modelid}, #{item.key}, #{item.value}, #{item.name}, #{item.valuetype}) |
| | | </foreach> |
| | | </insert> |
| | | <update id="updateByModelIdAndKey"> |
| | | update t_mm_model_arith_settings set value = #{value} where `modelid` = #{modelId} and `key` = #{key} |
| | | </update> |
| | | </mapper> |