| | |
| | | package org.springblade.modules.backblast.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.param.GridSet; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springblade.modules.backblast.entity.BackblastPubPersonEntity; |
| | | import org.springblade.modules.backblast.entity.BackblastPubRecordEntity; |
| | | import org.springblade.modules.backblast.service.IBackblastPubPersonService; |
| | | import org.springblade.modules.backblast.vo.BackblastPubRecordVO; |
| | | import org.springblade.modules.backblast.excel.BackblastPubRecordExcel; |
| | | import org.springblade.modules.backblast.mapper.BackblastPubRecordMapper; |
| | | import org.springblade.modules.backblast.service.IBackblastPubPersonService; |
| | | import org.springblade.modules.backblast.service.IBackblastPubRecordService; |
| | | import org.springblade.modules.backblast.vo.BackblastPubRecordVO; |
| | | import org.springblade.modules.grid.entity.GridEntity; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.place.entity.PlacePractitionerEntity; |
| | | import org.springblade.modules.place.service.IPlacePractitionerService; |
| | | import org.springblade.modules.police.entity.PoliceAffairsGridEntity; |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | boolean flag = false; |
| | | // 点落面计算警格,网格,警格 |
| | | setGridInfo(backblastPubRecord); |
| | | // "otherId":"\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"[1]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\"\"" |
| | | backblastPubRecord.setOtherId(cleanEscapes(backblastPubRecord.getOtherId())); |
| | | // 设置民警姓名电话(非民警暂时也记录) |
| | | User user = SpringUtils.getBean(IUserService.class).getById(AuthUtil.getUserId()); |
| | | if (null!=user){ |
| | |
| | | updateBackblastPubPerson(backblastPubRecord); |
| | | // 返回 |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 清理字符串中的多余转义字符 |
| | | * @param originalStr 原始字符串 |
| | | * @return 清理后的字符串 |
| | | */ |
| | | private static String cleanEscapes(String originalStr) { |
| | | if (StringUtils.isBlank(originalStr)) { |
| | | return ""; |
| | | } |
| | | // 替换多个反斜杠为单个反斜杠 |
| | | String replacedBackslashes = originalStr.replaceAll("\\\\+", "\\\\"); |
| | | // 替换转义的双引号为空 |
| | | String cleanedStr = replacedBackslashes.replaceAll("\\\\\"", "").replaceAll("\"", ""); |
| | | |
| | | return cleanedStr; |
| | | } |
| | | |
| | | /** |
| | |
| | | public BackblastPubRecordVO getDetail(BackblastPubRecordVO backblastPubRecord) { |
| | | return baseMapper.getDetail(backblastPubRecord); |
| | | } |
| | | |
| | | /** |
| | | * 反炸宣传记录表 删除 |
| | | */ |
| | | @Override |
| | | public boolean removeBackblastPubByIds(List<Long> toLongList) { |
| | | // 先删除对应的宣传记录 |
| | | boolean flag = removeByIds(toLongList); |
| | | // 再删除对应的宣传对象信息 |
| | | if (flag){ |
| | | IBackblastPubPersonService backblastPubPersonService = SpringUtil.getBean(IBackblastPubPersonService.class); |
| | | // 删除所有 |
| | | QueryWrapper<BackblastPubPersonEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.in("backblast_pub_record_id", toLongList); |
| | | backblastPubPersonService.remove(wrapper); |
| | | // for (Long id : toLongList) { |
| | | // // 删除所有 |
| | | // QueryWrapper<BackblastPubPersonEntity> wrapper = new QueryWrapper<>(); |
| | | // wrapper.eq("backblast_pub_record_id", id); |
| | | // backblastPubPersonService.remove(wrapper); |
| | | // } |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | @Override |
| | | public List<BackblastPubRecordExcel> export(BackblastPubRecordVO backblastPubRecord) { |
| | | CommonParamSet commonParamSet = new CommonParamSet<>().invoke(BackblastPubRecordVO.class, backblastPubRecord); |
| | | if (!Strings.isBlank(backblastPubRecord.getRoleName())){ |
| | | backblastPubRecord.setCreateUser(AuthUtil.getUserId()); |
| | | } |
| | | return baseMapper.selectBackblastPubRecordExport(backblastPubRecord, |
| | | commonParamSet.getIsAdministrator(), |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getGridCodeList()); |
| | | } |
| | | } |