提交 6a16f140 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 06575c9b
server:
port: 8761
\ No newline at end of file
port: 8081
\ No newline at end of file
server:
port: 8701
port: 8082
spring:
cloud:
config:
uri: http://localhost:8786 #配置中心地址
uri: http://localhost:8085 #配置中心地址
name: file
profile: prod
label: master
\ No newline at end of file
/*package com.zrqx.resource.bg.controller.imagelibrary;
package com.zrqx.resource.bg.controller.imagelibrary;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -48,12 +48,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
*//**
/**
* 图片库Controller
*//*
*/
@RestController
@RequestMapping(ResourceRequestPath.BG+ResourceRequestPath.IMAGE_LIBRARY)
@Api(description = "资源管理-图片库")
@Api(description = "资源管理-精彩瞬间")
public class ImageLibraryController {
@Autowired
......@@ -62,10 +62,6 @@ public class ImageLibraryController {
private ImageLibraryDiyTypeRelationService idrService;
@Autowired
private ImageResourceService resourceService;
@Autowired
private ResourceRelationService resourceRelationService;
@Autowired
private ImageLibraryDiyTypeService imageLibraryDiyTypeService;
......@@ -93,72 +89,14 @@ public class ImageLibraryController {
if(!service.saveOrUpdate(form)){
throw new BusinessValidateException("操作失败");
}
ImageLibrary entity = service.selectByPrimaryKey(form.getId());
return CallBack.success();
}
@ApiOperation(value = "批量修改价格" , notes ="批量修改价格")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_PRICE)
public CallBack<Boolean> updatePrice(@RequestBody BatchUpdateImageLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
ImageLibrary entity = new ImageLibrary();
entity.setRealPrice(form.getRealPrice());
entity.setUpdateTime(new Date());
if(!service.UpdateByExampleSelective(entity,example)){
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量修改分类", notes = "批量修改分类")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_DIYTIPE)
public CallBack<Boolean> updateDivType(@RequestBody BatchUpdateImageLibraryForm form) {
List<ImageLibraryDiyType> list = new ArrayList<ImageLibraryDiyType>();
form.getIds().forEach(alId -> {
//刪除原有的分类
ImageLibraryDiyType ob = new ImageLibraryDiyType();
ob.setIlId(alId);
imageLibraryDiyTypeService.delete(ob);
//添加
List<ImageLibraryDiyType> ls = form.getDiyType();
ls.forEach(l -> l.setIlId(alId));
list.addAll(ls);
});
if (!imageLibraryDiyTypeService.insertList(list)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量审核", notes = "批量审核")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_STATUS)
public CallBack<Boolean> updateArray(@RequestBody List<String> ids) {
Example example = service.createExample();
example.createCriteria().andIn("id", ids);
ImageLibrary entity = new ImageLibrary();
entity.setStatus(LibraryStatusEnum.STATUS_1.getCode());
entity.setUpdateTime(new Date());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量 上架/下架" , notes ="批量 上架/下架")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_UPDOWN)
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateImageLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List<ImageLibrary> list = service.selectByExample(example);
for (ImageLibrary entity : list) {
if(entity.getStatus() == LibraryStatusEnum.STATUS_0.getCode()){
throw new BusinessValidateException("待审核状态的文章不能直接操作上架状态需通过批量审核操作上架");
}
if(entity.getBookId() != null){
throw new BusinessValidateException("图书内拆分出来的文章不支持单独上、下架、删除操作");
}
}
ImageLibrary entity = new ImageLibrary();
entity.setStatus(form.getStatus());
entity.setUpdateTime(new Date());
......@@ -205,23 +143,6 @@ public class ImageLibraryController {
ImageLibrary entity = service.selectByPrimaryKey(oid);
ImageLibraryOneVO vo = new ImageLibraryOneVO();
BeanUtils.copyProperties(entity , vo);
if(StringUtils.isNotBlank(entity.getAuthorId())){
vo.setAuthorNameAndId(entity.getAuthor() + "," + entity.getAuthorId());
}else{
vo.setAuthorNameAndId(entity.getAuthor());
}
if(entity.getRealPrice() != null){
vo.setRealPrice(entity.getRealPrice().toString());
}
if(entity.getPrice() != null){
vo.setPrice(entity.getPrice().toString());
}
Example example = idrService.createExample();
example.createCriteria().andEqualTo("ilId" , oid);
List<ImageLibraryDiyType> list = idrService.selectByExample(example);
//组装自定义分类
vo.setDiyType(list);
return CallBack.success(vo);
}
@ApiOperation(value = "分页查询" , notes ="查询列表")
......@@ -230,58 +151,6 @@ public class ImageLibraryController {
return CallBack.success(service.page(form, pageParam));
}
@ApiOperation("相关资源列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.PAGE)
public CallBack<PageInfo<ResourceRelationVo>> reousrceRelationPage(QueryResourceRelationForm entity,
PageParam pageParam) {
if (entity == null || entity.getId() == null) {
throw new ParameterValidateException(ResponseCodeEnum.MISS_EXCEPTION.getCode(), "资源id不能为空!");
}
List<ResourceRelationVo> list = resourceService.queryByIdAndResourceType(entity, pageParam);
if (list == null || list.size() == 0) {
return CallBack.success(new PageInfo<ResourceRelationVo>(list));
}
return CallBack.success(new PageInfo<ResourceRelationVo>(resourceRelationService.queryRelationList(list)));
}
@ApiOperation(value = "选择弹窗中的列表" , notes ="查询选择弹窗中的列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.POPPAGE)
public CallBack<PageInfo<ImageLibraryListVO>> page(QueryResourceForPoPForm form, PageParam pageParam){
return CallBack.success(service.pageByTitleAndDiyType(form, pageParam));
}
@ApiOperation(value = "保存相关资源" , notes ="保存相关资源")
@PostMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.SAVE)
public CallBack<Boolean> saveRelation(@RequestBody SaveResourceRelationForm entity){
if(entity.getId() == null || entity.getResourceIds() == null || entity.getResourceType() == null || entity.getResourceIds().length == 0){
throw new ParameterValidateException(ResponseCodeEnum.MISS_EXCEPTION.getCode(), "必须指定id、被关联的resourceId、资源类型");
}
List<ImageResource> recordList = new ArrayList<ImageResource>();
Arrays.asList(entity.getResourceIds()).forEach(resourceId -> {
ImageResource e = new ImageResource();
e.setImageId(entity.getId());
e.setResourceId(resourceId);
e.setCreateTime(new Date());
e.setResourceType(entity.getResourceType());
recordList.add(e);
});
return CallBack.success(resourceService.insertList(recordList));
}
@ApiOperation(value = "批量删除关联资源", notes = "批量删除")
@PostMapping(value = ResourceRequestPath.RES_BATCH_DELETE)
public CallBack<Boolean> deleteByResourceIds(@RequestBody List<Integer> ids) {
if (ids.size() == 0) {
throw new BaseException(-7,"没有选中任何数据,请重新选择");
}
Example example = resourceService.createExample();
example.createCriteria().andIn("id", ids);
List<ImageResource> list = resourceService.selectByExample(example);
for (ImageResource entity : list) {
resourceService.deleteByPrimaryKey(entity);
}
return CallBack.success();
}
@ApiOperation(value = "修改排序号", notes = "修改排序号")
@PostMapping(value = ResourceRequestPath.UPDATE + ResourceRequestPath.SORT)
public CallBack<Boolean> updateSort(@RequestBody UpdateEbookRelationForm form) {
......@@ -294,17 +163,4 @@ public class ImageLibraryController {
return CallBack.success();
}
@ApiOperation(value = "批量修改阅读权限", notes = "批量修改阅读权限")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_READ)
public CallBack<Boolean> updateReadTextPower(@RequestBody BatchUpdateImageLibraryForm form) {
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
ImageLibrary entity = new ImageLibrary();
entity.setReadTextPower(form.getReadTextPower());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
}
*/
\ No newline at end of file
server:
port: 8705
port: 8083
spring:
cloud:
config:
uri: http://localhost:8786 #配置中心地址
uri: http://localhost:8085 #配置中心地址
name: resource
profile: prod
label: master
\ No newline at end of file
server:
port: 8706
port: 8084
spring:
cloud:
config:
uri: http://localhost:8786 #配置中心地址
uri: http://localhost:8085 #配置中心地址
name: sysuser
profile: prod
label: master
\ No newline at end of file
server:
port: 8786
\ No newline at end of file
port: 8085
\ No newline at end of file
......@@ -2,11 +2,11 @@
#tx-manager 分布式事务服务端口号
tx-manager-prot: 8700
#file服务端口号
file-port: 8701
file-port: 8082
#resource 服务端口号
resource-port: 8705
resource-port: 8083
#sysuser服务端口号
sysuser-port: 8706
sysuser-port: 8084
#默认
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论