Browse Source

Merge remote-tracking branch 'origin/master'

yuhongqi 1 day ago
parent
commit
ea97b1379b

+ 30 - 7
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreOrderScrmController.java

@@ -8,6 +8,8 @@ import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.domain.entity.SysRole;
+import com.fs.common.core.domain.entity.SysUser;
 import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
@@ -53,6 +55,7 @@ import com.fs.hisStore.service.*;
 import com.fs.hisStore.vo.*;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
+import com.fs.system.service.ISysRoleService;
 import com.github.pagehelper.PageHelper;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
@@ -340,19 +343,19 @@ public class FsStoreOrderScrmController extends BaseController {
         }
         param.setNotHealth(1);
         List<FsStoreOrderErpExportVO> list = fsStoreOrderService.selectFsStoreOrderListVOByExport(param);
+
         //对手机号脱敏
         if (list != null) {
-            //获取当前账号角色权限
-            LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+            SysRole sysRole = isCheckPermission();
 
             for (FsStoreOrderErpExportVO vo : list) {
-                if (vo.getPhone() != null) {
+                if (vo.getPhone() != null && sysRole.getIsCheckPhone() != 1) {
                     vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                 }
-                if (vo.getUserPhone() != null) {
+                if (vo.getUserPhone() != null && sysRole.getIsCheckPhone() != 1) {
                     vo.setUserPhone(vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
                 }
-                if (vo.getUserAddress()!=null){
+                if (vo.getUserAddress()!=null && sysRole.getIsCheckAddress() != 1){
                     vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
                 }
             }
@@ -377,6 +380,25 @@ public class FsStoreOrderScrmController extends BaseController {
         }
     }
 
+    @Autowired
+    private ISysRoleService sysRoleService;
+    private SysRole isCheckPermission() {
+        SysRole sysRole = new SysRole();
+        SysUser user = getLoginUser().getUser();
+        boolean flag = user.isAdmin();
+        if (flag) {
+            sysRole.setIsCheckPhone(1);
+            sysRole.setIsCheckAddress(1);
+        } else {
+            List<SysRole> roles = user.getRoles();
+            if (roles != null && !roles.isEmpty()) {
+                Long[] roleIds = roles.stream().map(SysRole::getRoleId).toArray(Long[]::new);
+                return sysRoleService.getIsCheckPermission(roleIds);
+            }
+        }
+        return sysRole;
+    }
+
 
     /**
      * 导出订单列表(明文)
@@ -453,14 +475,15 @@ public class FsStoreOrderScrmController extends BaseController {
         List<FsStoreOrderItemExportVO> list = orderItemService.selectFsStoreOrderItemListExportVO(param);
         //对手机号脱敏
         if (list != null) {
+            SysRole sysRole = isCheckPermission();
             LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
 
             for (FsStoreOrderItemExportVO vo : list) {
-                if (vo.getUserPhone() != null) {
+                if (vo.getUserPhone() != null && sysRole.getIsCheckPhone() != 1) {
                     String phone = vo.getUserPhone().replaceAll("(\\d{3})\\d*(\\d{1})", "$1****$2");
                     vo.setUserPhone(phone);
                 }
-                if (vo.getUserAddress()!=null){
+                if (vo.getUserAddress()!=null && sysRole.getIsCheckAddress() != 1){
                     vo.setUserAddress(ParseUtils.parseAddress(vo.getUserAddress()));
                 }
                 if (!StringUtils.isEmpty(vo.getJsonInfo())) {

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

@@ -108,4 +108,7 @@ public class FsUserInformationCollection extends BaseEntity{
     //药师签名
     private String doctorType2Sign;
 
+    //药品订单id
+    private Long storeOrderId;
+
 }

+ 7 - 2
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -1055,7 +1055,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         if (fsStoreOrderMapper.insertFsStoreOrder(order) > 0) {
             if(CloudHostUtils.hasCloudHostName("金牛明医")){
                 //信息采集 发送药师im
-                doctorSendIm(packageOrder);
+                doctorSendIm(packageOrder,order.getOrderId());
             }
             if (packageOrder.getCycle() >= followRate) {
                 FsFollow fsFollow = new FsFollow();
@@ -1141,7 +1141,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         return R.ok();
     }
 
-    private void doctorSendIm(FsPackageOrder packageOrder) {
+    private void doctorSendIm(FsPackageOrder packageOrder,Long storeOrderId) {
         try {
             //信息采集 发送药师im
             FsUserInformationCollection fsUserInformationCollectionParam = new FsUserInformationCollection();
@@ -1152,6 +1152,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
             if (!fsUserInformationCollections.isEmpty()) {
                 for (FsUserInformationCollection collection : fsUserInformationCollections) {
                     openIMService.sendUserInformation(collection.getUserId(),collection.getDoctorType2Id(),collection.getId());
+                    //保存id 到信息采集表
+                    FsUserInformationCollection saveParam = new FsUserInformationCollection();
+                    saveParam.setId(collection.getId());
+                    saveParam.setStoreOrderId(storeOrderId);
+                    fsUserInformationCollectionMapper.updateFsUserInformationCollection(saveParam);
                 }
             }
         } catch (Exception e) {

+ 3 - 3
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreOrderScrmMapper.java

@@ -1283,9 +1283,9 @@ public interface FsStoreOrderScrmMapper
             "        </if>" +
             "<if test=\"maps.status == 6\">" +
             "            AND o.`status` = 1" +
-            "            AND (" +
-            "            o.store_id IN (SELECT store_id FROM fs_store WHERE delivery_type=2 OR delivery_type=1)" +
-            "            )" +
+//            "            AND (" +
+//            "            o.store_id IN (SELECT store_id FROM fs_store WHERE delivery_type=2 OR delivery_type=1)" +
+//            "            )" +
             "            AND (o.extend_order_id IS NULL OR o.extend_order_id = '')" +
             "        </if>" +
             "<if test = 'maps.deliveryStatus != null    '> " +

+ 20 - 2
fs-service/src/main/resources/mapper/his/FsStoreOrderMapper.xml

@@ -532,6 +532,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             ) sp_latest ON sp_latest.business_code = so.order_code AND sp_latest.rn = 1
             LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
         </if>
+        <if test="maps.status != null and (maps.status == 7 or maps.status == 6)">
+            LEFT JOIN fs_user_information_collection fuic ON fuic.store_order_id = so.order_id
+        </if>
 
         where so.is_del=0
         <if test="maps.packageSecondName != null and maps.packageSecondName != ''">
@@ -567,7 +570,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.isFirst != null">
             and so.is_first = #{maps.isFirst}
         </if>
-        <if test="maps.status != null and maps.status != 6">
+        <if test="maps.status != null and maps.status != 6 and maps.status != 7">
             and so.status = #{maps.status}
         </if>
         <if test="maps.status == 6">
@@ -576,6 +579,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             so.store_id in (select store_id from fs_store where delivery_type=2 or delivery_type=1)
             )
             and  (so.extend_order_id is null or  so.extend_order_id like '')
+            and (fuic.doctor_type2_confirm = 1 or fuic.doctor_type2_confirm = null)
+        </if>
+        <if test="maps.status == 7">
+            and so.`status`= 2
+            and fuic.doctor_type2_confirm = 0
+
         </if>
         <if test="maps.source != null">
             and so.source = #{maps.source}
@@ -741,6 +750,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE sp.business_code IS NOT NULL
         ) sp_latest ON sp_latest.business_code = so.order_code AND sp_latest.rn = 1
         LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
+        <if test="maps.status != null and (maps.status == 7 or maps.status == 6)">
+            LEFT JOIN fs_user_information_collection fuic ON fuic.store_order_id = so.order_id
+        </if>
         <where>
             <if test="maps.packageSecondName != null and maps.packageSecondName != ''">
                 and so.package_second_name like concat('%', #{maps.packageSecondName}, '%')
@@ -775,7 +787,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.isFirst != null">
                 and so.is_first = #{maps.isFirst}
             </if>
-            <if test="maps.status != null and maps.status != 6">
+            <if test="maps.status != null and maps.status != 6 and maps.status != 7">
                 and so.status = #{maps.status}
             </if>
             <if test="maps.status == 6">
@@ -784,6 +796,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 so.store_id in (select store_id from fs_store where delivery_type=2 or delivery_type=1)
                 )
                 and  (so.extend_order_id is null or  so.extend_order_id like '')
+                and (fuic.doctor_type2_confirm = 1 or fuic.doctor_type2_confirm = null)
+            </if>
+            <if test="maps.status == 7">
+                and so.`status`= 2
+                and fuic.doctor_type2_confirm = 0
+
             </if>
             <if test="maps.source != null">
                 and so.source = #{maps.source}

+ 6 - 1
fs-service/src/main/resources/mapper/his/FsUserInformationCollectionMapper.xml

@@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="doctorType2Id"    column="doctor_type2_id"    />
         <result property="doctorType2Confirm"    column="doctor_type2_confirm"    />
         <result property="doctorType2Sign"    column="doctor_type2_sign"    />
+        <result property="storeOrderId"    column="store_order_id"    />
     </resultMap>
 
     <sql id="selectFsUserInformationCollectionVo">
@@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
              , doctor_confirm, create_time, update_time,doctor_id,company_user_id
              ,package_id,pay_type,amount,is_package,user_confirm2,package_order_code,package_order_id
              ,status,user_advice,doctor_advice,doctor_sign,doctor_confirm_time,sex,user_name,user_phone_four
-             ,allergy,remark,patient_id,doctor_type2_id,doctor_type2_confirm,doctor_type2_sign  from fs_user_information_collection
+             ,allergy,remark,patient_id,doctor_type2_id,doctor_type2_confirm,doctor_type2_sign,store_order_id  from fs_user_information_collection
     </sql>
 
     <select id="selectFsUserInformationCollectionList" parameterType="FsUserInformationCollection" resultMap="FsUserInformationCollectionResult">
@@ -55,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userConfirm != null "> and user_confirm = #{userConfirm}</if>
             <if test="doctorConfirm != null "> and doctor_confirm = #{doctorConfirm}</if>
             <if test="packageOrderId != null "> and package_order_id = #{packageOrderId}</if>
+            <if test="storeOrderId != null "> and store_order_id = #{storeOrderId}</if>
             <if test="packageOrderCode != null and packageOrderCode !=''"> and package_order_code = #{packageOrderCode}</if>
         </where>
         order by id desc
@@ -152,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="doctorType2Id != null">doctor_type2_id,</if>
             <if test="doctorType2Confirm != null">doctor_type2_confirm,</if>
             <if test="doctorType2Sign != null">doctor_type2_sign,</if>
+            <if test="storeOrderId != null">store_order_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="questionId != null">#{questionId},</if>
@@ -184,6 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="doctorType2Id != null">#{doctorType2Id},</if>
             <if test="doctorType2Confirm != null">#{doctorType2Confirm},</if>
             <if test="doctorType2Sign != null">#{doctorType2Sign},</if>
+            <if test="storeOrderId != null">#{storeOrderId},</if>
          </trim>
     </insert>
 
@@ -220,6 +224,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="doctorType2Id != null">doctor_type2_id = #{doctorType2Id},</if>
             <if test="doctorType2Confirm != null">doctor_type2_confirm = #{doctorType2Confirm},</if>
             <if test="doctorType2Sign != null">doctor_type2_sign = #{doctorType2Sign},</if>
+            <if test="storeOrderId != null">store_order_id = #{storeOrderId},</if>
         </trim>
         where id = #{id}
     </update>

+ 19 - 0
fs-service/src/main/resources/mapper/hisStore/FsStoreOrderScrmMapper.xml

@@ -1761,6 +1761,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="maps.companyUserNickName != null and  maps.companyUserNickName !=  ''">
             left join company_user cu on cu.user_id=o.company_user_id
         </if>
+        <if test="maps.erpAccount != null and maps.erpAccount != ''">
+            LEFT JOIN fs_store_order_df df on df.order_id=o.id
+
+        </if>
         <if test = "maps.productName != null and  maps.productName !=  '' ">
             left join fs_store_order_item_scrm oi on o.id = oi.order_id
             left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
@@ -1780,6 +1784,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.appId != null and map.appId != ''">
                 and csc.appid = #{maps.appId}
             </if>
+            <if test="maps.orderCodes != null  and maps.orderCodes.size > 0">
+                and o.order_code in
+                <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
+                    #{orderCode}
+                </foreach>
+            </if>
             <if test="maps.orderCode != null and  maps.orderCode !=''">
                 and o.order_code like CONCAT('%',#{maps.orderCode},'%')
             </if>
@@ -1881,6 +1891,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.appId != null and maps.appId != ''">
                 and csc.appid = #{maps.appId}
             </if>
+            <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
+                and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
+            </if>
+            <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
+                and df.login_account like #{maps.erpAccount}
+            </if>
+            <if test="maps.erpAccount == '未分拣'">
+                and ( df.login_account is null or df.login_account like '')
+            </if>
         </where>
         ${maps.params.dataScope}
         <if test="maps.productName != null and  maps.productName !=  ''   ">