diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 406ed01e48..c590dee3b9 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/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 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 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 selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 35fd0c2847..1ee00f03e0 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/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 selecWxLoginUserInfo(WxLoginUserInfoFormDTO loginUserInfoFormDTO) { + public Result 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 saveOrUpdateUserWechatDTO(UserWechatDTO userWechatDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveOrUpdateUserWechatDTO", userWechatDTO); } @Override diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index bfe1d83432..463ffbaed6 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/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 userResult = epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO); + Result 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 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 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 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 loginByPassword(LoginByPassWordFormDTO formDTO) { + if(LoginConstant.APP_RESI.equals(formDTO.getApp())){ + return new Result().error("居民端请使用微信登录"); + } //1、验证码是否正确 boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); if (!flag) { diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java index 15966f5f15..d034f07265 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java +++ b/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 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 getLatestGridInfoByUserId(@PathVariable("userId") String userId); + + /** + * @return com.epmet.dto.result.ResiRegisterResultDTO + * @Author sun + * @Description 居民端-居民注册页面初始化-居民注册访问记录表新增数据 + **/ + @PostMapping(value = "epmetuser/userresiregistervisit/init") + Result init(ResiRegisterFormDTO formDTO); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java index b45339f8ba..190298d177 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/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 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 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 init(ResiRegisterFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "init", formDTO); + } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java new file mode 100644 index 0000000000..58128b7e19 --- /dev/null +++ b/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 init(@LoginUser TokenDto tokenDTO, @RequestBody ResiRegisterFormDTO resiRegisterFormDTO) { + return resiMineGridService.init(tokenDTO, resiRegisterFormDTO); + } + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/ResiRegisterService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/ResiRegisterService.java new file mode 100644 index 0000000000..1b439f38db --- /dev/null +++ b/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 init(TokenDto tokenDTO, ResiRegisterFormDTO formDTO); + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/impl/ResiRegisterServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/service/impl/ResiRegisterServiceImpl.java new file mode 100644 index 0000000000..7b7f1fd0d0 --- /dev/null +++ b/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 init(TokenDto tokenDTO, ResiRegisterFormDTO formDTO) { + if (null == tokenDTO || StringUtils.isBlank(tokenDTO.getUserId())) { + return new Result().error(ModuleConstant.USER_NOT_NULL); + } + formDTO.setUserId(tokenDTO.getUserId()); + return epmetUserFeignClient.init(formDTO); + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java deleted file mode 100644 index dd32d2b8f5..0000000000 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -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; - -} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java index 44e2bd5998..95fafdccbd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java +++ b/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 roleIdList; -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PasswordLoginUserInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PasswordLoginUserInfoFormDTO.java index 7c6919c131..37c323b12b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PasswordLoginUserInfoFormDTO.java +++ b/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 = "手机号不能为空") diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiRegisterFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiRegisterFormDTO.java new file mode 100644 index 0000000000..15faa061e4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiRegisterFormDTO.java @@ -0,0 +1,59 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + + /** + * 访问来源 指的是用户点的那个功能进入到的注册页面,就是一个功能模块的Id(value:feature+action) + */ + @NotBlank(message = "访问来源不能为空") + private String visitFrom; + + /** + * 用户Id + */ + @NotBlank(message = "用户ID不能为空") + private String userId; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiRegisterResultDTO.java similarity index 58% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiRegisterResultDTO.java index f70ed57881..81496ffcfc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java +++ b/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 . */ -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; - } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserResiRegisterConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserResiRegisterConstant.java new file mode 100644 index 0000000000..bb00c84ef9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserResiRegisterConstant.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +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"; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java deleted file mode 100644 index a0c1dbf677..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -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> page(@RequestParam Map params){ - PageData page = customerUserService.page(params); - return new Result>().ok(page); - } - - @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ - CustomerUserDTO data = customerUserService.get(id); - return new Result().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 params, HttpServletResponse response) throws Exception { - List list = customerUserService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, CustomerUserExcel.class); - } - - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 根据openId、app查询对应终端用户信息 - * @Date 2020/3/16 16:15 - **/ - @PostMapping("selecWxLoginUserInfo") - public Result 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 saveOrUpdateCustomerUser(@RequestBody CustomerUserDTO customerUserDTO) { - //效验数据 - ValidatorUtils.validateEntity(customerUserDTO, AddGroup.class, DefaultGroup.class); - return customerUserService.saveOrUpdateCustomerUser(customerUserDTO); - } - - /** - * @param passwordLoginUserInfoFormDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 根据手机号、app获取对应终端用户信息 - * @Date 2020/3/16 16:15 - **/ - @PostMapping("selectLoginUserInfoByPassword") - public Result selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) { - //效验数据 - ValidatorUtils.validateEntity(passwordLoginUserInfoFormDTO); - Result result= customerUserService.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); - return result; - } -} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java new file mode 100644 index 0000000000..1f471bcca0 --- /dev/null +++ b/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 根据openId、app查询对应终端用户信息 + * @Date 2020/3/16 16:15 + **/ + @PostMapping("selecWxLoginUserInfo") + public Result 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 saveOrUpdateUserWechatDTO(@RequestBody UserWechatDTO userWechatDTO) { + //效验数据 + ValidatorUtils.validateEntity(userWechatDTO, AddGroup.class, DefaultGroup.class); + return userService.saveOrUpdateUserWechatDTO(userWechatDTO); + } + + /** + * @param passwordLoginUserInfoFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据手机号、app获取对应终端用户信息 + * @Date 2020/3/16 16:15 + **/ + @PostMapping("selectLoginUserInfoByPassword") + public Result selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) { + //效验数据 + ValidatorUtils.validateEntity(passwordLoginUserInfoFormDTO); + Result result= userService.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); + return result; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiRegisterVisitController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiRegisterVisitController.java index 076495660e..8b9971f8bd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiRegisterVisitController.java +++ b/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 init(@RequestBody ResiRegisterFormDTO resiRegisterFormDTO){ + return userResiRegisterVisitService.saveUserResiRegisterVisit(resiRegisterFormDTO); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java deleted file mode 100644 index e9744a74d8..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -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 { - - /** - * @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); -} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java index 276c6f8b1c..f3a02cf935 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java +++ b/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 { - - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-03-18 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-03-18 - */ - List list(Map 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); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiRegisterVisitDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiRegisterVisitDao.java index 19e5e45a3a..d5e564f559 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiRegisterVisitDao.java +++ b/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 { - + + void saveUserResiRegisterVisit(UserResiRegisterVisitDTO userResiRegisterVisitDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java index c79044d046..919fe3c366 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java +++ b/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{ 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 根据app、openId查询用户是否存在 + * @Date 2020/3/30 13:06 **/ - String selectUserIdByOpenId(String openId); - + UserDTO selectUserDTOByOpenId(WxLoginUserInfoFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java deleted file mode 100644 index 9b93cd7ee3..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -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; - -} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java index 6a355ed5ae..1cc5261936 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java +++ b/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 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java deleted file mode 100644 index e1d2bc9aec..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -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; - - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java deleted file mode 100644 index ae6d9e8613..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -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 { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-03-16 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-03-16 - */ - List list(Map 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); - - /** - * 根据openId、app查询对应终端用户信息 - * - * @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 saveOrUpdateCustomerUser(CustomerUserDTO customerUserDTO); - - /** - * @param passwordLoginUserInfoFormDTO - * @return 根据手机号获取用户信息 - * @Author yinzuomei - * @Description - * @Date 2020/3/16 15:49 - **/ - Result selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO); -} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java index a8a9a8530b..1a9c0e2b6b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java +++ b/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 saveUserResiRegisterVisit(ResiRegisterFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java index 8090a7b81b..887d7ede43 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserService.java +++ b/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 { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-03-18 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-03-18 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return UserDTO - * @author generator - * @date 2020-03-18 - */ - UserDTO get(String id); - /** - * 默认保存 + * 根据openId、app查询对应终端用户信息 * - * @param dto + * @param formDTO * @return void - * @author generator - * @date 2020-03-18 + * @author yinzuomei + * @date 2020-03-16 */ - void save(UserDTO dto); + Result 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 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 selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java deleted file mode 100644 index c67949460c..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java +++ /dev/null @@ -1,203 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -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 implements CustomerUserService { - - @Autowired - private CustomerUserRedis customerUserRedis; - - @Autowired - private UserWechatDao userWechatDao; - - @Autowired - private UserDao userDao; - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, CustomerUserDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, CustomerUserDTO.class); - } - - private QueryWrapper getWrapper(Map params) { - String id = (String) params.get(FieldConstant.ID_HUMP); - - QueryWrapper 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)); - } - - /** - * 根据openId、app查询对应终端用户信息 - * - * 居民端用户与政府端用户都在一张表内且都有微信登录的入口 - * user_wechat表保存每一个用户和微信(openId)的绑定关系 - * - * @return void - * @author yinzuomei - * @date 2020-03-16 - */ - @Override - public Result 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().ok(userId); - } - - /** - * @param customerUserDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 将获取到的居民微信信息,保存到customer_user表,返回主键 - * @Date 2020/3/17 11:04 - **/ - @Override - public Result 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().ok(entity.getId()); - } - - /** - * @param formDTO - * @return 根据手机号、app获取对应终端用户信息 - * @Author yinzuomei - * @Description - * @Date 2020/3/16 15:49 - **/ - @Override - public Result 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().ok(passwordLoginUserInfoResultDTO); - } - -} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java index 083355ae87..976a4d1358 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java +++ b/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 page(Map params) { @@ -65,8 +73,8 @@ public class UserResiRegisterVisitServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -101,4 +109,30 @@ public class UserResiRegisterVisitServiceImpl extends BaseServiceImpl 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().ok(resiRegisterResultDTO); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java index 0ba9805759..3f84f91f72 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java +++ b/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 implements UserService { + @Autowired + private UserWechatDao userWechatDao; + /** + * 根据openId、app查询对应终端用户信息 + * + * 居民端用户与政府端用户都在一张表内且都有微信登录的入口 + * user_wechat表保存每一个用户和微信(openId)的绑定关系 + * + * @return void + * @author yinzuomei + * @date 2020-03-16 + */ @Override - public PageData page(Map params) { - return null; - } - - @Override - public List list(Map params) { - return null; + public Result selecWxLoginUserInfo(WxLoginUserInfoFormDTO formDTO) { + UserDTO userDTO=userWechatDao.selectUserDTOByOpenId(formDTO); + return new Result().ok(userDTO); } + /** + * @param userWechatDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 将获取到的居民微信信息,保存到customer_user表,返回主键 + * @Date 2020/3/17 11:04 + **/ @Override - public UserDTO get(String id) { - return null; + public Result 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().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 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().ok(passwordLoginUserInfoResultDTO); } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml deleted file mode 100644 index 88e278586a..0000000000 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml index 11f49b333d..6800fd862d 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml @@ -3,5 +3,29 @@ + + - \ No newline at end of file + + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiRegisterVisitDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiRegisterVisitDao.xml index 4651dec2a4..1a1af30845 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiRegisterVisitDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiRegisterVisitDao.xml @@ -19,5 +19,37 @@ + + 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} + ) + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index dad43badfd..468e37264f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -4,53 +4,51 @@ - - - UPDATE user_wechat - - - CITY = #{city}, - - - - NICKNAME = #{nickname}, - - - - COUNTRY = #{country}, - - - - PROVINCE = #{province}, - - - - SEX = #{sex}, - - - WX_OPEN_ID = #{wxOpenId}, - - - UPDATED_BY = #{updatedBy}, - - UPDATED_TIME = sysdate - - - + + UPDATE user_wechat + + + CITY = #{city}, + + + WX_OPEN_ID = #{wxOpenId}, + + + WX_UNION_ID = #{unionId}, + + + NICKNAME = #{nickname}, + + + COUNTRY = #{country}, + + + HEAD_IMG_URL = #{headImgUrl}, + + + PROVINCE = #{province}, + + + SEX = #{sex}, + + UPDATED_TIME = sysdate + WHERE USER_ID = #{userId} - - - - 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} - \ No newline at end of file +