Преглед на файлове

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	common/common-entity/sql记录
yeshijie преди 3 години
родител
ревизия
99c6930766

+ 3 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/course/CourseCatalogueDao.java

@ -4,6 +4,8 @@ import com.yihu.jw.entity.care.course.CourseCatalogueDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 *
@ -14,5 +16,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface CourseCatalogueDao extends PagingAndSortingRepository<CourseCatalogueDO, String>, JpaSpecificationExecutor<CourseCatalogueDO> {
    List<CourseCatalogueDO> findByCourserId(String courserId);
}

+ 47 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/DoctorCourseEndpoint.java

@ -4,16 +4,17 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.entity.care.course.CourseDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.tencent.TencentVODUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -31,6 +32,10 @@ public class DoctorCourseEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private CourseService courseService;
    @Value("${tencent.secretId}")
    private String secretId;
    @Value("${tencent.secretKey}")
    private String secretKey;
    @GetMapping(value = "myCourseList")
    @ApiOperation(value = "我的课程列表")
@ -52,4 +57,42 @@ public class DoctorCourseEndpoint extends EnvelopRestEndpoint {
        return PageEnvelop.getError("查询失败");
    }
    @GetMapping(value = "courseDetail")
    @ApiOperation(value = "课程详情")
    public ObjEnvelop courseDetail(
            @ApiParam(name = "id", value = "id") @RequestParam(value = "id", required = true) String id) {
        try{
            JSONObject result = courseService.courseDetail(id);
            return ObjEnvelop.getSuccess("查询成功",result);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("查询失败");
    }
    @PostMapping(value = "addCourse")
    @ApiOperation(value = "新增课程")
    public ObjEnvelop addCourse(
            @ApiParam(name = "doctorId", value = "doctorId") @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "jsonData", value = "jsonData") @RequestParam(value = "jsonData", required = true) String jsonData) {
        try{
            JSONObject result = courseService.addCourse(doctorId, jsonData);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("新增成功",result);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ObjEnvelop.getError("新增失败");
    }
    @GetMapping(value = "getTXUploadSignature")
    @ApiOperation(value = "获取腾讯视频上传签名")
    public Envelop getTXUploadSignature() throws Exception {
        TencentVODUtil tencentVODUtil = new TencentVODUtil();
        tencentVODUtil.setSecretId(secretId);
        tencentVODUtil.setSecretKey(secretKey);
        return success(tencentVODUtil.getUploadSignature());
    }
}

+ 34 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java

@ -8,10 +8,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.care.course.CourseDO;
import com.yihu.jw.entity.care.course.CourseSalesOrderRecordDO;
import com.yihu.jw.entity.care.course.PatientOrderRefundDO;
import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
import com.yihu.jw.entity.care.course.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -24,6 +21,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -184,6 +182,24 @@ public class CourseService {
        return map;
    }
    /**
     * 课程详情
     * @param id
     * @return
     */
    public JSONObject courseDetail(String id){
        JSONObject result = new JSONObject();
        CourseDO courseDO = courseDao.findOne(id);
        if(!"1".equals(courseDO.getType())){
            List<CourseCatalogueDO> catalogueDOList = courseCatalogueDao.findByCourserId(id);
            courseDO.setCatalogueDOList(catalogueDOList);
        }
        result.put("courseDO",courseDO);
        return result;
    }
    /**
     * 新增课程
     * @param doctorId
@ -211,11 +227,25 @@ public class CourseService {
        courseDO.setDoctorName(doctorDO.getName());
        courseDO.setOrgCode(baseDoctorHospitalDO.get(0).getOrgCode());
        courseDO.setOrgName(baseDoctorHospitalDO.get(0).getOrgName());
        courseDO.setCreateTime(new Date());
        courseDO.setCreateUser(doctorId);
        courseDO.setCreateUserName(doctorDO.getName());
        if("1".equals(courseDO.getType())){
            //直播课程
            courseDO.setLiveStatus("1");
        }
        List<CourseCatalogueDO> catalogueDOList = courseDO.getCatalogueDOList();
        courseDao.save(courseDO);
        if(catalogueDOList!=null&&catalogueDOList.size()>0){
            for (CourseCatalogueDO catalogueDO : catalogueDOList){
                catalogueDO.setCourserId(catalogueDO.getId());
                catalogueDO.setType(courseDO.getType());
                catalogueDO.setCreateTime(new Date());
            }
            courseCatalogueDao.save(catalogueDOList);
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        return result;
    }

+ 4 - 0
svr/svr-cloud-care/src/main/resources/application.yml

@ -74,6 +74,10 @@ fast-dfs:
configDefault: # 默认配置
  saasId: xmjkzl_saasId
tencent:
  secretId: AKIDa1C6k7D2astd6JGvKRJvFJ6dsrZ1C5h2
  secretKey: 7xWpsd7KGC3f16vUq0ucARRAcnhKfjX4
---
spring:
  profiles: jwdev