From 7a5eef0b1248f93d98b1d8505bb4bb6a28ab94fa Mon Sep 17 00:00:00 2001 From: river <1376754470@qq.com> Date: Mon, 2 Nov 2020 09:23:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=81=E6=9C=88=E4=BB=BD=E5=A4=A7=E5=BA=86?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=92=8C=E4=BA=BA=E8=B5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrauth/service/impl/UserServiceImpl.java | 25 +++++++-------- .../service/impl/EmployeeServiceImpl.java | 22 ++++++++++--- .../service/impl/PositionServiceImpl.java | 31 ++++++++++++++----- .../hrms/service/impl/UserServiceImpl.java | 8 ++++- .../resources/mapper/hrms/EmployeeDao.xml | 7 +++-- .../framework/model/response/CommonCode.java | 2 ++ .../model/response/PromptSuccess.java | 6 ++-- .../com/daqing/framework/util/Md5Util.java | 2 +- .../domain/hrms/ext/EmployeeInfoVO.java | 4 +++ .../domain/hrms/ext/EmployeeTemplate.java | 6 ++-- .../domain/hrms/response/HrmsCode.java | 1 + .../src/main/resources/jwt.properties | 3 ++ 12 files changed, 84 insertions(+), 33 deletions(-) diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserServiceImpl.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserServiceImpl.java index 03e2e4fe..ba2aa8c1 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserServiceImpl.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserServiceImpl.java @@ -130,30 +130,29 @@ public class UserServiceImpl extends ServiceImpl imple */ @Override public Boolean weChatBinding(String code, HttpServletResponse response,String state) { - //String md5Code = Md5Util.md5(code); - String accessTokenUrl = String.format(weChatConfig.getOPEN_ACCESS_TOKEN_URL(),weChatConfig.getOpenAppid(),weChatConfig.getOpenAppsecret(),code); + String accessTokenUrl = String.format(weChatConfig.getOPEN_ACCESS_TOKEN_URL(),weChatConfig.getOpenAppid(),weChatConfig.getOpenAppsecret(),code); //获取access_token Map baseMap = HttpUtils.doGet(accessTokenUrl); if(baseMap == null || baseMap.isEmpty()){ return false; } String openId = (String) baseMap.get("openid"); + log.info(openId+"--------------------------------------------------------------------------------------------------"); String md5OpenId = Md5Util.md5(openId); Integer countWeChatId = this.getBaseMapper().countWeChatId(md5OpenId); String token = this.getBaseMapper().getTokenByUserId(Long.parseLong(state)); if (countWeChatId > 0){ - try { - response.sendRedirect("http://www.huorantech.cn/dq/index.html#/workbench-manpower?token="+token+"&message=1"); - } catch (IOException e) { - e.printStackTrace(); - } - } - Boolean result = this.getBaseMapper().updateWeChat(Long.parseLong(state), md5OpenId); - log.info("绑定成功---------------------------------------"); - if (result){ - - if (token != null){ + try { + log.info("微信重复了,我走到了这里............................."); + response.sendRedirect("http://www.huorantech.cn/dq/index.html#/workbench-manpower?token="+token+"&message=1"); + } catch (IOException e) { + e.printStackTrace(); + } + }else { + Boolean result = this.getBaseMapper().updateWeChat(Long.parseLong(state), md5OpenId); + log.info("绑定成功---------------------------------------"); + if (result){ try { log.info("转发成功---------------------------------------"); response.sendRedirect("http://www.huorantech.cn/dq/index.html#/workbench-manpower?token="+token); diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java index 6ca23860..003871a2 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java @@ -266,6 +266,13 @@ public class EmployeeServiceImpl extends ServiceImpl listDepartmentIdAndName = deptDao.listDepartmentIdAndName(); List listPositionIdAndName = positionDao.listPositionIdAndName(); List listRoleIdAndName = roleDao.listRoleIdAndName(); @@ -383,12 +394,15 @@ public class EmployeeServiceImpl extends ServiceImpl(deptIds)); // 职位 - String[] positionNames = employeeExcelImport.getPositionNameList().split(","); + String[] positionNames = employeeExcelImport.getPositionNameList().split("&"); if (positionNames.length == 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_POSITION_IS_NULL); } @@ -420,7 +434,7 @@ public class EmployeeServiceImpl extends ServiceImpl(positionIds)); // 角色 - String[] roleNames = employeeExcelImport.getRoleNameList().split(","); + String[] roleNames = employeeExcelImport.getRoleNameList().split("&"); if (roleNames.length == 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_ROLE_IS_NULL); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java index bba463bc..e6c07f82 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/PositionServiceImpl.java @@ -17,13 +17,17 @@ import com.daqing.framework.domain.hrms.response.HrmsCode; import com.daqing.framework.domain.hrms.response.PositionResponse; import com.daqing.framework.exception.ExceptionCast; import com.daqing.framework.model.response.CommonCode; +import com.daqing.framework.util.RedisUtil; import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.SnowflakeIdUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -63,11 +67,21 @@ public class PositionServiceImpl extends ServiceImpl deptIdList = Arrays.asList(position.getDeptIds()); @@ -98,12 +112,15 @@ public class PositionServiceImpl extends ServiceImpl deptIdList = Arrays.asList(positionRequest.getDeptIds()); deptIdList.forEach(deptId -> { diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java index 796c280c..498b2b3a 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/UserServiceImpl.java @@ -48,6 +48,9 @@ public class UserServiceImpl extends ServiceImpl implements public EmployeeAndUserVO info() { String userId = this.getUserId(); EmployeeAndUserVO employeeAndUser = employeeDao.getEmployeeByUserId(Long.parseLong(userId)); + if (employeeAndUser == null){ + return employeeAndUser; + } if (employeeAndUser.getWechatId() == null || employeeAndUser.getWechatId().length() == 0){ employeeAndUser.setWechatId(PromptSuccess.QR_CODE_FAIL); }else { @@ -136,13 +139,15 @@ public class UserServiceImpl extends ServiceImpl implements } String substring = filename.substring(filename.lastIndexOf(".")); String filePrefix = UUID.randomUUID().toString(); + // 图片上传绝对路径 String filePath = PromptSuccess.UPLOAD_FILE_PATH+filePrefix+substring; try { file.transferTo(new File(filePath)); } catch (IOException e) { ExceptionCast.cast(HrmsCode.USER_FILE_UPLOAD_FAIL); } - return filePath; + // 图片访问路径 + return PromptSuccess.IMAGE_URL_PATH+filePrefix+substring; } /** @@ -160,6 +165,7 @@ public class UserServiceImpl extends ServiceImpl implements if (!Objects.equals(affirmNewPassword, newPassword)){ ExceptionCast.cast(HrmsCode.USER_PASSWORD_NO_CONSISTENT); } + // 旧密码是否正确 String userId = this.getUserId(); if (!Objects.equals(Md5Util.md5(primaryPassword + Long.parseLong(userId)),this.getBaseMapper().getPasswordById(Long.parseLong(userId)))){ ExceptionCast.cast(HrmsCode.USER_PASSWORD_MISTAKE); diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml index 1950ecbf..02218124 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml @@ -424,7 +424,7 @@ - INSERT INTO hrms_user (account,create_time) VALUES (#{account},#{createTime}) + INSERT INTO hrms_user (account,create_time,motify_time) VALUES (#{account},#{createTime},#{motifyTime})