Browse Source

add:智谱配置信息管理,增加权限相关内容

zhongwei
luyie 3 months ago
parent
commit
b3ded10496
  1. 22
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuAnalysisInfoController.java
  2. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java
  3. 8
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ResultBooleanStrategy.java
  4. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java
  5. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/ZhipuAnalysisInfoService.java
  6. 1
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisInfoServiceImpl.java
  7. 1
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisServiceImpl.java
  8. 3
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisInfoVO.java
  9. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisResult.java

22
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuAnalysisInfoController.java

@ -1,12 +1,16 @@
package com.hnac.hzims.bigmodel.zhipuai.controller; package com.hnac.hzims.bigmodel.zhipuai.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
import com.hnac.hzims.bigmodel.zhipuai.service.ZhipuAnalysisInfoService; import com.hnac.hzims.bigmodel.zhipuai.service.ZhipuAnalysisInfoService;
import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisInfoVO; import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisInfoVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -33,7 +37,21 @@ public class ZhipuAnalysisInfoController {
@GetMapping("/remove") @GetMapping("/remove")
@ApiOperation("批量删除智谱分析信息") @ApiOperation("批量删除智谱分析信息")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R<Boolean> remove (@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { public R<Boolean> remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) {
return R.status(analysisInfoService.removeByIds(Func.toLongList(",",ids))); return R.status(analysisInfoService.removeByIds(Func.toLongList(",", ids)));
}
@GetMapping("/selectPage")
@ApiOperation("分页查询智谱分析配置信息")
@ApiOperationSupport(order = 3)
public R<IPage<ZhipuAnalysisInfoEntity>> selectPage(Query query, ZhipuAnalysisInfoEntity requestData) {
return R.data(analysisInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(new ZhipuAnalysisInfoEntity(), requestData)));
}
@PutMapping("/update")
@ApiOperation("更新智谱分析配置信息")
@ApiOperationSupport(order = 4)
public R<Boolean> update(@RequestBody @Validated ZhipuAnalysisInfoEntity requestData) {
return R.status(analysisInfoService.updateById(requestData));
} }
} }

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzims.bigmodel.zhipuai.entity; package com.hnac.hzims.bigmodel.zhipuai.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -7,6 +8,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity;
/** /**
* @Author: ypj * @Author: ypj
@ -16,7 +19,7 @@ import org.springblade.core.mp.base.BaseEntity;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@TableName("hzims_analysis_info") @TableName("hzims_analysis_info")
public class ZhipuAnalysisInfoEntity extends BaseEntity { public class ZhipuAnalysisInfoEntity extends TenantEntity {
@ApiModelProperty(value = "策略编码") @ApiModelProperty(value = "策略编码")
@TableField("CODE") @TableField("CODE")
@ -24,6 +27,7 @@ public class ZhipuAnalysisInfoEntity extends BaseEntity {
@ApiModelProperty(value = "策略名称") @ApiModelProperty(value = "策略名称")
@TableField("NAME") @TableField("NAME")
@QueryField(condition = SqlCondition.LIKE)
private String name; private String name;
@ApiModelProperty(value = "调用模型名称") @ApiModelProperty(value = "调用模型名称")

8
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ResultBooleanStrategy.java

@ -4,6 +4,10 @@ import com.hnac.hzims.bigmodel.zhipuai.constants.BaseEnum;
import com.hnac.hzims.bigmodel.zhipuai.constants.ComparisonType; import com.hnac.hzims.bigmodel.zhipuai.constants.ComparisonType;
import com.hnac.hzims.bigmodel.zhipuai.constants.ResultStrategyType; import com.hnac.hzims.bigmodel.zhipuai.constants.ResultStrategyType;
import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
import com.hnac.hzinfo.exception.HzServiceException;
import org.springframework.util.Assert;
import java.util.Objects;
/** /**
* @Author: ypj * @Author: ypj
@ -18,6 +22,9 @@ public class ResultBooleanStrategy implements ResultStrategy<Boolean> {
@Override @Override
public Boolean getResult(ZhipuAnalysisInfoEntity info, Object resultData) { public Boolean getResult(ZhipuAnalysisInfoEntity info, Object resultData) {
Object comparator = convertOriginalData(info.getResultCondition(), info.getResultType()); Object comparator = convertOriginalData(info.getResultCondition(), info.getResultType());
Assert.isTrue(Objects.nonNull(comparator), () -> {
throw new HzServiceException("没有获取到对比对象");
});
ComparisonType comparisonType = BaseEnum.getInstance(info.getResultJudgeModel(), ComparisonType.class); ComparisonType comparisonType = BaseEnum.getInstance(info.getResultJudgeModel(), ComparisonType.class);
switch (comparisonType) { switch (comparisonType) {
case EQUAL: case EQUAL:
@ -30,5 +37,4 @@ public class ResultBooleanStrategy implements ResultStrategy<Boolean> {
return null; return null;
} }
} }

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/mapper/ZhipuAnalysisInfoMapper.java

@ -1,11 +1,11 @@
package com.hnac.hzims.bigmodel.zhipuai.mapper; package com.hnac.hzims.bigmodel.zhipuai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/** /**
* @Author: ypj * @Author: ypj
* @Date: 2024/8/12 20:05 * @Date: 2024/8/12 20:05
*/ */
public interface ZhipuAnalysisInfoMapper extends BaseMapper<ZhipuAnalysisInfoEntity> { public interface ZhipuAnalysisInfoMapper extends UserDataScopeBaseMapper<ZhipuAnalysisInfoEntity> {
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/ZhipuAnalysisInfoService.java

@ -1,7 +1,9 @@
package com.hnac.hzims.bigmodel.zhipuai.service; package com.hnac.hzims.bigmodel.zhipuai.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity;
import org.springblade.core.mp.support.Query;
/** /**
* @Author: ypj * @Author: ypj

1
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisInfoServiceImpl.java

@ -12,4 +12,5 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class ZhipuAnalysisInfoServiceImpl extends ServiceImpl<ZhipuAnalysisInfoMapper, ZhipuAnalysisInfoEntity> implements ZhipuAnalysisInfoService { public class ZhipuAnalysisInfoServiceImpl extends ServiceImpl<ZhipuAnalysisInfoMapper, ZhipuAnalysisInfoEntity> implements ZhipuAnalysisInfoService {
} }

1
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisServiceImpl.java

@ -66,7 +66,6 @@ public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService {
response.setResultStr(resultStr); response.setResultStr(resultStr);
response.setResult(conclusion); response.setResult(conclusion);
response.setSuccess(Boolean.TRUE);
return response; return response;
} }

3
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisInfoVO.java

@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ -20,7 +21,7 @@ import javax.validation.constraints.NotNull;
@ApiModel(value = "大模型分析信息") @ApiModel(value = "大模型分析信息")
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class ZhipuAnalysisInfoVO { public class ZhipuAnalysisInfoVO extends TenantEntity {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键id") @ApiModelProperty(value = "主键id")
@TableId(value = "id", type = IdType.ASSIGN_ID) @TableId(value = "id", type = IdType.ASSIGN_ID)

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisResult.java

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Optional;
/** /**
* @Author: ypj * @Author: ypj
@ -17,7 +18,7 @@ public class ZhipuAnalysisResult<T> implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "是否成功", required = true) @ApiModelProperty(value = "是否成功", required = true)
private boolean success; private Boolean success = null;
@ApiModelProperty(value = "承载数据") @ApiModelProperty(value = "承载数据")
private T result; private T result;
@ -25,4 +26,7 @@ public class ZhipuAnalysisResult<T> implements Serializable {
@ApiModelProperty(value = "结果描述") @ApiModelProperty(value = "结果描述")
private String resultStr; private String resultStr;
public Boolean getSuccess() {
return Optional.ofNullable(success).orElse(null != result);
}
} }

Loading…
Cancel
Save