ct 1 deň pred
rodič
commit
56ab1a3276

+ 53 - 6
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseVideoController.java

@@ -1,7 +1,9 @@
 package com.fs.course.controller;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -12,12 +14,15 @@ import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.course.config.CourseConfig;
+import com.fs.course.domain.FsDepVideoShow;
 import com.fs.course.domain.FsUserCourse;
 import com.fs.course.domain.FsUserCourseVideo;
+import com.fs.course.mapper.FsDepVideoShowMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.BatchRedUpdate;
 import com.fs.course.param.BatchVideoSvae;
 import com.fs.course.param.CourseVideoUpdates;
+import com.fs.course.param.FsUserCourseVideoAddAndUpdateParam;
 import com.fs.course.service.IFsUserCourseService;
 import com.fs.course.service.IFsUserCourseVideoService;
 import com.fs.course.vo.FsUserCourseVideoChooseVO;
@@ -58,6 +63,9 @@ public class FsUserCourseVideoController extends BaseController
     @Autowired
     private ISysConfigService configService;
 
+    @Autowired
+    private FsDepVideoShowMapper fsDepVideoShowMapper;
+
     /**
      * 查询课堂视频列表
      */
@@ -120,9 +128,9 @@ public class FsUserCourseVideoController extends BaseController
     @PreAuthorize("@ss.hasPermi('course:userCourseVideo:add')")
     @Log(title = "课堂视频", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody FsUserCourseVideo fsUserCourseVideo)
+    public AjaxResult add(@RequestBody FsUserCourseVideoAddAndUpdateParam param)
     {
-        Long count = fsUserCourseVideoMapper.selectFsUserCourseVideoByCourseSort(fsUserCourseVideo.getCourseId(),fsUserCourseVideo.getCourseSort());
+        Long count = fsUserCourseVideoMapper.selectFsUserCourseVideoByCourseSort(param.getCourseId(),param.getCourseSort());
         if (count>0){
             return AjaxResult.error("课程排序重复");
         }
@@ -131,11 +139,29 @@ public class FsUserCourseVideoController extends BaseController
         String json = configService.selectConfigByKey("course.config");
         CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
         if (ObjectUtil.isNotEmpty(config.getIsBound())&&config.getIsBound()){
-            fsUserCourseVideo.setUserId(userId);
+            param.setUserId(userId);
         }
         // 设置项目ID
-        FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(fsUserCourseVideo.getCourseId());
-        fsUserCourseVideo.setProjectId(fsUserCourse.getProject());
+        FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(param.getCourseId());
+        param.setProjectId(fsUserCourse.getProject());
+        Integer showTreatment = param.getShowTreatment();
+        if (showTreatment != null){
+            // 先检查是否存在相同记录
+            QueryWrapper<FsDepVideoShow> queryWrapper = new QueryWrapper<>();
+            Long videoId = param.getVideoId();
+            queryWrapper.eq("video_id", videoId);
+            FsDepVideoShow fsDepVideoShow = fsDepVideoShowMapper.selectOne(queryWrapper);
+            int result;
+            if (fsDepVideoShow != null) {
+                // 更新现有记录
+                fsDepVideoShow.setIsShow(showTreatment.toString());
+                fsDepVideoShowMapper.updateByVideoId(fsDepVideoShow);
+            } else {
+                // 插入新记录
+                fsDepVideoShowMapper.insertFsDepVideoShowByVideoId(fsDepVideoShow);
+            }
+        }
+        FsUserCourseVideo fsUserCourseVideo = BeanUtil.copyProperties(param, FsUserCourseVideo.class);
         return toAjax(fsUserCourseVideoService.insertFsUserCourseVideo(fsUserCourseVideo));
     }
 
@@ -145,8 +171,29 @@ public class FsUserCourseVideoController extends BaseController
     @PreAuthorize("@ss.hasPermi('course:userCourseVideo:edit')")
     @Log(title = "课堂视频", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody FsUserCourseVideo fsUserCourseVideo)
