From aba3b1213588478ec1678b44fe318458640094c0 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Thu, 9 Nov 2023 11:50:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=A6=81=E5=81=9A=E6=8E=A8?= =?UTF-8?q?=E5=B9=BF=20=E5=AD=99=E6=80=BB=E7=BB=99=E5=AE=9A=E4=BA=86?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E8=A7=84=E5=88=99=EF=BC=9A11.9-11.12?= =?UTF-8?q?=E5=8F=B7=E6=9C=9F=E9=97=B4=E6=B3=A8=E5=86=8C=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=20=E5=B8=82=E7=BA=A7=E3=80=81=E5=8C=BA=E5=8E=BF?= =?UTF-8?q?=E7=BA=A7=E7=94=A8=E6=88=B7=E5=8F=AF=E4=BA=AB=E5=85=8D=E8=B4=B9?= =?UTF-8?q?30=E5=A4=A9=20=E4=B9=A1=E9=95=87=E7=BA=A7=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AF=E4=BA=AB=E5=85=8D=E8=B4=B9180=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/service/impl/SysUserServiceImpl.java | 81 +++++++++++++++---- 1 file changed, 65 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index df7ce7a..b76599d 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -141,8 +141,10 @@ public class SysUserServiceImpl implements SysUserService { if (streetNameList == null || streetNameList.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(0); sysUserEntity.setAccountType("街道级"); + sysUserEntity.setActiveFlag(0); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L))); + adapterStreetUser(sysUserEntity); } else if ("0000".equals(countyCode.substring(2))) { List proCodeList = streetDao.findByProCode(countyCode); if (proCodeList == null || proCodeList.size() == 0) { @@ -152,8 +154,10 @@ public class SysUserServiceImpl implements SysUserService { if (proNameList == null || proNameList.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(1); sysUserEntity.setAccountType("省级"); + sysUserEntity.setActiveFlag(1); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); +// adapterProUser(sysUserEntity); } else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) { List cityCodeList = streetDao.findByCityCode(countyCode); if (cityCodeList == null || cityCodeList.size() == 0) { @@ -163,8 +167,10 @@ public class SysUserServiceImpl implements SysUserService { if (cityNameList == null || cityNameList.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(1); sysUserEntity.setAccountType("市级"); + sysUserEntity.setActiveFlag(1); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); + adapterCityUser(sysUserEntity); } else { List countyCodeList = streetDao.findByCountyCode(countyCode); if (countyCodeList == null || countyCodeList.isEmpty()) { @@ -174,13 +180,10 @@ public class SysUserServiceImpl implements SysUserService { if (countyNameList == null || countyNameList.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(0); sysUserEntity.setAccountType("县级"); - } - if (9 == countyCode.length()) {//街道账号7天后过期 - sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L))); - } else {//省市区县账号5天后过期 + sysUserEntity.setActiveFlag(0); sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); + adapterCountyUser(sysUserEntity); } sysUserEntity.setStatusCode(0); sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now())); @@ -209,6 +212,53 @@ public class SysUserServiceImpl implements SysUserService { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "注册成功!", locale); } + /** + * 适配2023-11-09到2023-11-12之间注册的街道用户 + */ + private void adapterStreetUser(SysUserEntity sysUserEntity) { + if (in1109To1112()) { + sysUserEntity.setActiveFlag(0); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(180L))); + } + } + +// private void adapterProUser(SysUserEntity sysUserEntity) { +// if (in1109To1112()) { +// sysUserEntity.setActiveFlag(1); +// sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); +// } +// } + + /** + * 适配2023-11-09到2023-11-12之间注册的市级用户 + */ + private void adapterCityUser(SysUserEntity sysUserEntity) { + if (in1109To1112()) { + sysUserEntity.setActiveFlag(0); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(30L))); + } + } + + /** + * 适配2023-11-09到2023-11-12之间注册的区县用户 + */ + private void adapterCountyUser(SysUserEntity sysUserEntity) { + if (in1109To1112()) { + sysUserEntity.setActiveFlag(0); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(30L))); + } + } + + /** + * 判断当前是否处于2023-11-09到2023-11-12之间注册的 + */ + private boolean in1109To1112() { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime start1109 = LocalDateTime.of(2023, 11, 9, 0, 0, 0, 0); + LocalDateTime end1112 = LocalDateTime.of(2023, 11, 13, 0, 0, 0, 0); + return start1109.isBefore(now) && end1112.isAfter(now); + } + /** * 新增用户 * @@ -247,8 +297,9 @@ public class SysUserServiceImpl implements SysUserService { if (streetNameList == null || streetNameList.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(0); sysUserEntity.setAccountType("街道级"); + sysUserEntity.setActiveFlag(0); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L))); } else if ("0000".equals(countyCode.substring(2))) { List proCodeList = streetDao.findByProCode(countyCode); if (proCodeList == null || proCodeList.size() == 0) { @@ -258,8 +309,9 @@ public class SysUserServiceImpl implements SysUserService { if (proNameList == null || proNameList.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(1); sysUserEntity.setAccountType("省级"); + sysUserEntity.setActiveFlag(1); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); } else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) { List cityCodeList = streetDao.findByCityCode(countyCode); if (cityCodeList == null || cityCodeList.size() == 0) { @@ -269,8 +321,9 @@ public class SysUserServiceImpl implements SysUserService { if (cityNameList == null || cityNameList.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(1); sysUserEntity.setAccountType("市级"); + sysUserEntity.setActiveFlag(1); + sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); } else { List countyCodeList = streetDao.findByCountyCode(countyCode); if (countyCodeList == null || countyCodeList.isEmpty()) { @@ -280,12 +333,8 @@ public class SysUserServiceImpl implements SysUserService { if (countyNameList == null || countyNameList.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale); } - sysUserEntity.setActiveFlag(0); sysUserEntity.setAccountType("县级"); - } - if (9 == countyCode.length()) {//街道账号7天后过期 - sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(7L))); - } else {//省市区县账号5天后过期 + sysUserEntity.setActiveFlag(0); sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); } sysUserEntity.setStatusCode(0);