101captain
2022-05-27 bfe7b653a9d376b31699ef5eef34a8817546f84c
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidRecordServiceImpl.java
@@ -86,9 +86,34 @@
    }
    @Override
    public R exportNew(ComActAcidRecordDTO comActAcidRecordDTO) {
        List<ComActAcidRecordExcelReturn> comActAcidRecordExcelVOS=this.baseMapper.exportNew(comActAcidRecordDTO);
        comActAcidRecordExcelVOS.forEach(comActAcidRecordExcelVO -> {
            if(StringUtils.isNotEmpty(comActAcidRecordExcelVO.getTouristCity())&&comActAcidRecordExcelVO.getTouristCity().contains("[")){
                JSONArray jsonArray = JSON.parseArray(comActAcidRecordExcelVO.getTouristCity());
                if(jsonArray.isEmpty()){
                    comActAcidRecordExcelVO.setTouristCity("");
                }
                else {
                    StringBuilder touristCity= new StringBuilder();
                    for(int i=0;i<jsonArray.size();i++){
                        JSONObject jsonObject=jsonArray.getJSONObject(i);
                        String name=jsonObject.getString("name");
                        if(StringUtils.isNotEmpty(name)){
                            touristCity.append(name).append(";");
                        }
                    }
                    comActAcidRecordExcelVO.setTouristCity(touristCity.toString());
                }
            }
        });
        return R.ok(comActAcidRecordExcelVOS);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R insertRecord(ComActAcidRecordVO comActAcidRecordVO) {
        Integer count= this.baseMapper.selectCount(new QueryWrapper<ComActAcidRecord>().lambda().eq(ComActAcidRecord::getIdCard,comActAcidRecordVO.getIdCard()).ge(ComActAcidRecord::getCreateTime, DateUtils.getCurrentDate(DateUtils.yyyyMMdd_format)));
        Integer count= this.baseMapper.selectCount(new QueryWrapper<ComActAcidRecord>().lambda().eq(ComActAcidRecord::getIsDel,0).eq(ComActAcidRecord::getIdCard,comActAcidRecordVO.getIdCard()).ge(ComActAcidRecord::getCreateTime, DateUtils.getCurrentDate(DateUtils.yyyyMMdd_format)));
        if(count>0){
            return R.fail("请勿重复提交");
        }
@@ -191,7 +216,6 @@
            dangerMember.setRecordId(recordId);
            dangerMember.setIdCard(comActAcidRecordVO.getIdCard());
            dangerMember.setSource(1);
            dangerMember.setStatus(6);
            dangerMember.setType(type);
            dangerMember.setRelationName(relationName);
            dangerMember.setUpdateTime(new Date());
@@ -251,8 +275,12 @@
            String localCity = comActAcidRecordVO.getLocalCity();
            String localAddress = comActAcidRecordVO.getLocalAddress();
            BeanUtils.copyProperties(comActAcidRecord1, comActAcidRecordVO);
            comActAcidRecordVO.setLocalCity(localCity);
            comActAcidRecordVO.setLocalAddress(localAddress);
            if(StringUtils.isNotEmpty(localCity)){
                comActAcidRecordVO.setLocalCity(localCity);
            }
            if(StringUtils.isNotEmpty(localAddress)){
                comActAcidRecordVO.setLocalAddress(localAddress);
            }
        }
        ComActAcidDangerMember comActAcidDangerMember =
            comActAcidDangerMemberDao.selectOne(new QueryWrapper<ComActAcidDangerMember>().lambda()
@@ -277,6 +305,61 @@
    }
    @Override
    public R updateApplets(ComActAcidRecordVO comActAcidRecordVO) {
        ComActAcidRecord comActAcidRecord = new ComActAcidRecord();
        BeanUtils.copyProperties(comActAcidRecordVO, comActAcidRecord);
        String idCard = comActAcidRecordVO.getIdCard();
        if(StringUtils.isNotEmpty(comActAcidRecordVO.getAcidImage())){
            comActAcidRecord.setAcidImage(" ");
        }
        if(StringUtils.isNotEmpty(comActAcidRecordVO.getColorImage())){
            comActAcidRecord.setColorImage(" ");
        }
        if(StringUtils.isNotEmpty(comActAcidRecordVO.getTravelImage())){
            comActAcidRecord.setTravelImage(" ");
        }
        if(StringUtils.isNotEmpty(comActAcidRecordVO.getVaccinationImage())){
            comActAcidRecord.setVaccinationImage(" ");
        }
        if (isBlank(idCard)) {
            //只修改地址,其他信息需要查询
            ComActAcidRecord comActAcidRecord1 = this.baseMapper.selectById(comActAcidRecordVO.getId());
            if (isNull(comActAcidRecord1)) {
                return R.fail("填报纪录不存在");
            }
            String localCity = comActAcidRecordVO.getLocalCity();
            String localAddress = comActAcidRecordVO.getLocalAddress();
            BeanUtils.copyProperties(comActAcidRecord1, comActAcidRecordVO);
            if(StringUtils.isNotEmpty(localCity)){
                comActAcidRecordVO.setLocalCity(localCity);
            }
            if(StringUtils.isNotEmpty(localAddress)){
                comActAcidRecordVO.setLocalAddress(localAddress);
            }
        }
        ComActAcidDangerMember comActAcidDangerMember =
                comActAcidDangerMemberDao.selectOne(new QueryWrapper<ComActAcidDangerMember>().lambda()
                        .eq(ComActAcidDangerMember::getRecordId, comActAcidRecordVO.getId()).orderByDesc(ComActAcidDangerMember::getCreateTime).last("limit 1"));
        String colorMark = comActAcidRecordVO.getColorMark();
        String travelCard = comActAcidRecordVO.getTravelCard();
        String dangerArea = comActAcidRecordVO.getDangerArea();
        String outsideCity = comActAcidRecordVO.getOutsideCity();
        String acidTest = comActAcidRecordVO.getAcidTest();
        if (StringUtils.inStringIgnoreCase(colorMark, "红码", "黄码") || travelCard.equals("是") || dangerArea.equals("是")
                || outsideCity.equals("是") || acidTest.equals("阳性")) {
            // 风险人员
            String riskType = retrieveRiskType(colorMark, travelCard, dangerArea, outsideCity, acidTest);
            saveAcidDangerMember(comActAcidRecordVO, comActAcidRecord.getId(), 1, riskType);
        } else if (StringUtils.isEmpty(comActAcidRecordVO.getLocalCity())) {
            // 未填住址人员
            saveAcidDangerMember(comActAcidRecordVO, comActAcidRecord.getId(), 2, null);
        } else if (comActAcidDangerMember != null && comActAcidDangerMember.getType() == 2) {
            this.comActAcidDangerMemberDao.deleteById(comActAcidDangerMember.getId());
        }
        return R.ok(this.baseMapper.updateById(comActAcidRecord));
    }
    @Override
    public R delete(Long id) {
        ComActAcidRecord comActAcidRecord=new ComActAcidRecord();
        comActAcidRecord.setId(id);