+    public AjaxResult edit(@RequestBody FsUserCourseVideoAddAndUpdateParam param)
     {
+        Integer showTreatment = param.getShowTreatment();
+        if (showTreatment != null){
+            // 先检查是否存在相同记录
+            QueryWrapper<FsDepVideoShow> queryWrapper = new QueryWrapper<>();
+            Long videoId = param.getVideoId();
+            queryWrapper.eq("video_id", videoId);
+            FsDepVideoShow fsDepVideoShow = fsDepVideoShowMapper.selectOne(queryWrapper);
+            int result;
+            if (fsDepVideoShow != null) {
+                // 更新现有记录
+                fsDepVideoShow.setIsShow(showTreatment.toString());
+                fsDepVideoShowMapper.updateByVideoId(fsDepVideoShow);
+            } else {
+                // 插入新记录
+                fsDepVideoShow = new FsDepVideoShow();
+                fsDepVideoShow.setIsShow(showTreatment.toString());
+                fsDepVideoShow.setVideoId(videoId);
+                fsDepVideoShowMapper.insertFsDepVideoShowByVideoId(fsDepVideoShow);
+            }
+        }
+        FsUserCourseVideo fsUserCourseVideo = BeanUtil.copyProperties(param, FsUserCourseVideo.class);
         return toAjax(fsUserCourseVideoService.updateFsUserCourseVideo(fsUserCourseVideo));
     }
 

+ 4 - 1
fs-service/src/main/java/com/fs/course/mapper/FsDepVideoShowMapper.java

@@ -20,7 +20,10 @@ public interface FsDepVideoShowMapper extends BaseMapper<FsDepVideoShow>{
      * @param videoId, depId  部门视频疗包展示关联主键
      * @return 部门视频疗包展示关联
      */
-    @Select("select is_show from fs_dep_video_show where video_id=#{videoId} AND dep_id = #{depId}")
+    @Select("<script>" +
+            "SELECT is_show FROM fs_dep_video_show WHERE video_id = #{videoId}" +
+            "<if test='depId != null'> AND dep_id = #{depId}</if>" +
+            "</script>")
     String selectFsDepVideoShowByVideoId(@Param("videoId")Long videoId,@Param("depId") Long depId);
 
     @Select("SELECT is_show FROM fs_dep_video_show WHERE video_id = #{videoId}")

+ 24 - 0
fs-service/src/main/java/com/fs/course/param/FsUserCourseVideoAddAndUpdateParam.java

@@ -0,0 +1,24 @@
+package com.fs.course.param;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import com.fs.course.domain.FsUserCourseVideo;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalTime;
+
+/**
+ * 课堂视频对象 fs_user_course_video
+ *
+ * @author fs
+ * @date 2024-05-17
+ */
+@Data
+public class FsUserCourseVideoAddAndUpdateParam extends FsUserCourseVideo
+{
+
+    private Integer showTreatment; //1不展示疗法,0展示疗法
+}

+ 22 - 7
fs-user-app/src/main/java/com/fs/app/controller/FsUserInformationCollectionController.java

@@ -1,5 +1,6 @@
 package com.fs.app.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.fs.app.annotation.Login;
 import com.fs.common.core.domain.R;
 import com.fs.company.domain.CompanyUser;
@@ -13,12 +14,14 @@ import com.fs.his.param.FsUserInformationCollectionParam;
 import com.fs.his.service.*;
 import com.fs.his.service.impl.FsStoreOrderServiceImpl;
 import com.fs.his.service.impl.FsUserServiceImpl;
+import com.fs.his.vo.AnswerVO;
 import com.fs.his.vo.FsUserInformationCollectionAndPatientVO;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import static com.fs.his.utils.PhoneUtil.decryptPhone;
@@ -53,9 +56,20 @@ public class FsUserInformationCollectionController extends AppBaseController
             return R.error("未查询到信息!");
         }
         String userId = getUserId();
