diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/HrmsFeignService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/HrmsFeignService.java index 31cb0345..76f963b7 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/HrmsFeignService.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/HrmsFeignService.java @@ -33,6 +33,12 @@ public interface HrmsFeignService { @GetMapping("/hrms/employee/getEmployeeAndDeptById") // 远程调用传递集合类型的参数必须以数组封装,不然会导致数据接收不完整 ResponseResult> getEmployeeAndDeptById(@RequestParam("ids") Long[] ids); + /** + * 根据userId获取用户名以及部门名称 + */ + @GetMapping("hrms/employee/getAccountAndDeptNameByIds") + ResponseResult> getAccountAndDeptNameByIds(@RequestParam("ids") Long[] ids); + /** * 根据部门id获取该部门下所有员工信息 */ diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgStatisticsServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgStatisticsServiceImpl.java index 0a7b1e04..2ab75553 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgStatisticsServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgStatisticsServiceImpl.java @@ -96,7 +96,8 @@ public class DgStatisticsServiceImpl extends ServiceImpl> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + //ResponseResult> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + ResponseResult> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); if (empAndDeptList.getData() != null) { List listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); IPage iPages = new Page<>(); @@ -129,7 +130,8 @@ public class DgStatisticsServiceImpl extends ServiceImpl> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + //ResponseResult> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + ResponseResult> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); if (empAndDeptList.getData() != null) { List listResponse = this.jointStatistics(dgStatisticsPOList, empAndDeptList.getData()); List excelResponse = new ArrayList<>(); @@ -237,7 +239,8 @@ public class DgStatisticsServiceImpl extends ServiceImpl> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + //ResponseResult> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + ResponseResult> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); if (empAndDeptList.getData() != null) { List listResponse = this.jointRefuseStatistics(dgStatisticsRefusePOList, empAndDeptList.getData()); IPage iPages = new Page<>(); @@ -270,7 +273,8 @@ public class DgStatisticsServiceImpl extends ServiceImpl> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + //ResponseResult> empAndDeptList = hrmsFeignService.getEmployeeAndDeptById(ids); + ResponseResult> empAndDeptList = hrmsFeignService.getAccountAndDeptNameByIds(ids); if (empAndDeptList.getData() != null) { // 提单人姓名、部门拼装 List listResponse = this.jointRefuseStatistics(statisticsRefusePOList, empAndDeptList.getData()); @@ -317,6 +321,9 @@ public class DgStatisticsServiceImpl extends ServiceImpl0 ? ResponseResult.SUCCESS() : ResponseResult.FAIL(55003,"开启通知提醒失败!"); + } + + /** + * 读取是否已开启通知提醒 + * @return + */ + @GetMapping("/readIsRemind") + public ResponseResult readIsRemind(){ + String result = userLoginService.readIsRemind(); + return ResponseResult.SUCCESS(result); + } } diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java index bf3e6749..bd930ccd 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java @@ -41,4 +41,6 @@ public interface UserLoginDao extends BaseMapper { int selectUserEmpCount(@Param("md5UnionId")String md5UnionId); UserEntity xcxLogin(LoginRequest loginRequest); + + String readIsRemind(Long id); } diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java index 17799ac9..8972746b 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java @@ -26,4 +26,8 @@ public interface UserLoginService extends IService { int isPhoneExist(String mobile); ResponseResult wxAuthLogin(String encryptedData, String iv, String code, Integer identify); + + int isRemind(Integer isRemind); + + String readIsRemind(); } diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java index 66ec398b..d4e20977 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java @@ -23,15 +23,19 @@ import com.daqing.framework.exception.ExceptionCast; import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.util.JwtUtils; import com.daqing.framework.util.Md5Util; +import com.daqing.framework.util.RedisUtil; import com.daqing.framework.util.SendUtil; import lombok.extern.java.Log; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UsernameNotFoundException; 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.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -437,4 +441,32 @@ public class UserLoginServiceImpl extends ServiceImpl return result; } + @Override + public int isRemind(Integer isRemind) { + String userId = this.getUserId(); + UserEntity entity = new UserEntity(); + entity.setIsRemind(isRemind); + entity.setId(Long.valueOf(userId)); + + return userLoginDao.updateById(entity); + } + + @Override + public String readIsRemind() { + String userId = this.getUserId(); + UserEntity entity = new UserEntity(); + entity.setId(Long.valueOf(userId)); + + return userLoginDao.readIsRemind(entity.getId()); + } + + /** + * 获取当前登录用户信息 + */ + private String getUserId() { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String token = request.getHeader("token"); + return RedisUtil.get("dq:token:" + token); + } + } diff --git a/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml b/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml index 34986418..06c85000 100644 --- a/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml +++ b/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml @@ -96,4 +96,8 @@ SELECT COUNT(0) FROM hrms_user hu INNER JOIN hrms_employee he ON he.user_id=hu.id WHERE hu.wechat_id = #{md5UnionId} + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java index b3b3c951..9b58eb03 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java @@ -217,6 +217,12 @@ public class EmployeeController implements EmployeeControllerApi { return new ResponseResult>().SUCCESS(employeeTO); } + @GetMapping("/getAccountAndDeptNameByIds") + public ResponseResult getAccountAndDeptNameByIds(@RequestParam("ids") Long[] ids) { + List employeeTO = employeeService.getAccountAndDeptNameByIds(Arrays.asList(ids)); + return new ResponseResult>().SUCCESS(employeeTO); + } + /** * 根据id查询员工姓名 * diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java index 68dd6a1f..97ca9501 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java @@ -117,4 +117,6 @@ public interface EmployeeDao extends BaseMapper { Boolean deleteRoleByUserId(@Param("ids") List ids); EmployeeEntity getEmpmsgById(Long id); + + List getAccountAndDeptNameByIds(@Param("ids")List ids); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java index f5867db1..2701a3b1 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java @@ -80,5 +80,6 @@ public interface EmployeeService extends IService { EmployeeEntity getEmpmsgById(Long id); + List getAccountAndDeptNameByIds(List ids); } 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 e04ad053..a5fba62c 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 @@ -628,6 +628,12 @@ public class EmployeeServiceImpl extends ServiceImpl getAccountAndDeptNameByIds(List ids) { + + return this.getBaseMapper().getAccountAndDeptNameByIds(ids); + } + /** * 根据userId查询员工的头像 * 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 5955daf0..151bbe5a 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml @@ -160,6 +160,19 @@ + +