提交 b0ad9dda 作者: xiaowang

分类业务列表

上级 0e837e2f
......@@ -100,9 +100,11 @@ public class BackstageCategoriesController {
@GetMapping("queryRelevantBusiness")
public ResultBody queryRelevantBusiness(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryRelevantBusiness(id, type);
@ApiParam(value = "业务类型: 0、商城商品列表 1、租赁商品列表 2、服务列表 3、课程列表", required = true) @Min(value = 0)
@RequestParam(value = "type") Integer type,
@RequestParam Integer pageNo,
@RequestParam Integer pageSize) {
return ResultBody.success(categoriesService.queryRelevantBusiness(id, type,pageNo,pageSize));
}
@ApiOperation(value = "分类删除")
......
package com.mmc.pms.dao;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
......@@ -50,4 +49,6 @@ public interface BackstageTaskServiceDao {
void exchange(ServiceDO serviceDO);
void exchangeSort(Integer id,Integer sort);
List<ServiceDO> queryWorkInfoByCategoryId(Integer pageNo , Integer pageSize,Integer id);
}
......@@ -89,7 +89,7 @@ public interface GoodsInfoDao {
List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer pageNo,Integer pageSize,Integer id,int type);
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId);
......@@ -114,4 +114,6 @@ public interface GoodsInfoDao {
List<MallProdInfoDO> getAllMallProSkuInfo(Integer goodsInfoId);
int updateGoodsInfoSort(Integer id, Integer sort);
int countServiceByCategoryId(Integer id);
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.vo.RelevanceServiceInfoVO;
import com.mmc.pms.model.group.Others;
import com.mmc.pms.model.work.vo.ServiceVO;
import io.swagger.annotations.ApiModelProperty;
......@@ -88,9 +89,7 @@ public class ServiceDO implements Serializable {
this.serviceIntroduction = param.getServiceIntroduction();
this.companyId=param.getCompanyId();
}
public ServiceDO(Integer id, Integer accountId) {
this.id = id;
this.accountId = accountId;
public RelevanceServiceInfoVO buildRelevanceServiceInfoVO(){
return RelevanceServiceInfoVO.builder().id(id).name(serviceName).shelf(displayState).videoUrl(video).build();
}
}
......@@ -17,4 +17,7 @@ import java.util.List;
public interface ImsAppApi {
@GetMapping("/release/curriculum/feignCurriculumInfoList")
List<CurriculumInfoVO> feignCurriculumInfoList(@RequestParam Integer categoriesId);
@GetMapping("/release/curriculum/feignCountCurriculumInfo")
int feignCountCurriculumInfo(@RequestParam Integer categoriesId);
}
......@@ -18,4 +18,10 @@ public class ImsApiHystrix implements ImsAppApi {
log.error("熔断:feignCurriculumInfoList:{}", categoriesId);
return null;
}
@Override
public int feignCountCurriculumInfo(Integer categoriesId) {
log.error("熔断:feignCountCurriculumInfo:{}", categoriesId);
return 0;
}
}
......@@ -71,4 +71,8 @@ public class CurriculumInfoVO implements Serializable {
@ApiModelProperty(value = "课程详情")
private String detailContent;
public RelevanceCurriculumVO buildRelevanceCurriculumVO(){
return RelevanceCurriculumVO.builder().id(id).curriculumUrl(surfaceUrl).curriculumName(curriculumName).build();
}
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.model.categories.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -15,6 +16,7 @@ import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class RelevanceCurriculumVO implements Serializable {
@ApiModelProperty(value = "id")
......@@ -22,7 +24,10 @@ public class RelevanceCurriculumVO implements Serializable {
@ApiModelProperty(value = "课程名称")
private String curriculumName;
// 课程图片
// 状态
@ApiModelProperty(value = "课程图片")
private String curriculumUrl;
@ApiModelProperty(value = "状态")
private String status;
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.model.categories.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -15,11 +16,10 @@ import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class RelevanceServiceInfoVO implements Serializable {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "服务编号")
private String number;
@ApiModelProperty(value = "服务名称")
private String name;
@ApiModelProperty(value = "视频")
......
......@@ -2,8 +2,6 @@ package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.DistrictDO;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
......@@ -11,7 +9,6 @@ import com.mmc.pms.model.sale.vo.QueryClassifyVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
......@@ -37,7 +34,7 @@ public interface CategoriesService {
ResultBody getClassifyDetails(Integer id);
ResultBody queryRelevantBusiness(Integer id, Integer type);
PageResult queryRelevantBusiness(Integer id, Integer type,Integer pageNo,Integer pageSize);
ResultBody deleteRelevantBusiness(Integer id);
......
......@@ -3,12 +3,14 @@ package com.mmc.pms.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.BackstageTaskServiceDao;
import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.dao.DirectoryDao;
import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.GoodsInfo;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.feign.ImsAppApi;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.dto.CategoriesDTO;
......@@ -45,7 +47,8 @@ public class CategoriesServiceImpl implements CategoriesService {
@Resource private GoodsInfoDao goodsInfoDao;
@Autowired private DirectoryDao directoryDao;
@Autowired private BackstageTaskService backstageTaskService;
@Autowired private ImsAppApi appApi;
@Autowired private BackstageTaskServiceDao backstageTaskServiceDao;
@Autowired private ImsAppApi imsAppApi;
@Override
public ResultBody addOrEditDirectory(DirectoryInfoVO param) {
......@@ -191,23 +194,68 @@ public class CategoriesServiceImpl implements CategoriesService {
}
@Override
public ResultBody queryRelevantBusiness(Integer id, Integer type) {
public PageResult queryRelevantBusiness(Integer id, Integer type,Integer pageNo,Integer pageSize) {
RelevantBusinessVO relevantBusinessVO = new RelevantBusinessVO();
switch (type) {
case 0:
List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id);
if (CollectionUtils.isNotEmpty(goodsInfo)) {
int count = goodsInfoDao.countGoodsInfoByCategoryId(id);
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, count);
}
List<GoodsInfo> mallGoodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId((pageNo - 1) * pageSize, pageSize,id,0);
if (CollectionUtils.isNotEmpty(mallGoodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(
goodsInfo.stream()
mallGoodsInfo.stream()
.map(GoodsInfo::buildRelevanceGoodsInfoVO)
.collect(Collectors.toList()));
return ResultBody.success(relevantBusinessVO);
return PageResult.buildPage(pageNo,pageSize,count,relevantBusinessVO);
}
break;
case 1:
int countOne = goodsInfoDao.countGoodsInfoByCategoryId(id);
if (countOne == 0) {
return PageResult.buildPage(pageNo, pageSize, countOne);
}
List<GoodsInfo> leaseTermGoodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId((pageNo - 1) * pageSize, pageSize,id,1);
if (CollectionUtils.isNotEmpty(leaseTermGoodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(
leaseTermGoodsInfo.stream()
.map(GoodsInfo::buildRelevanceGoodsInfoVO)
.collect(Collectors.toList()));
return PageResult.buildPage(pageNo,pageSize,countOne,relevantBusinessVO);
}
break;
case 2:
int countTwo = goodsInfoDao.countServiceByCategoryId(id);
if (countTwo == 0) {
return PageResult.buildPage(pageNo, pageSize, countTwo);
}
List<ServiceDO> serviceList = backstageTaskServiceDao.queryWorkInfoByCategoryId((pageNo - 1) * pageSize,pageSize,id);
if (CollectionUtils.isNotEmpty(serviceList)) {
relevantBusinessVO.setRelevanceServiceInfoVOs(
serviceList.stream().map(ServiceDO :: buildRelevanceServiceInfoVO)
.collect(Collectors.toList()));
return PageResult.buildPage(pageNo,pageSize,countTwo,relevantBusinessVO);
}
break;
case 3 :
int countThree = imsAppApi.feignCountCurriculumInfo(id);
if (countThree == 0){
return PageResult.buildPage(pageNo, pageSize, countThree);
}
List<CurriculumInfoVO> curriculumList = imsAppApi.feignCurriculumInfoList(id);
if(CollectionUtils.isNotEmpty(curriculumList)){
relevantBusinessVO.setRelevanceCurriculumVOs(curriculumList
.stream().skip((pageNo - 1) * pageSize).limit(pageSize)
.map(CurriculumInfoVO::buildRelevanceCurriculumVO)
.collect(Collectors.toList()));
return PageResult.buildPage(pageNo, pageSize, countThree,relevantBusinessVO);
}
break;
default:
return ResultBody.error("输入类型有误!");
throw new RuntimeException("输入类型有误!");
}
return ResultBody.success();
return PageResult.buildPage(pageNo,pageSize,0);
}
@Override
......@@ -271,7 +319,7 @@ public class CategoriesServiceImpl implements CategoriesService {
if (taskCount > 0) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE);
}
List<CurriculumInfoVO> curriculumInfo = appApi.feignCurriculumInfoList(id);
List<CurriculumInfoVO> curriculumInfo = imsAppApi.feignCurriculumInfoList(id);
if (CollectionUtils.isNotEmpty(curriculumInfo)) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE);
}
......
......@@ -460,7 +460,8 @@
FROM goods_info gi
INNER JOIN goods_img im ON gi.id = im.goods_info_id
AND im.img_type = 0
WHERE gi.category_by_one = #{id}
WHERE gi.category_by_one = #{id} and gi.goods_type = #{type} and gi.is_deleted = 0
limit #{pageNo},#{pageSize}
</select>
<resultMap id="resultMallProdSkuInfoSpecMap" type="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
<id property="id" column="id"/>
......@@ -612,4 +613,7 @@
AND mi.is_deleted = 0
ORDER BY mi.create_time asc
</select>
<select id="countServiceByCategoryId" resultType="java.lang.Integer">
select count(*) from service where (application_id = #{id} or industry_id = #{id})
</select>
</mapper>
......@@ -299,6 +299,12 @@
<select id="queryByIdCount" resultType="java.lang.Integer">
select count(1) from service where company_id=#{companyId} and is_deleted=0
</select>
<select id="queryWorkInfoByCategoryId" resultType="com.mmc.pms.entity.ServiceDO">
select id,service_name,display_state,video
from service
where (application_id = #{id} or industry_id = #{id})
limit #{pageNo},#{pageSize}
</select>
<update id="exchange" parameterType="com.mmc.pms.entity.ServiceDO">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论