diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 5423f6fb6a..4d4c5b04f2 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.29 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.30 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 0e33d14dae..bedc5ca532 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.29 + 0.3.30 com.epmet epmet-cloud diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 61358a0c6b..a9a79cb949 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -272,9 +272,6 @@ public class GovLoginServiceImpl implements GovLoginService { throw new RenException(customerStaffDTOResult.getCode()); } CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); - /*if(null==customerStaff.getPassword()||"".equals(customerStaff.getPassword().trim())){ - throw new RenException(EpmetErrorCode.PLEASE_ACTIVATE_CURRENT_CUSTOMER_ACCOUNT.getCode()); - }*/ //2、解析微信用户 WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); //3、记录staff_wechat,并记录用户激活状态,激活时间 @@ -346,19 +343,20 @@ public class GovLoginServiceImpl implements GovLoginService { havePasswordFlag=true; }else{ logger.warn(String.format("当前用户:手机号%s,客户Id%s下未设置密码.",formDTO.getMobile(),customerStaffDTO.getCustomerId())); + continue; } if (!PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) { - logger.warn(String.format("当前用户:手机号%s,客户Id%s密码输入错误.",formDTO.getMobile(),customerStaffDTO.getCustomerId())); + logger.warn(String.format("当前用户:手机号%s,客户Id%s密码匹配错误.",formDTO.getMobile(),customerStaffDTO.getCustomerId())); }else{ logger.warn(String.format("当前用户:手机号%s,客户Id%s密码匹配正确.",formDTO.getMobile(),customerStaffDTO.getCustomerId())); passwordRightFlag=true; + customerIdList.add(customerStaffDTO.getCustomerId()); } - customerIdList.add(customerStaffDTO.getCustomerId()); } //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 if(!havePasswordFlag){ - throw new RenException(EpmetErrorCode.PLEASE_ACTIVATE_ACCOUNT.getCode()); + logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile())); } //密码错误 if(!passwordRightFlag){ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 0d17ca70b9..e11006dcaa 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -31,9 +31,10 @@ public enum EpmetErrorCode { LOSE_EFFICACY(8006,"此邀请链接已过期"), ERROR_PHONE(8007,"请输入正确的手机号"), PLEASE_LOGIN(8008,"请重新登录"), - PASSWORD_ERROR(8009,"密码错误,请重新输入"), - PLEASE_ACTIVATE_ACCOUNT(8010,"请先使用验证码登录激活账户"), - PLEASE_ACTIVATE_CURRENT_CUSTOMER_ACCOUNT(8011,"当前组织下,账号未激活,请先使用验证码登录"), + PASSWORD_ERROR(8009,"手机号密码不符"), + PASSWORD_NOT_FIT(8010,"两次填写的密码不一致"), + PASSWORD_OUT_OF_ORDER(8011,"密码必须8-20个字符,而且同时包含大小写字母和数字"), + PASSWORD_UPDATE_FAILED(8012,"密码修改失败"), MOBILE_HAS_BEEN_USED(8101, "该手机号已注册,请更换手机号或使用原绑定的微信账号登录"), MOBILE_CODE_ERROR(8102, "验证码错误"), AUTO_CONFIRM_FAILED(8103, "党员注册失败"), diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java index a72096446c..d23fa24b96 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/UserSummaryInfoResultDTO.java @@ -60,6 +60,7 @@ public class UserSummaryInfoResultDTO implements Serializable { public UserSummaryInfoResultDTO(){ this.currentDate=""; + this.dateId=""; this.regTotal=0; this.partiTotal=0; this.partymemberTotal=0; diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml index dea1fde0fd..5764ec4118 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.17 + image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.18 ports: - "8109:8109" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml index a2118c4848..5a3f52ce13 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-report-server:0.3.15 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-report-server:0.3.17 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index a79c50eef2..620c2c4919 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 0.3.17 + 0.3.18 data-report-server diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java index bedde8bf91..3244076896 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/user/impl/UserAnalysisServiceImpl.java @@ -93,12 +93,13 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { userSummaryInfoResultDTO=userAnalysisDao.selectRegUserSummaryInfo(myAgencyId); } if (userSummaryInfoResultDTO == null){ + logger.info(String.format("当前机关%s没有统计数据",myAgencyId)); userSummaryInfoResultDTO = new UserSummaryInfoResultDTO(); LocalDate yesterday = LocalDate.now().plusDays(NumConstant.MINUS_ONE_L); DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtils.DATE_PATTERN_YYYYMMDD); userSummaryInfoResultDTO.setCurrentDate(DateUtils.getxAxisDatePattern(yesterday.format(format),".")); - + userSummaryInfoResultDTO.setDateId(yesterday.format(format)); return userSummaryInfoResultDTO; } userSummaryInfoResultDTO.setCurrentDate(DateUtils.getxAxisDatePattern(userSummaryInfoResultDTO.getCurrentDate(),".")); diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 0ea8dc6ffa..a684c3ae3f 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.22 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.23 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml index c06172eb76..dd660c184f 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.21 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.22 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 6e761e9709..c16c922bde 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.22 + 0.3.23 data-statistical com.epmet diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java index 87cd7c6879..f09091487f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java @@ -56,12 +56,12 @@ public interface StatsIssueDao extends BaseDao { List selectAgencyClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date); /** - * @param customerId + * @param issueEntity * @return * @Author sun * @Description 根据客户Id查询议题库已转项目的网格项目关系数据 **/ - List selectGridProjectList(@Param("customerId") String customerId); + List selectGridProjectList(IssueEntity issueEntity); /** * 获取当前日期网格下议题统计结果 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index 4ffeb599c9..d2a9ef721a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -54,12 +54,12 @@ public interface IssueService { List getAgencyClosedIssueInc(String customerId, String date); /** - * @param customerId + * @param issueEntity * @return * @Author sun * @Description 根据客户Id查询议题库已转项目的网格项目关系数据 **/ - List getGridProjectList(String customerId); + List getGridProjectList(IssueEntity issueEntity); /** * 获取以网格为单位议题统计结果 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index 443c9ddc41..1757166dba 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -66,14 +66,14 @@ public class IssueServiceImpl implements IssueService { } /** - * @param customerId + * @param issueEntity * @return * @Author sun * @Description 根据客户Id查询议题库已转项目的网格项目关系数据 **/ @Override - public List getGridProjectList(String customerId) { - return statsIssueDao.selectGridProjectList(customerId); + public List getGridProjectList(IssueEntity issueEntity) { + return statsIssueDao.selectGridProjectList(issueEntity); } @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java index 75748d696b..aded6e95d3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java @@ -323,7 +323,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { monthlyEntity.setResolvedRatio(entity.getResolvedRatio()); monthlyEntity.setUnresolvedTotal(entity.getUnresolvedTotal()); monthlyEntity.setUnresolvedRatio(entity.getUnresolvedRatio()); - monthlyEntity.setProjectIncr(pendingIncr + closedIncr); + monthlyEntity.setProjectIncr(pendingIncr); monthlyEntity.setPendingIncr(pendingIncr); monthlyEntity.setClosedIncr(closedIncr); monthlyEntity.setResolvedIncr(resolvedIncr); @@ -440,7 +440,10 @@ public class StatsProjectServiceImpl implements StatsProjectService { numberFormat.setMaximumFractionDigits(6); //1:根据客户Id查询议题库已转项目的网格项目关系数据 - List gridProjectList = issueService.getGridProjectList(customerId); + IssueEntity issueEntity = new IssueEntity(); + issueEntity.setCustomerId(customerId); + issueEntity.setCreatedTime(date); + List gridProjectList = issueService.getGridProjectList(issueEntity); //2:遍历网格维度数据,统计每个网格各项指标数据 for (DimGridEntity grid : dimGridList) { @@ -616,7 +619,7 @@ public class StatsProjectServiceImpl implements StatsProjectService { monthlyEntity.setResolvedRatio(entity.getResolvedRatio()); monthlyEntity.setUnresolvedTotal(entity.getUnresolvedTotal()); monthlyEntity.setUnresolvedRatio(entity.getUnresolvedRatio()); - monthlyEntity.setProjectIncr(pendingIncr + closedIncr); + monthlyEntity.setProjectIncr(pendingIncr); monthlyEntity.setPendingIncr(pendingIncr); monthlyEntity.setClosedIncr(closedIncr); monthlyEntity.setResolvedIncr(resolvedIncr); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index 2f6545f289..a96cc346f8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -179,6 +179,7 @@ i.del_flag = '0' AND ipr.del_flag = '0' AND i.customer_id = #{customerId} + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java new file mode 100644 index 0000000000..7fe2d7bf6c --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/1 9:52 + */ +@Data +public class StaffResetPassWordFormDTO implements Serializable { + private static final long serialVersionUID = 7457641974958356125L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "新密码不能为空", groups = {AddUserShowGroup.class}) + private String newPassword; + @NotBlank(message = "确认新密码不能为空", groups = {AddUserShowGroup.class}) + private String confirmNewPassword; + @NotBlank(message = "staffId不能为空", groups = {AddUserInternalGroup.class}) + private String staffId; +} diff --git a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml index 4ab15b8a3a..284a5ed7ab 100644 --- a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.30 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.31 ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index eacaa5299d..e92d85f7f6 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.30 + 0.3.31 com.epmet gov-mine diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java index 39130b6857..cc9a8c9e94 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java @@ -3,10 +3,13 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.StaffResetPassWordFormDTO; import com.epmet.dto.result.MineResultDTO; import com.epmet.service.MineService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -32,4 +35,19 @@ public class MineController { public Result profile(@LoginUser TokenDto tokenDto) { return new Result().ok(mineService.profile(tokenDto)); } + + /** + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 修改密码 + * @Date 2020/7/1 9:59 + **/ + @PostMapping("resetpassword") + public Result resetPassword(@LoginUser TokenDto tokenDto, @RequestBody StaffResetPassWordFormDTO formDTO) { + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, StaffResetPassWordFormDTO.AddUserShowGroup.class, StaffResetPassWordFormDTO.AddUserInternalGroup.class); + return mineService.resetPassword(formDTO); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/MineService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/MineService.java index 8ec08f7905..61d3830dbe 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/MineService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/MineService.java @@ -1,6 +1,8 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffResetPassWordFormDTO; import com.epmet.dto.result.MineResultDTO; /** @@ -17,4 +19,13 @@ public interface MineService { * @return com.epmet.dto.result.MineResultDTO */ MineResultDTO profile(TokenDto tokenDto); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 修改密码 + * @Date 2020/7/1 10:00 + **/ + Result resetPassword(StaffResetPassWordFormDTO formDTO); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java index 66b152df9f..4d9c0e30c8 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java @@ -1,15 +1,20 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffInfoFromDTO; +import com.epmet.dto.form.StaffResetPassWordFormDTO; +import com.epmet.dto.form.StaffResetPwFormDTO; import com.epmet.dto.result.MineResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.MineService; -import org.apache.poi.ss.formula.constant.ErrorConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,8 +25,12 @@ import org.springframework.stereotype.Service; */ @Service public class MineServiceImpl implements MineService { + private static final Logger logger = LoggerFactory.getLogger(MineServiceImpl.class); @Autowired GovOrgFeignClient govOrgFeignClient; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Override public MineResultDTO profile(TokenDto tokenDto) { StaffInfoFromDTO fromDTO = new StaffInfoFromDTO(); @@ -32,4 +41,68 @@ public class MineServiceImpl implements MineService { } return result.getData(); } + + @Override + public Result resetPassword(StaffResetPassWordFormDTO formDTO) { + //1、两次填写的密码需要保持一致 + if(!formDTO.getNewPassword().equals(formDTO.getConfirmNewPassword())){ + logger.error(String.format("两次填写的新密码不一致,新密码%s,确认新密码%s",formDTO.getNewPassword(),formDTO.getConfirmNewPassword())); + throw new RenException(EpmetErrorCode.PASSWORD_NOT_FIT.getCode()); + } + //2、校验密码规则:密码必须8-20个字符,而且同时包含大小写字母和数字 + boolean flag=this.checkPassWord(formDTO.getNewPassword()); + if(!flag){ + throw new RenException(EpmetErrorCode.PASSWORD_OUT_OF_ORDER.getCode()); + } + //3、调用user服务修改密码 + StaffResetPwFormDTO staffResetPwFormDTO=new StaffResetPwFormDTO(); + staffResetPwFormDTO.setNewPassword(formDTO.getNewPassword()); + staffResetPwFormDTO.setConfirmNewPassword(formDTO.getConfirmNewPassword()); + staffResetPwFormDTO.setStaffId(formDTO.getStaffId()); + Result updatePassWordResult=epmetUserOpenFeignClient.resetStaffPassword(staffResetPwFormDTO); + if(updatePassWordResult.success()){ + logger.info(String.format("调用%s服务,修改密码成功", ServiceConstant.EPMET_USER_SERVER)); + }else{ + logger.error(String.format("调用%s服务,修改密码失败,返参:%s", ServiceConstant.EPMET_USER_SERVER, + JSON.toJSONString(updatePassWordResult))); + return new Result().error(EpmetErrorCode.PASSWORD_UPDATE_FAILED.getCode()); + } + return new Result(); + } + + private boolean checkPassWord(String password) { + boolean flag=false; + if(password.length()<8||password.length()>20){ + logger.error(String.format("密码长度应为8-20位,当前输入密码%s,长度为%s",password,password.length())); + return flag; + } + boolean numFlag=false; + boolean bigLetter=false; + boolean smallLetter=false; + char[] passwordArray = password.toCharArray(); + for(int i=0;i < passwordArray.length;i++) { + char currentStr=passwordArray[i]; + logger.info(String.format("当前字符%s",currentStr)); + // 判断ch是否是数字字符,如'1','2‘,是返回true。否则返回false + if(Character.isDigit(currentStr)){ + numFlag=true; + continue; + } + // 判断ch是否是字母字符,如'a','b‘,是返回true。否则返回false + if(Character.isUpperCase(currentStr)){ + bigLetter=true; + continue; + } + if(Character.isLowerCase(currentStr)){ + smallLetter=true; + continue; + } + } + if(numFlag&&bigLetter&&smallLetter){ + flag=true; + }else{ + logger.error(String.format("当前密码%s,是否包含数字%s,是否包含大写字母%s,是否包含小写字母%s",password,numFlag,bigLetter,smallLetter)); + } + return flag; + } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java new file mode 100644 index 0000000000..9d21502254 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 工作端,修改工作人员密码 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/1 10:34 + */ +@Data +public class StaffResetPwFormDTO implements Serializable { + + private static final long serialVersionUID = 6230552511846731272L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "新密码不能为空", groups = {AddUserShowGroup.class}) + private String newPassword; + @NotBlank(message = "确认新密码不能为空", groups = {AddUserShowGroup.class}) + private String confirmNewPassword; + @NotBlank(message = "staffId不能为空", groups = {AddUserInternalGroup.class}) + private String staffId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index d4a09e63cc..0faea1fb73 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -3,13 +3,11 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.form.CustomerStaffRoleListFormDTO; -import com.epmet.dto.form.GovStaffRoleFormDTO; -import com.epmet.dto.form.LoginUserDetailsFormDTO; -import com.epmet.dto.form.TagCustomerFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.fallback.EpmetUserOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -31,7 +29,7 @@ public interface EpmetUserOpenFeignClient { * * @return */ - @PostMapping("/epmetuser/user/loginuserdetails") + @PostMapping(value = "/epmetuser/user/loginuserdetails", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto); /** @@ -40,7 +38,7 @@ public interface EpmetUserOpenFeignClient { * @Author sun * @Description 根据客户Id和staffId查询一个员工在指定客户下的角色列表 **/ - @PostMapping("/epmetuser/staffrole/getcustomerstaffrolelist") + @PostMapping(value = "/epmetuser/staffrole/getcustomerstaffrolelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result> getCustomerStaffRoleList(@RequestBody CustomerStaffRoleListFormDTO formDTO); /** @@ -68,7 +66,7 @@ public interface EpmetUserOpenFeignClient { * @Description 根据userId获取customerId * @author zxc */ - @PostMapping("/epmetuser/user/getcustomeridbyuserid") + @PostMapping(value = "/epmetuser/user/getcustomeridbyuserid", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result getCustomerIdByUserId(@RequestBody TagCustomerFormDTO formDTO); /** @@ -76,6 +74,16 @@ public interface EpmetUserOpenFeignClient { * @param form * @return */ - @PostMapping("/epmetuser/govstaffrole/getbyids") + @PostMapping(value = "/epmetuser/govstaffrole/getbyids", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result> getByIds(@RequestBody GovStaffRoleFormDTO form); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param staffResetPwFormDTO + * @author yinzuomei + * @description 工作端,修改工作人员密码 + * @Date 2020/7/1 10:37 + **/ + @PostMapping(value = "/epmetuser/customerstaff/resetstaffpassword", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result resetStaffPassword(@RequestBody StaffResetPwFormDTO staffResetPwFormDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 9f87d6f530..ec9cac1b00 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -4,10 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.form.CustomerStaffRoleListFormDTO; -import com.epmet.dto.form.GovStaffRoleFormDTO; -import com.epmet.dto.form.LoginUserDetailsFormDTO; -import com.epmet.dto.form.TagCustomerFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; import org.springframework.stereotype.Component; @@ -53,4 +50,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getById", form); } + @Override + public Result resetStaffPassword(StaffResetPwFormDTO staffResetPwFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "resetStaffPassword", staffResetPwFormDTO); + } + } diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index cfb884d0b4..7151b2b15d 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.66 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.68 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 9adaadd7e9..e1f620d602 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.66 + 0.3.68 com.epmet epmet-user diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index ca315b6c68..883b9b21bd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -284,4 +284,17 @@ public class CustomerStaffController { return new Result().ok(customerStaffService.getCustomerStaff(staffId)); } + /** + * @return com.epmet.commons.tools.utils.Result + * @param staffResetPwFormDTO + * @author yinzuomei + * @description 工作端,修改工作人员密码 + * @Date 2020/7/1 10:39 + **/ + @PostMapping("resetstaffpassword") + public Result resetStaffPassword(@RequestBody StaffResetPwFormDTO staffResetPwFormDTO){ + ValidatorUtils.validateEntity(staffResetPwFormDTO,StaffResetPwFormDTO.AddUserShowGroup.class,StaffResetPwFormDTO.AddUserInternalGroup.class); + customerStaffService.resetStaffPassword(staffResetPwFormDTO); + return new Result(); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index c166c3093f..4129e37c8c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -232,4 +232,13 @@ public interface CustomerStaffService extends BaseService { * @Description 根据staffId查询工作人员基本信息 **/ CustomerStaffDTO getCustomerStaff(String staffId); + + /** + * @return void + * @param staffResetPwFormDTO + * @author yinzuomei + * @description 工作端,修改工作人员密码 + * @Date 2020/7/1 10:41 + **/ + void resetStaffPassword(StaffResetPwFormDTO staffResetPwFormDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 48b2f5a45f..a0f3aab8e2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; @@ -55,7 +56,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -456,4 +460,24 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl