提交 86b2033c 作者: zhenjie

课程相关接口修改

上级 a29ed3bc
package com.mmc.csf.release.flyer.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author: zj
* @Date: 2023/6/10 20:34
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AllCategoryDTO implements Serializable {
private static final long serialVersionUID = 1171841063641249397L;
private Integer directoryId;
private String name;
private List<CategoriesInfoListDTO> categoriesInfoListDTO;
}
/** Copyright 2023 bejson.com */
package com.mmc.csf.release.flyer.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Auto-generated: 2023-06-08 16:2:43
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CategoriesInfoListDTO implements Serializable {
private static final long serialVersionUID = -8381856228953745772L;
private Integer id;
private Integer directoryId;
private String name;
private String icon;
}
...@@ -23,12 +23,14 @@ public class CurriculumQo implements Serializable { ...@@ -23,12 +23,14 @@ public class CurriculumQo implements Serializable {
private static final long serialVersionUID = 3124398495152234751L; private static final long serialVersionUID = 3124398495152234751L;
@ApiModelProperty(value = "课程名称") @ApiModelProperty(value = "课程名称")
private String curriculumName; private String curriculumName;
@ApiModelProperty(value = "地域id") @ApiModelProperty(value = "省份编码")
private Integer regionId; private Integer provinceCode;
@ApiModelProperty(value = "执照id") @ApiModelProperty(value = "执照id")
private Integer licenseId; private Integer licenseId;
@ApiModelProperty(value = "技能id") @ApiModelProperty(value = "技能id")
private Integer flightSkillsId; private Integer flightSkillsId;
@ApiModelProperty(value = "课程类型id")
private Integer categoriesId;
@ApiModelProperty(value = "页码", required = true) @ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = { Page.class }) @NotNull(message = "页码不能为空", groups = { Page.class })
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
......
...@@ -41,15 +41,18 @@ public class CurriculumInfoVO implements Serializable { ...@@ -41,15 +41,18 @@ public class CurriculumInfoVO implements Serializable {
@ApiModelProperty(value = "课程是否免费 0:免费 1:付费") @ApiModelProperty(value = "课程是否免费 0:免费 1:付费")
private Integer free; private Integer free;
@ApiModelProperty(value = "课程技能类型,二级id") @ApiModelProperty(value = "课程类型,二级id")
@NotNull(message = "课程技能id不能为空" ,groups = {Insert.class}) @NotNull(message = "课程类型id不能为空" ,groups = {Insert.class})
private Integer flightSkills; private Integer categoriesId;
@ApiModelProperty(value = "目录名称", example = "技能")
private String directoryName;
@ApiModelProperty(value = "课程技能类型名称1", example = "技能") @ApiModelProperty(value = "课程类型名称", example = "通用巡检")
private String flightSkillsName1; private String categoriesName;
@ApiModelProperty(value = "课程技能类型名称2", example = "通用巡检") @ApiModelProperty(value = "课程技能类型,二级id")
private String flightSkillsName2; private Integer flightSkills;
@ApiModelProperty(value = "课程介绍(简介), 长度255") @ApiModelProperty(value = "课程介绍(简介), 长度255")
@Length(max = 255) @Length(max = 255)
......
package com.mmc.csf.release.controller; package com.mmc.csf.release.controller;
import com.mmc.csf.common.util.web.ResultBody; import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.release.feign.PmsAppApi;
import com.mmc.csf.release.flyer.qo.CurriculumQo; import com.mmc.csf.release.flyer.qo.CurriculumQo;
import com.mmc.csf.release.flyer.vo.CurriculumInfoVO; import com.mmc.csf.release.flyer.vo.CurriculumInfoVO;
import com.mmc.csf.release.model.group.Insert; import com.mmc.csf.release.model.group.Insert;
...@@ -10,6 +11,7 @@ import com.mmc.csf.release.flyer.vo.DronePilotLicenseVO; ...@@ -10,6 +11,7 @@ import com.mmc.csf.release.flyer.vo.DronePilotLicenseVO;
import com.mmc.csf.release.flyer.vo.FlightSkillsVO; import com.mmc.csf.release.flyer.vo.FlightSkillsVO;
import com.mmc.csf.release.flyer.vo.RegistrationVO; import com.mmc.csf.release.flyer.vo.RegistrationVO;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -59,7 +61,7 @@ public class FlyerTrainingController extends BaseController{ ...@@ -59,7 +61,7 @@ public class FlyerTrainingController extends BaseController{
return flyerTrainingService.licenseOrSkillQueryCurriculum(type); return flyerTrainingService.licenseOrSkillQueryCurriculum(type);
} }
@ApiOperation(value = "V1.0.1课程技能列表") @ApiOperation(value = "飞手技能列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = FlightSkillsVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = FlightSkillsVO.class)})
@GetMapping("treeCurriculumSkill") @GetMapping("treeCurriculumSkill")
public ResultBody treeCurriculumSkill() { public ResultBody treeCurriculumSkill() {
...@@ -100,4 +102,14 @@ public class FlyerTrainingController extends BaseController{ ...@@ -100,4 +102,14 @@ public class FlyerTrainingController extends BaseController{
public ResultBody removeCurriculum(@RequestParam Integer id) { public ResultBody removeCurriculum(@RequestParam Integer id) {
return ResultBody.success(flyerTrainingService.removeCurriculum(id)); return ResultBody.success(flyerTrainingService.removeCurriculum(id));
} }
@Autowired
private PmsAppApi pmsAppApi;
@ApiOperation(value = "V1.0.1test")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("test")
public ResultBody test() {
return ResultBody.success(pmsAppApi.feignQqueryCategoryInfoByType(3));
}
} }
...@@ -69,6 +69,11 @@ public class CurriculumInfoDO implements Serializable { ...@@ -69,6 +69,11 @@ public class CurriculumInfoDO implements Serializable {
private String detailContent; private String detailContent;
/**
* 课程类型id
*/
private Integer categoriesId;
public CurriculumInfoDO(CurriculumInfoVO curriculumInfoVO) { public CurriculumInfoDO(CurriculumInfoVO curriculumInfoVO) {
this.id = curriculumInfoVO.getId(); this.id = curriculumInfoVO.getId();
this.curriculumName = curriculumInfoVO.getCurriculumName(); this.curriculumName = curriculumInfoVO.getCurriculumName();
...@@ -77,12 +82,14 @@ public class CurriculumInfoDO implements Serializable { ...@@ -77,12 +82,14 @@ public class CurriculumInfoDO implements Serializable {
this.surfaceUrl = curriculumInfoVO.getSurfaceUrl(); this.surfaceUrl = curriculumInfoVO.getSurfaceUrl();
this.detailContent = curriculumInfoVO.getDetailContent(); this.detailContent = curriculumInfoVO.getDetailContent();
this.videoUrl = curriculumInfoVO.getVideoUrl(); this.videoUrl = curriculumInfoVO.getVideoUrl();
this.categoriesId = curriculumInfoVO.getCategoriesId();
} }
public CurriculumInfoVO buildCurriculumInfoVO(){ public CurriculumInfoVO buildCurriculumInfoVO(){
return CurriculumInfoVO.builder().id(id).curriculumDesc(curriculumDesc).price(curriculumPrice) return CurriculumInfoVO.builder().id(id).curriculumDesc(curriculumDesc).price(curriculumPrice)
.free(free).supplierName("浙江科比特创新科技有限公司").curriculumName(curriculumName) .free(free).supplierName("浙江科比特创新科技有限公司").curriculumName(curriculumName)
.videoUrl(videoUrl).surfaceUrl(this.surfaceUrl).flightSkills(this.flightSkills).detailContent(this.detailContent).build(); .videoUrl(videoUrl).surfaceUrl(this.surfaceUrl).flightSkills(this.flightSkills).detailContent(this.detailContent)
.categoriesId(this.categoriesId).build();
} }
} }
......
package com.mmc.csf.release.feign;
import com.mmc.csf.release.feign.hystrix.PmsAppApHystrix;
import com.mmc.csf.release.flyer.dto.AllCategoryDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author: zj
* @Date: 2023/6/10 20:23
*/
@FeignClient(url = "${iuav.pmsapp.url}", name = "pms-svc", fallback = PmsAppApHystrix.class)
public interface PmsAppApi {
@RequestMapping(value = "/pms/classify/feignQqueryCategoryInfoByType", method = RequestMethod.GET)
public List<AllCategoryDTO> feignQqueryCategoryInfoByType(@RequestParam Integer type);
}
package com.mmc.csf.release.feign.config; package com.mmc.csf.release.feign.config;
import com.mmc.csf.release.feign.hystrix.PmsAppApHystrix;
import com.mmc.csf.release.feign.hystrix.UserAppApiHystrix; import com.mmc.csf.release.feign.hystrix.UserAppApiHystrix;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
...@@ -18,4 +19,9 @@ public class FeignConfiguration { ...@@ -18,4 +19,9 @@ public class FeignConfiguration {
public UserAppApiHystrix userAppApi(){ public UserAppApiHystrix userAppApi(){
return new UserAppApiHystrix(); return new UserAppApiHystrix();
} }
@Bean(name = "PmsAppApHystrix")
public PmsAppApHystrix pmsAppApi(){
return new PmsAppApHystrix();
}
} }
package com.mmc.csf.release.feign.hystrix;
import com.mmc.csf.release.feign.PmsAppApi;
import com.mmc.csf.release.flyer.dto.AllCategoryDTO;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* @author: zj
* @Date: 2023/6/10 20:24
*/
@Slf4j
public class PmsAppApHystrix implements PmsAppApi {
@Override
public List<AllCategoryDTO> feignQqueryCategoryInfoByType(Integer type) {
log.info("熔断--feignQqueryCategoryInfoByType:" + type);
return null;
}
}
...@@ -6,6 +6,9 @@ import com.mmc.csf.release.dao.FlyerTrainingDao; ...@@ -6,6 +6,9 @@ import com.mmc.csf.release.dao.FlyerTrainingDao;
import com.mmc.csf.release.entity.CurriculumInfoDO; import com.mmc.csf.release.entity.CurriculumInfoDO;
import com.mmc.csf.release.entity.FlightSkillsDO; import com.mmc.csf.release.entity.FlightSkillsDO;
import com.mmc.csf.release.entity.PilotRegistrationDO; import com.mmc.csf.release.entity.PilotRegistrationDO;
import com.mmc.csf.release.feign.PmsAppApi;
import com.mmc.csf.release.flyer.dto.AllCategoryDTO;
import com.mmc.csf.release.flyer.dto.CategoriesInfoListDTO;
import com.mmc.csf.release.flyer.qo.CurriculumQo; import com.mmc.csf.release.flyer.qo.CurriculumQo;
import com.mmc.csf.release.flyer.vo.CurriculumInfoVO; import com.mmc.csf.release.flyer.vo.CurriculumInfoVO;
import com.mmc.csf.release.flyer.vo.DronePilotLicenseVO; import com.mmc.csf.release.flyer.vo.DronePilotLicenseVO;
...@@ -14,6 +17,7 @@ import com.mmc.csf.release.flyer.vo.RegistrationVO; ...@@ -14,6 +17,7 @@ import com.mmc.csf.release.flyer.vo.RegistrationVO;
import com.mmc.csf.release.service.FlyerTrainingService; import com.mmc.csf.release.service.FlyerTrainingService;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -34,6 +38,9 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService { ...@@ -34,6 +38,9 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService {
@Resource @Resource
private FlyerTrainingDao flyerTrainingDao; private FlyerTrainingDao flyerTrainingDao;
@Autowired
private PmsAppApi pmsAppApi;
@Override @Override
public ResultBody pilotRegistration(RegistrationVO registrationVO,Integer userAccountId) { public ResultBody pilotRegistration(RegistrationVO registrationVO,Integer userAccountId) {
PilotRegistrationDO pilotRegistrationDO = new PilotRegistrationDO(registrationVO); PilotRegistrationDO pilotRegistrationDO = new PilotRegistrationDO(registrationVO);
...@@ -81,7 +88,7 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService { ...@@ -81,7 +88,7 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService {
@Override @Override
public PageResult queryCurriculumInfoList(CurriculumQo curriculumQo) { public PageResult queryCurriculumInfoList(CurriculumQo curriculumQo) {
Integer SZ = 440300; Integer SZ = 440300;
if (curriculumQo.getRegionId() != null && !curriculumQo.getRegionId().equals(SZ)) { if (curriculumQo.getProvinceCode() != null && !curriculumQo.getProvinceCode().equals(SZ)) {
return PageResult.buildPage(curriculumQo.getPageNo(), curriculumQo.getPageSize(), 0); return PageResult.buildPage(curriculumQo.getPageNo(), curriculumQo.getPageSize(), 0);
} }
int count = flyerTrainingDao.countCurriculumInfoList(curriculumQo); int count = flyerTrainingDao.countCurriculumInfoList(curriculumQo);
...@@ -91,16 +98,22 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService { ...@@ -91,16 +98,22 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService {
Integer pageNo = curriculumQo.getPageNo(); Integer pageNo = curriculumQo.getPageNo();
curriculumQo.buildCurrentPage(); curriculumQo.buildCurrentPage();
List<CurriculumInfoDO> curriculumList = flyerTrainingDao.listPageCurriculumInfo(curriculumQo); List<CurriculumInfoDO> curriculumList = flyerTrainingDao.listPageCurriculumInfo(curriculumQo);
Map<Integer, FlightSkillsDO> flightSkillsMap = flyerTrainingDao.listIndustryFlightSkills().stream().collect(Collectors.toMap(FlightSkillsDO::getId, d -> d)); List<AllCategoryDTO> allCategoryDTOS = pmsAppApi.feignQqueryCategoryInfoByType(3);
List<CurriculumInfoVO> list = curriculumList.stream().map(CurriculumInfoDO::buildCurriculumInfoVO).collect(Collectors.toList()); List<CurriculumInfoVO> list = curriculumList.stream().map(CurriculumInfoDO::buildCurriculumInfoVO).collect(Collectors.toList());
list.stream().map(d -> { if (CollectionUtils.isNotEmpty(allCategoryDTOS)){
if (flightSkillsMap.get(d.getFlightSkills()) != null){ list.stream().forEach(curriculumInfoVO -> {
FlightSkillsDO flightSkillsDO = flightSkillsMap.get(d.getFlightSkills()); allCategoryDTOS.stream().forEach(directory -> {
d.setFlightSkillsName1(flightSkillsMap.get(flightSkillsDO.getPid()).getSkillsName()); if (CollectionUtils.isNotEmpty(directory.getCategoriesInfoListDTO())){
d.setFlightSkillsName2(flightSkillsDO.getSkillsName()); directory.getCategoriesInfoListDTO().stream().forEach(category -> {
} if (curriculumInfoVO.getCategoriesId().equals(category.getId())){
return d; curriculumInfoVO.setDirectoryName(directory.getName());
}).collect(Collectors.toList()); curriculumInfoVO.setCategoriesName(category.getName());
}
});
}
});
});
}
return PageResult.buildPage(pageNo, curriculumQo.getPageSize(), count, list); return PageResult.buildPage(pageNo, curriculumQo.getPageSize(), count, list);
} }
...@@ -124,12 +137,18 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService { ...@@ -124,12 +137,18 @@ public class FlyerTrainingServiceImpl implements FlyerTrainingService {
if (curriculumInfoDO == null) { if (curriculumInfoDO == null) {
return ResultBody.error("课程不存在或已下架!"); return ResultBody.error("课程不存在或已下架!");
}else { }else {
Map<Integer, FlightSkillsDO> flightSkillsMap = flyerTrainingDao.listIndustryFlightSkills().stream().collect(Collectors.toMap(FlightSkillsDO::getId, d -> d));
CurriculumInfoVO curriculumInfoVO = curriculumInfoDO.buildCurriculumInfoVO(); CurriculumInfoVO curriculumInfoVO = curriculumInfoDO.buildCurriculumInfoVO();
if (flightSkillsMap.get(curriculumInfoVO.getFlightSkills()) != null) { List<AllCategoryDTO> allCategoryDTOS = pmsAppApi.feignQqueryCategoryInfoByType(3);
FlightSkillsDO flightSkillsDO = flightSkillsMap.get(curriculumInfoVO.getFlightSkills()); for (AllCategoryDTO directory : allCategoryDTOS) {
curriculumInfoVO.setFlightSkillsName1(flightSkillsMap.get(flightSkillsDO.getPid()).getSkillsName()); if (CollectionUtils.isNotEmpty(directory.getCategoriesInfoListDTO())){
curriculumInfoVO.setFlightSkillsName2(flightSkillsDO.getSkillsName()); for (CategoriesInfoListDTO category : directory.getCategoriesInfoListDTO()) {
if (curriculumInfoVO.getCategoriesId().equals(category.getId())){
curriculumInfoVO.setDirectoryName(directory.getName());
curriculumInfoVO.setCategoriesName(category.getName());
break;
}
}
}
} }
return ResultBody.success(curriculumInfoVO); return ResultBody.success(curriculumInfoVO);
} }
......
...@@ -144,6 +144,8 @@ ribbon: ...@@ -144,6 +144,8 @@ ribbon:
iuav: iuav:
userapp: userapp:
url: http://cms-svc:35150 url: http://cms-svc:35150
pmsapp:
url: http://pms-svc:8099
#mmc: #mmc:
# appid: 80001 # appid: 80001
......
...@@ -118,6 +118,8 @@ mybatis: ...@@ -118,6 +118,8 @@ mybatis:
iuav: iuav:
userapp: userapp:
url: http://cms-svc:35150 url: http://cms-svc:35150
pmsapp:
url: http://127.0.0.1:8099
##feign ##feign
#feign: #feign:
......
...@@ -144,6 +144,8 @@ ribbon: ...@@ -144,6 +144,8 @@ ribbon:
iuav: iuav:
userapp: userapp:
url: http://cms-svc:35150 url: http://cms-svc:35150
pmsapp:
url: http://pms-svc:8099
#mmc: #mmc:
# appid: 80001 # appid: 80001
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
</insert> </insert>
<insert id="addCurriculum" keyProperty="id" useGeneratedKeys="true" parameterType="com.mmc.csf.release.entity.CurriculumInfoDO"> <insert id="addCurriculum" keyProperty="id" useGeneratedKeys="true" parameterType="com.mmc.csf.release.entity.CurriculumInfoDO">
INSERT INTO `curriculum_info`(`curriculum_name`, `supplier_id`, `curriculum_desc`, `drone_pilot_license_id`, `flight_skills`, `surface_url`, `video_url`, `detail_content`) INSERT INTO `curriculum_info`(`curriculum_name`, `supplier_id`, `curriculum_desc`, `drone_pilot_license_id`, `flight_skills`, `categories_id`, `surface_url`, `video_url`, `detail_content`)
VALUES (#{curriculumName},#{supplierId},#{curriculumDesc},#{dronePilotLicenseId},#{flightSkills},#{surfaceUrl},#{videoUrl},#{detailContent}); VALUES (#{curriculumName},#{supplierId},#{curriculumDesc},#{dronePilotLicenseId},#{flightSkills},#{categoriesId},#{surfaceUrl},#{videoUrl},#{detailContent});
</insert> </insert>
<update id="updateCurriculum" parameterType="com.mmc.csf.release.entity.CurriculumInfoDO"> <update id="updateCurriculum" parameterType="com.mmc.csf.release.entity.CurriculumInfoDO">
...@@ -44,6 +44,9 @@ ...@@ -44,6 +44,9 @@
<if test="flightSkills != null"> <if test="flightSkills != null">
flight_skills = #{flightSkills}, flight_skills = #{flightSkills},
</if> </if>
<if test="categoriesId != null">
categories_id = #{categoriesId},
</if>
<if test="surfaceUrl != null"> <if test="surfaceUrl != null">
surface_url = #{surfaceUrl}, surface_url = #{surfaceUrl},
</if> </if>
...@@ -107,6 +110,7 @@ ...@@ -107,6 +110,7 @@
ci.flight_skills, ci.flight_skills,
ci.detail_content, ci.detail_content,
ci.video_url, ci.video_url,
ci.categories_id,
ci.surface_url ci.surface_url
from curriculum_info ci from curriculum_info ci
<where> <where>
...@@ -120,6 +124,9 @@ ...@@ -120,6 +124,9 @@
<if test="flightSkillsId != null"> <if test="flightSkillsId != null">
and flight_skills = #{flightSkillsId} and flight_skills = #{flightSkillsId}
</if> </if>
<if test="categoriesId != null">
and categories_id = #{categoriesId}
</if>
</where> </where>
order by ci.create_time desc order by ci.create_time desc
LIMIT #{pageNo},#{pageSize} LIMIT #{pageNo},#{pageSize}
...@@ -163,6 +170,7 @@ ...@@ -163,6 +170,7 @@
ci.flight_skills, ci.flight_skills,
ci.detail_content, ci.detail_content,
ci.video_url, ci.video_url,
ci.categories_id,
ci.surface_url ci.surface_url
from curriculum_info ci from curriculum_info ci
where ci.id = #{id} where ci.id = #{id}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论