Explorar el Código

增加搭销会员历史订单、处理记录查询接口

cgp hace 1 semana
padre
commit
f0c4c91039

+ 30 - 4
fs-doctor-app/src/main/java/com/fs/app/controller/FsSopDoctorTaskController.java

@@ -8,9 +8,7 @@ import com.fs.app.utils.JwtUtils;
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
-import com.fs.his.domain.FsPatient;
-import com.fs.his.domain.FsUser;
-import com.fs.his.domain.FsUserAddress;
+import com.fs.his.domain.*;
 import com.fs.his.dto.FsDoctorTaskDTO;
 import com.fs.his.dto.SopDoctorTaskDto;
 import com.fs.his.param.FsStoreOrderParam;
@@ -41,7 +39,6 @@ import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.enums.BusinessType;
-import com.fs.his.domain.FsSopDoctorTask;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.common.core.page.TableDataInfo;
 
@@ -288,4 +285,33 @@ public class FsSopDoctorTaskController extends BaseController
         }
         return R.error("提交失败");
     }
+
+    /**
+     * 查询搭销会员任务处理记录
+     * @param queryDto 医生处理任务
+     * @return 医生处理sop任务集合
+     * */
+    @GetMapping("/selectFsSopDoctorTaskVoListHandleRecords")
+    public TableDataInfo selectFsSopDoctorTaskVoListHandleRecords(SopDoctorTaskDto queryDto)
+    {
+        startPage();
+        List<SopDoctorTaskVo> list = fsSopDoctorTaskService.selectFsSopDoctorTaskVoListHandleRecords(queryDto);
+        return getDataTable(list);
+
+    }
+    /**
+     * 查询用户历史订单列表
+     * */
+    @GetMapping("/storeOrder/userHistoryOrderList")
+    public TableDataInfo userHistoryOrderList(FsStoreOrder fsStoreOrder)
+    {
+        startPage();
+        fsStoreOrder.setCompanyUserId(fsStoreOrder.getCompanyUserId());
+        List<FsStoreOrder> list = fsStoreOrderService.selectFsStoreOrderList(fsStoreOrder);
+        if (CollectionUtils.isEmpty(list)){
+            return getDataTable(Collections.emptyList());
+        }
+        return getDataTable(list);
+
+    }
 }

+ 3 - 0
fs-service/src/main/java/com/fs/his/domain/FsSopDoctorTask.java

@@ -55,4 +55,7 @@ public class FsSopDoctorTask extends BaseEntity{
 
     //医生会员搭销id
     private Long doctorMemberSalesId;
+
+    /** 提醒天数 */
+    private Integer sendDays;
 }

+ 2 - 0
fs-service/src/main/java/com/fs/his/dto/FsDoctorTaskDTO.java

