Browse Source

暂时提交

feature/evaluate
yinzuomei 5 years ago
parent
commit
70a547ce5e
  1. 2
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/ParamsFeignClient.java
  2. 6
      epmet-auth/pom.xml
  3. 14
      epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  4. 5
      epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  5. 21
      epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
  6. 2
      epmet-cloud-generator/src/main/resources/application.yml
  7. 2
      epmet-cloud-generator/src/main/resources/generator.properties
  8. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java
  9. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  10. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  11. 2
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/MessageFeignClient.java
  12. 4
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java
  13. 3
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java
  14. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java
  15. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java
  16. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  17. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerStaffEntity.java
  18. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  19. 28
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  20. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java
  21. 5
      epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql

2
epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/ParamsFeignClient.java

@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author Mark sunlightcs@gmail.com
* @since 1.1.0
*/
@FeignClient(name = ServiceConstant.EPMET_ADMIN_SERVER, fallback = ParamsFeignClientFallback.class)
@FeignClient(name = ServiceConstant.EPMET_ADMIN_SERVER, fallback = ParamsFeignClientFallback.class,url ="http://localhost:8082" )
public interface ParamsFeignClient {
/**

6
epmet-auth/pom.xml

@ -86,6 +86,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-message-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

14
epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -10,6 +10,8 @@ import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -18,7 +20,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @Author yinzuomei
* @Date 2020/3/16 14:48
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class )
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class ,url = "http://localhost:8087")
public interface EpmetUserFeignClient {
/**
@ -52,4 +54,14 @@ public interface EpmetUserFeignClient {
**/
@PostMapping(value = "epmetuser/user/selectLoginUserInfoByPassword", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO);
/**
* @param phone
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息校验用户是否存在
* @Date 2020/4/18 14:03
**/
@GetMapping(value = "epmetuser/customerstaff/getcustsomerstaffbyphone/{phone}")
Result checkCustomerStaff(@PathVariable("phone") String phone);
}

5
epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java

@ -34,4 +34,9 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectLoginUserInfoByPassword", passwordLoginUserInfoFormDTO);
}
@Override
public Result checkCustomerStaff(String phone) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByPhone", phone);
}
}

21
epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java

@ -10,6 +10,7 @@ package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dto.form.SendSmsCodeFormDTO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,6 +29,11 @@ public class CaptchaRedis {
* 验证码5分钟过期
*/
private final static long EXPIRE = 60 * 5L;
/**
* 过期时长为30分钟单位
*/
private final static long MINUTE_THIRTY_EXPIRE = 60 * 30 * 1L;
@Autowired
private RedisUtils redisUtils;
@ -48,4 +54,19 @@ public class CaptchaRedis {
return captcha;
}
/**
* @param sendSmsCodeFormDTO appclientphone
* @param smsCode 验证码
* @return void
* @Author yinzuomei
* @Description
* @Date 2020/4/18 13:53
**/
public void saveSmsCode(SendSmsCodeFormDTO sendSmsCodeFormDTO, String smsCode) {
String smsCodeKey = RedisKeys.getLoginSmsCodeKey(sendSmsCodeFormDTO.getApp(), sendSmsCodeFormDTO.getClient(), sendSmsCodeFormDTO.getPhone(), smsCode);
logger.info(String.format("短信验证码key=%s", smsCodeKey));
redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE);
}
}

2
epmet-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://47.104.224.45:3308/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://localhost:3306/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet
password: elink@833066
#oracle配置

2
epmet-cloud-generator/src/main/resources/generator.properties

@ -3,7 +3,7 @@
main=
#관츰
package=com.epmet
moduleName=customer
moduleName=
#鱗諒
author=generator
#경굶뵀

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java

