Ver Fonte

cid调试加企微

wangxy há 1 dia atrás
pai
commit
0ff06dad4b

+ 16 - 1
fs-company/src/main/java/com/fs/company/controller/company/CompanyVoiceRoboticController.java

@@ -86,6 +86,21 @@ public class CompanyVoiceRoboticController extends BaseController
         List<CompanyVoiceRobotic> list = companyVoiceRoboticService.selectCompanyVoiceRoboticListCompany(companyVoiceRobotic);
         return getDataTable(list);
     }
+
+    /**
+     * 查询我的机器人外呼任务列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:companyVoiceRobotic:list')")
+    @GetMapping("/myList")
+    public TableDataInfo myList(CompanyVoiceRobotic companyVoiceRobotic) {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        companyVoiceRobotic.setCompanyId(loginUser.getCompany().getCompanyId());
+        companyVoiceRobotic.setCompanyUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<CompanyVoiceRobotic> list = companyVoiceRoboticService.selectCompanyVoiceRoboticListCompany(companyVoiceRobotic);
+        return getDataTable(list);
+    }
+
     /**
      * 查询机器人外呼任务列表
      */
@@ -204,7 +219,7 @@ public class CompanyVoiceRoboticController extends BaseController
      * 获取机器人外呼任务详细信息
      */
     @PreAuthorize("@ss.hasPermi('system:companyVoiceRobotic:query')")
-    @GetMapping(value = "/{id}")
+    @GetMapping(value = "/{id:\\d+}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
         return AjaxResult.success(companyVoiceRoboticService.selectCompanyVoiceRoboticById(id));

+ 22 - 2
fs-company/src/main/java/com/fs/company/controller/qw/QwUserController.java

@@ -531,6 +531,27 @@ public class QwUserController extends BaseController
         List<QwUser> list = qwUserService.selectQwUserList(qwUser);
         return getDataTable(list);
     }
+
+    /**
+     * 查询企微用户列表(任务分配账号选择)
+     * 非管理员仅查当前登录销售绑定的企微账号
+     */
+    @GetMapping("/queryQwList")
+    public TableDataInfo queryQwList(QwUser qwUser)
+    {
+        startPage();
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (qwUser.getCompanyId() == null) {
+            qwUser.setCompanyId(loginUser.getCompany().getCompanyId());
+        }
+        if (!CompanyUser.isAdmin(loginUser.getUser().getUserType())) {
+            qwUser.setCompanyId(loginUser.getCompany().getCompanyId());
+            qwUser.setCompanyUserId(loginUser.getUser().getUserId());
+        }
+        List<QwUser> list = qwUserService.selectQwUserList(qwUser);
+        return getDataTable(list);
+    }
+
     /**
     * 查询企微员工列表-用于员工管理绑定
     */
@@ -566,8 +587,7 @@ public class QwUserController extends BaseController
     /**
      * 获取企微用户详细信息
      */
-
-    @GetMapping(value = "/{id}")
+    @GetMapping(value = "/{id:\\d+}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
         return AjaxResult.success(qwUserService.selectQwUserVOById(id));

+ 14 - 2
fs-company/src/main/java/com/fs/company/controller/store/FsExternalOrderController.java

@@ -163,8 +163,20 @@ public class FsExternalOrderController extends BaseController {
     public AjaxResult export(FsExternalOrderQueryParam queryParam) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         queryParam.setCompanyId(loginUser.getCompany().getCompanyId());
-        List<FsExternalOrder> list = fsExternalOrderService.selectFsExternalOrderList(queryParam);
-        ExcelUtil<FsExternalOrder> util = new ExcelUtil<>(FsExternalOrder.class);
+        // 会员电话需要加密后和数据库匹配(支持多选:分别加密每个手机号后用逗号拼接,与SQL的FIND_IN_SET配合)
+        if (queryParam.getMemberPhone() != null && !queryParam.getMemberPhone().isEmpty()) {
+            String[] phones = queryParam.getMemberPhone().split(",");
+            StringBuilder sb = new StringBuilder();
+            for (String phone : phones) {
+                String trimmed = phone.trim();
+                if (trimmed.isEmpty()) continue;
+                if (sb.length() > 0) sb.append(",");
+                sb.append(PhoneUtil.encryptPhone(trimmed));
+            }
+            queryParam.setMemberPhone(sb.length() > 0 ? sb.toString() : null);
+        }
+        List<FsExternalOrderListVO> list = fsExternalOrderService.selectExternalOrderListVO(queryParam);
+        ExcelUtil<FsExternalOrderListVO> util = new ExcelUtil<>(FsExternalOrderListVO.class);
         return util.exportExcel(list, "外部订单数据");
     }
 }

