From 1d7b2d0e8ef3456d9c666845016a0ba3cd75dc1f Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 23 Aug 2022 14:42:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=81=AB=E7=82=B9=E5=85=A5?= =?UTF-8?q?=E5=BA=93-=E5=8E=BB=E9=99=A4=E9=87=8D=E5=A4=8D=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FirePointServiceImpl.java | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 3586fc2..1383ee5 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -48,6 +48,8 @@ public class FirePointServiceImpl implements FirePointService { public static Logger log = LoggerFactory.getLogger(FirePointServiceImpl.class); + private final Locale locale = LocaleContextHolder.getLocale(); + @Resource private FirePointDao firePointDao; @@ -148,7 +150,7 @@ public class FirePointServiceImpl implements FirePointService { */ private boolean checkDuplicatedData(FirePointEntity firePointEntity) { List duplicatedDataList = firePointDao.findDuplicatedData(firePointEntity.getLongitude(), firePointEntity.getLatitude(), firePointEntity.getStreetCode(), firePointEntity.getSatelliteTime(), firePointEntity.getSatelliteType(), firePointEntity.getLandType()); - return duplicatedDataList != null && duplicatedDataList.size() > 0; + return duplicatedDataList != null && duplicatedDataList.size() > 1; } /** @@ -159,7 +161,7 @@ public class FirePointServiceImpl implements FirePointService { */ private boolean checkDuplicatedDataX(ShanDongFirePointEntity shanDongFirePoint) { List duplicatedDataList = firePointDao.findDuplicatedData(shanDongFirePoint.getLongitude(), shanDongFirePoint.getLatitude(), shanDongFirePoint.getStreetCode(), shanDongFirePoint.getSatelliteTime(), shanDongFirePoint.getSatelliteType(), shanDongFirePoint.getLandType()); - return duplicatedDataList != null && duplicatedDataList.size() > 0; + return duplicatedDataList != null && duplicatedDataList.size() > 1; } /** @@ -170,7 +172,7 @@ public class FirePointServiceImpl implements FirePointService { */ private boolean checkDuplicatedData(ShanDongFirePointEntity shanDongFirePoint) { List duplicatedDataList = shanDongFirePointDao.findDuplicatedData(shanDongFirePoint.getLongitude(), shanDongFirePoint.getLatitude(), shanDongFirePoint.getStreetCode(), shanDongFirePoint.getSatelliteTime(), shanDongFirePoint.getSatelliteType(), shanDongFirePoint.getLandType()); - return duplicatedDataList != null && duplicatedDataList.size() > 0; + return duplicatedDataList != null && duplicatedDataList.size() > 1; } /** @@ -326,8 +328,6 @@ public class FirePointServiceImpl implements FirePointService { @Transactional(rollbackOn = Exception.class) @Override public String updateVerifyStateByFireCode(String fireCode, String verifyState) { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); if ((!"0".equals(verifyState)) && (!"1".equals(verifyState)) && (!"2".equals(verifyState))) { return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL, "审核失败,审核状态参数错误", locale); } @@ -454,7 +454,7 @@ public class FirePointServiceImpl implements FirePointService { LocalDate now = LocalDate.now(); List> list = firePointDao.downloadFirePointByVip(dateTimeToString(LocalDateTime.of(now.minusDays(1), LocalTime.MIN))); if (list.size() == 0) { - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "无数据!", LocaleContextHolder.getLocale()); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "无数据!", locale); } int year = now.getYear(); int month = now.getMonth().getValue(); @@ -468,7 +468,7 @@ public class FirePointServiceImpl implements FirePointService { } catch (IOException e) { log.error("download vip user's fire point fail: {}", e.getMessage()); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "ok", LocaleContextHolder.getLocale()); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "ok", locale); } /** @@ -536,8 +536,6 @@ public class FirePointServiceImpl implements FirePointService { @Transactional(rollbackOn = Exception.class) @Override public String updateTypeByFireCode(String fireCode, String fireType, String token) { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); String tokenUserName = TokenUtil.getTokenUserName(token); SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName); FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode); @@ -590,8 +588,6 @@ public class FirePointServiceImpl implements FirePointService { @Transactional(rollbackOn = Exception.class) @Override public String insertAppTask(MultipartFile[] files, AppTaskBodyVo appTaskBodyVo) throws IOException { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); FirePointEntity byFireCode = firePointDao.findByFireCode(appTaskBodyVo.getFireCode()); if (byFireCode == null) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "火点编码错误,请重新输入", locale); @@ -626,8 +622,6 @@ public class FirePointServiceImpl implements FirePointService { */ @Override public String selectAppTask(String fireCode) throws Exception { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(fireCode); if (byTaskFireCode == null) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该火点的任务信息", locale); @@ -652,8 +646,6 @@ public class FirePointServiceImpl implements FirePointService { @Cacheable(keyGenerator = "keyGenerator", unless = "#result == null") @Override public String selectFirePointNumMonth() { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); Map map = new HashMap(3); LocalDateTime localDateTime = LocalDateTime.now(); LocalDateTime localDateTime2 = localDateTime.plusDays(1); @@ -679,8 +671,6 @@ public class FirePointServiceImpl implements FirePointService { @Cacheable(keyGenerator = "keyGenerator", unless = "#result == null") @Override public String selectFirePointNumDay() { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); Map map = new HashMap(3); LocalDateTime localDateTime = LocalDateTime.now(); LocalDateTime localDateTime2 = localDateTime.plusDays(1); @@ -706,8 +696,6 @@ public class FirePointServiceImpl implements FirePointService { @Cacheable(keyGenerator = "keyGenerator", unless = "#result == null") @Override public String selectFirePointNumWeek() { - // 获取区域信息 - Locale locale = LocaleContextHolder.getLocale(); Map map = new HashMap(3); LocalDateTime localDateTime = LocalDateTime.now(); LocalDateTime localDateTime2 = localDateTime.plusDays(1); @@ -757,7 +745,6 @@ public class FirePointServiceImpl implements FirePointService { System.out.println("街道编号格式化出现错误:" + e.getMessage()); } } - Locale locale = LocaleContextHolder.getLocale(); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "街道编号格式化完毕", locale); }