@@ -8,6 +8,8 @@ public class FsDoctorTaskDTO {
     private Long id;
     //医生id
     private Long doctorId;
+    //销售id
+    private Long companyUserId;
     //提醒时间天数
     private Integer sendDays;
     //处理方式 1:签收,2:提醒时间

+ 6 - 0
fs-service/src/main/java/com/fs/his/dto/SopDoctorTaskDto.java

@@ -32,12 +32,18 @@ public class SopDoctorTaskDto  extends BaseEntity {
     /** 套餐包Id */
     private Long packageId;
 
+    /** 搭销会员Id */
+    private Long doctorMemberSalesId;
+
     /** 订单号 */
     private String orderCode;
 
     /** 0:待处理,1:已处理 */
     private Integer status;
 
+    /** 1:签收 2:提醒*/
+    private Integer handleType;
+
     /** 1:小品未购 主品未购 2:小品已购 主品未购 3:小品未购 主品已购 4:小品已购 主品已购 */
     private Integer type;
 }

+ 7 - 0
fs-service/src/main/java/com/fs/his/service/IFsSopDoctorTaskService.java

@@ -71,4 +71,11 @@ public interface IFsSopDoctorTaskService extends IService<FsSopDoctorTask>{
      * 提交搭销会员任务
      * */
     int submitDoctorTask(FsDoctorTaskDTO addTaskDto);
+
+    /**
+     * 查询搭销会员任务处理记录
+     * @param queryDto 医生处理任务
+     * @return 医生处理sop任务集合
+     * */
+    List<SopDoctorTaskVo> selectFsSopDoctorTaskVoListHandleRecords(SopDoctorTaskDto queryDto);
 }

+ 21 - 6
fs-service/src/main/java/com/fs/his/service/impl/FsSopDoctorTaskServiceImpl.java

@@ -180,12 +180,15 @@ public class FsSopDoctorTaskServiceImpl extends ServiceImpl<FsSopDoctorTaskMappe
         doctorTask.setHandleType(addTaskDto.getHandleType());
         doctorTask.setRemark(addTaskDto.getRemark());
         doctorTask.setUpdateTime(DateUtils.getNowDate());
+        doctorTask.setSendDays(addTaskDto.getSendDays());
+        int updateResult = fsSopDoctorTaskMapper.updateFsSopDoctorTask(doctorTask);
 
+        //如果是"签收"类型 额外处理
         if (addTaskDto.getHandleType() != null && addTaskDto.getHandleType() == 1) {
             doctorTask.setOrderCode(addTaskDto.getOrderCode());
-            //签收的订单号存入缓存中
-            //String signOffOrderCacheKey = "SIGN_OFF_ORDERS_CODE:"+addTaskDto.getId();
-            //redisCache.setCacheObject(signOffOrderCacheKey,addTaskDto.getOrderCode());
+            //签收的doctorTask缓存中
+            String signOffOrderCacheKey = "doctorMemberSaLes:"+ addTaskDto.getOrderCode();
+            redisCache.setCacheObject(signOffOrderCacheKey,doctorTask);
             //修改fs_store_order表的is_receive_notice为已签收
             FsStoreOrder fsStoreOrder=new FsStoreOrder();
             fsStoreOrder.setIsReceiveNotice(1);//已签收
@@ -193,9 +196,7 @@ public class FsSopDoctorTaskServiceImpl extends ServiceImpl<FsSopDoctorTaskMappe
             fsStoreOrderMapper.updateFsStoreOrderByOrderCode(fsStoreOrder);
         }
 
-        int updateResult = fsSopDoctorTaskMapper.updateFsSopDoctorTask(doctorTask);
-
-        // --- 3. 根据处理类型执行后续操作 ---
+        // --- 3. "提醒时间"类型执行后续操作 ---
         if (addTaskDto.getHandleType() != null && addTaskDto.getHandleType() == 2) {
             // --- 3.1 计算提醒时间 ---
             Date now = DateUtils.getNowDate();
@@ -206,6 +207,7 @@ public class FsSopDoctorTaskServiceImpl extends ServiceImpl<FsSopDoctorTaskMappe
             sopOrderLog.setDoctorId(addTaskDto.getDoctorId());// 医生ID
             sopOrderLog.setStatus(0); // 0:未发送,1:已发送
             sopOrderLog.setFsUserId(fsDoctorMemberSales.getFsUserId());
+            sopOrderLog.setCompanyUserId(addTaskDto.getCompanyUserId());
             sopOrderLog.setCreateTime(now);
             sopOrderLog.setSendTime(futureDate);
             sopOrderLog.setDoctorMemberSalesId(addTaskDto.getDoctorMemberSalesId());
@@ -215,6 +217,19 @@ public class FsSopDoctorTaskServiceImpl extends ServiceImpl<FsSopDoctorTaskMappe
         return updateResult;
     }
 
+    /**
+     * 查询搭销会员任务处理记录
+     * */
+    @Override
+    public List<SopDoctorTaskVo> selectFsSopDoctorTaskVoListHandleRecords(SopDoctorTaskDto queryDto) {
+        // ---验证输入参数 ---
+        if (queryDto == null || queryDto.getDoctorMemberSalesId() == null) {
+            throw new CustomException("医生会员搭销ID不能为空");
+        }
+        queryDto.setStatus(1);//1:已处理
+        return fsSopDoctorTaskMapper.selectFsSopDoctorTaskVoList(queryDto);
+    }
+
     /**
      * 计算未来日期
      * @param baseDate 基准日期

+ 11 - 0
fs-service/src/main/java/com/fs/his/vo/SopDoctorTaskVo.java

@@ -39,6 +39,8 @@ public class SopDoctorTaskVo {
     @Excel(name = "客户姓名")
     private String name;
 
+    /** 营期id */
+    private String sopId;
 
     private String avatar;
 
@@ -65,4 +67,13 @@ public class SopDoctorTaskVo {
 
     /** qw_external_contact表主键 */
     private Long qwExternalContactId;
+
+    /** 处理类型 1:签收,2:选择下次提醒时间 */
+    private Integer handleType;
+
+    /** 提醒天数 */
+    private Integer sendDays;
+
+    //医生会员搭销id
+    private Long doctorMemberSalesId;
 }

+ 2 - 1
fs-service/src/main/java/com/fs/qw/vo/SopCompanyUserTaskVo.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
-import io.swagger.models.auth.In;
 import lombok.Data;
 
 import java.util.Date;
@@ -41,6 +40,8 @@ public class SopCompanyUserTaskVo {
     @Excel(name = "用户姓名")
     private String name;
 
+    /** 营期id */
+    private String sopId;
 
     private String avatar;
 

+ 14 - 5
fs-service/src/main/resources/mapper/his/FsSopDoctorTaskMapper.xml

@@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="type"    column="type"    />
         <result property="qwExternalContactId"    column="qw_external_contact_id"    />
         <result property="handleType"    column="handle_type"    />
+        <result property="doctorMemberSalesId"    column="doctor_member_sales_id"    />
     </resultMap>
 
     <resultMap type="com.fs.his.vo.SopDoctorTaskVo" id="SopDoctorTaskVoResult">
@@ -35,18 +36,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime"   column="update_time" />
         <result property="qwExternalContactId"    column="qw_external_contact_id"    />
         <result property="handleType"    column="handle_type"    />
-
+        <result property="doctorMemberSalesId"    column="doctor_member_sales_id"    />
+        <result property="sendDays"    column="send_days"    />
         <!-- 关联表字段 -->
         <result property="name"     column="name" />          <!-- qwec.name -->
         <result property="companyUserName"   column="company_user_name" />   <!-- cp.nick_name -->
         <result property="packageName"  column="package_name" />
         <result property="avatar" column="avatar" />
         <result property="phone"  column="phone" />
-        <result property="doctor_name"  column="doctorName" />
+        <result property="doctorName"  column="doctor_name" />
     </resultMap>
 
     <sql id="selectFsSopDoctorTaskVo">
-        select id, company_user_id,doctor_id, user_id, status, create_time, update_time, remark, package_id, order_code, type,qw_external_contact_id,handle_type from fs_sop_doctor_task
+        select id, company_user_id,doctor_id, user_id, status, create_time, update_time, remark, package_id, order_code, type,qw_external_contact_id,handle_type,doctor_member_sales_id,send_days from fs_sop_doctor_task
     </sql>
 
     <select id="selectFsSopDoctorTaskVoList" parameterType="com.fs.his.dto.SopDoctorTaskDto" resultMap="SopDoctorTaskVoResult">
@@ -66,7 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         sdt.type,
         fd.doctor_name,
         sdt.qw_external_contact_id,
-        sdt.handle_type
+        sdt.handle_type,
+        sdt.send_days
         FROM
         fs_sop_doctor_task sdt
         LEFT JOIN company_user cp ON sdt.company_user_id = cp.user_id
@@ -82,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyUserId != null "> and sdt.company_user_id = #{companyUserId}</if>
             <if test="status != null "> and sdt.status = #{status}</if>
             <if test="handleType != null "> and sdt.handle_type = #{handleType}</if>
+            <if test="doctorMemberSalesId != null "> and sdt.doctor_member_sales_id = #{doctorMemberSalesId}</if>
             <if test="type != null "> and sdt.type = #{type}</if>
             <if test="qwUserId != null "> and qwec.qw_user_id = #{qwUserId}</if>
             <if test="name != null "> and qwec.name like concat('%', #{name}, '%')</if>
@@ -113,7 +117,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             sdt.remark,
             sdt.type,
             sdt.qw_external_contact_id,
-            sdt.handle_type
+            sdt.handle_type,
+            sdt.doctor_member_sales_id,
+            sdt.send_days
         FROM
             fs_sop_doctor_task sdt
                 LEFT JOIN company_user cp ON sdt.company_user_id = cp.user_id
@@ -138,6 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="handleType != null">handle_type,</if>
             <if test="qwExternalContactId != null">qw_external_contact_id,</if>
             <if test="doctorMemberSalesId != null">doctor_member_sales_id,</if>
+            <if test="sendDays != null">send_days,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="companyUserId != null">#{companyUserId},</if>
@@ -153,6 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="handleType != null">#{handleType},</if>
             <if test="qwExternalContactId != null">#{qwExternalContactId},</if>
             <if test="doctorMemberSalesId != null">#{doctorMemberSalesId},</if>
+            <if test="sendDays != null">#{sendDays},</if>
          </trim>
     </insert>
 
@@ -171,6 +179,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="type != null">type = #{type},</if>
             <if test="handleType != null">handle_type = #{handleType},</if>
             <if test="qwExternalContactId != null">qw_external_contact_id=#{qwExternalContactId},</if>
+            <if test="sendDays != null">send_days=#{sendDays},</if>
         </trim>
         where id = #{id}
     </update>

+ 1 - 0
fs-service/src/main/resources/mapper/his/FsStoreOrderMapper.xml

@@ -148,6 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="doctorId != null "> and doctor_id = #{doctorId}</if>
             <if test="orderType != null "> and order_type = #{doctorId}</if>
         </where>
+        order by create_time desc
     </select>
 
     <select id="selectFsStoreOrderByOrderId" parameterType="Long" resultMap="FsStoreOrderResult">