nidapeng
2024-03-08 57a2020223e33def0a22c42307871ef2a765af25
整理
已修改1个文件
21 ■■■■■ 文件已修改
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncVisitServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncVisitServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl.hksync;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.doumee.biz.system.SystemDictDataBiz;
@@ -204,8 +205,8 @@
        List<DeviceRole> roleList = deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
                .eq(DeviceRole::getType, Constants.ONE));
        //标记是否走免登记预约
        String applyType =systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.MDJ_VISIT_REQUIRED).getCode();
        String applyLwType =systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.MDJ_LW_REQUIRED).getCode();
//        String applyType =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.MDJ_VISIT_REQUIRED).getCode();
//        String applyLwType =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.MDJ_LW_REQUIRED).getCode();
        try {
            //查询所有需要同步的数据
            List<Visits> list = getVisitList();
@@ -217,8 +218,7 @@
            Date date = new Date();
            for(Visits c : list) {
                //发起海康预约接口(需要登记),根据预约返回接口封装申请记录更新字段
                String type = Constants.equalsInteger(c.getType(),Constants.ONE)?applyType:applyLwType;
                getUpdateModelByResponse(c,date,type,roleList,path);
                getUpdateModelByResponse(c,date,roleList,path);
                visitsMapper.updateById(c);
                if(Objects.isNull(c.getParentId())){
                    wxPlatNotice.sendVisitAuditTemplateNotice(c,
@@ -267,13 +267,15 @@
     * @param date
     * @param type 0需要登记 1免登记
     */
    private void getUpdateModelByResponse(  Visits c,Date date,String type,List<DeviceRole> roleList,String path ) {
    private void getUpdateModelByResponse(  Visits c,Date date, List<DeviceRole> roleList,String path ) {
        String code = null;
        String id = null;
        String qrcode = null;
        String reson = "";
        //发起海康预约接口
        if(StringUtils.equals(type,"0")){
        if(Constants.equalsInteger(c.getVisitType(),Constants.ZERO)){
            //(需要登记)
            c.setVisitType(Constants.ZERO);
            VisitAppointmentRequest request =  getHkRequestPara(c,roleList,path);
            if(request == null){
                //海康下发成功
@@ -291,8 +293,10 @@
                id =response.getData().getAppointmentInfoList().get(0).getOrderId();
                qrcode =response.getData().getAppointmentInfoList().get(0).getQRCode();
            }
            reson = response!=null?JSONObject.toJSONString(response):"";
        }else{
            //免登记
            c.setVisitType(Constants.ONE);
            VisitAppointmentMDJRequest request =getHkMDJRequestPara(c,roleList,path);
            if(request == null){
                //海康下发成功
@@ -308,17 +312,18 @@
                id = response.getData().getOrderId();
                qrcode =response.getData().getQRCode();
            }
            reson = response!=null?JSONObject.toJSONString(response):"";
        }
        if (code!= null && id!=null) {
            //海康下发成功
            c.setHkId( id);//预约标识
            c.setQrcode(qrcode);
            c.setRemark("下发海康成功!【"+type+"】");
            c.setRemark("下发海康成功!");
            c.setStatus(Constants.VisitStatus.xfSuccess);//下发海康成功
        } else {
            //海康下发失败
            c.setRemark("下发海康失败!【"+type+"】");
            c.setRemark("下发海康失败,原因:"+ reson);
            c.setStatus(Constants.VisitStatus.xfFail);//下发海康失败
        }
        c.setHkStatus(Constants.ONE);