bug修改

This commit is contained in:
guojunjie 2025-03-06 17:59:57 +08:00
parent 24a1b92fc4
commit f57f22ae98
12 changed files with 90 additions and 59 deletions

View File

@ -134,6 +134,9 @@ public class CpLabelController extends BaseController {
String errorMsg = map.entrySet().iterator().next().getValue(); String errorMsg = map.entrySet().iterator().next().getValue();
return new Result(false, "保存标签失败", errorMsg, map); return new Result(false, "保存标签失败", errorMsg, map);
} else { } else {
if (entity.getParentid()==null){
entity.setParentid(0);
}
entity.setCreatetime(new Date()); entity.setCreatetime(new Date());
entity.setState("t"); entity.setState("t");
entityService.save(entity); entityService.save(entity);
@ -188,13 +191,19 @@ public class CpLabelController extends BaseController {
List<MoudleTree> moudleTrees=new ArrayList<>(); List<MoudleTree> moudleTrees=new ArrayList<>();
for (CpModule cpModule:cpModules){ for (CpModule cpModule:cpModules){
MoudleTree moudleTree=new MoudleTree(); MoudleTree moudleTree=new MoudleTree();
moudleTree.setCpModule(cpModule); moudleTree.setId(cpModule.getId());
moudleTree.setModuleName(cpModule.getModuleName());
moudleTree.setState(cpModule.getState());
moudleTree.setModuleLevel(cpModule.getModuleLevel());
moudleTree.setModuleRemark(cpModule.getModuleRemark());
List<CpLabelTree> cpLabelTree =new ArrayList<>(); List<CpLabelTree> cpLabelTree =new ArrayList<>();
for (CpLabelTree cpLabeltree:collect){ for (CpLabelTree cpLabeltree:collect){
if (cpLabeltree.getModuleid()==cpModule.getId()){ if (cpLabeltree.getModuleid()==cpModule.getId()){
cpLabelTree.add(cpLabeltree); cpLabelTree.add(cpLabeltree);
} }
} }
moudleTree.setCpLabelTree(cpLabelTree); moudleTree.setCpLabelTree(cpLabelTree);
moudleTrees.add(moudleTree); moudleTrees.add(moudleTree);
} }

View File

@ -12,7 +12,6 @@ import java.util.List;
*/ */
@Data @Data
@ApiModel @ApiModel
public class MoudleTree { public class MoudleTree extends CpModule {
CpModule cpModule;
List<CpLabelTree> cpLabelTree; List<CpLabelTree> cpLabelTree;
} }

View File

@ -104,7 +104,9 @@ public class PaCollectionController extends BaseController {
} }
Integer count=entityService.lambdaQuery() Integer count=entityService.lambdaQuery()
.eq(PaCollection::getUserId,userid) .eq(PaCollection::getUserId,userid)
.eq(PaCollection::getCreationId,entity.getCreationId()).count(); .eq(PaCollection::getCreationId,entity.getCreationId())
.eq(PaCollection::getState,"t")
.count();
if(count>0){ if(count>0){
return new Result(false, "请勿重复收藏作品"); return new Result(false, "请勿重复收藏作品");
} }

View File

@ -126,7 +126,10 @@ public class PaCreationReleaseController extends BaseController {
// if(entity.getCreationId()==null){ // if(entity.getCreationId()==null){
// return new Result(false, "", "作品id为空"); // return new Result(false, "", "作品id为空");
// } // }
Integer count=entityService.lambdaQuery().eq(PaCreationRelease::getCreationId, entity.getCreationId()).count(); Integer count=entityService.lambdaQuery()
.eq(PaCreationRelease::getCreationId, entity.getCreationId())
.eq(PaCreationRelease::getState,"t")
.count();
if(count>0){ if(count>0){
return new Result(false, "", "请勿重复共享作品"); return new Result(false, "", "请勿重复共享作品");
} }
@ -175,7 +178,7 @@ public class PaCreationReleaseController extends BaseController {
paRecommend.setState("t"); paRecommend.setState("t");
paRecommend.setPhotoSourceId(entity.getPhotoSourceId()); paRecommend.setPhotoSourceId(entity.getPhotoSourceId());
paRecommend.setPhotoTargetId(entity.getPhotoTargetId()); paRecommend.setPhotoTargetId(entity.getPhotoTargetId());
paRecommend.setServiceName(paServices.getName()); paRecommend.setServiceId(paServices.getId());
paRecommendService.save(paRecommend); paRecommendService.save(paRecommend);
entity.setRecommendId(paRecommend.getId()); entity.setRecommendId(paRecommend.getId());
entityService.updateById(entity); entityService.updateById(entity);

View File

@ -4,10 +4,13 @@ import com.base.annotation.Unsecured;
import com.pixelai.api.component.entity.CpPhoto; import com.pixelai.api.component.entity.CpPhoto;
import com.pixelai.api.component.service.CpPhotoService; import com.pixelai.api.component.service.CpPhotoService;
import com.pixelai.api.pa.dao.PaCreationMapper; import com.pixelai.api.pa.dao.PaCreationMapper;
import com.pixelai.api.pa.entity.PaServices;
import com.pixelai.api.pa.service.PaServicesService;
import com.pixelai.api.pa.vo.PaCreationReleaseVo; import com.pixelai.api.pa.vo.PaCreationReleaseVo;
import com.pixelai.api.pa.vo.PaCreationVo; import com.pixelai.api.pa.vo.PaCreationVo;
import com.pixelai.api.pa.vo.PaRecommendVo; import com.pixelai.api.pa.vo.PaRecommendVo;
import com.pixelai.api.user.service.AcUserService; import com.pixelai.api.user.service.AcUserService;
import com.pixelai.utils.StringUtil;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.base.annotation.SysLog; import com.base.annotation.SysLog;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -53,6 +56,8 @@ public class PaRecommendController extends BaseController {
private PaCreationMapper paCreationMapper; private PaCreationMapper paCreationMapper;
@Autowired @Autowired
private AcUserService acUserService; private AcUserService acUserService;
@Autowired
private PaServicesService paServicesService;
@Unsecured @Unsecured
@SysLog(action = "findByPage", value = "分页查询推荐作品") @SysLog(action = "findByPage", value = "分页查询推荐作品")
@ -75,6 +80,10 @@ public class PaRecommendController extends BaseController {
CpPhoto cpPhoto=cpPhotoService.getById(paRecommendVo.getPhotoTargetId()); CpPhoto cpPhoto=cpPhotoService.getById(paRecommendVo.getPhotoTargetId());
paRecommendVo.setPath(cpPhoto.getPath()); paRecommendVo.setPath(cpPhoto.getPath());
} }
if(StringUtil.isBlank(paRecommendVo.getServiceName())){
PaServices paServices=paServicesService.getById(paRecommendVo.getServiceId());
paRecommendVo.setServiceName(paServices.getName());
}
} }
return new Result(true, records); return new Result(true, records);
} }
@ -122,7 +131,6 @@ public class PaRecommendController extends BaseController {
} else { } else {
entity.setUserId(acUserService.getUserId()); entity.setUserId(acUserService.getUserId());
entity.setState("t"); entity.setState("t");
entity.setNumber(0);
entity.setCreatetime(new Date()); entity.setCreatetime(new Date());
entityService.save(entity); entityService.save(entity);
return new Result(true, "成功保存推荐作品", null); return new Result(true, "成功保存推荐作品", null);

View File

@ -41,7 +41,7 @@ public class PaRecommend implements Serializable {
private String state; private String state;
String serviceName; private Integer serviceId;
@ApiModelProperty(value = "原图") @ApiModelProperty(value = "原图")
private Integer photoSourceId; private Integer photoSourceId;

View File

@ -1,34 +1,34 @@
//package com.pixelai.api.pa.service; package com.pixelai.api.pa.service;
//
//import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.pixelai.api.pa.entity.MbConsumption; import com.pixelai.api.pa.entity.MbConsumption;
//import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
//
//import java.util.List; import java.util.List;
//
///** /**
// * <p> * <p>
// * 服务类 * 服务类
// * </p> * </p>
// * *
// * @author gjj * @author gjj
// * @since 2024-12-23 * @since 2024-12-23
// */ */
//public interface MbConsumptionService extends IService<MbConsumption> { public interface MbConsumptionService extends IService<MbConsumption> {
//
// /** /**
// * 条件查询 * 条件查询
// * @param example * @param example
// * @return * @return
// */ */
// List<MbConsumption> list(MbConsumption example); List<MbConsumption> list(MbConsumption example);
//
// /** /**
// * 分页查询 * 分页查询
// * @param example * @param example
// * @param page * @param page
// * @return * @return
// */ */
// IPage<MbConsumption> page(MbConsumption example,IPage page); IPage<MbConsumption> page(MbConsumption example,IPage page);
//
//} }

View File

@ -59,7 +59,7 @@ public class PaRecommendServiceImpl extends ServiceImpl<PaRecommendMapper, PaRec
private QueryWrapper<PaRecommendVo> buildPaCreationVoWrapper(PaRecommendVo example) { private QueryWrapper<PaRecommendVo> buildPaCreationVoWrapper(PaRecommendVo example) {
QueryWrapper<PaRecommendVo> wrapper = new QueryWrapper<>(); QueryWrapper<PaRecommendVo> wrapper = new QueryWrapper<>();
wrapper wrapper
.like(example.getServiceName()!=null,"service_name", example.getServiceName()) .eq(example.getServiceId()!=null,"service_id", example.getServiceId())
.eq("state", "t"); .eq("state", "t");
if(example.getIsBackend()!=null && example.getIsBackend()==1){ if(example.getIsBackend()!=null && example.getIsBackend()==1){
wrapper.orderByDesc("createtime"); wrapper.orderByDesc("createtime");

View File

@ -7,7 +7,7 @@ import lombok.Data;
public class PaRecommendVo extends PaRecommend { public class PaRecommendVo extends PaRecommend {
String path; String path;
String sourcePath; String sourcePath;
Integer serviceId; String serviceName;
//1后台查询2前台查询 //1后台查询2前台查询
Integer isBackend; Integer isBackend;

View File

@ -113,7 +113,7 @@ public class AiPictureController {
case "CharacterAnime" : case "CharacterAnime" :
aiPictureService.CharacterAnime(aiPictureVo,paCreation); aiPictureService.CharacterAnime(aiPictureVo,paCreation);
break; break;
//百度更换图片风格 //百度图像风格转换
case "styleTrans" : case "styleTrans" :
aiPictureService.styleTrans(aiPictureVo,paCreation); aiPictureService.styleTrans(aiPictureVo,paCreation);
break; break;

View File

@ -192,6 +192,15 @@ public class AiPictureServiceImpl implements AiPictureService {
req.put ("model_version", "general_v2.1_L"); req.put ("model_version", "general_v2.1_L");
req.put ("return_url", true); req.put ("return_url", true);
req.put ("use_pre_llm", true); req.put ("use_pre_llm", true);
if (StringUtil.isNotBlank(aiPictureVo.getSize())){
String str=aiPictureVo.getSize();
String[] strlist=str.split("\\*");
if (strlist.length==2){
req.put ("width",Integer.parseInt(strlist[0]) );
req.put ("height", Integer.parseInt(strlist[1]));
}
}
JSONObject response =VolcengineUtil.CVSubmitTask(paCreation,req); JSONObject response =VolcengineUtil.CVSubmitTask(paCreation,req);
if (response==null) if (response==null)
return; return;
@ -601,7 +610,6 @@ public class AiPictureServiceImpl implements AiPictureService {
public Map text2Images(AiPictureVo aiPictureVo, PaCreation paCreation) { public Map text2Images(AiPictureVo aiPictureVo, PaCreation paCreation) {
try { try {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(org.springframework.http.MediaType.APPLICATION_JSON);//固定返回类型只有json headers.setContentType(org.springframework.http.MediaType.APPLICATION_JSON);//固定返回类型只有json
headers.set("Authorization", API_KEY);//固定api密钥 headers.set("Authorization", API_KEY);//固定api密钥
@ -609,10 +617,10 @@ public class AiPictureServiceImpl implements AiPictureService {
String url="https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis";//文生图url String url="https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis";//文生图url
Map<String, Object> input = new HashMap<>();//放到request中 Map<String, Object> input = new HashMap<>();//放到request中
input.put("prompt", aiPictureVo.getText());//////////文本描述 input.put("prompt", aiPictureVo.getText());//////////文本描述
input.put("size", aiPictureVo.getSize());//////////尺寸
Map<String, Object> parameters = new HashMap<>();//放到request中 Map<String, Object> parameters = new HashMap<>();//放到request中
parameters.put("style", aiPictureVo.getOption());//////////类型 parameters.put("style", aiPictureVo.getOption());//////////类型
parameters.put("n", 1);//////////数量 parameters.put("n", 1);//////////数量
parameters.put("size", aiPictureVo.getSize());//////////尺寸
Map<String, Object> request = new HashMap<>();//请求体 Map<String, Object> request = new HashMap<>();//请求体
request.put("model", "wanx-v1");/////////选择模型wanx-v1一个apikey可以冲所有模型详情看文档介绍 request.put("model", "wanx-v1");/////////选择模型wanx-v1一个apikey可以冲所有模型详情看文档介绍
request.put("input", input);/////////文本描述和尺寸 request.put("input", input);/////////文本描述和尺寸

View File

@ -27,21 +27,23 @@
service_id, service_id,
path, path,
service_name, service_name,
service_id,
photo_source_id, photo_source_id,
photo_target_id photo_target_id
from (select from (select
pa_recommend.id as id, pa_recommend.id as id,
pa_recommend."number" as "number", pa_recommend."number" as "number",
pa_recommend.createtime as createtime, pa_recommend.createtime as createtime,
pa_recommend."state" as "state", pa_recommend."state" as "state",
pa_creation.service_id as "service_id", pa_recommend.service_id as "service_id",
cp_attachment.path as "path", cp_attachment.path as "path",
pa_recommend.service_name as service_name, pa_recommend.photo_source_id as photo_source_id,
pa_recommend.photo_source_id as photo_source_id, pa_recommend.photo_target_id as photo_target_id,
pa_recommend.photo_target_id as photo_target_id pa_services."name" as service_name
from pa_recommend from pa_recommend
left join pa_creation on pa_recommend.creation_id=pa_creation.id left join pa_creation on pa_recommend.creation_id=pa_creation.id
left join cp_attachment on pa_creation.photo_id=cp_attachment.id left join cp_attachment on pa_creation.photo_id=cp_attachment.id
left join pa_services on pa_creation.service_id=pa_services.id
) t ) t
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>