+
         long nowUserId = Long.parseLong(userId);
         if (vo.getUserId()!=null){
             if (vo.getUserId() != nowUserId) {
+                //先查询之前的订单
+                FsUserInformationCollection param = new FsUserInformationCollection();
+                param.setUserId(nowUserId);
+                param.setPackageId(vo.getPackageId());
+                param.setDoctorType2Confirm(0);
+                List<FsUserInformationCollection> list = fsUserInformationCollectionService.selectFsUserInformationCollectionList(param);
+                param.setUserConfirm(0);
+                if (!list.isEmpty()){
+                    return R.error(300,"有信息采集订单暂未完成").put("data",list.get(0));
+                }
                 //一对多 创建新的用户采集
                 FsUserInformationCollectionParam info = new FsUserInformationCollectionParam();
                 FsUser fsUser = fsUserService.selectFsUserById(nowUserId);
@@ -63,10 +77,6 @@ public class FsUserInformationCollectionController extends AppBaseController
                 if (StringUtils.isNotBlank(nickName)){
                     nickName = fsUser.getNickName();
                 }
-                String phone = fsUser.getPhone();
-                if (StringUtils.isNotBlank(phone)){
-                    phone = decryptPhone(phone);
-                }
                 BeanUtils.copyProperties(vo, info);
                 //一对多 这条记录已绑定用户 就重新创建一条
                 info.setId(null);
@@ -77,12 +87,17 @@ public class FsUserInformationCollectionController extends AppBaseController
                 info.setPackageOrderCode(null);
                 info.setSex(fsUser.getSex());
                 info.setUserName(nickName);
-                info.setUserPhoneFour(phone.substring(phone.length()-4));
                 info.setAllergy(null);
-                info.setRemark(null);
                 info.setPatientId(null);
+                info.setRemark(null);
+                List<AnswerVO> answerVOS = JSON.parseArray(vo.getJsonInfo(), AnswerVO.class);
+                for (AnswerVO answerVO : answerVOS) {
+                    answerVO.setValue(new ArrayList<>());
+                }
+                info.setAnswers(answerVOS);
                 Long newId = fsUserInformationCollectionService.insertFsUserInformationCollection(info);
-                vo = fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(newId);//                return R.error("未查询您的采集信息!");
+                vo = fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(newId);
+                // return R.error("未查询您的采集信息!");
             }
 
         }

+ 7 - 2
fs-user-app/src/main/java/com/fs/app/controller/StoreOrderController.java

@@ -192,8 +192,13 @@ public class StoreOrderController extends  AppBaseController {
             throw new CustomException("未发货订单不能查询");
         }
         if (CloudHostUtils.hasCloudHostName("金牛明医")){
-            ExpressInfoDTO dto = orderService.getDfExpressInfoDTO(order);
-            dto.setShipperName(order.getDeliveryName());
+            ExpressInfoDTO dto = null;
+            try {
+                dto = orderService.getDfExpressInfoDTO(order);
+                dto.setShipperName(order.getDeliveryName());
+            } catch (Exception e) {
+                return R.error("暂未查询到物流!");
+            }
             return R.ok().put("data", dto).put("express",expressService.selectFsExpressByName(order.getDeliveryName())).put("deliverySn", order.getDeliverySn());
         } else {
             return orderService.getExpress(order);

+ 6 - 5
fs-user-app/src/main/java/com/fs/app/controller/course/CourseQwController.java

@@ -245,12 +245,13 @@ public class CourseQwController extends AppBaseController {
      * 小黄车商品和展示
      */
     private void getGoodsAndShow(FsUserCourseVideoFinishUParam param, FsUserCourseVideoH5DVO course) {
-        FsCourseWatchLog log = fsCourseWatchLogMapper.getWatchCourseVideo(param.getUserId(),param.getVideoId(),param.getQwUserId(),param.getQwExternalId());
-        CompanyUser companyUser = companyUserMapper.selectCompanyUserById(log.getCompanyUserId());
+//        FsCourseWatchLog log = fsCourseWatchLogMapper.getWatchCourseVideo(param.getUserId(),param.getVideoId(),param.getQwUserId(),param.getQwExternalId());
+//        CompanyUser companyUser = companyUserMapper.selectCompanyUserById(log.getCompanyUserId());
         Long videoId = param.getVideoId();
-        Long deptId = companyUser.getDeptId();
-        String show = fsDepVideoShowMapper.selectFsDepVideoShowByVideoId(videoId, deptId);
-        course.setShowTreatment(ObjectUtil.isEmpty(show) ? "1" : "show");
+        Long deptId = null;
+//        Long deptId = companyUser.getDeptId();
+        String show = fsDepVideoShowMapper.selectFsDepVideoShowByVideoId(videoId, null);
+        course.setShowTreatment(ObjectUtil.isEmpty(show) ? "1" : show);
 
         FsUserCourseVideo courseVideo = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
         String packageJson = courseVideo.getPackageJson();