diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/company/controller/CompanyLoginController.java b/jero-boot-incoming-payment/src/main/java/com/jero/company/controller/CompanyLoginController.java index 722f1d1a..0a75c9c0 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/company/controller/CompanyLoginController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/company/controller/CompanyLoginController.java @@ -61,9 +61,9 @@ public class CompanyLoginController { @PostMapping(value = "/login") public Result login(@RequestBody SysLoginModel sysLoginModel) { Result result = new Result<>(); - String username = PasswordUtil.encrypt(sysLoginModel.getUsername()); + String phone = sysLoginModel.getUsername(); String password = sysLoginModel.getPassword(); - /*String rsaPublicKey = sysLoginModel.getRsaPublicKey(); + String rsaPublicKey = sysLoginModel.getRsaPublicKey(); String rsaPrivateKey = String.valueOf(redisUtil.get(rsaPublicKey)); //update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题 //前端密码加密,后端进行密码解密 @@ -88,14 +88,14 @@ public class CompanyLoginController { try { //解密获取密码和用户名 password = CommonUtils.decryptBtRsaPriKey(password, rsaPrivateKey); - username = CommonUtils.decryptBtRsaPriKey(username, rsaPrivateKey); + phone = CommonUtils.decryptBtRsaPriKey(phone, rsaPrivateKey); } catch (Exception e) { e.printStackTrace(); - }*/ + } //1. 校验用户是否有效 //update-begin-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(PayContactsManagement::getPhone, username); + queryWrapper.eq(PayContactsManagement::getPhone, PasswordUtil.encrypt(phone)); PayContactsManagement contactsManagement = payContactsManagementService.getOne(queryWrapper); //update-end-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false if (Objects.isNull(contactsManagement)) { @@ -104,37 +104,88 @@ public class CompanyLoginController { // 若用户名有效,则查询该账号的登陆失败次数是否符合等保要求 int retryCount = 0; - if (redisUtil.get(RETRY_LOGIN_PREFIX + username) != null) { - retryCount = (int) redisUtil.get(RETRY_LOGIN_PREFIX + username); + if (redisUtil.get(RETRY_LOGIN_PREFIX + phone) != null) { + retryCount = (int) redisUtil.get(RETRY_LOGIN_PREFIX + phone); } if (retryCount >= RETRY_LOGIN_MAX_COUNT) { result.error500("密码错误次数过多,请稍后重试"); return result; } //2. 校验用户名或密码是否正确 - String userpassword = PasswordUtil.encrypt(username, password, contactsManagement.getSalt()); + String userpassword = PasswordUtil.encrypt(phone, password, contactsManagement.getSalt()); String syspassword = contactsManagement.getPassword(); if (!syspassword.equals(userpassword)) { // 重试登录次数加一 retryCount++; if (retryCount == 1) { - redisUtil.set(RETRY_LOGIN_PREFIX + username, retryCount, 60 * 30); + redisUtil.set(RETRY_LOGIN_PREFIX + phone, retryCount, 60 * 30); } else { - redisUtil.set(RETRY_LOGIN_PREFIX + username, retryCount, redisUtil.getExpire(RETRY_LOGIN_PREFIX + username)); + redisUtil.set(RETRY_LOGIN_PREFIX + phone, retryCount, redisUtil.getExpire(RETRY_LOGIN_PREFIX + phone)); } String msg = retryCount == RETRY_LOGIN_MAX_COUNT ? "密码错误次数过多,请稍后重试" : "用户名或密码错误,剩余可登录次数:" + (RETRY_LOGIN_MAX_COUNT - retryCount); result.error500(msg); return result; } //登录成功,清除错误登录次数 - redisUtil.del(RETRY_LOGIN_PREFIX + username); + redisUtil.del(RETRY_LOGIN_PREFIX + phone); //用户登录信息 userInfo(contactsManagement, result); //update-begin--Author:wangshuai Date:20200714 for:登录日志没有记录人员 LoginUser loginUser = new LoginUser(); BeanUtils.copyProperties(contactsManagement, loginUser); - baseCommonService.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null, loginUser); + baseCommonService.addLog("用户名: " + phone + ",登录成功!", CommonConstant.LOG_TYPE_1, null, loginUser); + //update-end--Author:wangshuai Date:20200714 for:登录日志没有记录人员 + return result; + } + + @ApiOperation("短信登录接口") + @PostMapping(value = "/smsLogin") + public Result smsLogin(@RequestBody SysLoginModel sysLoginModel) { + Result result = new Result<>(); + String phone = sysLoginModel.getUsername(); + String rsaPublicKey = sysLoginModel.getRsaPublicKey(); + String rsaPrivateKey = String.valueOf(redisUtil.get(rsaPublicKey)); + //update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题 + //前端密码加密,后端进行密码解密 + //password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword().replaceAll("%2B", "\\+")).trim();//密码解密 + //update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题 + //update-begin-author:taoyan date:20190828 for:校验验证码 + try { + //解密获取密码和用户名 + phone = CommonUtils.decryptBtRsaPriKey(phone, rsaPrivateKey); + } catch (Exception e) { + e.printStackTrace(); + } + String captcha = sysLoginModel.getCaptcha(); + if (captcha == null) { + result.error500("验证码无效"); + return result; + } + Object checkCode = redisUtil.get("_verification:_phone:" + phone); + if (checkCode == null) { + result.error500("验证码错误"); + return result; + } else { + redisUtil.del("_verification:_phone:" + phone); + } + + //1. 校验用户是否有效 + //update-begin-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PayContactsManagement::getPhone, phone); + PayContactsManagement contactsManagement = payContactsManagementService.getOne(queryWrapper); + //update-end-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false + if (Objects.isNull(contactsManagement)) { + throw new JeroBootException("手机号不存在"); + } + + //用户登录信息 + userInfo(contactsManagement, result); + //update-begin--Author:wangshuai Date:20200714 for:登录日志没有记录人员 + LoginUser loginUser = new LoginUser(); + BeanUtils.copyProperties(contactsManagement, loginUser); + baseCommonService.addLog("用户名: " + phone + ",登录成功!", CommonConstant.LOG_TYPE_1, null, loginUser); //update-end--Author:wangshuai Date:20200714 for:登录日志没有记录人员 return result; } @@ -207,9 +258,6 @@ public class CompanyLoginController { throw new JeroBootException("手机号不是企业联系人"); } sysBaseAPI.sendVerificationCode(phone,"2",null,null); - if (StringUtils.isBlank(contactsManagement.getPassword())){ - return Result.error("updatePassword"); - } String string = redisUtil.get("_verification:_phone:" + PasswordUtil.decrypt(phone)).toString(); return Result.OK(string); } @@ -221,4 +269,12 @@ public class CompanyLoginController { return Result.OK("修改密码成功"); } + @ApiOperation(value = "修改密码") + @PostMapping(value = "/changePassword") + public Result changePassword(@RequestBody CompanyLoginVO companyLoginVO) { + payContactsManagementService.changePassword(companyLoginVO); + + return Result.OK("修改密码成功"); + } + } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/company/service/IPayContactsManagementService.java b/jero-boot-incoming-payment/src/main/java/com/jero/company/service/IPayContactsManagementService.java index db31ed58..3103eeb4 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/company/service/IPayContactsManagementService.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/company/service/IPayContactsManagementService.java @@ -50,4 +50,6 @@ public interface IPayContactsManagementService extends IService listPayContactsManagement(List phoneList); void verificationChangePassword(CompanyLoginVO companyLoginVO); + + void changePassword(CompanyLoginVO companyLoginVO); } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/company/service/impl/PayContactsManagementServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/company/service/impl/PayContactsManagementServiceImpl.java index 796098c4..85692cc1 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/company/service/impl/PayContactsManagementServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/company/service/impl/PayContactsManagementServiceImpl.java @@ -5,16 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.api.vo.Result; import com.jero.common.exception.JeroBootException; -import com.jero.common.util.CommonUtils; -import com.jero.common.util.PasswordUtil; -import com.jero.common.util.RedisUtil; -import com.jero.common.util.ValidUtil; +import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.*; import com.jero.company.entity.PayContactsManagement; import com.jero.company.mapper.PayContactsManagementMapper; import com.jero.company.service.IPayContactsManagementService; import com.jero.company.vo.CompanyLoginVO; +import com.jero.modules.system.entity.SysUser; import org.apache.commons.collections.CollectionUtils; +import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -107,4 +108,24 @@ public class PayContactsManagementServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PayContactsManagement::getPhone, PasswordUtil.encrypt(phone)); + PayContactsManagement contactsManagement = this.getOne(queryWrapper); + + if (oConvertUtils.isEmpty(newPassword)) { + throw new JeroBootException("新密码不允许为空!"); + } + if (!newPassword.equals(verifyPassword)) { + throw new JeroBootException("两次输入密码不一致!"); + } + String password = PasswordUtil.encrypt(phone, newPassword, contactsManagement.getSalt()); + this.update(new PayContactsManagement().setPassword(password), new LambdaQueryWrapper().eq(PayContactsManagement::getPhone, phone)); + } } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/company/vo/CompanyLoginVO.java b/jero-boot-incoming-payment/src/main/java/com/jero/company/vo/CompanyLoginVO.java index ff2694d8..fe67691f 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/company/vo/CompanyLoginVO.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/company/vo/CompanyLoginVO.java @@ -25,15 +25,16 @@ public class CompanyLoginVO { /** * 密码 */ - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) @ApiModelProperty(value = "密码") @NotEmpty(message = "密码不能为空!") private String password; + @ApiModelProperty(value = "新密码") + private String newPassword; + /** * 确认密码 */ - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) @ApiModelProperty(value = "确认密码") @NotEmpty(message = "确认密码不能为空!") private String verifyPassword; diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingController.java b/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingController.java index 61c1fcc0..dc6b414b 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingController.java @@ -43,6 +43,7 @@ import com.jero.util.QrcodeUtil; import io.swagger.annotations.ApiImplicitParam; import lombok.extern.slf4j.Slf4j; import com.jero.common.system.base.controller.JeroController; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -79,7 +80,7 @@ public class PayMeetingController extends JeroController queryPageList(PayMeeting payMeeting, @@ -127,7 +128,7 @@ public class PayMeetingController extends JeroController> queryList() { @@ -138,6 +139,7 @@ public class PayMeetingController extends JeroController queryById(@RequestParam(name = "id") String id) { @@ -225,6 +230,7 @@ public class PayMeetingController extends JeroController queryWrapper = QueryGenerator.initQueryWrapper(payMeeting, request.getParameterMap()); @@ -320,45 +326,12 @@ public class PayMeetingController extends JeroController queryWrapper = QueryGenerator.initQueryWrapper(payMeeting, request.getParameterMap()); - List pageList = payMeetingService.list(queryWrapper); - List exportList = new ArrayList<>(); - // 过滤选中数据 - String selections = request.getParameter("selections"); - if (oConvertUtils.isNotEmpty(selections)) { - List selectionList = Arrays.asList(selections.split(",")); - pageList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); - } - for (PayMeeting meeting : pageList) { - //查询会议负责人 - LoginUser user = sysBaseApi.getUserById(meeting.getDirectorId()); - meeting.setDirectorName(user.getUsername()); - meeting.setDirectorPhone(PasswordUtil.decrypt(user.getPhone())); - WorkingGroupMeetingExcel workingGroupMeetingExcel = new WorkingGroupMeetingExcel(); - BeanUtils.copyProperties(meeting, workingGroupMeetingExcel); - String meetingType = meeting.getMeetingType().toString(); - String meetingType1 = sysBaseApi.translateDict("meeting_type", meetingType); - workingGroupMeetingExcel.setMeetingType(meetingType1); - // 工作组项目查询工作组项目名 - if (meetingType.equals(MeetingCommon.WORKING_GROUP_MEETING)) { - String workingGroupId = meeting.getWorkingGroupId(); - PayWorkingGroup workingGroup = payWorkingGroupService.getById(workingGroupId); - workingGroupMeetingExcel.setWorkingGroupName(workingGroup.getWorkingGroupProject()); - } - exportList.add(workingGroupMeetingExcel); - } - return super.exportListXls(exportList, WorkingGroupMeetingExcel.class, "会议管理"); - } /** * 上传资料 */ @AutoLog(value = "上传资料") + @RequiresPermissions("meeting:upload") @ApiOperation(value="上传资料", notes="上传资料") @PostMapping(value = "/uploadFile") public Result uploadFile(@RequestBody UploadFileVO uploadFileVO) { @@ -390,6 +363,8 @@ public class PayMeetingController extends JeroController publishReminder(@RequestBody PublishReminderVO publishReminderVO) { @@ -407,7 +382,7 @@ public class PayMeetingController extends JeroController addStandards(@RequestBody PayMeeting payMeeting, HttpServletRequest request) { String publicKey = request.getParameter("publicKey"); diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingSituationController.java b/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingSituationController.java index 614a40b4..c1c806b5 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingSituationController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/meeting/controller/PayMeetingSituationController.java @@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j; import com.jero.common.system.base.controller.JeroController; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -65,7 +66,7 @@ public class PayMeetingSituationController extends JeroController queryPageList(PayMeetingSituation payMeetingSituation, @@ -91,7 +92,6 @@ public class PayMeetingSituationController extends JeroController contractPage(MeetingSituationContractVO meetingSituationContractVO, @@ -106,7 +106,6 @@ public class PayMeetingSituationController extends JeroController queryPageList2(PayMeetingSituation payMeetingSituation, @@ -125,8 +124,7 @@ public class PayMeetingSituationController extends JeroController signUpPage(PayMeetingSituation payMeetingSituation, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @@ -137,12 +135,11 @@ public class PayMeetingSituationController extends JeroController page = new Page<>(pageNo, pageSize); IPage pageList = payMeetingSituationService.page(page, queryWrapper); return Result.OK(pageList); - } + }*/ /** * 列表查询 */ - @AutoLog(value = "参会人员信息-列表查询") @ApiOperation(value = "参会人员信息-列表查询", notes = "参会人员信息-列表查询") @GetMapping(value = "/list") public Result> queryList() { @@ -153,6 +150,7 @@ public class PayMeetingSituationController extends JeroController edit(@RequestBody PayMeetingSituationVO payMeetingSituationVO) { @@ -187,6 +186,7 @@ public class PayMeetingSituationController extends JeroController queryWrapper = QueryGenerator.initQueryWrapper(payMeetingSituation, request.getParameterMap()); @@ -309,6 +311,7 @@ public class PayMeetingSituationController extends JeroController checkRegister(@RequestBody CheckVO checkVO) { @@ -360,7 +365,7 @@ public class PayMeetingSituationController extends JeroController signIn(@RequestBody SignInVO signInVO) { ValidUtil.validate(signInVO); payMeetingSituationService.signIn(signInVO); - return Result.OK("合并开票成功!"); + return Result.OK("签到成功!"); } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/meeting/service/impl/PayMeetingSituationServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/meeting/service/impl/PayMeetingSituationServiceImpl.java index 17b0d767..057b9312 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/meeting/service/impl/PayMeetingSituationServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/meeting/service/impl/PayMeetingSituationServiceImpl.java @@ -398,6 +398,7 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl