Browse Source

Merge remote-tracking branch 'origin/dev0.2' into dev0.2

master
wangchao 5 years ago
parent
commit
aa52648f60
  1. 17
      epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  2. 9
      epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  3. 100
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  4. 29
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java
  5. 35
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java
  6. 38
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java
  7. 25
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/ResiRegisterService.java
  8. 33
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/impl/ResiRegisterServiceImpl.java
  9. 127
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java
  10. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java
  11. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PasswordLoginUserInfoFormDTO.java
  12. 59
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiRegisterFormDTO.java
  13. 35
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiRegisterResultDTO.java
  14. 37
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserResiRegisterConstant.java
  15. 138
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java
  16. 73
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
  17. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiRegisterVisitController.java
  18. 88
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java
  19. 80
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java
  20. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiRegisterVisitDao.java
  21. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java
  22. 96
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java
  23. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java
  24. 86
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java
  25. 127
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java
  26. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java
  27. 77
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java
  28. 203
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java
  29. 40
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java
  30. 92
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java
  31. 80
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml
  32. 26
      epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml
  33. 32
      epmet-user/epmet-user-server/src/main/resources/mapper/UserResiRegisterVisitDao.xml
  34. 82
      epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml

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

@ -2,7 +2,8 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerUserDTO;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
@ -28,19 +29,19 @@ public interface EpmetUserFeignClient {
* @author yinzuomei
* @date 2020/3/16 14:48
*/
@PostMapping(value = "epmetuser/customeruser/selecWxLoginUserInfo", consumes = MediaType.APPLICATION_JSON_VALUE)
Result selecWxLoginUserInfo(WxLoginUserInfoFormDTO loginUserInfoFormDTO);
@PostMapping(value = "epmetuser/user/selecWxLoginUserInfo", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<UserDTO> selecWxLoginUserInfo(@RequestBody WxLoginUserInfoFormDTO loginUserInfoFormDTO);
/**
* 获取居民微信信息保存到customer_user,返回主键
* 获取居民微信信息保存到user_wechat,返回主键
*
* @param customerUserDTO
* @param userWechatDTO
* @return java.lang.String
* @author yinzuomei
* @date 2020/3/16 14:48
*/
@PostMapping(value = "epmetuser/customeruser/saveOrUpdateCustomerUser", consumes = MediaType.APPLICATION_JSON_VALUE)
Result saveOrUpdateCustomerUser(CustomerUserDTO customerUserDTO);
@PostMapping(value = "epmetuser/user/saveOrUpdateUserWechatDTO", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<UserDTO> saveOrUpdateUserWechatDTO(@RequestBody UserWechatDTO userWechatDTO);
/**
* @param passwordLoginUserInfoFormDTO
@ -49,6 +50,6 @@ public interface EpmetUserFeignClient {
* @Description 根据手机号查询用户信息
* @Date 2020/3/16 16:14
**/
@PostMapping(value = "epmetuser/customeruser/selectLoginUserInfoByPassword", consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "epmetuser/user/selectLoginUserInfoByPassword", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO);
}

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

@ -3,7 +3,8 @@ package com.epmet.feign.fallback;
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.CustomerUserDTO;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
@ -19,13 +20,13 @@ import org.springframework.stereotype.Component;
public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
@Override
public Result<String> selecWxLoginUserInfo(WxLoginUserInfoFormDTO loginUserInfoFormDTO) {
public Result<UserDTO> selecWxLoginUserInfo(WxLoginUserInfoFormDTO loginUserInfoFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selecWxLoginUserInfo", loginUserInfoFormDTO);
}
@Override
public Result saveOrUpdateCustomerUser(CustomerUserDTO customerUserDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveOrUpdateCustomerUser", customerUserDTO);
public Result<UserDTO> saveOrUpdateUserWechatDTO(UserWechatDTO userWechatDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveOrUpdateUserWechatDTO", userWechatDTO);
}
@Override

100
epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java

@ -12,7 +12,8 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerUserDTO;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
@ -128,19 +129,21 @@ public class LoginServiceImpl implements LoginService {
wxLoginUserInfoFormDTO.setApp(formDTO.getApp());
wxLoginUserInfoFormDTO.setOpenId(wxMaJscode2SessionResult.getOpenid());
//1、先根据app、client、openId查询
Result<String> userResult = epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO);
Result<UserDTO> userResult = epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO);
String userId = "";
if (!userResult.success()) {
throw new RenException("获取用户信息失败" + userResult.getMsg());
}
userId = userResult.getData();
if(null!=userResult.getData()&&StringUtils.isNotBlank(userResult.getData().getId())){
userId = userResult.getData().getId();
}
//2、如果已经存在userId,则更新微信信息
if (StringUtils.isNotBlank(userId) && StringUtils.isNotBlank(formDTO.getEncryptedData()) && StringUtils.isNotBlank(formDTO.getIv())) {
this.updateWxInfO(userId,formDTO,wxMaJscode2SessionResult);
}
//3、数据库不存在此用户则创建此用户
if (StringUtils.isBlank(userId)) {
userId = createEpmtUser(formDTO, wxMaJscode2SessionResult);
userId = createUser(formDTO, wxMaJscode2SessionResult);
}
return userId;
}
@ -156,21 +159,13 @@ public class LoginServiceImpl implements LoginService {
private Result updateWxInfO(String userId,
LoginByWxCodeFormDTO formDTO,
WxMaJscode2SessionResult wxMaJscode2SessionResult) {
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) {
//查询customer_staff待完善
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) {
//查询oper_user待完善
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) {
WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService()
.getUserInfo(wxMaJscode2SessionResult.getSessionKey(),
formDTO.getEncryptedData(),
formDTO.getIv());
CustomerUserDTO customerUserDTO = this.packageCustomerUserDTO(wxMaUserInfo);
customerUserDTO.setId(userId);
epmetUserFeignClient.saveOrUpdateCustomerUser(customerUserDTO);
}
WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService()
.getUserInfo(wxMaJscode2SessionResult.getSessionKey(),
formDTO.getEncryptedData(),
formDTO.getIv());
UserWechatDTO userWechatDTO = this.packageCustomerUserDTO(wxMaUserInfo);
userWechatDTO.setUserId(userId);
Result<UserDTO> updateUserDtoResult=epmetUserFeignClient.saveOrUpdateUserWechatDTO(userWechatDTO);
return new Result();
}
@ -182,52 +177,46 @@ public class LoginServiceImpl implements LoginService {
* @Description 陌生人首次授权创建用户信息
* @Date 2020/3/20 19:42
**/
private String createEpmtUser(LoginByWxCodeFormDTO formDTO, WxMaJscode2SessionResult wxMaJscode2SessionResult) {
private String createUser(LoginByWxCodeFormDTO formDTO, WxMaJscode2SessionResult wxMaJscode2SessionResult) {
String userId = "";
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) {
//查询customer_staff待完善
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) {
//查询oper_user待完善
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) {
//查询customer_user
CustomerUserDTO customerUserDTO = new CustomerUserDTO();
if (StringUtils.isNotBlank(formDTO.getIv()) && StringUtils.isNotBlank(formDTO.getEncryptedData())) {
WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService()
.getUserInfo(wxMaJscode2SessionResult.getSessionKey(),
formDTO.getEncryptedData(),
formDTO.getIv());
customerUserDTO = this.packageCustomerUserDTO(wxMaUserInfo);
} else {
customerUserDTO.setWxOpenId(wxMaJscode2SessionResult.getOpenid());
customerUserDTO.setUnionId(wxMaJscode2SessionResult.getUnionid());
}
Result<String> saveCustomerUserResult = epmetUserFeignClient.saveOrUpdateCustomerUser(customerUserDTO);
if (!saveCustomerUserResult.success()) {
throw new RenException("创建用户失败" + saveCustomerUserResult.getMsg());
}
userId = saveCustomerUserResult.getData();
//查询customer_user
UserWechatDTO userWechatDTO = new UserWechatDTO();
if (StringUtils.isNotBlank(formDTO.getIv()) && StringUtils.isNotBlank(formDTO.getEncryptedData())) {
WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService()
.getUserInfo(wxMaJscode2SessionResult.getSessionKey(),
formDTO.getEncryptedData(),
formDTO.getIv());
userWechatDTO = this.packageCustomerUserDTO(wxMaUserInfo);
} else {
userWechatDTO.setWxOpenId(wxMaJscode2SessionResult.getOpenid());
userWechatDTO.setUnionId(wxMaJscode2SessionResult.getUnionid());
}
Result<UserDTO> saveUserWechatResult = epmetUserFeignClient.saveOrUpdateUserWechatDTO(userWechatDTO);
if (!saveUserWechatResult.success()||null==saveUserWechatResult.getData()) {
throw new RenException("创建用户失败" + saveUserWechatResult.getMsg());
}
userId = saveUserWechatResult.getData().getId();
return userId;
}
/**
* @param wxMaUserInfo
* @return com.epmet.dto.CustomerUserDTO
* @return com.epmet.dto.UserWechatDTO
* @Author yinzuomei
* @Description 微信信息封装为customer_user记录
* @Date 2020/3/17 18:22
**/
private CustomerUserDTO packageCustomerUserDTO(WxMaUserInfo wxMaUserInfo) {
CustomerUserDTO customerUserDTO = new CustomerUserDTO();
customerUserDTO.setCity(wxMaUserInfo.getCity());
customerUserDTO.setWxOpenId(wxMaUserInfo.getOpenId());
customerUserDTO.setNickname(wxMaUserInfo.getNickName());
customerUserDTO.setCountry(wxMaUserInfo.getCountry());
customerUserDTO.setHeadImgUrl(wxMaUserInfo.getAvatarUrl());
customerUserDTO.setCountry(wxMaUserInfo.getCountry());
customerUserDTO.setProvince(wxMaUserInfo.getProvince());
customerUserDTO.setSex(Integer.valueOf(wxMaUserInfo.getGender()));
return customerUserDTO;
private UserWechatDTO packageCustomerUserDTO(WxMaUserInfo wxMaUserInfo) {
UserWechatDTO userWechatDTO = new UserWechatDTO();
userWechatDTO.setCity(wxMaUserInfo.getCity());
userWechatDTO.setWxOpenId(wxMaUserInfo.getOpenId());
userWechatDTO.setUnionId(wxMaUserInfo.getUnionId());
userWechatDTO.setNickname(wxMaUserInfo.getNickName());
userWechatDTO.setCountry(wxMaUserInfo.getCountry());
userWechatDTO.setHeadImgUrl(wxMaUserInfo.getAvatarUrl());
userWechatDTO.setProvince(wxMaUserInfo.getProvince());
userWechatDTO.setSex(Integer.valueOf(wxMaUserInfo.getGender()));
return userWechatDTO;
}
/**
@ -277,6 +266,9 @@ public class LoginServiceImpl implements LoginService {
*/
@Override
public Result<UserTokenResultDTO> loginByPassword(LoginByPassWordFormDTO formDTO) {
if(LoginConstant.APP_RESI.equals(formDTO.getApp())){
return new Result<UserTokenResultDTO>().error("居民端请使用微信登录");
}
//1、验证码是否正确
boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha());
if (!flag) {

29
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java

@ -2,11 +2,14 @@ package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ResiRegisterFormDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @Description 居民端陌生人导览 调用epmet-user服务
@ -15,13 +18,21 @@ import org.springframework.web.bind.annotation.PathVariable;
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class)
public interface EpmetUserFeignClient {
/**
* @param userId
* @return com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:05
**/
@GetMapping(value = "epmetuser/gridlatest/getLatestGridInfoByUserId/{userId}")
Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(@PathVariable("userId") String userId);
/**
* @param userId
* @return com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:05
**/
@GetMapping(value = "epmetuser/gridlatest/getLatestGridInfoByUserId/{userId}")
Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(@PathVariable("userId") String userId);
/**
* @return com.epmet.dto.result.ResiRegisterResultDTO
* @Author sun
* @Description 居民端-居民注册页面初始化-居民注册访问记录表新增数据
**/
@PostMapping(value = "epmetuser/userresiregistervisit/init")
Result<ResiRegisterResultDTO> init(ResiRegisterFormDTO formDTO);
}

35
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java

@ -3,7 +3,9 @@ package com.epmet.modules.feign.fallback;
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.form.ResiRegisterFormDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
@ -15,15 +17,26 @@ import org.springframework.stereotype.Component;
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
/**
* @param userId
* @return com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:05
**/
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestGridInfoByUserId", userId);
}
/**
* @param userId
* @return com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:05
**/
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestGridInfoByUserId", userId);
}
/**
* @return com.epmet.dto.result.ResiRegisterResultDTO
* @Author sun
* @Description 居民端-居民注册页面初始化-居民注册访问记录表新增数据
* @Date 2020/3/30
**/
@Override
public Result<ResiRegisterResultDTO> init(ResiRegisterFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "init", formDTO);
}
}

38
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java

@ -0,0 +1,38 @@
package com.epmet.modules.resiregister.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.dto.form.ResiRegisterFormDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.modules.resiregister.service.ResiRegisterService;
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;
/**
* @Description 居民端居民注册相关接口入口
* @Author sun
* @Date 2020/3/30
* @since v1.0.0
*/
@RestController
@RequestMapping("resiregister")
public class ResiRegisterController {
@Autowired
private ResiRegisterService resiMineGridService;
/**
* @param
* @Author sun
* @Description 居民端-居民注册页面初始化-居民注册访问记录表新增数据
* @Date 2020/3/30
**/
@PostMapping("init")
public Result<ResiRegisterResultDTO> init(@LoginUser TokenDto tokenDTO, @RequestBody ResiRegisterFormDTO resiRegisterFormDTO) {
return resiMineGridService.init(tokenDTO, resiRegisterFormDTO);
}
}

25
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/ResiRegisterService.java

@ -0,0 +1,25 @@
package com.epmet.modules.resiregister.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ResiRegisterFormDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
/**
* @Description 居民端居民注册信息service
* @Author sun
* @Date 2020/3/30
*/
public interface ResiRegisterService {
/**
* 居民端-居民注册页面初始化-居民注册访问记录表新增数据
*
* @param
* @return void
* @author sun
*/
Result<ResiRegisterResultDTO> init(TokenDto tokenDTO, ResiRegisterFormDTO formDTO);
}

33
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/impl/ResiRegisterServiceImpl.java

@ -0,0 +1,33 @@
package com.epmet.modules.resiregister.service.impl;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ResiRegisterFormDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.resiregister.service.ResiRegisterService;
import com.epmet.modules.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Description 居民端居民注册信息service
* @Author sun
* @Date 2020/3/30
*/
@Service
public class ResiRegisterServiceImpl implements ResiRegisterService {
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public Result<ResiRegisterResultDTO> init(TokenDto tokenDTO, ResiRegisterFormDTO formDTO) {
if (null == tokenDTO || StringUtils.isBlank(tokenDTO.getUserId())) {
return new Result<ResiRegisterResultDTO>().error(ModuleConstant.USER_NOT_NULL);
}
formDTO.setUserId(tokenDTO.getUserId());
return epmetUserFeignClient.init(formDTO);
}
}

127
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java

@ -1,127 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Data
public class CustomerUserDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 微信openId
*/
private String wxOpenId;
/**
* 微信unionId
*/
private String unionId;
/**
* 手机号
*/
private String mobile;
/**
* 昵称
*/
private String nickname;
/**
* 性别:0.未知 1.男性2女性
*/
private Integer sex;
/**
* 头像
*/
private String headImgUrl;
/**
* 国家
*/
private String country;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 语言
*/
private String language;
/**
* 删除标识0.未删除 1.已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

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

@ -75,11 +75,6 @@ public class OperUserDTO implements Serializable {
*/
private String phone;
/**
* 微信openId
*/
private String wxOpenId;
/**
* 部门ID
*/
@ -135,4 +130,4 @@ public class OperUserDTO implements Serializable {
*/
private List<String> roleIdList;
}
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PasswordLoginUserInfoFormDTO.java

@ -14,7 +14,7 @@ import java.io.Serializable;
public class PasswordLoginUserInfoFormDTO implements Serializable {
private static final long serialVersionUID = -6653010297552029277L;
@NotBlank(message = "app1111不能为空")
@NotBlank(message = "app不能为空")
private String app;
@NotBlank(message = "手机号不能为空")

59
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiRegisterFormDTO.java

@ -0,0 +1,59 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 居民端-居民注册页面初始化-居民访问记录表新增数据-配置入参
* @author sun
*/
@Data
public class ResiRegisterFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户Id CUSTOMER.id
*/
@NotBlank(message = "客户ID不能为空")
private String customerId;
/**
* 网格Id
*/
@NotBlank(message = "网格ID不能为空")
private String gridId;
/**
* 访问来源 指的是用户点的那个功能进入到的注册页面就是一个功能模块的Idvalue:feature+action
*/
@NotBlank(message = "访问来源不能为空")
private String visitFrom;
/**
* 用户Id
*/
@NotBlank(message = "用户ID不能为空")
private String userId;
}

35
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java → epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiRegisterResultDTO.java

@ -15,33 +15,26 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
package com.epmet.dto.result;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import lombok.Data;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Component
public class CustomerUserRedis {
@Autowired
private RedisUtils redisUtils;
import java.io.Serializable;
public void delete(Object[] ids) {
}
/**
* 居民端-居民注册页面初始化-居民访问记录表新增数据-配置入参
* @author sun
*/
@Data
public class ResiRegisterResultDTO implements Serializable {
public void set(){
private static final long serialVersionUID = 1L;
}
/**
* 用户居民端注册访问记录表(user_resi_register_visit)Id
*/
private String userResiRegisterVisitId;
public String get(String id){
return null;
}
}

37
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserResiRegisterConstant.java

@ -0,0 +1,37 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.constant;
/**
* 常量
* @author sun
* @since 1.0.0
*/
public interface UserResiRegisterConstant {
/**
* 最后一次操作行为-初始化
*/
String INITIALIZE = "initialize";
/**
* 最后一次操作行为-获取手机验证码
*/
String SMS_CODE = "sms_code";
/**
* 最后一次操作行为-提交成功
*/
String SUCCESS = "success";
/**
* 最后一次操作行为-提交失败
*/
String FAILD="faild";
}

138
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java

@ -1,138 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerUserDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.excel.CustomerUserExcel;
import com.epmet.service.CustomerUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@RestController
@RequestMapping("customeruser")
public class CustomerUserController {
@Autowired
private CustomerUserService customerUserService;
@GetMapping("page")
public Result<PageData<CustomerUserDTO>> page(@RequestParam Map<String, Object> params){
PageData<CustomerUserDTO> page = customerUserService.page(params);
return new Result<PageData<CustomerUserDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<CustomerUserDTO> get(@PathVariable("id") String id){
CustomerUserDTO data = customerUserService.get(id);
return new Result<CustomerUserDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody CustomerUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
customerUserService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody CustomerUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
customerUserService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
customerUserService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<CustomerUserDTO> list = customerUserService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, CustomerUserExcel.class);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据openIdapp查询对应终端用户信息
* @Date 2020/3/16 16:15
**/
@PostMapping("selecWxLoginUserInfo")
public Result<String> selecWxLoginUserInfo(@RequestBody WxLoginUserInfoFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return customerUserService.selecWxLoginUserInfo(formDTO);
}
/**
* @param customerUserDTO
* @return 将获取到的居民微信信息保存到customer_user表,返回主键
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
@PostMapping("saveOrUpdateCustomerUser")
public Result<String> saveOrUpdateCustomerUser(@RequestBody CustomerUserDTO customerUserDTO) {
//效验数据
ValidatorUtils.validateEntity(customerUserDTO, AddGroup.class, DefaultGroup.class);
return customerUserService.saveOrUpdateCustomerUser(customerUserDTO);
}
/**
* @param passwordLoginUserInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.PasswordLoginUserInfoResultDTO>
* @Author yinzuomei
* @Description 根据手机号app获取对应终端用户信息
* @Date 2020/3/16 16:15
**/
@PostMapping("selectLoginUserInfoByPassword")
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) {
//效验数据
ValidatorUtils.validateEntity(passwordLoginUserInfoFormDTO);
Result<PasswordLoginUserInfoResultDTO> result= customerUserService.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO);
return result;
}
}

73
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java

@ -0,0 +1,73 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.service.UserService;
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;
/**
* @Description
* @Author yinzuomei
* @Date 2020/3/30 12:42
*/
@RestController
@RequestMapping("user")
public class UserController {
@Autowired
private UserService userService;
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 根据openIdapp查询对应终端用户信息
* @Date 2020/3/16 16:15
**/
@PostMapping("selecWxLoginUserInfo")
public Result<UserDTO> selecWxLoginUserInfo(@RequestBody WxLoginUserInfoFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return userService.selecWxLoginUserInfo(formDTO);
}
/**
* @param userWechatDTO
* @return 将获取到的居民微信信息保存到user_wechat表,返回主键
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
@PostMapping("saveOrUpdateUserWechatDTO")
public Result<UserDTO> saveOrUpdateUserWechatDTO(@RequestBody UserWechatDTO userWechatDTO) {
//效验数据
ValidatorUtils.validateEntity(userWechatDTO, AddGroup.class, DefaultGroup.class);
return userService.saveOrUpdateUserWechatDTO(userWechatDTO);
}
/**
* @param passwordLoginUserInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.PasswordLoginUserInfoResultDTO>
* @Author yinzuomei
* @Description 根据手机号app获取对应终端用户信息
* @Date 2020/3/16 16:15
**/
@PostMapping("selectLoginUserInfoByPassword")
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) {
//效验数据
ValidatorUtils.validateEntity(passwordLoginUserInfoFormDTO);
Result<PasswordLoginUserInfoResultDTO> result= userService.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO);
return result;
}
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiRegisterVisitController.java

@ -26,6 +26,8 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.UserResiRegisterVisitDTO;
import com.epmet.dto.form.ResiRegisterFormDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.excel.UserResiRegisterVisitExcel;
import com.epmet.service.UserResiRegisterVisitService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +93,8 @@ public class UserResiRegisterVisitController {
ExcelUtils.exportExcelToTarget(response, null, list, UserResiRegisterVisitExcel.class);
}
@PostMapping("init")
public Result<ResiRegisterResultDTO> init(@RequestBody ResiRegisterFormDTO resiRegisterFormDTO){
return userResiRegisterVisitService.saveUserResiRegisterVisit(resiRegisterFormDTO);
}
}

88
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java

@ -1,88 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.entity.CustomerUserEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Mapper
public interface CustomerUserDao extends BaseDao<CustomerUserEntity> {
/**
* @param openId
* @return userId
* @Author yinzuomei
* @Description 根据openId查询居民用户信息
* @Date 2020/3/14 20:45
**/
String selectCustomerIdByOpenId(String openId);
/**
* @param openId
* @return userId
* @Author yinzuomei
* @Description 根据openId查询政府工作人员信息
* @Date 2020/3/14 20:45
**/
String selectCustomerStaffId(String openId);
/**
* @param openId
* @return userId
* @Author yinzuomei
* @Description 根据openId查询运营人员信息
* @Date 2020/3/14 20:45
**/
String selectOperUserId(String openId);
/**
* @param phone
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO
* @Author yinzuomei
* @Description 根据手机号查询政府工作人员信息
* @Date 2020/3/17 11:01
**/
PasswordLoginUserInfoResultDTO selectCustomerStaffByPhone(String phone);
/**
* @param phone
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO
* @Author yinzuomei
* @Description 根据手机号查询运营人员信息
* @Date 2020/3/17 11:01
**/
PasswordLoginUserInfoResultDTO selectOperUserByPhone(String phone);
/**
* @param phone
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO
* @Author yinzuomei
* @Description 根据手机号查询居民信息
* @Date 2020/3/17 11:01
**/
PasswordLoginUserInfoResultDTO selectCustomerUserByPhone(String phone);
}

80
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java

@ -1,15 +1,10 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* @Description 用户DAO
* @IntefaceName UserDao
@ -18,68 +13,23 @@ import java.util.Map;
*/
@Mapper
public interface UserDao extends BaseDao<UserEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<UserWechatDTO>
* @author generator
* @date 2020-03-18
*/
PageData<UserWechatDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<UserWechatDTO>
* @author generator
* @date 2020-03-18
*/
List<UserWechatDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return UserWechatDTO
* @author generator
* @date 2020-03-18
*/
UserDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void save(UserWechatDTO dto);
* @param phone
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO
* @Author yinzuomei
* @Description 根据手机号查询政府工作人员信息
* @Date 2020/3/17 11:01
**/
PasswordLoginUserInfoResultDTO selectCustomerStaffByPhone(String phone);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(UserWechatDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
* @param phone
* @return com.epmet.dto.result.PasswordLoginUserInfoResultDTO
* @Author yinzuomei
* @Description 根据手机号查询运营人员信息
* @Date 2020/3/17 11:01
**/
PasswordLoginUserInfoResultDTO selectOperUserByPhone(String phone);
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiRegisterVisitDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.UserResiRegisterVisitDTO;
import com.epmet.entity.UserResiRegisterVisitEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface UserResiRegisterVisitDao extends BaseDao<UserResiRegisterVisitEntity> {
void saveUserResiRegisterVisit(UserResiRegisterVisitDTO userResiRegisterVisitDTO);
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java

@ -1,7 +1,9 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.entity.UserWechatEntity;
import org.apache.ibatis.annotations.Mapper;
@ -24,12 +26,11 @@ public interface UserWechatDao extends BaseDao<UserWechatEntity>{
int updateByUserId(UserWechatDTO userWechatDTO);
/**
* @Description 根据openId查询系统下用户信息不区分用户政府端运营端
* @Param openId
* @return userId
* @Author wangc
* @Date 2020.03.28 13:25
* @return com.epmet.dto.UserDTO
* @param formDTO
* @Author yinzuomei
* @Description 根据appopenId查询用户是否存在
* @Date 2020/3/30 13:06
**/
String selectUserIdByOpenId(String openId);
UserDTO selectUserDTOByOpenId(WxLoginUserInfoFormDTO formDTO);
}

96
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java

@ -1,96 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("customer_user")
public class CustomerUserEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id CUSTOMER.id
*/
private String customerId;
/**
* 微信openId
*/
private String wxOpenId;
/**
* 微信unionId
*/
private String unionId;
/**
* 手机号
*/
private String mobile;
/**
* 昵称
*/
private String nickname;
/**
* 性别:0.未知 1.男性2女性
*/
private Integer sex;
/**
* 头像
*/
private String headImgUrl;
/**
* 国家
*/
private String country;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 语言
*/
private String language;
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java

@ -73,11 +73,6 @@ public class OperUserEntity extends BaseEpmetEntity {
*/
private String phone;
/**
* 微信openId
*/
private String wxOpenId;
/**
* 部门ID
*/

86
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java

@ -1,86 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Data
public class CustomerUserExcel {
@Excel(name = "唯一标识")
private String id;
@Excel(name = "客户Id CUSTOMER.id")
private String customerId;
@Excel(name = "微信openId")
private String wxOpenId;
@Excel(name = "手机号")
private String mobile;
@Excel(name = "昵称")
private String nickname;
@Excel(name = "性别:0.未知 1.男性2女性")
private Integer sex;
@Excel(name = "头像")
private String headImgUrl;
@Excel(name = "国家")
private String country;
@Excel(name = "省份")
private String province;
@Excel(name = "城市")
private String city;
@Excel(name = "语言")
private String language;
@Excel(name = "删除标识:0.未删除 1.已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

127
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java

@ -1,127 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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.CustomerUserDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.entity.CustomerUserEntity;
import java.util.List;
import java.util.Map;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
public interface CustomerUserService extends BaseService<CustomerUserEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CustomerUserDTO>
* @author generator
* @date 2020-03-16
*/
PageData<CustomerUserDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CustomerUserDTO>
* @author generator
* @date 2020-03-16
*/
List<CustomerUserDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return CustomerUserDTO
* @author generator
* @date 2020-03-16
*/
CustomerUserDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-03-16
*/
void save(CustomerUserDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-16
*/
void update(CustomerUserDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-16
*/
void delete(String[] ids);
/**
* 根据openIdapp查询对应终端用户信息
*
* @param formDTO
* @return void
* @author yinzuomei
* @date 2020-03-16
*/
Result selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO);
/**
* @param customerUserDTO
* @return 获取居民微信信息保存到customer_user表,返回主键
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
Result<String> saveOrUpdateCustomerUser(CustomerUserDTO customerUserDTO);
/**
* @param passwordLoginUserInfoFormDTO
* @return 根据手机号获取用户信息
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO);
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java

@ -19,7 +19,11 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiRegisterVisitDTO;
import com.epmet.dto.form.ResiRegisterFormDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.entity.UserResiRegisterVisitEntity;
import java.util.List;
@ -92,4 +96,13 @@ public interface UserResiRegisterVisitService extends BaseService<UserResiRegist
* @date 2020-03-30
*/
void delete(String[] ids);
/**
* 居民端-居民注册页面初始化-居民注册访问记录表新增数据
*
* @param
* @return void
* @author sun
*/
Result<ResiRegisterResultDTO> saveUserResiRegisterVisit(ResiRegisterFormDTO formDTO);
}

77
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java

@ -2,7 +2,12 @@ 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.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.entity.UserEntity;
import java.util.List;
@ -15,65 +20,31 @@ import java.util.Map;
* @date 2020.03.28 14:34
*/
public interface UserService extends BaseService<UserEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<UserDTO>
* @author generator
* @date 2020-03-18
*/
PageData<UserDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<UserDTO>
* @author generator
* @date 2020-03-18
*/
List<UserDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return UserDTO
* @author generator
* @date 2020-03-18
*/
UserDTO get(String id);
/**
* 默认保存
* 根据openIdapp查询对应终端用户信息
*
* @param dto
* @param formDTO
* @return void
* @author generator
* @date 2020-03-18
* @author yinzuomei
* @date 2020-03-16
*/
void save(UserDTO dto);
Result<UserDTO> selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-03-18
*/
void update(UserDTO dto);
* @param userWechatDTO
* @return 获取居民微信信息保存到user_wechat表,返回主键
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
Result<UserDTO> saveOrUpdateUserWechatDTO(UserWechatDTO userWechatDTO);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-03-18
*/
void delete(String[] ids);
* @param passwordLoginUserInfoFormDTO
* @return 根据手机号获取用户信息
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO);
}

203
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java

@ -1,203 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.CustomerUserDao;
import com.epmet.dao.UserDao;
import com.epmet.dao.UserWechatDao;
import com.epmet.dto.CustomerUserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.entity.CustomerUserEntity;
import com.epmet.entity.UserEntity;
import com.epmet.entity.UserWechatEntity;
import com.epmet.redis.CustomerUserRedis;
import com.epmet.service.CustomerUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 居民用户信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Service
public class CustomerUserServiceImpl extends BaseServiceImpl<CustomerUserDao, CustomerUserEntity> implements CustomerUserService {
@Autowired
private CustomerUserRedis customerUserRedis;
@Autowired
private UserWechatDao userWechatDao;
@Autowired
private UserDao userDao;
@Override
public PageData<CustomerUserDTO> page(Map<String, Object> params) {
IPage<CustomerUserEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, CustomerUserDTO.class);
}
@Override
public List<CustomerUserDTO> list(Map<String, Object> params) {
List<CustomerUserEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CustomerUserDTO.class);
}
private QueryWrapper<CustomerUserEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<CustomerUserEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public CustomerUserDTO get(String id) {
CustomerUserEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, CustomerUserDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CustomerUserDTO dto) {
CustomerUserEntity entity = ConvertUtils.sourceToTarget(dto, CustomerUserEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(CustomerUserDTO dto) {
CustomerUserEntity entity = ConvertUtils.sourceToTarget(dto, CustomerUserEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 根据openIdapp查询对应终端用户信息
*
* 居民端用户与政府端用户都在一张表内且都有微信登录的入口
* user_wechat表保存每一个用户和微信(openId)的绑定关系
*
* @return void
* @author yinzuomei
* @date 2020-03-16
*/
@Override
public Result<String> selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO) {
String userId = "";
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) {
//查询customer_staff待完善
//userId = baseDao.selectCustomerStaffId(formDTO.getOpenId());
userId = userWechatDao.selectUserIdByOpenId(formDTO.getOpenId());
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) {
//查询oper_staff待完善
//userId = baseDao.selectOperUserId(formDTO.getOpenId());
userId = userWechatDao.selectUserIdByOpenId(formDTO.getOpenId());
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) {
//居民端
//userId = baseDao.selectCustomerIdByOpenId(formDTO.getOpenId());
userId = userWechatDao.selectUserIdByOpenId(formDTO.getOpenId());
}
return new Result<String>().ok(userId);
}
/**
* @param customerUserDTO
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Author yinzuomei
* @Description 将获取到的居民微信信息保存到customer_user表,返回主键
* @Date 2020/3/17 11:04
**/
@Override
public Result<String> saveOrUpdateCustomerUser(CustomerUserDTO customerUserDTO) {
CustomerUserEntity entity = ConvertUtils.sourceToTarget(customerUserDTO, CustomerUserEntity.class);
UserWechatDTO dto = ConvertUtils.sourceToTarget(customerUserDTO, UserWechatDTO.class);
if (StringUtils.isNotBlank(customerUserDTO.getId())) {
//updateById(entity);
dto.setUserId(customerUserDTO.getId());
userWechatDao.updateByUserId(dto);
} else {
//insert(entity);
UserEntity userEntity = new UserEntity();
userEntity.setFromApp(UserConstant.APP_RESI);
userEntity.setFromClient(UserConstant.CLIENT_WX);
userDao.insert(userEntity);
dto.setUserId(userEntity.getId());
UserWechatEntity userWechatEntity = ConvertUtils.sourceToTarget(dto,UserWechatEntity.class);
userWechatDao.insert(userWechatEntity);
}
return new Result<String>().ok(entity.getId());
}
/**
* @param formDTO
* @return 根据手机号app获取对应终端用户信息
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
@Override
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO formDTO) {
PasswordLoginUserInfoResultDTO passwordLoginUserInfoResultDTO = null;
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) {
//查询customer_staff待完善
passwordLoginUserInfoResultDTO = baseDao.selectCustomerStaffByPhone(formDTO.getPhone());
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) {
//查询oper_user待完善
passwordLoginUserInfoResultDTO = baseDao.selectOperUserByPhone(formDTO.getPhone());
} else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) {
passwordLoginUserInfoResultDTO = baseDao.selectCustomerUserByPhone(formDTO.getPhone());
}
return new Result<PasswordLoginUserInfoResultDTO>().ok(passwordLoginUserInfoResultDTO);
}
}

40
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java

@ -19,12 +19,17 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
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.UserResiRegisterConstant;
import com.epmet.dao.UserResiRegisterVisitDao;
import com.epmet.dto.UserResiRegisterVisitDTO;
import com.epmet.dto.form.ResiRegisterFormDTO;
import com.epmet.dto.result.ResiRegisterResultDTO;
import com.epmet.entity.UserResiRegisterVisitEntity;
import com.epmet.redis.UserResiRegisterVisitRedis;
import com.epmet.service.UserResiRegisterVisitService;
@ -34,6 +39,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -48,6 +54,8 @@ public class UserResiRegisterVisitServiceImpl extends BaseServiceImpl<UserResiRe
@Autowired
private UserResiRegisterVisitRedis userResiRegisterVisitRedis;
@Autowired
private UserResiRegisterVisitDao userResiRegisterVisitDao;
@Override
public PageData<UserResiRegisterVisitDTO> page(Map<String, Object> params) {
@ -65,8 +73,8 @@ public class UserResiRegisterVisitServiceImpl extends BaseServiceImpl<UserResiRe
return ConvertUtils.sourceToTarget(entityList, UserResiRegisterVisitDTO.class);
}
private QueryWrapper<UserResiRegisterVisitEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<UserResiRegisterVisitEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<UserResiRegisterVisitEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -101,4 +109,30 @@ public class UserResiRegisterVisitServiceImpl extends BaseServiceImpl<UserResiRe
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result<ResiRegisterResultDTO> saveUserResiRegisterVisit(ResiRegisterFormDTO formDTO) {
Date date = new Date();
UserResiRegisterVisitDTO userResiRegisterVisitDTO = new UserResiRegisterVisitDTO();
userResiRegisterVisitDTO.setCustomerId(formDTO.getCustomerId());
userResiRegisterVisitDTO.setGridId(formDTO.getGridId());
userResiRegisterVisitDTO.setUserId(formDTO.getUserId());
userResiRegisterVisitDTO.setVisitFrom(formDTO.getVisitFrom());
//最后一次操作行为(initialize:初始化 sms_code:获取验证码 success:提交成功 faild:提交失败)
userResiRegisterVisitDTO.setLastOperateVisit(UserResiRegisterConstant.INITIALIZE);
userResiRegisterVisitDTO.setVisitTime(date);
//UUID
userResiRegisterVisitDTO.setId(IdWorker.get32UUID());
userResiRegisterVisitDTO.setDelFlag(0);
userResiRegisterVisitDTO.setRevision(0);
userResiRegisterVisitDTO.setCreatedBy(formDTO.getUserId());
userResiRegisterVisitDTO.setCreatedTime(date);
userResiRegisterVisitDTO.setUpdatedBy(formDTO.getUserId());
userResiRegisterVisitDTO.setUpdatedTime(date);
userResiRegisterVisitDao.saveUserResiRegisterVisit(userResiRegisterVisitDTO);
ResiRegisterResultDTO resiRegisterResultDTO = new ResiRegisterResultDTO();
resiRegisterResultDTO.setUserResiRegisterVisitId(userResiRegisterVisitDTO.getId());
return new Result<ResiRegisterResultDTO>().ok(resiRegisterResultDTO);
}
}

92
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java

@ -1,14 +1,23 @@
package com.epmet.service.impl;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.UserDao;
import com.epmet.dao.UserWechatDao;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.WxLoginUserInfoFormDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.entity.UserEntity;
import com.epmet.entity.UserWechatEntity;
import com.epmet.service.UserService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -17,35 +26,68 @@ import java.util.Map;
* @Author wangc
* @date 2020.03.28 14:41
*/
@Service
public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implements UserService {
@Autowired
private UserWechatDao userWechatDao;
/**
* 根据openIdapp查询对应终端用户信息
*
* 居民端用户与政府端用户都在一张表内且都有微信登录的入口
* user_wechat表保存每一个用户和微信(openId)的绑定关系
*
* @return void
* @author yinzuomei
* @date 2020-03-16
*/
@Override
public PageData<UserDTO> page(Map<String, Object> params) {
return null;
}
@Override
public List<UserDTO> list(Map<String, Object> params) {
return null;
public Result<UserDTO> selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO) {
UserDTO userDTO=userWechatDao.selectUserDTOByOpenId(formDTO);
return new Result<UserDTO>().ok(userDTO);
}
/**
* @param userWechatDTO
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Author yinzuomei
* @Description 将获取到的居民微信信息保存到customer_user表,返回主键
* @Date 2020/3/17 11:04
**/
@Override
public UserDTO get(String id) {
return null;
public Result<UserDTO> saveOrUpdateUserWechatDTO(UserWechatDTO userWechatDTO) {
UserEntity resultUserEntity;
UserWechatEntity userWechatEntity = ConvertUtils.sourceToTarget(userWechatDTO, UserWechatEntity.class);
if (StringUtils.isNotBlank(userWechatEntity.getUserId())) {
userWechatDao.updateByUserId(userWechatDTO);
resultUserEntity = baseDao.selectById(userWechatDTO.getUserId());
} else {
UserEntity userEntity = new UserEntity();
userEntity.setFromApp(UserConstant.APP_RESI);
userEntity.setFromClient(UserConstant.CLIENT_WX);
baseDao.insert(userEntity);
userWechatEntity.setUserId(userEntity.getId());
userWechatDao.insert(userWechatEntity);
resultUserEntity = baseDao.selectById(userEntity.getId());
}
return new Result<UserDTO>().ok(ConvertUtils.sourceToTarget(resultUserEntity, UserDTO.class));
}
/**
* @param formDTO
* @return 根据手机号app获取对应终端用户信息
* @Author yinzuomei
* @Description
* @Date 2020/3/16 15:49
**/
@Override
public void save(UserDTO dto) {
}
@Override
public void update(UserDTO dto) {
}
@Override
public void delete(String[] ids) {
public Result<PasswordLoginUserInfoResultDTO> selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO formDTO) {
PasswordLoginUserInfoResultDTO passwordLoginUserInfoResultDTO = null;
if (LoginConstant.APP_GOV.equals(formDTO.getApp())) {
passwordLoginUserInfoResultDTO = baseDao.selectCustomerStaffByPhone(formDTO.getPhone());
} else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) {
passwordLoginUserInfoResultDTO = baseDao.selectOperUserByPhone(formDTO.getPhone());
}
return new Result<PasswordLoginUserInfoResultDTO>().ok(passwordLoginUserInfoResultDTO);
}
}

80
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.CustomerUserDao">
<!-- 根据openId查询居民用户信息 -->
<select id="selectCustomerIdByOpenId" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
cu.id
FROM
customer_user cu
WHERE
cu.DEL_FLAG = '0'
AND cu.WX_OPEN_ID = #{openId}
</select>
<!-- 根据openId查询政府工作人员信息-->
<select id="selectCustomerStaffId" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
cs.id
FROM
customer_staff cs
WHERE
cs.DEL_FLAG = '0'
AND cs.WX_OPEN_ID = #{openId}
</select>
<!-- 根据openId查询运营人员信息-->
<select id="selectOperUserId" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
ou.id
FROM
oper_user ou
WHERE
ou.DEL_FLAG = '0'
AND ou.WX_OPEN_ID = #{openId}
</select>
<!-- 根据手机号查询政府工作人员信息-->
<select id="selectCustomerStaffByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO">
SELECT
cs.id AS userId,
PASSWORD AS PASSWORD
FROM
customer_staff cs
WHERE
cs.DEL_FLAG = '0'
AND cs.PHONE = #{phone}
</select>
<!-- 根据手机号查询运营人员信息-->
<select id="selectOperUserByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO">
SELECT
ou.USER_ID AS userId,
PASSWORD AS PASSWORD
FROM
oper_user ou
WHERE
ou.DEL_FLAG = '0'
AND ou.STATUS = '1'
AND ou.PHONE = #{phone}
</select>
<!-- 根据手机号查询居民信息-->
<select id="selectCustomerUserByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO">
SELECT
cu.id as userId,
null as password
FROM
customer_user cu
WHERE
cu.DEL_FLAG = '0'
AND cu.MOBILE = #{phone}
</select>
</mapper>

26
epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml

@ -3,5 +3,29 @@
<mapper namespace="com.epmet.dao.UserDao">
<!-- 根据手机号查询政府工作人员信息-->
<select id="selectCustomerStaffByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO">
SELECT
cs.USER_ID AS userId,
PASSWORD AS PASSWORD
FROM
customer_staff cs
WHERE
cs.DEL_FLAG = '0'
AND cs.PHONE = #{phone}
</select>
</mapper>
<!-- 根据手机号查询运营人员信息-->
<select id="selectOperUserByPhone" resultType="com.epmet.dto.result.PasswordLoginUserInfoResultDTO">
SELECT
ou.USER_ID AS userId,
PASSWORD AS PASSWORD
FROM
oper_user ou
WHERE
ou.DEL_FLAG = '0'
AND ou.STATUS = '1'
AND ou.PHONE = #{phone}
</select>
</mapper>

32
epmet-user/epmet-user-server/src/main/resources/mapper/UserResiRegisterVisitDao.xml

@ -19,5 +19,37 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<insert id="saveUserResiRegisterVisit" parameterType="com.epmet.dto.UserResiRegisterVisitDTO">
INSERT INTO user_resi_register_visit (
id,
customer_id,
grid_id,
user_id,
visit_from,
last_operate_visit,
visit_time,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
)VALUES(
#{id},
#{customerId},
#{gridId},
#{userId},
#{visitFrom},
#{lastOperateVisit},
#{visitTime},
#{delFlag},
#{revision},
#{createdBy},
#{createdTime},
#{updatedBy},
#{updatedTime}
)
</insert>
</mapper>

82
epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml

@ -4,53 +4,51 @@
<mapper namespace="com.epmet.dao.UserWechatDao">
<!-- 根据userId更新 用户-微信关系表里的属性 -->
<update id="updateByUserId">
UPDATE user_wechat
<set>
<if test='null != city and "" != city '>
CITY = #{city},
</if>
<if test='null != nickname and "" != nickname '>
NICKNAME = #{nickname},
</if>
<if test='null != country and "" != country '>
COUNTRY = #{country},
</if>
<if test='null != province and "" != province '>
PROVINCE = #{province},
</if>
<if test='null != sex and "" != sex '>
SEX = #{sex},
</if>
<if test='null != wxOpenId and "" != wxOpenId'>
WX_OPEN_ID = #{wxOpenId},
</if>
<if test='null != updatedBy and "" != updatedBy'>
UPDATED_BY = #{updatedBy},
</if>
UPDATED_TIME = sysdate
</set>
<update id="updateByUserId" parameterType="com.epmet.dto.UserWechatDTO">
UPDATE user_wechat
<set>
<if test='null != city and "" != city '>
CITY = #{city},
</if>
<if test='null != wxOpenId and "" != wxOpenId'>
WX_OPEN_ID = #{wxOpenId},
</if>
<if test='null != unionId and "" != unionId'>
WX_UNION_ID = #{unionId},
</if>
<if test='null != nickname and "" != nickname '>
NICKNAME = #{nickname},
</if>
<if test='null != country and "" != country '>
COUNTRY = #{country},
</if>
<if test='null != headImgUrl and "" != headImgUrl'>
HEAD_IMG_URL = #{headImgUrl},
</if>
<if test='null != province and "" != province '>
PROVINCE = #{province},
</if>
<if test='null != sex and "" != sex '>
SEX = #{sex},
</if>
UPDATED_TIME = sysdate
</set>
WHERE
USER_ID = #{userId}
</update>
<!-- 根据openId查询系统下(所有身份)用户信息 -->
<select id="selectUserIdByOpenId" parameterType="java.lang.String" resultType="java.lang.String">
<!-- 根据app、openId查询用户是否存在 -->
<select id="selectUserDTOByOpenId" parameterType="com.epmet.dto.form.WxLoginUserInfoFormDTO" resultType="com.epmet.dto.UserDTO">
SELECT
uw.user_id as id
u.*
FROM
user_wechat uw
USER u
LEFT JOIN user_wechat uw ON (
u.id = uw.USER_ID
AND uw.WX_OPEN_ID = #{openId})
WHERE
uw.DEL_FLAG = '0'
AND uw.WX_OPEN_ID = #{openId}
u.DEL_FLAG = '0'
AND uw.DEL_FLAG = '0'
AND u.FROM_APP = #{app}
</select>
</mapper>
</mapper>

Loading…
Cancel
Save