diff --git a/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java b/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java index 728d767..3cb6512 100644 --- a/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java +++ b/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java @@ -78,11 +78,6 @@ public class CustomAuthenticationProvider implements AuthenticationProvider { throw new DisabledException("该账号还未激活,请联系管理员"); } - //检查用户状态是否正常 - if (userEntity.getStatusCode() != 0) { - throw new DisabledException("用户状态不正常,请联系管理员"); - } - // 认证逻辑 String encryptPassword = encry256(password + userEntity.getSalt()); if (encryptPassword.equals(userEntity.getPassword())) { diff --git a/src/main/java/com/xkrs/common/tool/CompareVersion.java b/src/main/java/com/xkrs/common/tool/CompareVersion.java deleted file mode 100644 index 7d2d6e7..0000000 --- a/src/main/java/com/xkrs/common/tool/CompareVersion.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.xkrs.common.tool; - -/** - * CompareVersion 比较版本号 - * @author tajochen - */ -public class CompareVersion { - - /** - * 比较三位版本号 ,若 版本1>版本2 返回 1,若版本1<版本2 返回 -1,否则返回0 - * @param version1 版本1 - * @param version2 版本2 - * @return - */ - public static int compareVersion(String version1, String version2) { - String[] v1 = version1.split("\\."); - String[] v2 = version2.split("\\."); - int n = Math.max(v1.length, v2.length); - for (int i = 0; i < n; i++) { - int v1Int = i < v1.length ? Integer.parseInt(v1[i]) : 0; - int v2Int = i < v2.length ? Integer.parseInt(v2[i]) : 0; - if (v1Int == v2Int) { - continue; - } - if (v1Int > v2Int){ - return 1; - } else { - return -1; - } - } - return 0; - } -} diff --git a/src/main/java/com/xkrs/common/tool/EntityUtil.java b/src/main/java/com/xkrs/common/tool/EntityUtil.java deleted file mode 100644 index 70c54b6..0000000 --- a/src/main/java/com/xkrs/common/tool/EntityUtil.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.xkrs.common.tool; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * dao接口类处理工具 - * @author tajochen - */ -public class EntityUtil { - private static final Logger logger = LoggerFactory.getLogger(EntityUtil.class); - - /** - * 将数组数据转换为实体类 - * 此处数组元素的顺序必须与实体类构造函数中的属性顺序一致 - * @param list 数组对象集合 - * @param clazz 实体类 - * @param 实体类 - * @param model 实例化的实体类 - * @return 实体类集合 - */ - public static List castEntity(List list, Class clazz, Object model) { - List returnList = new ArrayList(); - if (list.isEmpty()) { - return returnList; - } - //获取每个数组集合的元素个数 - Object[] co = list.get(0); - - //获取当前实体类的属性名、属性值、属性类别 - List attributeInfoList = getFiledsInfo(model); - //创建属性类别数组 - Class[] c2 = new Class[attributeInfoList.size()]; - //如果数组集合元素个数与实体类属性个数不一致则发生错误 - if (attributeInfoList.size() != co.length) { - return returnList; - } - //确定构造方法 - for (int i = 0; i < attributeInfoList.size(); i++) { - c2[i] = (Class) attributeInfoList.get(i).get("type"); - } - try { - for (Object[] o : list) { - Constructor constructor = clazz.getConstructor(c2); - returnList.add(constructor.newInstance(o)); - } - } catch (Exception ex) { - logger.error("实体数据转化为实体类发生异常:异常信息:{}", ex.getMessage()); - return returnList; - } - return returnList; - } - - /** - * 根据属性名获取属性值 - * @param fieldName 属性名 - * @param modle 实体类 - * @return 属性值 - */ - private static Object getFieldValueByName(String fieldName, Object modle) { - try { - String firstLetter = fieldName.substring(0, 1).toUpperCase(); - String getter = "get" + firstLetter + fieldName.substring(1); - Method method = modle.getClass().getMethod(getter, new Class[]{}); - Object value = method.invoke(modle, new Object[]{}); - return value; - } catch (Exception e) { - return null; - } - } - - /** - * 获取属性类型(type),属性名(name),属性值(value)的map组成的list - * @param model 实体类 - * @return list集合 - */ - private static List getFiledsInfo(Object model) { - Field[] fields = model.getClass().getDeclaredFields(); - List list = new ArrayList(fields.length); - Map infoMap = null; - for (int i = 0; i < fields.length; i++) { - infoMap = new HashMap(3); - infoMap.put("type", fields[i].getType()); - infoMap.put("name", fields[i].getName()); - infoMap.put("value", getFieldValueByName(fields[i].getName(), model)); - list.add(infoMap); - } - return list; - } -} diff --git a/src/main/java/com/xkrs/controller/PushController.java b/src/main/java/com/xkrs/controller/PushController.java index 0a2f683..2c555d1 100644 --- a/src/main/java/com/xkrs/controller/PushController.java +++ b/src/main/java/com/xkrs/controller/PushController.java @@ -32,8 +32,7 @@ public class PushController { @PostMapping("/bindUserPushInfo") public String bindUserPushInfo(@RequestBody SysUserPushAccountQo sysUserPushAccountQo) { Long id = sysUserPushAccountQo.getId(); - String regID = sysUserPushAccountQo.getRegID(); - String userAccount = sysUserPushAccountQo.getUserAccount(); + String pushId = sysUserPushAccountQo.getPushId(); if (null == id) { return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "绑定失败,id == null", locale); } @@ -41,17 +40,12 @@ public class PushController { if (targetSysUserOptional.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "绑定失败,id不存在", locale); } - if (TextUtils.isEmpty(regID)) { - return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "绑定失败,regID == null", locale); - } - if (TextUtils.isEmpty(userAccount)) { - return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "绑定失败,userAccount == null", locale); + if (TextUtils.isEmpty(pushId)) { + return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "绑定失败,pushId == null", locale); } SysUserEntity targetSysUser = targetSysUserOptional.get(); - // 更新 regID - targetSysUser.setPushRegID(regID); - // 更新 userAccount - targetSysUser.setPushUserAccount(userAccount); + // 更新 pushId + targetSysUser.setPushId(pushId); sysUserDao.save(targetSysUser); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "绑定成功", locale); } diff --git a/src/main/java/com/xkrs/model/qo/SysUserPushAccountQo.java b/src/main/java/com/xkrs/model/qo/SysUserPushAccountQo.java index 33a99d3..d8e9dab 100644 --- a/src/main/java/com/xkrs/model/qo/SysUserPushAccountQo.java +++ b/src/main/java/com/xkrs/model/qo/SysUserPushAccountQo.java @@ -4,9 +4,7 @@ public class SysUserPushAccountQo { private Long id; - private String regID; - - private String userAccount; + private String pushId; public SysUserPushAccountQo() { } @@ -19,19 +17,11 @@ public class SysUserPushAccountQo { this.id = id; } - public String getRegID() { - return regID; + public String getPushId() { + return pushId; } - public void setRegID(String regID) { - this.regID = regID; - } - - public String getUserAccount() { - return userAccount; - } - - public void setUserAccount(String userAccount) { - this.userAccount = userAccount; + public void setPushId(String pushId) { + this.pushId = pushId; } } diff --git a/src/main/java/com/xkrs/straw/model/helper/PushHelper.java b/src/main/java/com/xkrs/straw/model/helper/PushHelper.java index aa89118..e846d4f 100644 --- a/src/main/java/com/xkrs/straw/model/helper/PushHelper.java +++ b/src/main/java/com/xkrs/straw/model/helper/PushHelper.java @@ -18,14 +18,14 @@ public class PushHelper { public PushHelper() { } - public List obtainUserAccountList(List sysUserList) { - List userAccountList = new ArrayList<>(); + public List obtainUserPushIdList(List sysUserList) { + List userPushIdList = new ArrayList<>(); if (sysUserList != null && sysUserList.size() > 0) { for (SysUserEntity sysUserEntity : sysUserList) { - userAccountList.add(sysUserEntity.getPushUserAccount()); + userPushIdList.add(sysUserEntity.getPushId()); } } - return userAccountList; + return userPushIdList; } /** diff --git a/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java index 03f69b0..d2884b2 100644 --- a/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java @@ -71,15 +71,9 @@ public class SysUserServiceImpl implements SysUserService { List sysUserList = sysUserDao.findAll(); List vipSysUserList = new ArrayList<>(); for (SysUserEntity sysUser : sysUserList) { - if (sysUser.getDeleteFlag() != 0) {//被删除的用户不属于Vip - continue; - } if (sysUser.getActiveFlag() != 0) {//被禁用的用户不属于Vip continue; } - if (sysUser.getStatusCode() != 0) {//状态不正常的用户不属于Vip - continue; - } if ("管理员".equals(sysUser.getAccountType())) {//管理员用户不属于Vip continue; } @@ -190,16 +184,13 @@ public class SysUserServiceImpl implements SysUserService { } else {//省市区县账号5天后过期 sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L))); } - sysUserEntity.setStatusCode(0); sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now())); - sysUserEntity.setDeleteFlag(0); sysUserEntity.setLoginNum(0); sysUserEntity.setCountyCode(countyCode); sysUserEntity.setCountyName(countyName); sysUserEntity.setVipLevel(0); sysUserEntity.setReceiveSms(0); sysUserEntity.setRemark("");//备注 - sysUserEntity.setAgentOrgId(sysUserQo.getAgentOrgId() == null ? 1L : sysUserQo.getAgentOrgId()); sysUserDao.save(sysUserEntity); RelUserRoleEntity relUserRoleEntity = new RelUserRoleEntity(); diff --git a/src/main/java/com/xkrs/utils/FirePointCodeUtils.java b/src/main/java/com/xkrs/utils/FirePointCodeUtils.java index cdf65d5..3bad7a3 100644 --- a/src/main/java/com/xkrs/utils/FirePointCodeUtils.java +++ b/src/main/java/com/xkrs/utils/FirePointCodeUtils.java @@ -45,18 +45,12 @@ public class FirePointCodeUtils { try { String formatCutCode = FirePointCodeUtils.getFormatCutCode(sysUser.getCountyCode()); if (firePointStreetCode.startsWith(formatCutCode)) { - if (sysUser.getDeleteFlag() != 0) {//被删除的用户不发短信 - continue; - } if (sysUser.getActiveFlag() != 0) {//被禁用的用户不发短信 continue; } if (sysUser.getReceiveSms() != 1) {//关掉开关的用户不发短信 continue; } - if (sysUser.getStatusCode() != 0) {//状态不正常的用户不发短信 - continue; - } if ("管理员".equals(sysUser.getAccountType())) {//管理员用户不发短信 continue; } diff --git a/src/main/java/com/xkrs/utils/ObjectToBeanUtils.java b/src/main/java/com/xkrs/utils/ObjectToBeanUtils.java deleted file mode 100644 index ceb0381..0000000 --- a/src/main/java/com/xkrs/utils/ObjectToBeanUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.xkrs.utils; - - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author XinYi Song - */ -public class ObjectToBeanUtils { - - public static Logger log = LoggerFactory.getLogger(ObjectToBeanUtils.class); - - /** - * 把List转换成List - */ - public static List objectToBean(List objList, Class clz) throws Exception { - if (objList == null || objList.size() == 0) { - return null; - } - - Class[] cz = null; - Constructor[] cons = clz.getConstructors(); - for (Constructor ct : cons) { - Class[] clazz = ct.getParameterTypes(); - if (objList.get(0).length == clazz.length) { - cz = clazz; - break; - } - } - - List list = new ArrayList(); - for (Object[] obj : objList) { - Constructor cr = clz.getConstructor(cz); - list.add(cr.newInstance(obj)); - } - return list; - } - - /** - * 根据属性名获取属性值 - * - * @param fieldName 属性名 - * @param modle 实体类 - * @return 属性值 - */ - private static Object getFieldValueByName(String fieldName, Object modle) { - try { - String firstLetter = fieldName.substring(0, 1).toUpperCase(); - String getter = "get" + firstLetter + fieldName.substring(1); - Method method = modle.getClass().getMethod(getter, new Class[]{}); - Object value = method.invoke(modle, new Object[]{}); - return value; - } catch (Exception e) { - return null; - } - } - - /** - * 获取属性类型(type),属性名(name),属性值(value)的map组成的list - * - * @param model 实体类 - * @return list集合 - */ - private static List getFiledsInfo(Object model) { - Field[] fields = model.getClass().getDeclaredFields(); - List list = new ArrayList(fields.length); - Map infoMap = null; - for (int i = 0; i < fields.length; i++) { - infoMap = new HashMap(3); - infoMap.put("type", fields[i].getType()); - infoMap.put("name", fields[i].getName()); - infoMap.put("value", getFieldValueByName(fields[i].getName(), model)); - list.add(infoMap); - } - return list; - } - - -} diff --git a/src/main/java/com/xkrs/websocket/controller/websocketbroker/ViewController.java b/src/main/java/com/xkrs/websocket/controller/websocketbroker/ViewController.java deleted file mode 100644 index 4bd39b1..0000000 --- a/src/main/java/com/xkrs/websocket/controller/websocketbroker/ViewController.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.xkrs.websocket.controller.websocketbroker; - -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -/** - * @author xkrs - */ -@Configuration -public class ViewController extends WebMvcConfigurerAdapter { - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/ws").setViewName("/ws"); - } -}