jiangping
2025-04-28 ab890bca34582e2ec8e2d4b19798f067ea075b7a
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -172,7 +172,7 @@
            if (erpVisitDTO.getEndtime().getTime() <= erpVisitDTO.getStarttime().getTime()) {
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,预约结束时间必须大于开始时间!");
            }
            if (Constants.equalsInteger(Constants.ZERO, erpVisitDTO.getIdcardType()) && erpVisitDTO.getIdcardNo().length() != 18
            if (StringUtils.isNotBlank(erpVisitDTO.getIdcardNo()) && Constants.equalsInteger(Constants.ZERO, erpVisitDTO.getIdcardType()) && erpVisitDTO.getIdcardNo().length() != 18
                //&&!IdcardUtil.isValidCard(visits.getIdcardNo())
            ){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!");
@@ -240,9 +240,8 @@
        getHkDeviceRoles(visits,isERP);
        //检验拜访人是否合法
        Member visitMember = isValideVisitedUser(visits.getReceptMemberId());
        if(Constants.equalsInteger(Constants.ZERO, visits.getIdcardType())
                &&visits.getIdcardNo().length()!=18
        ){
        if(StringUtils.isNotBlank(visits.getIdcardNo()) && Constants.equalsInteger(Constants.ZERO, visits.getIdcardType())
                &&visits.getIdcardNo().length()!=18 ){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,身份证号码有误,请核实后重试!");
        }
        Date date = new Date();
@@ -303,8 +302,7 @@
            WxPlatNotice wxPlatNotice = new WxPlatNotice();
            wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz,
                    wxNoticeConfigMapper,visits,
                    Constants.equalsInteger(visits.getType(),Constants.TWO)?WxPlatConstants.visitReportContent.visitReportUpload:WxPlatConstants.visitContent.visitUpload,
                    systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                    Constants.equalsInteger(visits.getType(),Constants.TWO)?WxPlatConstants.visitReportContent.visitReportUpload:WxPlatConstants.visitContent.visitUpload,
                    Arrays.asList(visits.getOpenid().split(","))
            );
        }
@@ -313,7 +311,6 @@
        return visits.getId();
    }
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
@@ -342,7 +339,6 @@
                wxPlatNotice.sendVisitTemplateNotice(systemDictDataBiz,
                        wxNoticeConfigMapper,visits,
                        Constants.equalsInteger(visits.getType(),Constants.TWO)?WxPlatConstants.visitReportContent.visitReportUpload:WxPlatConstants.visitContent.visitUpload,
                        systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                        Arrays.asList(systemUser.getOpenid().split(","))
                );
            }
@@ -569,7 +565,7 @@
                .eq(ApproveParam::getLevel,Constants.ONE)
                .eq(ApproveParam::getMemberType,Constants.ZERO)
                .last("limit 1"));
         return  Objects.isNull(approveParam)?null:approveParam.getId();
        return  Objects.isNull(approveParam)?null:approveParam.getId();
    }
@@ -1681,13 +1677,33 @@
                    new UpdateWrapper<Notices>().lambda()
                            .set(Notices::getEditDate,new Date())
                            .set(Notices::getInfo,"手动取消")
//                        .set(Notices::getStatus,Constants.ONE)
                            .set(Notices::getParam2,Constants.FOUR)//已取消
                            .setSql(" param4 = user_id ")
                            .set(Notices::getStatus,Constants.ONE)
                            .set(Notices::getParam2,Constants.ONE)//标记已处理
                            .eq(Notices::getStatus,Constants.ZERO)
                            .eq(Notices::getParam2,Constants.ZERO)//待处理
                            .eq(Notices::getObjId,visits.getId())
                            .eq(Notices::getObjType,Constants.equalsInteger(visits.getType(),Constants.ZERO)?Constants.noticesObjectType.visit:Constants.noticesObjectType.visitReporting)
                            .eq(Notices::getObjType,!Constants.equalsInteger(visits.getType(),Constants.TWO)?
                                    Constants.noticesObjectType.visit:Constants.noticesObjectType.visitReporting)
            );
            Approve approve = new Approve();
            approve.setCreateDate(new Date());
            approve.setIsdeleted(Constants.ZERO);
            approve.setRemark("手动取消");
            approve.setChekorId(visits.getEditor());
            approve.setTitle("取消预约");
            approve.setStatus(Constants.THREE);
            approve.setStatusInfo("手动取消");
            approve.setObjId(visits.getId());
            approve.setLevel(9999);
            approve.setApproveType(2);
            approve.setDriverParam(Constants.ZERO);
            approve.setAddrParam(Constants.ZERO);
            approve.setObjType(visits.getType());
            approve.setType(Constants.ZERO);
            approve.setCheckDate(new Date());
            approveMapper.insert(approve);
        }
        visitsMapper.update(null,updateWrapper);
@@ -1965,6 +1981,7 @@
        List<Visits> visitsList = visitsMapper.selectList(new QueryWrapper<Visits>().lambda()
                .eq(Visits::getStatus,Constants.VisitStatus.signin)
                .eq(Visits::getSendTimeOutNotice,Constants.ZERO)
                .eq(Visits::getIsdeleted,Constants.ZERO)
                .apply("   now() >=  DATE_ADD(ENDTIME,INTERVAL -"+times+" MINUTE)   ")
        );
        Integer visitTimeCount = 0;
@@ -2041,6 +2058,22 @@
                !Constants.equalsInteger(s.getType(),Constants.TWO)?Constants.noticesObjectType.visit:Constants.noticesObjectType.visitReporting
        );
        Approve approve = new Approve();
        approve.setCreateDate(new Date());
        approve.setIsdeleted(Constants.ZERO);
        approve.setRemark("系统自动取消");
        approve.setTitle("取消预约");
        approve.setStatus(Constants.THREE);
        approve.setStatusInfo("超时自动取消");
        approve.setObjId(s.getId());
        approve.setLevel(9999);
        approve.setApproveType(2);
        approve.setDriverParam(Constants.ZERO);
        approve.setAddrParam(Constants.ZERO);
        approve.setObjType(s.getType());
        approve.setType(Constants.ZERO);
        approve.setCheckDate(new Date());
        approveMapper.insert(approve);
//        //更新审批中的记录为取消
//        approveMapper.update(null,
@@ -2087,8 +2120,10 @@
            noticesJoinMapper.update(null,
                    new UpdateWrapper<Notices>().lambda()
                            .set(Notices::getEditDate,new Date())
                            .set(Notices::getInfo,info)
                            .set(Notices::getParam2,Constants.FOUR)//已取消
                            .set(Notices::getInfo,"自动取消")
                            .setSql(" param4 = user_id ")
                            .set(Notices::getStatus,Constants.ONE)
                            .set(Notices::getParam2,Constants.ONE)//已取消
                            .eq(Notices::getStatus,Constants.ZERO)
                            .eq(Notices::getParam2,Constants.ZERO)//待处理
                            .eq(Notices::getObjId,objId)