+ 5 - 1
fs-service/src/main/java/com/fs/his/domain/FsExternalOrder.java

@@ -42,10 +42,14 @@ public class FsExternalOrder extends BaseEntity
     private Long totalNum;
 
     /** 商品数量(从明细表实时汇总,用于导出展示) */
-    @Excel(name = "商品数量")
     @TableField(exist = false)
     private Long productNum;
 
+    /** 商品名称*数量(多商品逗号分隔,如:商品A*2,商品B*3) */
+    @Excel(name = "商品名称*数量")
+    @TableField(exist = false)
+    private String productInfo;
+
     /** 订单总价(即商品总额) */
     @Excel(name = "商品总额")
     private BigDecimal totalPrice;

+ 55 - 0
fs-service/src/main/java/com/fs/his/domain/vo/FsExternalOrderListVO.java

@@ -1,6 +1,7 @@
 package com.fs.his.domain.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -11,8 +12,10 @@ public class FsExternalOrderListVO {
 
     private Long orderId;
 
+    @Excel(name = "用户id")
     private  Long userId;
 
+    @Excel(name = "外部订单号")
     private String orderCode;
 
     private String companyName;
@@ -21,8 +24,10 @@ public class FsExternalOrderListVO {
 
     private String companyUserName;
 
+    @Excel(name = "收货人")
     private String userName;
 
+    @Excel(name = "收货人电话")
     private String userPhone;
 
     private String memberPhone;
@@ -35,43 +40,86 @@ public class FsExternalOrderListVO {
 
     private String productNames;
 
+    /** 商品名称*数量(多商品逗号分隔,如:商品A*2,商品B*3) */
+    @Excel(name = "商品名称*数量")
+    private String productInfo;
+
     /** 商品数量(订单商品总件数,从明细表实时汇总) */
     private Long productNum;
 
     private BigDecimal receivablePrice;
 
+    @Excel(name = "定金")
     private BigDecimal payPrice;
 
+    @Excel(name = "商品总额")
     private BigDecimal totalPrice;
 
+    @Excel(name = "代收金额")
     private BigDecimal collectionPrice;
 
+    @Excel(name = "运费金额")
+    private BigDecimal freightPrice;
+
+    @Excel(name = "支付状态", readConverterExp = "0=待支付,1=已支付")
+    private Integer isPay;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date payTime;
+
+    @Excel(name = "收件人电话")
+    private String receiverPhone;
+
+    @Excel(name = "回款金额")
+    private BigDecimal returnPrice;
+
+    @Excel(name = "是否还货", readConverterExp = "1=是,2=否")
+    private Integer isReturnGoods;
+
+    @Excel(name = "订单商品总数")
+    private Long totalNum;
+
+    @Excel(name = "详细地址")
+    private String userAddress;
+
     private Integer payType;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "外部订单创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date externalCreateTime;
 
+    @Excel(name = "订单状态", readConverterExp = "-3=已取消,1=未审核,2=审核通过,3=已发货,4=已回款")
     private Integer status;
 
+    @Excel(name = "订单类型", readConverterExp = "1=外部订单,2=套餐包,3=问诊,4=积分")
     private Integer orderType;
 
+    @Excel(name = "快递单号")
     private String deliverySn;
 
+    @Excel(name = "快递公司编号")
     private String deliveryCode;
 
+    @Excel(name = "快递名称")
     private String deliveryName;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "发货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date deliveryTime;
 
+    @Excel(name = "物流状态")
     private Integer deliveryStatus;
 
+    @Excel(name = "物流状态类型")
     private String deliveryType;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "物流更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date deliveryUpdateTime;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "跟单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date followTime;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@@ -80,21 +128,28 @@ public class FsExternalOrderListVO {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date depositReturnTime;
 
+    @Excel(name = "退款金额")
     private BigDecimal refundPrice;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "退款日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date refundTime;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "拒收回退时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date rejectReturnTime;
 
+    @Excel(name = "备注")
     private String remark;
 
+    @Excel(name = "审核人")
     private String auditor;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date auditTime;
 
+    @Excel(name = "病名")
     private String diseaseName;
 
     private String province;

+ 9 - 0
fs-service/src/main/java/com/fs/his/mapper/FsThirdDeviceDataMapper.java

@@ -144,4 +144,13 @@ public interface FsThirdDeviceDataMapper extends BaseMapper<FsThirdDeviceData>{
                                                                           @Param("endTime") Date endTime,
                                                                           @Param("deviceId")String deviceId,
                                                                           @Param("recordType")Integer recordType);
+
+    /**
+     * 删除与指定时间窗重叠的睡眠分段(按 record_value 中 startTime/endTime)
+     */
+    int deleteSleepByTimeOverlap(@Param("userId") Long userId,
+                                 @Param("deviceId") String deviceId,
+                                 @Param("deviceType") Integer deviceType,
+                                 @Param("minStart") Long minStart,
+                                 @Param("maxEnd") Long maxEnd);
 }

+ 65 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsThirdDeviceDataServiceImpl.java

@@ -108,9 +108,74 @@ public class FsThirdDeviceDataServiceImpl extends ServiceImpl<FsThirdDeviceDataM
 
     @Override
     public void insertFsThirdDeviceDataList(List<FsThirdDeviceData> fsThirdDeviceData) {
+        if (fsThirdDeviceData == null || fsThirdDeviceData.isEmpty()) {
+            return;
+        }
+        // 智能手表睡眠:同用户同设备重复同步时 recordValue 会变,查询又会按段累加 → 先覆盖重叠旧数据
+        replaceOverlappingSmartWatchSleep(fsThirdDeviceData);
         baseMapper.insertFsThirdDeviceDataList(fsThirdDeviceData);
     }
 
+    /**
+     * deviceType=3(智能手表)睡眠分段:按 startTime~endTime 时间窗删除旧重叠数据后再插入,
+     * 避免同夜多次同步导致睡眠时长翻倍。
+     */
+    private void replaceOverlappingSmartWatchSleep(List<FsThirdDeviceData> list) {
+        Map<String, List<FsThirdDeviceData>> sleepGroups = list.stream()
+                .filter(item -> item != null
+                        && Objects.equals(item.getRecordType(), 7)
+                        && Objects.equals(item.getDeviceType(), 3)
+                        && item.getUserId() != null
+                        && StringUtils.isNotBlank(item.getDeviceId()))
+                .collect(Collectors.groupingBy(item -> item.getUserId() + "|" + item.getDeviceId()));
+        if (sleepGroups.isEmpty()) {
+            return;
+        }
+        for (List<FsThirdDeviceData> group : sleepGroups.values()) {
+            // 同批次内相同 start/end/status 只保留最后一条
+            LinkedHashMap<String, FsThirdDeviceData> unique = new LinkedHashMap<>();
+            List<FsThirdDeviceData> validItems = new ArrayList<>();
+            long minStart = Long.MAX_VALUE;
+            long maxEnd = Long.MIN_VALUE;
+            for (FsThirdDeviceData item : group) {
+                JSONObject json = parseSleepRecordValue(item.getRecordValue());
+                if (json == null) {
+                    continue;
+                }
+                Long startTime = json.getLong("startTime");
+                Long endTime = json.getLong("endTime");
+                Integer status = json.getInteger("status");
+                if (startTime == null || endTime == null || endTime <= startTime) {
+                    continue;
+                }
+                minStart = Math.min(minStart, startTime);
+                maxEnd = Math.max(maxEnd, endTime);
+                String key = startTime + "_" + endTime + "_" + (status == null ? "" : status);
+                unique.put(key, item);
+                validItems.add(item);
+            }
+            if (minStart == Long.MAX_VALUE || maxEnd == Long.MIN_VALUE || validItems.isEmpty()) {
+                continue;
+            }
+            FsThirdDeviceData sample = group.get(0);
+            baseMapper.deleteSleepByTimeOverlap(sample.getUserId(), sample.getDeviceId(), 3, minStart, maxEnd);
+            // 去掉本批有效分段(含批内重复),再放入去重后的数据
+            list.removeAll(validItems);
+            list.addAll(unique.values());
+        }
+    }
+
+    private JSONObject parseSleepRecordValue(String recordValue) {
+        if (StringUtils.isBlank(recordValue)) {
+            return null;
+        }
+        try {
+            return JSONObject.parseObject(recordValue);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
     @Override
     public List<FsThirdDeviceData> getLastData(Long userId,Integer deviceType,String deviceId) {
         return baseMapper.getLastData(userId,deviceType,deviceId);

+ 26 - 10
fs-service/src/main/java/com/fs/watch/service/impl/WatchSleepDataServiceImpl.java

@@ -353,30 +353,36 @@ public class WatchSleepDataServiceImpl implements WatchSleepDataService {
                     List<SleepSection> sleepSection1 = sleepStatistics.getSleepSection();
                     //统计图对象
                     sleepSection.addAll(sleepSection1);
+                    // 用毫秒直接换算分钟,避免 hours.longValue()*60 截断精度
+                    int dayDeep = msToMinutes(sleepStatistics.getDeepSleepDuration());
+                    int dayLight = msToMinutes(sleepStatistics.getLightSleepDuration());
+                    int dayWeak = msToMinutes(sleepStatistics.getAwakeDuration());
+                    int dayRem = msToMinutes(sleepStatistics.getRemDuration());
+                    int dayTotal = msToMinutes(sleepStatistics.getTotalDuration());
                     //深睡时间
-                    sSleep = sSleep + sleepStatistics.getDeepSleepHours().longValue()*60;
+                    sSleep = sSleep + dayDeep;
                     //浅睡时间
-                    lightSleep =lightSleep+ sleepStatistics.getLightSleepHours().longValue()*60;
+                    lightSleep = lightSleep + dayLight;
                     //清醒时间
-                    weakSleep = (long) (weakSleep+ (sleepStatistics.getAwakeDuration() / (1000.0 * 60)));
+                    weakSleep = weakSleep + dayWeak;
                     //没有快速眼动时间
                     //清醒次数
                     weakTime = weakTime + sleepStatistics.getAwakeCount();
                     //夜间睡眠时间(深睡+浅睡)
-                    sleepCount=sleepCount+(sleepStatistics.getDeepSleepCount() + sleepStatistics.getLightSleepCount());
+                    sleepCount = sleepCount + (sleepStatistics.getDeepSleepCount() + sleepStatistics.getLightSleepCount());
 
-                    timeTotal = timeTotal + sleepStatistics.getTotalSleepHours().longValue()*60;
+                    timeTotal = timeTotal + dayTotal;
                     WatchSleepDataVo watchSleepDataVo = new WatchSleepDataVo();
                     watchSleepDataVo.setDeviceId(deviceId);
                     watchSleepDataVo.setDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, currentDate));
                     watchSleepDataVo.setStartTime(sleepSection1.get(0).getStart());
                     watchSleepDataVo.setEndTime(sleepSection1.get(sleepSection1.size()-1).getEnd());
-                    watchSleepDataVo.setDeepSleep(sleepStatistics.getDeepSleepHours().intValue() * 60);
-                    watchSleepDataVo.setLightSleep(sleepStatistics.getLightSleepHours().intValue() * 60);
-                    watchSleepDataVo.setWeakSleep((int) (sleepStatistics.getAwakeDuration() / (1000.0 * 60)));
-                    watchSleepDataVo.setEyemoveSleep(sleepStatistics.getRemHours().intValue() * 60);
+                    watchSleepDataVo.setDeepSleep(dayDeep);
+                    watchSleepDataVo.setLightSleep(dayLight);
+                    watchSleepDataVo.setWeakSleep(dayWeak);
+                    watchSleepDataVo.setEyemoveSleep(dayRem);
 //                    watchSleepDataVo.setScore(score); // 需要从某处获取睡眠得分
-                    watchSleepDataVo.setSleepTime(sleepStatistics.getTotalSleepHours().intValue() * 60);
+                    watchSleepDataVo.setSleepTime(dayTotal);
                     watchSleepDataVo.setSleepSection(sleepSection1);
                     watchSleepDataVos.add(watchSleepDataVo);
                 }
@@ -808,6 +814,16 @@ public class WatchSleepDataServiceImpl implements WatchSleepDataService {
         }
     }
 
+    /**
+     * 毫秒转分钟,四舍五入,避免先转小时再截断导致精度丢失
+     */
+    private static int msToMinutes(Long durationMs) {
+        if (durationMs == null || durationMs <= 0) {
+            return 0;
+        }
+        return (int) Math.round(durationMs / 60000.0);
+    }
+
     /**
      * 查询某天某个设备的房颤数据
      *

+ 2 - 2
fs-service/src/main/resources/application-config-druid-hdt.yml

@@ -92,10 +92,10 @@ cloud_host:
 headerImg:
   imgUrl: https://jz-cos-1356808054.cos.ap-chengdu.myqcloud.com/fs/20250515/0877754b59814ea8a428fa3697b20e68.png
 ipad:
-  ipadUrl: http://ipad.hebeihdt.com
+  ipadUrl: http://ipad.hondeyiyuan.cn
 #  aiApi: http://152.136.202.157:3000/api
   aiApi: http://49.232.181.28:3000/api
-  wxIpadUrl: http://ipad.hebeihdt.com
+  wxIpadUrl: http://ipad.hondeyiyuan.cn
   voiceApi:
   commonApi:
 wx_miniapp_temp:

+ 12 - 1
fs-service/src/main/resources/mapper/his/FsExternalOrderMapper.xml

@@ -55,6 +55,7 @@
         <result property="diseaseName"         column="disease_name"         />
         <result property="isReturnGoods"      column="is_return_goods"      />
         <result property="productNum"         column="product_num"         />
+        <result property="productInfo"        column="product_info"        />
     </resultMap>
 
     <sql id="selectFsExternalOrderVo">
@@ -66,7 +67,8 @@
                extend_order_id, store_id, receiver_phone,
                collection_price, follow_time,
                refund_price, return_price, refund_time, reject_return_time, order_type, auditor, audit_time, disease_name, is_return_goods,
-           (SELECT IFNULL(SUM(num),0) FROM fs_external_order_item WHERE order_id = fs_external_order.order_id) AS product_num
+           (SELECT IFNULL(SUM(num),0) FROM fs_external_order_item WHERE order_id = fs_external_order.order_id) AS product_num,
+           (SELECT GROUP_CONCAT(CONCAT(product_name, '*', num) SEPARATOR ',') FROM fs_external_order_item WHERE order_id = fs_external_order.order_id) AS product_info
     from fs_external_order
     </sql>
 
@@ -291,11 +293,20 @@
             (SELECT COUNT(DISTINCT o2.order_id) FROM fs_external_order o2
              WHERE o2.user_id = o.user_id AND o2.company_id = o.company_id AND o2.status != -3) AS memberBuyCount,
             GROUP_CONCAT(oi.product_name SEPARATOR ',') AS productNames,
+            GROUP_CONCAT(CONCAT(oi.product_name, '*', oi.num) SEPARATOR ',') AS productInfo,
             SUM(oi.num) AS productNum,
             IFNULL(o.total_price, SUM(oi.price * oi.num)) AS receivablePrice,
             o.pay_price AS payPrice,
             o.total_price AS totalPrice,
             o.collection_price AS collectionPrice,
+            o.freight_price AS freightPrice,
+            o.is_pay AS isPay,
+            o.pay_time AS payTime,
+            o.receiver_phone AS receiverPhone,
+            o.return_price AS returnPrice,
+            o.is_return_goods AS isReturnGoods,
+            o.total_num AS totalNum,
+            ua.detail AS userAddress,
             o.pay_type AS payType,
             o.external_create_time AS externalCreateTime,
             o.status,

+ 13 - 0
fs-service/src/main/resources/mapper/his/FsThirdDeviceDataMapper.xml

@@ -306,6 +306,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from fs_third_device_data where id = #{id}
     </delete>
 
+    <!-- 智能手表睡眠重复同步:删除时间重叠的旧分段,避免时长被累加 -->
+    <delete id="deleteSleepByTimeOverlap">
+        delete from fs_third_device_data
+        where user_id = #{userId}
+          and device_id = #{deviceId}
+          and device_type = #{deviceType}
+          and record_type = 7
+          and record_value is not null
+          and record_value != ''
+          and CAST(JSON_UNQUOTE(JSON_EXTRACT(record_value, '$.startTime')) AS UNSIGNED) &lt; #{maxEnd}
+          and CAST(JSON_UNQUOTE(JSON_EXTRACT(record_value, '$.endTime')) AS UNSIGNED) &gt; #{minStart}
+    </delete>
+
     <delete id="deleteFsThirdDeviceDataByIds" parameterType="String">
         delete from fs_third_device_data where id in 
         <foreach item="id" collection="array" open="(" separator="," close=")">

+ 20 - 20
fs-service/src/main/resources/mapper/watch/WatchUserMapper.xml

@@ -28,9 +28,9 @@
 
     <!--查询单个-->
     <select id="selectWatchFsUserById" resultType="com.fs.watch.domain.WatchFsUser">
-        select u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,
+        select u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,
                wu.nick_name,
-               wu.sex,wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
+               wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
                wu.target_activity,wu.target_sport,wu.device_id,wu.other_device,wu.monitor_data_type_order,
                wu.xhs_device_id,wu.new_xhs_device_id,wu.smart_watch_device_id
         from watch_user wu
@@ -152,9 +152,9 @@
 
     <select id="selectWatchFsUserByDeviceIdAndUserId" resultType="com.fs.watch.domain.WatchFsUser">
         <if test="type==0">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,
+            wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,
             wu.target_calorie,wu.target_activity,wu.target_sport,wu.device_id,wu.other_device,
             wu.monitor_data_type_order,wu.xhs_device_id
             FROM watch_user wu
@@ -163,18 +163,18 @@
             AND  wu.user_id = #{userId}
         </if>
         <if test="type==1">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,wu.target_activity,
+            wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,wu.target_activity,
             wu.target_sport,wu.device_id,wu.monitor_data_type_order
             FROM watch_family_user wu
             left join fs_user u on u.user_id = #{userId}
             WHERE wu.device_id LIKE concat('%',#{deviceId},'%') AND wu.is_del = 0
         </if>
         <if test="type==2">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
+            wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
             wu.target_activity,wu.target_sport,wu.device_id,wu.other_device,wu.monitor_data_type_order,
             wu.xhs_device_id
             FROM watch_user wu
@@ -183,18 +183,18 @@
             AND  wu.user_id = #{userId}
         </if>
         <if test="type==3">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,
+            wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,
             wu.target_activity,wu.target_sport,wu.device_id as xhs_device_id,wu.monitor_data_type_order
             FROM watch_family_user wu
             left join fs_user u on u.user_id = #{userId}
             WHERE wu.device_id LIKE concat('%',#{deviceId},'%') AND wu.is_del = 0
         </if>
         <if test="type==4">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
+            wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
             wu.target_activity,wu.target_sport,wu.device_id,wu.other_device,wu.monitor_data_type_order,wu.new_xhs_device_id
             FROM watch_user wu
             left join fs_user u on wu.user_id = u.user_id
@@ -202,18 +202,18 @@
             AND  wu.user_id = #{userId}
         </if>
         <if test="type==5">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,
+            wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,
             wu.target_activity,wu.target_sport,wu.device_id as new_xhs_device_id,wu.monitor_data_type_order
             FROM watch_family_user wu
             left join fs_user u on u.user_id = #{userId}
             WHERE wu.device_id LIKE concat('%',#{deviceId},'%') AND wu.is_del = 0
         </if>
         <if test="type==6">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
+            wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,
             wu.target_activity,wu.target_sport,wu.device_id,wu.other_device,wu.monitor_data_type_order,wu.smart_watch_device_id
             FROM watch_user wu
             left join fs_user u on wu.user_id = u.user_id
@@ -221,9 +221,9 @@
             AND  wu.user_id = #{userId}
         </if>
         <if test="type==7">
-            SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,u.phone,
+            SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,u.phone,
             wu.nick_name,
-            wu.sex,wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,
+            wu.birthday,wu.height,wu.weight,wu.target_step,wu.target_calorie,
             wu.target_activity,wu.target_sport,wu.device_id as smart_watch_device_id,wu.monitor_data_type_order
             FROM watch_family_user wu
             left join fs_user u on u.user_id = #{userId}
@@ -248,9 +248,9 @@
         WHERE wu.device_id LIKE #{deviceId}
     </select>
     <select id="selectWatchFsUserByDeviceId" resultType="com.fs.watch.domain.WatchFsUser">
-        SELECT u.user_id, u.avatar, u.password, u.sex, u.status, u.remark,
+        SELECT u.user_id, u.avatar, u.password, COALESCE(wu.sex, u.sex) as sex, u.status, u.remark,
                wu.nick_name,
-               wu.sex,wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,wu.target_activity,wu.target_sport,wu.device_id,wu.other_device,wu.monitor_data_type_order
+               wu.birthday,wu.w_company_id,wu.height,wu.weight,wu.target_step,wu.target_calorie,wu.target_activity,wu.target_sport,wu.device_id,wu.other_device,wu.monitor_data_type_order
         FROM watch_user wu
                  left join fs_user u on wu.user_id = u.user_id
         WHERE wu.device_id LIKE concat('%',#{deviceId},'%') AND wu.is_del = 0

+ 3 - 3
fs-user-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

@@ -632,9 +632,9 @@ public class InquiryOrderController extends  AppBaseController {
         if(order==null){
             return R.error("订单不存在");
         }
-        if(!order.getUserId().equals(Long.parseLong(getUserId()))){
-            return R.error("非法操作");
-        }
+//        if(!order.getUserId().equals(Long.parseLong(getUserId()))){
+//            return R.error("非法操作");
+//        }
         if(order!=null&&StringUtils.isNotEmpty(order.getPatientJson())){
             FsInquiryOrderPatientDTO dto=JSONUtil.toBean(order.getPatientJson(),FsInquiryOrderPatientDTO.class);
             dto.setMobile(ParseUtils.parsePhone(dto.getMobile()));

+ 4 - 0
fs-watch/src/main/java/com/fs/app/controller/WatchUserController.java

@@ -174,6 +174,10 @@ public class WatchUserController extends AppBaseController {
         if (StringUtils.isNoneBlank(param.getTargetActivity())) {
             user.setTargetActivity(param.getTargetActivity());
         }
+        //性别
+        if (param.getSex()!=null) {
+            user.setSex(param.getSex());
+        }
         //家人
         String otherDevice = param.getOtherDevice();
         //更新设备表watch_device_info