@ -118,4 +118,9 @@ public interface Constant {
*
*/
String NO="no";
/**
* 短信验证码code
*/
String SMS_CODE="smsCode";
}

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -10,8 +10,10 @@ public enum EpmetErrorCode {
CANNOT_JOIN_GROUP(8001, "只有认证党员和居民才可以加入小组,请选择您的身份"),
CANNOT_CREATE_GROUP(8002, "只有党员和热心居民才能创建小组,请选择您的身份"),
GROUP_ALREADY_EXISTED(8003,"组名已存在"),
GOV_STAFF_NOT_EXISTS(8004,"未找到您所属的组织,请联系您单位的管理员,确认其录入的手机号和您注册的号码一致。"),
GOV_STAFF_DISABLED(8005,"您好,您的账户已被冻结,请联系管理员。"),
LOSE_EFFICACY(8006,"此邀请链接已过期"),
ERROR_PHONE(8007,"请输入正确的手机号"),
MOBILE_HAS_BEEN_USED(8101, "该手机号已注册,请更换手机号或使用原绑定的微信账号登录"),
MOBILE_CODE_ERROR(8102, "验证码错误"),
AUTO_CONFIRM_FAILED(8103, "党员注册失败"),

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -195,4 +195,16 @@ public class RedisKeys {
public static String getResiGroupMemberInfoKey(String groupId, String userId){
return rootPrefix.concat("resi:group:member:").concat(groupId).concat(":").concat(userId);
}
/**
* @param phone 手机号
* @param smsCode 短信验证码
* @return java.lang.String
* @Author yinzuomei
* @Description 政府端登录发送验证码 epmet:app:client:phone
* @Date 2020/4/18 13:54
**/
public static String getLoginSmsCodeKey(String app, String client, String phone, String smsCode) {
return String.format(rootPrefix+":%s:%s:%s",app,client,phone);
}
}

2
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/MessageFeignClient.java

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = MessageFeignClientFallback.class)
@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = MessageFeignClientFallback.class,url = "http://localhost:8085")
public interface MessageFeignClient {
/**

4
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java

@ -116,7 +116,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity>
Integer code = (int) ((Math.random() * 9 + 1) * 100000);
String codeStr = String.valueOf(code);
HashMap<String, String> map = new HashMap<>();
map.put("code", codeStr);
map.put(Constant.SMS_CODE, codeStr);
try {
String paramJson = new ObjectMapper().writeValueAsString(map);
@ -128,7 +128,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity>
Result result = messageFeignClient.send(sysSmsDTO);
if (result != null && result.success()) {
HashMap<String, String> data = new HashMap<>();
data.put("code", codeStr);
data.put(Constant.SMS_CODE, codeStr);
return new Result().ok(data);
} else {
logger.error(String.format("短信验证码发送失败,手机号:%s。code:%d,msg:%s", mobile, result.getCode(), result.getMsg()));

3
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.modules.partymember.service.impl;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -122,7 +123,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService
partyMemberInfoRedis.deleteUserMobileCodeByPattern(fromDTO.getUserId(), fromDTO.getMobile());
//将验证码存入Redis
partyMemberInfoRedis.setUserMobileCode(fromDTO.getUserId(), fromDTO.getMobile(), message.get("code"));
partyMemberInfoRedis.setUserMobileCode(fromDTO.getUserId(), fromDTO.getMobile(), message.get(Constant.SMS_CODE));
//将访问记录更新到热心居民申请行为记录表
saveOrUpdateVisit(fromDTO.getVisitId(), null, PartyMemberConstant.OPERATE_OPERATE_SMS_CODE);

7
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -123,4 +124,8 @@ public class CustomerStaffDTO implements Serializable {
*/
private String enableFlag;
/**
* 客户id
*/
private String customerId;
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java

@ -47,4 +47,14 @@ public interface UserConstant {
* 党员角色
*/
String ROLE_PARTYMEMBER = "partymember";
/**
* 未禁用enable,已禁用diabled
*/
String ENABLE="enable";
/**
* 未禁用enable,已禁用diabled
*/
String DISABLED="disabled";
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -91,4 +91,15 @@ public class CustomerStaffController {
ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffExcel.class);
}
/**
* @param phone 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息校验用户是否存在
* @Date 2020/4/18 14:07
**/
@GetMapping(value = "getcustsomerstaffbyphone/{phone}")
public Result getCustsomerStaffByPhone(@PathVariable("phone") String phone) {
return customerStaffService.getCustsomerStaffByPhone(phone);
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerStaffEntity.java

@ -93,4 +93,8 @@ public class CustomerStaffEntity extends BaseEpmetEntity {
*/
private String enableFlag;
/**
* 客户id
*/
private String customerId;
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -19,6 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.entity.CustomerStaffEntity;
@ -92,4 +93,13 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @date 2020-04-18
*/
void delete(String[] ids);
/**
* @param phone 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据手机号查询政府端工作人员基本信息校验用户是否存在
* @Date 2020/4/18 14:07
**/
Result getCustsomerStaffByPhone(String phone);
}

28
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -20,15 +20,20 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.CustomerStaffDao;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.redis.CustomerStaffRedis;
import com.epmet.service.CustomerStaffService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -45,7 +50,7 @@ import java.util.Map;
*/
@Service
public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, CustomerStaffEntity> implements CustomerStaffService {
private Logger logger = LogManager.getLogger(getClass());
@Autowired
private CustomerStaffRedis customerStaffRedis;
@ -101,4 +106,23 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public Result getCustsomerStaffByPhone(String phone) {
//判断用户是否存在
QueryWrapper<CustomerStaffEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(phone), FieldConstant.MOBILE, phone);
List<CustomerStaffEntity> customerStaffEntityList = baseDao.selectList(wrapper);
if (null == customerStaffEntityList || customerStaffEntityList.size() == 0) {
logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(),EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg()));
return new Result().error(EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode());
}
//判断用户是否已被禁用
CustomerStaffEntity customerStaff = customerStaffEntityList.get(0);
if (UserConstant.DISABLED.equals(customerStaff.getEnableFlag())) {
logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg()));
return new Result().error(EpmetErrorCode.GOV_STAFF_DISABLED.getCode());
}
return new Result();
}
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -20,6 +20,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -49,7 +50,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;
/**
* 用户居民端注册信息表 用户在居民端完善的个人信息
@ -206,13 +210,13 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
//3:调用短信服务 生成验证码发送短信
result = messageFeignClient.sendSmsCaptcha(verificationCodeFormDTO.getMobile());
Map<String,Object> map = (Map<String, Object>) result.getData();
if (null == map || null == map.get("code")) {
if (null == map || null == map.get(Constant.SMS_CODE)) {
return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode());
}
//4:删除缓存中可能存在的旧验证码
userResiInfoRedis.deleteOldUserMobileCode(verificationCodeFormDTO.getUserId(), verificationCodeFormDTO.getMobile());
//5:将验证码存入redis
userResiInfoRedis.setUserResiMobileCode(verificationCodeFormDTO.getUserId(),verificationCodeFormDTO.getMobile(),map.get("code").toString());
userResiInfoRedis.setUserResiMobileCode(verificationCodeFormDTO.getUserId(),verificationCodeFormDTO.getMobile(),map.get(Constant.SMS_CODE).toString());
return result;
}

5
epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql

@ -6,5 +6,8 @@ alter table customer_staff MODIFY COLUMN GENDER int(1) COMMENT '性别0.未知
alter table customer_staff add column HEAD_PHOTO varchar(500) COMMENT '头像';
alter table customer_staff add column ACTIVE_FLAG varchar(20) not null COMMENT 'inactive未激活,active已激活';
alter table customer_staff add column ACTIVE_TIME DATETIME COMMENT '激活时间';
alter table customer_staff add column ENABLE_FLAG VARCHAR(20) not null COMMENT '未禁用enable,已禁用diabled';
alter table customer_staff add column ENABLE_FLAG VARCHAR(20) not null COMMENT '未禁用enable,已禁用disabled';
alter table customer_staff add column WORK_TYPE VARCHAR(20) not null comment 'fulltime专职parttime兼职';
-- --2020-04-18
alter table customer_staff add column CUSTOMER_ID varchar(64) NOT NULL COMMENT '客户Id CUSTOMER.id';
Loading…
Cancel
Save